package com.ximple.eofms.jobs.context.postgis; import java.sql.Connection; import java.io.IOException; import com.ximple.eofms.jobs.context.AbstractOracleJobContext; import org.geotools.data.postgis.PostgisDataStore; import org.geotools.data.Transaction; import org.geotools.data.DataStore; public abstract class AbstractOracleToPostGISJobContext extends AbstractOracleJobContext { protected PostgisDataStore targetDataStore; public AbstractOracleToPostGISJobContext(String dataPath, DataStore targetDataStore) { if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { this.targetDataStore = (PostgisDataStore) targetDataStore; } else { getLogger().info("targetDataStore has wrong."); } setDataPath(dataPath); } public PostgisDataStore getTargetDataStore() { return targetDataStore; } public void setTargetDataStore(PostgisDataStore targetDataStore) { this.targetDataStore = targetDataStore; } public Connection getConnection() { if (targetDataStore != null) { try { return targetDataStore.getConnection(Transaction.AUTO_COMMIT); } catch (IOException e) { getLogger().warn(e.getMessage(), e); } } return null; } }