| | |
| | | boolean profileMode, |
| | | boolean useTransform) { |
| | | return new OracleConvertPostGISJobContext(getDataPath(), |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | // Log the time the job started |
| | | logger.info(jobName + " fired at " + new Date()); |
| | | extractJobConfiguration(jobDetail); |
| | | |
| | | if (isIgnoreDBETL()) { |
| | | return; |
| | | } |
| | | |
| | | createSourceDataStore(); |
| | | createTargetDataStore(); |
| | | if (getSourceDataStore() == null) { |
| | |
| | | |
| | | OracleConvertPostGISJobContext jobContext = |
| | | (OracleConvertPostGISJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed()); |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | // jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | | |
| | | |
| | | createHibernateSequence(jobContext); |
| | | |
| | | long tStep = System.currentTimeMillis(); |
| | | |
| | | if (isCopyConnectivityMode()) |
| | | { |
| | | if (isCopyConnectivityMode()) { |
| | | copyConnectivity(jobContext); |
| | | } |
| | | |
| | |
| | | private void copyConnectivity(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | Connection connection = jobContext.getOracleConnection(); |
| | | ResultSet rsMeta = connection.getMetaData().getTables(null, "BASEDB", |
| | | AbstractOracleJobContext.CONNECTIVITY_WEBCHECK_NAME + "%", |
| | | new String[]{"TABLE"}); |
| | | AbstractOracleJobContext.CONNECTIVITY_WEBCHECK_NAME + "%", |
| | | new String[]{"TABLE"}); |
| | | |
| | | boolean found = false; |
| | | try { |
| | |
| | | } |
| | | |
| | | |
| | | private void createHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | private void createHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | Connection connection = jobContext.getOracleConnection(); |
| | | |
| | | try { |
| | | Statement stmt = connection.createStatement(); |
| | | stmt.execute(AbstractOracleJobContext.CREATE_HIBERNATE_SEQUENCE); |
| | | stmt.close(); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn("HIBERNATE_SEQUENCE is already exist."); |
| | | } catch (SQLException e) { |
| | | logger.warn("HIBERNATE_SEQUENCE is already exist."); |
| | | } |
| | | } |
| | | |
| | |
| | | String querySchema, String targetSchemaName) throws SQLException { |
| | | int order = 0; |
| | | OrderedMap map = getBlobStorageList(jobContext.getOracleConnection(), |
| | | querySchema, "SD$SPACENODES", null); |
| | | querySchema, "SD$SPACENODES", null); |
| | | |
| | | logger.info("begin convert job:[" + map.size() + "]:testmode=" + _testMode); |
| | | |
| | |
| | | int step = total / 100; |
| | | int current = 0; |
| | | |
| | | if (total == 0) { |
| | | if (total == 0) { |
| | | logger.warn("SELECT COUNT FROM " + querySchema + ".SD$SPACENODES is zero."); |
| | | return; |
| | | } |
| | | logger.warn("SELECT COUNT FROM " + querySchema + ".SD$SPACENODES is " + map.size() ); |
| | | logger.warn("SELECT COUNT FROM " + querySchema + ".SD$SPACENODES is " + map.size()); |
| | | |
| | | //jobContext.startTransaction(); |
| | | jobContext.setCurrentSchema(querySchema); |
| | | jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 0); |
| | | for (OrderedMapIterator it = map.orderedMapIterator(); it.hasNext();) { |
| | | for (OrderedMapIterator it = map.orderedMapIterator(); it.hasNext(); ) { |
| | | it.next(); |
| | | |
| | | Pair pair = (Pair) it.getValue(); |
| | |
| | | System.runFinalization(); |
| | | } |
| | | |
| | | if( step != 0) |
| | | { |
| | | if (step != 0) { |
| | | int now = order % step; |
| | | if (now != current) { |
| | | current = now; |
| | | jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", current); |
| | | |
| | | } |
| | | }else |
| | | { |
| | | } else { |
| | | jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", current); |
| | | current++; |
| | | } |
| | |
| | | if (dgnFile.isDirectory()) continue; |
| | | IndexDgnConvertPostGISJobContext convertContext = |
| | | new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start index dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc = null; |
| | |
| | | } finally { |
| | | convertContext.closeFeatureWriter(); |
| | | |
| | | if (reader != null) |
| | | { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | |
| | | // } |
| | | //} else { |
| | | // if (element instanceof ShapeElement) { |
| | | convertContext.putFeatureCollection(element); |
| | | convertContext.putFeatureCollection(element); |
| | | // } |
| | | //} |
| | | } |
| | |
| | | |
| | | GeneralDgnConvertPostGISJobContext convertContext = |
| | | new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start other dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc; |
| | |
| | | } finally { |
| | | convertContext.closeFeatureWriter(); |
| | | |
| | | if (reader != null) |
| | | { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertPostGISJobContext convertContext = |
| | | new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |