| | |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import oracle.jdbc.OracleConnection; |
| | | import oracle.jdbc.OracleResultSet; |
| | | import oracle.sql.ARRAY; |
| | |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.ShapeElement; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.util.PrintfFormat; |
| | | |
| | | public class OracleConvertDgn2PostGISJob extends AbstractOracleDatabaseJob { |
| | |
| | | |
| | | protected static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | protected String _pgHost; |
| | | protected String _pgDatabase; |
| | | protected String _pgPort; |
| | |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | boolean useTransform) { |
| | | return new OracleConvertPostGISJobContext(getDataPath(), |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform, useEPSG3826); |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | |
| | | OracleConvertPostGISJobContext jobContext = |
| | | (OracleConvertPostGISJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | // jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | | |
| | | CreateHibernateSequence(jobContext); |
| | | createHibernateSequence(jobContext); |
| | | |
| | | long tStep = System.currentTimeMillis(); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | private void CreateHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | private void createHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | Connection connection = jobContext.getOracleConnection(); |
| | | |
| | | try { |
| | |
| | | stmt.close(); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn("HIBERNATE_SEQUENCE �w�g�s�b"); |
| | | logger.warn("HIBERNATE_SEQUENCE is already exist."); |
| | | } |
| | | } |
| | | |
| | |
| | | if (dgnFile.isDirectory()) continue; |
| | | IndexDgnConvertPostGISJobContext convertContext = |
| | | new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start index dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc = null; |
| | |
| | | |
| | | GeneralDgnConvertPostGISJobContext convertContext = |
| | | new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start other dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc; |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertPostGISJobContext convertContext = |
| | | new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | |
| | | sql = new StringBuilder("ALTER TABLE "); |
| | | sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); |
| | | sql.append(" OWNER TO spatialdb"); |
| | | sql.append(" OWNER TO ").append(_pgUsername); |
| | | stmt.executeUpdate(sql.toString()); |
| | | |
| | | sql = new StringBuilder("GRANT ALL ON TABLE "); |
| | |
| | | |
| | | StringBuilder sbSQL = new StringBuilder("CREATE SCHEMA "); |
| | | sbSQL.append(s).append(' '); |
| | | sbSQL.append("AUTHORIZATION spatialdb"); |
| | | sbSQL.append("AUTHORIZATION ").append(_pgUsername); |
| | | stmt = connection.createStatement(); |
| | | stmt.executeUpdate(sbSQL.toString()); |
| | | |