package com.ximple.eofms.jobs.context.postgis; import java.io.IOException; import java.sql.Connection; import org.geotools.data.DataStore; import org.geotools.data.Transaction; import org.geotools.data.postgis.PostgisDataStore; import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; public abstract class AbstractDgnToPostGISJobContext extends AbstractDgnFileJobContext { protected PostgisDataStore targetDataStore; public AbstractDgnToPostGISJobContext(String dataPath, DataStore targetDataStore) { super(dataPath); this.targetDataStore = (PostgisDataStore) targetDataStore; } 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; } }