package com.ximple.eofms.jobs.context.orasdo; import java.io.IOException; import java.sql.Connection; import org.geotools.data.DataStore; import org.geotools.data.Transaction; import org.geotools.data.oracle.OracleDataStore; import com.ximple.eofms.jobs.context.AbstractOracleJobContext; public abstract class AbstractOracleToOraSDOJobContext extends AbstractOracleJobContext { protected OracleDataStore targetDataStore; public AbstractOracleToOraSDOJobContext(String dataPath, DataStore targetDataStore) { if ((targetDataStore != null) && (targetDataStore instanceof OracleDataStore)) { this.targetDataStore = (OracleDataStore) targetDataStore; } else { getLogger().info("targetDataStore has wrong."); } setDataPath(dataPath); } public OracleDataStore getTargetDataStore() { return targetDataStore; } public void setTargetDataStore(OracleDataStore 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; } }