| | |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleElementLogger.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleUpgradeBlob2UDTJob.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java -text |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnToOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnToPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleToOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleToPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/DummyFeatureConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/DummyFeatureConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/FeatureDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/FeatureDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/GeneralDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/GeneralDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/IndexDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/IndexDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleConvertOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleConvertShapefilesJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleUpgradeJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/Base64.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/BinConverter.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/Bits.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/LangUtil.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java svneol=native#text/plain |
| | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | |
| | | <!-- ORACLE --> |
| | | <!-- Download and install into your own repo --> |
| | | <dependency> |
| | | <artifactId>ojdbc5</artifactId> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | <version>11.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoapi</artifactId> |
| | | <version>11.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdotype</artifactId> |
| | | <version>11.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoutl</artifactId> |
| | | <version>11.1.0</version> |
| | | </dependency> |
| | | |
| | |
| | | <dependency> |
| | | <artifactId>gt2-main</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>gt2-data</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>jdom</artifactId> |
| | | <groupId>jdom</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>velocity</artifactId> |
| | | <groupId>velocity</groupId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | </pluginManagement> |
| | | |
| | | <!-- http://www.ibiblio.org/maven2/org/apache/maven/wagon/ --> |
| | | <!-- |
| | | <extensions> |
| | | <extension> |
| | | <groupId>org.apache.maven.wagon</groupId> |
| | |
| | | <version>1.0-beta-2</version> |
| | | </extension> |
| | | </extensions> |
| | | |
| | | --> |
| | | |
| | | <plugins> |
| | | <!-- ======================================================= --> |
| | | <!-- Source reformat --> |
| | |
| | | <!-- Dependencies to be inherited by all modules. --> |
| | | <!-- =========================================================== --> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <!-- =========================================================== --> |
| | |
| | | <version>1.0.1B</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>jdom</artifactId> |
| | | <groupId>jdom</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>velocity</artifactId> |
| | | <groupId>velocity</groupId> |
| | | </dependency> |
| | | |
| | | <!-- ORACLE --> |
| | | <dependency> |
| | | <artifactId>ojdbc5</artifactId> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoapi</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdotype</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoutl</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | </entry> |
| | | <entry> |
| | | <key>PGDDATBASE</key> |
| | | <value>nstpc</value> |
| | | <value>tctpc</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGPORT</key> |
| | |
| | | </entry> |
| | | <entry> |
| | | <key>ORAINST</key> |
| | | <value>nntpc</value> |
| | | <value>tctpc</value> |
| | | </entry> |
| | | <entry> |
| | | <key>ORAPORT</key> |
| | |
| | | <groupId>opensymphony</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>jdom</artifactId> |
| | | <groupId>jdom</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>velocity</artifactId> |
| | | <groupId>velocity</groupId> |
| | | </dependency> |
| | | |
| | | <!-- ORACLE --> |
| | | <dependency> |
| | | <artifactId>ojdbc5</artifactId> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoapi</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdotype</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>sdoutl</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof ArcElement) |
| | | { |
| | | ArcElement lineStringElement = (ArcElement) element; |
| | | convertDecorator.setConverter(lineStringElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineStringElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineStringElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | lineStringElement.getWeight(), |
| | | lineStringElement.getLineStyle() |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.EllipseElement; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof EllipseElement) |
| | | { |
| | | EllipseElement shapeElement = (EllipseElement) element; |
| | | convertDecorator.setConverter(shapeElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | shapeElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) shapeElement.getLevelIndex(), |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | (short) shapeElement.getWeight(), |
| | | (short) shapeElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.LineElement; |
| | | import com.ximple.io.dgn7.LineStringElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | |
| | | public class CreateLineStringStrategy implements CreateFeatureTypeStrategy |
| | | { |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineStringFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof LineStringElement) |
| | | { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | convertDecorator.setConverter(lineStringElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineStringElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineStringElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | lineStringElement.getWeight(), |
| | | lineStringElement.getLineStyle() |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof ComplexChainElement) |
| | | { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChain); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | complexChain.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) complexChain.getLevelIndex(), |
| | | colorTable.getColorCode(complexChain.getColorIndex()), |
| | | complexChain.getWeight(), |
| | | complexChain.getLineStyle() |
| | | (short) complexChain.getWeight(), |
| | | (short) complexChain.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof LineElement) |
| | | { |
| | | LineElement lineElement = (LineElement) element; |
| | | convertDecorator.setConverter(lineElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineElement.getColorIndex()), |
| | | lineElement.getWeight(), |
| | | lineElement.getLineStyle() |
| | | (short) lineElement.getWeight(), |
| | | (short) lineElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof ArcElement) |
| | | { |
| | | ArcElement lineStringElement = (ArcElement) element; |
| | | convertDecorator.setConverter(lineStringElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineStringElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineStringElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | lineStringElement.getWeight(), |
| | | lineStringElement.getLineStyle() |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } |
| | | |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineStringFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof LineStringElement) |
| | | { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | convertDecorator.setConverter(lineStringElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineStringElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineStringElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | lineStringElement.getWeight(), |
| | | lineStringElement.getLineStyle() |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof TextElement) |
| | | { |
| | | TextElement txtElement = (TextElement) element; |
| | |
| | | |
| | | txtElement.getRotationAngle(); |
| | | |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | line, |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | txtElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) txtElement.getLevelIndex(), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle() |
| | | (short) txtElement.getWeight(), |
| | | (short) txtElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof ComplexChainElement) |
| | | { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChain); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | complexChain.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) complexChain.getLevelIndex(), |
| | | colorTable.getColorCode(complexChain.getColorIndex()), |
| | | complexChain.getWeight(), |
| | | complexChain.getLineStyle() |
| | | (short) complexChain.getWeight(), |
| | | (short) complexChain.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof LineElement) |
| | | { |
| | | LineElement lineElement = (LineElement) element; |
| | | convertDecorator.setConverter(lineElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | lineElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) lineElement.getLevelIndex(), |
| | | colorTable.getColorCode(lineElement.getColorIndex()), |
| | | lineElement.getWeight(), |
| | | lineElement.getLineStyle() |
| | | (short) lineElement.getWeight(), |
| | | (short) lineElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } |
| | | |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ComplexShapeElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPolygonFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof ShapeElement) |
| | | { |
| | | ShapeElement shapeElement = (ShapeElement) element; |
| | | convertDecorator.setConverter(shapeElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | shapeElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) shapeElement.getLevelIndex(), |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | (short) shapeElement.getWeight(), |
| | | (short) shapeElement.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof ComplexShapeElement) |
| | | { |
| | | ComplexShapeElement complexShape = (ComplexShapeElement) element; |
| | | convertDecorator.setConverter(complexShape); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | complexShape.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) complexShape.getLevelIndex(), |
| | | colorTable.getColorCode(complexShape.getColorIndex()), |
| | | complexShape.getWeight(), |
| | | complexShape.getLineStyle() |
| | | (short) complexShape.getWeight(), |
| | | (short) complexShape.getLineStyle() |
| | | }); |
| | | return feature; |
| | | } |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMBOL", String.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createSymbolFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof TextElement) |
| | | { |
| | |
| | | sb.append(txtElement.getFontIndex()); |
| | | |
| | | convertDecorator.setConverter(txtElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | txtElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) txtElement.getLevelIndex(), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle(), |
| | | txtElement.getJustification(), |
| | | txtElement.getTextHeight(), |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | (short) txtElement.getWeight(), |
| | | (short) txtElement.getLineStyle(), |
| | | (short) txtElement.getJustification(), |
| | | (float) txtElement.getTextHeight(), |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | return feature; |
| | | } else |
| | | { |
| | | logger.info("CreateSymbolStrategy cannot conver " + element.toString() + "to Feature"); |
| | | } |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CONTEXT", String.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof TextElement) |
| | | { |
| | |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | txtElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) txtElement.getLevelIndex(), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle(), |
| | | txtElement.getJustification(), |
| | | txtElement.getTextHeight(), |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | (short) txtElement.getWeight(), |
| | | (short) txtElement.getLineStyle(), |
| | | (short) txtElement.getJustification(), |
| | | (float) txtElement.getTextHeight(), |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | txtElement.getText() |
| | | }); |
| | | return feature; |
| | | } else if (element instanceof TextNodeElement) |
| | | { |
| | | TextNodeElement nodeElement = (TextNodeElement) element; |
| | |
| | | double angle = nodeElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | convertDecorator.setConverter(nodeElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | feature = featureType.create(new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | | 0, |
| | | nodeElement.getLevelIndex(), |
| | | (short) fLinkage.getComponentID(), |
| | | (short) 0, |
| | | (short) nodeElement.getLevelIndex(), |
| | | colorTable.getColorCode(nodeElement.getColorIndex()), |
| | | nodeElement.getWeight(), |
| | | nodeElement.getLineStyle(), |
| | | nodeElement.getJustification(), |
| | | nodeElement.getTextNodeHeight(), |
| | | nodeElement.getTextNodeLength(), |
| | | angle, |
| | | (short) nodeElement.getWeight(), |
| | | (short) nodeElement.getLineStyle(), |
| | | (short) nodeElement.getJustification(), |
| | | (float) nodeElement.getTextNodeHeight(), |
| | | (float) nodeElement.getTextNodeLength(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | return feature; |
| | | } |
| | | return null; |
| | | return feature; |
| | | } |
| | | } |
| | |
| | | import java.nio.ByteBuffer; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Map; |
| | | import java.util.StringTokenizer; |
| | | import java.util.TreeMap; |
| | | |
| | | import com.vividsolutions.jts.util.Assert; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.jdbc.ConnectionPoolManager; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.oracle.OracleDataStoreFactory; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import com.vividsolutions.jts.util.Assert; |
| | | |
| | | import oracle.sql.BLOB; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | |
| | | public abstract class AbstractOracleDatabaseJob implements Job |
| | | { |
| | | /** The Oracle driver class name */ |
| | | private static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; |
| | | |
| | | private static final String ORACLE_URL = "jdbc:oracle:thin:@"; |
| | | private static final String PROPUsrKey = "user"; |
| | | private static final String PROPPassKey = "password"; |
| | | |
| | | private static final String JOBDATA_DIR = "JOBDATA_DIR"; |
| | | private static final String CONFELMSFILTER = "ELMSFILTER_CONF"; |
| | | private static final String SPATAILSCHEMA = "ORGSCHEMA"; |
| | |
| | | private static final String TESTMODE = "TESTMODE"; |
| | | private static final String TESTCOUNT = "TESTCOUNT"; |
| | | |
| | | protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | |
| | | protected String _dataPath; |
| | | protected String _filterPath; |
| | | protected String _oracleHost; |
| | |
| | | protected ArrayList<String> _orgSchema = new ArrayList<String>(); |
| | | protected boolean _testMode = false; |
| | | protected int _testCount = -1; |
| | | protected OracleDataStore sourceDataStore; |
| | | private boolean driverFound = true; |
| | | |
| | | protected AbstractOracleDatabaseJob() |
| | | { |
| | | try { |
| | | Class.forName(JDBC_DRIVER); |
| | | } catch (Throwable t) { |
| | | // must be running off dummy jar! |
| | | driverFound = false; |
| | | } |
| | | } |
| | | |
| | | public abstract void execute(JobExecutionContext context) throws JobExecutionException; |
| | | |
| | | public Log getLogger() { return null; } |
| | | public abstract Log getLogger(); |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException |
| | | { |
| | |
| | | _createDummy = dataMap.getString(CREATEDUMMY); |
| | | |
| | | Log logger = getLogger(); |
| | | /* |
| | | logger.info("JOBDATA_DIR=" + _dataPath); |
| | | logger.info("CONFELMSFILTER=" + _filterPath); |
| | | logger.info("ORAHOST=" + _oracleHost); |
| | |
| | | logger.info("CONVERTFILE=" + _convertFile); |
| | | logger.info("CONVERTELEMIN=" + _convertElementIn); |
| | | logger.info("ELEMLOG=" + _elementLogging); |
| | | */ |
| | | |
| | | String strSchema = dataMap.getString(SPATAILSCHEMA); |
| | | StringTokenizer st = new StringTokenizer(strSchema, ","); |
| | |
| | | |
| | | if (_oracleHost == null) |
| | | { |
| | | logger.warn("OracleHOST is null"); |
| | | throw new JobExecutionException("Unknown Oracle Host."); |
| | | } |
| | | if (_oracleInstance == null) |
| | | { |
| | | logger.warn("OracleINSTANCE is null"); |
| | | throw new JobExecutionException("Unknown Oracle Instance."); |
| | | } |
| | | if (_username == null) |
| | | { |
| | | logger.warn("OracleUSER is null"); |
| | | throw new JobExecutionException("Unknown Oracle Username."); |
| | | } |
| | | if (_password == null) |
| | | { |
| | | logger.warn("OraclePASS is null"); |
| | | throw new JobExecutionException("Unknown Oracle Password."); |
| | | } |
| | | if (_orgSchema == null) |
| | | { |
| | | logger.warn("OracleSchema is null"); |
| | | throw new JobExecutionException("Unknown Spatial Database Schema."); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | return raw; |
| | | } |
| | | |
| | | public boolean isDriverFound() |
| | | { |
| | | return driverFound; |
| | | } |
| | | |
| | | public String getDataPath() |
| | |
| | | return _createDummy != null && !_createDummy.equalsIgnoreCase("false") && |
| | | !_createDummy.equalsIgnoreCase("no") && !_createDummy.equalsIgnoreCase("0"); |
| | | } |
| | | |
| | | public DataStore getSourceDataStore() |
| | | { |
| | | return sourceDataStore; |
| | | } |
| | | |
| | | protected void createSourceDataStore() throws JobExecutionException |
| | | { |
| | | if (sourceDataStore != null) |
| | | { |
| | | sourceDataStore.dispose(); |
| | | sourceDataStore = null; |
| | | } |
| | | |
| | | if (!isDriverFound()) |
| | | { |
| | | throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER); |
| | | } |
| | | Map<String, String> map = new TreeMap<String, String>(); |
| | | map.put("host", _oracleHost); |
| | | map.put("port", _oraclePort); |
| | | map.put("instance", _oracleInstance); |
| | | map.put("user", _username); |
| | | map.put("passwd", _password); |
| | | map.put("dbtype", "oracle"); |
| | | map.put("alias", _oracleInstance); |
| | | map.put("namespace", null); |
| | | if (!dataStoreFactory.canProcess(map)) |
| | | { |
| | | getLogger().warn("cannot process properties-"); |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try |
| | | { |
| | | sourceDataStore = (OracleDataStore) dataStoreFactory.createDataStore(map); |
| | | } catch (IOException e) |
| | | { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | protected void disconnect() |
| | | { |
| | | ConnectionPoolManager manager = ConnectionPoolManager.getInstance(); |
| | | manager.closeAll(); |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.jobs; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.net.URL; |
| | | import java.net.MalformedURLException; |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.TypeCompIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeIdDispatchableFilter; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertJobContext extends AbstractDgnFileJobContext |
| | |
| | | } else if (filter instanceof TypeCompLevelIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } else if(filter instanceof TypeIdDispatchableFilter) |
| | | } else if (filter instanceof TypeIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | |
| | | return dataOut; |
| | | } |
| | | |
| | | public void closeFeatureWriter() throws IOException { |
| | | public void closeFeatureWriter() throws IOException |
| | | { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) |
| | | { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.jobs; |
| | | |
| | | import java.util.Date; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.Types; |
| | | import java.io.IOException; |
| | | import java.io.File; |
| | | import java.io.FilenameFilter; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FilenameFilter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.channels.FileChannel; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.sql.Types; |
| | | import java.util.Date; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.collections.OrderedMap; |
| | | import org.apache.commons.collections.OrderedMapIterator; |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.quartz.JobDetail; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.quartz.JobDetail; |
| | | 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.BLOB; |
| | | import oracle.sql.ARRAY; |
| | | import oracle.sql.BLOB; |
| | | |
| | | import com.ximple.util.PrintfFormat; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.GeneralDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.IndexDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.OracleConvertShapefilesJobContext; |
| | | import com.ximple.eofms.util.BinConverter; |
| | | import com.ximple.eofms.util.ByteArrayCompressor; |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.GeneralDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.IndexDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.OracleConvertShapefilesJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.util.PrintfFormat; |
| | | |
| | | public class OracleConvertDgn2OraSDOJob extends AbstractOracleDatabaseJob |
| | | { |
| | | final static Log logger = LogFactory.getLog(OracleConvertDgn2OraSDOJob.class); |
| | | |
| | | /** The Oracle driver class name */ |
| | | /** |
| | | * The Oracle driver class name |
| | | */ |
| | | private static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; |
| | | |
| | | private static final int FETCHSIZE = 30; |
| | |
| | | FeatureStore fs = (FeatureStore) dstore.getFeatureSource("ORA_TEST_POINTS"); |
| | | fs.addFeatures(DataUtilities.collection(feature)); |
| | | */ |
| | | |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String filterPath) |
| | | { |
| | | return new OracleConvertShapefilesJobContext(filterPath); |
| | |
| | | // Log the time the job started |
| | | logger.info(jobName + " fired at " + new Date()); |
| | | extractJobConfiguration(jobDetail); |
| | | createSourceDataStore(); |
| | | if (getSourceDataStore() == null) |
| | | { |
| | | throw new JobExecutionException("Cannot connect source oracle database."); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | for (String orgSchema : _orgSchema) |
| | | { |
| | | OracleConvertShapefilesJobContext jobContext = (OracleConvertShapefilesJobContext) prepareJobContext(_filterPath); |
| | | jobContext.setConnectionInfo(_oracleHost, _oraclePort, _oracleInstance); |
| | | jobContext.setLogin(_username, _password); |
| | | jobContext.setShapeData(_dataPath); |
| | | jobContext.setConvertDB(_convertDB); |
| | | jobContext.setConvertFile(_convertFile); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | |
| | | logger.info("-- step:createDummyFeatureFile --"); |
| | | createDummyFeatureFile(context); |
| | | } |
| | | |
| | | disconnect(); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn(e.getMessage(), e); |
| | |
| | | * °õ¦æÂà´«¯Á¤Þ¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context ¤u§@°õ¦æÀô¹Ò |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertIndexDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | * °õ¦æÂà´«¨ä¥L³]p¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context jobContext |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertOtherDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | package com.ximple.eofms.jobs; |
| | | |
| | | import java.util.Date; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.Types; |
| | | import java.io.IOException; |
| | | import java.io.File; |
| | | import java.io.FilenameFilter; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FilenameFilter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.channels.FileChannel; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.collections.OrderedMap; |
| | | import org.apache.commons.collections.OrderedMapIterator; |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobDataMap; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.sql.Types; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import oracle.jdbc.OracleConnection; |
| | | import oracle.jdbc.OracleResultSet; |
| | | import oracle.sql.BLOB; |
| | | import oracle.sql.ARRAY; |
| | | |
| | | import com.ximple.util.PrintfFormat; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.FeatureDgnConvertPostGISJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.GeneralDgnConvertPostGISJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.IndexDgnConvertPostGISJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.OracleConvertPostGISJobContext; |
| | | import com.ximple.eofms.util.BinConverter; |
| | | import com.ximple.eofms.util.ByteArrayCompressor; |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.GeneralDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.IndexDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.OracleConvertShapefilesJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.util.PrintfFormat; |
| | | |
| | | import org.apache.commons.collections.OrderedMap; |
| | | import org.apache.commons.collections.OrderedMapIterator; |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import oracle.jdbc.OracleConnection; |
| | | import oracle.jdbc.OracleResultSet; |
| | | import oracle.sql.ARRAY; |
| | | import oracle.sql.BLOB; |
| | | |
| | | public class OracleConvertDgn2PostGISJob extends AbstractOracleDatabaseJob |
| | | { |
| | |
| | | private static final String PGPORT = "PGPORT"; |
| | | private static final String PGSCHEMA = "PGSCHEMA"; |
| | | private static final String PGUSER = "PGUSER"; |
| | | private static final String PGPASS = " PGPASS"; |
| | | private static final String PGPASS = "PGPASS"; |
| | | private static final String USEWKB = "USEWKB"; |
| | | |
| | | private static final int FETCHSIZE = 30; |
| | |
| | | } |
| | | } |
| | | |
| | | protected static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | protected String _pgHost; |
| | | protected String _pgDatabase; |
| | |
| | | protected String _pgPassword; |
| | | protected String _pgUseWKB; |
| | | |
| | | // static PostgisDataStoreFactory factory = new PostgisDataStoreFactory(); |
| | | protected Map pgProperties; |
| | | protected PostgisDataStore targetDataStore; |
| | | |
| | | /* |
| | | f = PostgisTests.newFixture(); |
| | | remote = new HashMap(); |
| | | remote.put("dbtype", "postgis"); |
| | | remote.put("charset", ""); |
| | | remote.put("host", f.host); |
| | | remote.put("port", f.port); |
| | | remote.put("database", f.database); |
| | | remote.put("user", f.user); |
| | | remote.put("passwd", f.password); |
| | | remote.put("namespace", f.namespace); |
| | | */ |
| | | /* |
| | | PostgisDataStore pg = new PostgisDataStore(pool, f.schema, getName(), |
| | | PostgisDataStore.OPTIMIZE_SQL); |
| | | pg.setWKBEnabled(WKB_ENABLED); |
| | | pg.setEstimatedExtent(true); |
| | | pg.setFIDMapper("road", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "road")); |
| | | pg.setFIDMapper("river", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "river")); |
| | | pg.setFIDMapper("testset", |
| | | new TypedFIDMapper(new BasicFIDMapper("gid", 255, true), "testset")); |
| | | |
| | | */ |
| | | PostgisDataStore pg = new PostgisDataStore(pool, f.schema, getName(), |
| | | PostgisDataStore.OPTIMIZE_SQL); |
| | | pg.setWKBEnabled(WKB_ENABLED); |
| | | pg.setEstimatedExtent(true); |
| | | pg.setFIDMapper("road", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "road")); |
| | | pg.setFIDMapper("river", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "river")); |
| | | pg.setFIDMapper("testset", |
| | | new TypedFIDMapper(new BasicFIDMapper("gid", 255, true), "testset")); |
| | | |
| | | */ |
| | | /* |
| | | Transaction transaction = new DefaultTransaction("attemptWriteFW"); |
| | | FeatureWriter writer = ds.getFeatureWriter(table, transaction); |
| | |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String filterPath) |
| | | { |
| | | return new OracleConvertShapefilesJobContext(filterPath); |
| | | return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), filterPath); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException |
| | |
| | | _pgUseWKB = dataMap.getString(USEWKB); |
| | | |
| | | Log logger = getLogger(); |
| | | /* |
| | | logger.info("PGHOST=" + _pgHost); |
| | | logger.info("PGDDATBASE=" + _pgDatabase); |
| | | logger.info("PGPORT=" + _pgPort); |
| | |
| | | logger.info("PGUSER=" + _pgUsername); |
| | | logger.info("PGPASS=" + _pgPassword); |
| | | logger.info("USEWKB=" + _pgUseWKB); |
| | | */ |
| | | |
| | | if (_pgHost == null) |
| | | { |
| | | logger.warn("PGHOST is null"); |
| | | throw new JobExecutionException("Unknown PostGIS host."); |
| | | } |
| | | if (_pgDatabase == null) |
| | | { |
| | | logger.warn("PGDATABASE is null"); |
| | | throw new JobExecutionException("Unknown PostGIS database."); |
| | | } |
| | | if (_pgPort == null) |
| | | { |
| | | logger.warn("PGPORT is null"); |
| | | throw new JobExecutionException("Unknown PostGIS port."); |
| | | } |
| | | if (_pgSchema == null) |
| | | { |
| | | logger.warn("PGSCHEMA is null"); |
| | | throw new JobExecutionException("Unknown PostGIS schema."); |
| | | } |
| | | if (_pgUsername == null) |
| | | { |
| | | logger.warn("PGUSERNAME is null"); |
| | | throw new JobExecutionException("Unknown PostGIS username."); |
| | | } |
| | | if (_pgPassword == null) |
| | | { |
| | | logger.warn("PGPASSWORD is null"); |
| | | throw new JobExecutionException("Unknown PostGIS password."); |
| | | } |
| | | |
| | | Map<String, String> remote = new TreeMap<String, String>(); |
| | | remote.put("dbtype", "postgis"); |
| | | remote.put("charset", "UTF-8"); |
| | | remote.put("host", _pgHost); |
| | | remote.put("port", _pgPort); |
| | | remote.put("database", _pgDatabase); |
| | | remote.put("user", _pgUsername); |
| | | remote.put("passwd", _pgPassword); |
| | | remote.put("namespace", null); |
| | | pgProperties = remote; |
| | | } |
| | | |
| | | public void execute(JobExecutionContext context) throws JobExecutionException |
| | |
| | | // Log the time the job started |
| | | logger.info(jobName + " fired at " + new Date()); |
| | | extractJobConfiguration(jobDetail); |
| | | createSourceDataStore(); |
| | | createTargetDataStore(); |
| | | if (getSourceDataStore() == null) |
| | | { |
| | | logger.warn("Cannot connect source oracle database."); |
| | | throw new JobExecutionException("Cannot connect source oracle database."); |
| | | } |
| | | |
| | | if (getTargetDataStore() == null) |
| | | { |
| | | logger.warn("Cannot connect source postgreSQL database."); |
| | | throw new JobExecutionException("Cannot connect source postgreSQL database."); |
| | | } |
| | | |
| | | Calendar cal = Calendar.getInstance(); |
| | | Date startTime = cal.getTime(); |
| | | try |
| | | { |
| | | logger.info("-- step:clearOutputDirectory --"); |
| | | clearOutputDirectory(); |
| | | logger.info("-- step:clearOutputDatabase --"); |
| | | clearOutputDatabase(); |
| | | boolean bFirst = true; |
| | | if (checkConvertDB()) |
| | | { |
| | |
| | | |
| | | for (String orgSchema : _orgSchema) |
| | | { |
| | | OracleConvertShapefilesJobContext jobContext = (OracleConvertShapefilesJobContext) prepareJobContext(_filterPath); |
| | | jobContext.setConnectionInfo(_oracleHost, _oraclePort, _oracleInstance); |
| | | jobContext.setLogin(_username, _password); |
| | | jobContext.setShapeData(_dataPath); |
| | | jobContext.setConvertDB(_convertDB); |
| | | jobContext.setConvertFile(_convertFile); |
| | | OracleConvertPostGISJobContext jobContext = |
| | | (OracleConvertPostGISJobContext) prepareJobContext(_filterPath); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | |
| | | logger.info("-- step:createDummyFeatureFile --"); |
| | | createDummyFeatureFile(context); |
| | | } |
| | | |
| | | disconnect(); |
| | | Date endTime = cal.getTime(); |
| | | Date time = new Date(endTime.getTime() - startTime.getTime()); |
| | | // public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; |
| | | // SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); |
| | | logger.warn("use time = " + time); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn(e.getMessage(), e); |
| | |
| | | * @param jobContext job context |
| | | * @throws SQLException sql exception |
| | | */ |
| | | private void copyConnectivity(OracleConvertShapefilesJobContext jobContext) throws SQLException |
| | | private void copyConnectivity(OracleConvertPostGISJobContext jobContext) throws SQLException |
| | | { |
| | | OracleConnection connection = jobContext.getOracleConnection(); |
| | | Statement stmt = connection.createStatement(); |
| | | stmt.execute(OracleConvertShapefilesJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK); |
| | | stmt.execute(OracleConvertShapefilesJobContext.COPY_CONNECTIVITY_TO_WEBCHECK); |
| | | stmt.execute(AbstractOracleJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK); |
| | | stmt.execute(AbstractOracleJobContext.COPY_CONNECTIVITY_TO_WEBCHECK); |
| | | } |
| | | |
| | | private void exetcuteConvert(OracleConvertShapefilesJobContext jobContext, |
| | | private void exetcuteConvert(OracleConvertPostGISJobContext jobContext, |
| | | String querySchema, String dataPath) throws SQLException |
| | | { |
| | | int order = 0; |
| | |
| | | return orderedMap; |
| | | } |
| | | |
| | | protected void queryIgsetElement(OracleConvertShapefilesJobContext jobContext, |
| | | protected void queryIgsetElement(OracleConvertPostGISJobContext jobContext, |
| | | String srcschema, String srctable) throws SQLException |
| | | { |
| | | OracleConnection connection = jobContext.getOracleConnection(); |
| | |
| | | stmtSrc.close(); |
| | | } |
| | | |
| | | protected void queryRawElement(OracleConvertShapefilesJobContext jobContext, |
| | | protected void queryRawElement(OracleConvertPostGISJobContext jobContext, |
| | | String srcschema, String srctable) throws SQLException |
| | | { |
| | | OracleConnection connection = jobContext.getOracleConnection(); |
| | |
| | | * °õ¦æÂà´«¯Á¤Þ¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context ¤u§@°õ¦æÀô¹Ò |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertIndexDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | |
| | | for (File dgnFile : dgnFiles) |
| | | { |
| | | IndexDgnConvertShpJobContext convertContext = new IndexDgnConvertShpJobContext(getDataPath()); |
| | | IndexDgnConvertPostGISJobContext convertContext = |
| | | new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore()); |
| | | logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | protected void scanIndexDgnElement(IndexDgnConvertShpJobContext convertContext) |
| | | protected void scanIndexDgnElement(IndexDgnConvertPostGISJobContext convertContext) |
| | | throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException |
| | | { |
| | | Dgn7fileReader reader = convertContext.getReader(); |
| | |
| | | logger.debug("ElementRecord Count=" + count); |
| | | } |
| | | |
| | | private void processIndexElement(Element element, IndexDgnConvertShpJobContext convertContext) throws IllegalAttributeException, SchemaException |
| | | private void processIndexElement(Element element, IndexDgnConvertPostGISJobContext convertContext) |
| | | throws IllegalAttributeException, SchemaException |
| | | { |
| | | if (element instanceof TextElement) |
| | | { |
| | |
| | | * °õ¦æÂà´«¨ä¥L³]p¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context jobContext |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertOtherDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | |
| | | for (File dgnFile : dgnFiles) |
| | | { |
| | | GeneralDgnConvertShpJobContext convertContext = new GeneralDgnConvertShpJobContext(getDataPath()); |
| | | GeneralDgnConvertPostGISJobContext convertContext = |
| | | new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public void scanOtherDgnElement(GeneralDgnConvertShpJobContext convertContext) |
| | | public void scanOtherDgnElement(GeneralDgnConvertPostGISJobContext convertContext) |
| | | throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException |
| | | { |
| | | Dgn7fileReader reader = convertContext.getReader(); |
| | |
| | | logger.debug("ElementRecord Count=" + count); |
| | | } |
| | | |
| | | private void processOtherElement(Element element, GeneralDgnConvertShpJobContext convertContext) |
| | | private void processOtherElement(Element element, GeneralDgnConvertPostGISJobContext convertContext) |
| | | throws IllegalAttributeException, SchemaException |
| | | { |
| | | convertContext.putFeatureCollection(element); |
| | | } |
| | | |
| | | private void clearOutputDirectory() |
| | | private void clearOutputDatabase() |
| | | { |
| | | File outDataPath = new File(getDataPath(), OracleConvertShapefilesJobContext.SHPOUTPATH); |
| | | /* |
| | | File outDataPath = new File(getDataPath(), OracleConvertPostGISJobContext.SHPOUTPATH); |
| | | if (outDataPath.exists() && outDataPath.isDirectory()) |
| | | { |
| | | deleteFilesInPath(outDataPath); |
| | |
| | | { |
| | | deleteFilesInPath(outDataPath); |
| | | } |
| | | */ |
| | | } |
| | | |
| | | private void deleteFilesInPath(File outDataPath) |
| | |
| | | |
| | | for (File dgnFile : dgnFiles) |
| | | { |
| | | FeatureDgnConvertShpJobContext convertContext = new FeatureDgnConvertShpJobContext(getDataPath(), _filterPath); |
| | | FeatureDgnConvertPostGISJobContext convertContext = |
| | | new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _filterPath); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public void scanFeatureDgnElement(FeatureDgnConvertShpJobContext convertContext) |
| | | public void scanFeatureDgnElement(FeatureDgnConvertPostGISJobContext convertContext) |
| | | throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException |
| | | { |
| | | Dgn7fileReader reader = convertContext.getReader(); |
| | |
| | | logger.debug("ElementRecord Count=" + count); |
| | | } |
| | | |
| | | private void processFeatureElement(Element element, FeatureDgnConvertShpJobContext convertContext) |
| | | private void processFeatureElement(Element element, FeatureDgnConvertPostGISJobContext convertContext) |
| | | throws IllegalAttributeException, SchemaException |
| | | { |
| | | convertContext.putFeatureCollection(element); |
| | |
| | | } |
| | | */ |
| | | } |
| | | |
| | | public DataStore getTargetDataStore() |
| | | { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | protected void createTargetDataStore() throws JobExecutionException |
| | | { |
| | | if (targetDataStore != null) |
| | | { |
| | | targetDataStore.dispose(); |
| | | targetDataStore = null; |
| | | } |
| | | |
| | | /* |
| | | if (!isDriverFound()) |
| | | { |
| | | throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER); |
| | | } |
| | | */ |
| | | |
| | | if (!dataStoreFactory.canProcess(pgProperties)) |
| | | { |
| | | getLogger().warn("cannot process properties-"); |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try |
| | | { |
| | | targetDataStore = (PostgisDataStore) dataStoreFactory.createDataStore(pgProperties); |
| | | } catch (IOException e) |
| | | { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.jdbc.ConnectionPoolManager; |
| | | import org.geotools.data.jdbc.datasource.DataSourceUtil; |
| | | import org.geotools.data.jdbc.datasource.DataSourceFinder; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | |
| | | import oracle.sql.ARRAY; |
| | | import oracle.sql.BLOB; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.GeneralDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.IndexDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.OracleConvertShapefilesJobContext; |
| | | import com.ximple.eofms.util.BinConverter; |
| | | import com.ximple.eofms.util.ByteArrayCompressor; |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.context.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.GeneralDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.IndexDgnConvertShpJobContext; |
| | | import com.ximple.eofms.jobs.context.OracleConvertShapefilesJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | |
| | | // Log the time the job started |
| | | logger.info(jobName + " fired at " + new Date()); |
| | | extractJobConfiguration(jobDetail); |
| | | createSourceDataStore(); |
| | | if (getSourceDataStore() == null) |
| | | { |
| | | throw new JobExecutionException("Cannot connect source oracle database."); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | for (String orgSchema : _orgSchema) |
| | | { |
| | | OracleConvertShapefilesJobContext jobContext = (OracleConvertShapefilesJobContext) prepareJobContext(_filterPath); |
| | | jobContext.setConnectionInfo(_oracleHost, _oraclePort, _oracleInstance); |
| | | jobContext.setLogin(_username, _password); |
| | | jobContext.setShapeData(_dataPath); |
| | | jobContext.setConvertDB(_convertDB); |
| | | jobContext.setConvertFile(_convertFile); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | jobContext.setDataPath(_dataPath); |
| | | jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | |
| | | logger.info("-- step:createDummyFeatureFile --"); |
| | | createDummyFeatureFile(context); |
| | | } |
| | | |
| | | disconnect(); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn(e.getMessage(), e); |
| | |
| | | * °õ¦æÂà´«¯Á¤Þ¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context ¤u§@°õ¦æÀô¹Ò |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertIndexDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | * °õ¦æÂà´«¨ä¥L³]p¹ÏÀɪº¤u§@ |
| | | * |
| | | * @param context jobContext |
| | | * @throws org.quartz.JobExecutionException exception |
| | | * @throws org.quartz.JobExecutionException |
| | | * exception |
| | | */ |
| | | private void convertOtherDesignFile(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | |
| | | public void logElement(Element element, String currentSchema) |
| | | { |
| | | if ((this.currentSchema == null) || |
| | | (!this.currentSchema.equalsIgnoreCase(currentSchema))) |
| | | (!this.currentSchema.equalsIgnoreCase(currentSchema))) |
| | | { |
| | | schemaChanged = true; |
| | | this.currentSchema = currentSchema; |
| | |
| | | while (logFile.exists()) |
| | | { |
| | | logFile = new File(getDataOutPath(), this.currentSchema + "-" |
| | | + (++logCount) +".dgn"); |
| | | + (++logCount) + ".dgn"); |
| | | } |
| | | |
| | | logger.warn("Create Dgn Logging File:" + logFile.toString()); |
| | |
| | | } |
| | | |
| | | is.close(); |
| | | assert buffer != null; |
| | | buffer.position(0); |
| | | raw = buffer.array(); |
| | | } catch (IOException e) |
| | |
| | | // Log the time the job started |
| | | logger.info(jobName + " fired at " + new Date()); |
| | | extractJobConfiguration(jobDetail); |
| | | createSourceDataStore(); |
| | | if (getSourceDataStore() == null) |
| | | { |
| | | throw new JobExecutionException("Cannot connect source oracle database."); |
| | | } |
| | | |
| | | AbstractOracleJobContext jobContext = prepareJobContext(_filterPath); |
| | | jobContext.setConnectionInfo(_oracleHost, _oraclePort, _oracleInstance); |
| | | jobContext.setLogin(_username, _password); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String filterPath) |
| | | { |
| | | return new OracleUpgradeJobContext(); |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import org.quartz.JobExecutionContext; |
| | | |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | |
| | | public abstract class AbstractDgnFileJobContext |
| | | { |
| | | /** |
| | | * Encoding of URL path. |
| | | */ |
| | | protected static final String ENCODING = "UTF-8"; |
| | | |
| | | private JobExecutionContext executionContext = null; |
| | | |
| | | protected String _dataPath = null; |
| | | protected Map properties = null; |
| | | |
| | | private Dgn7fileReader reader = null; |
| | | private String filename = null; |
| | | private boolean _elementLogging; |
| | | |
| | | public AbstractDgnFileJobContext(String dataPath) |
| | | { |
| | | _dataPath = dataPath; |
| | | } |
| | | |
| | | public String getDataPath() |
| | | { |
| | | return _dataPath; |
| | | } |
| | | |
| | | public JobExecutionContext getExecutionContext() |
| | | { |
| | | return executionContext; |
| | | } |
| | | |
| | | public void setExecutionContext(JobExecutionContext context) |
| | | { |
| | | executionContext = context; |
| | | } |
| | | |
| | | public abstract void startTransaction(); |
| | | |
| | | public abstract void commitTransaction(); |
| | | |
| | | public abstract void rollbackTransaction(); |
| | | |
| | | public abstract String getDataOutPath(); |
| | | |
| | | public Dgn7fileReader getReader() |
| | | { |
| | | return this.reader; |
| | | } |
| | | |
| | | public void setReader(Dgn7fileReader reader) |
| | | { |
| | | this.reader = reader; |
| | | } |
| | | |
| | | public String getFilename() |
| | | { |
| | | return filename; |
| | | } |
| | | |
| | | public void setFilename(String filename) |
| | | { |
| | | this.filename = filename; |
| | | } |
| | | |
| | | public boolean getElementLogging() |
| | | { |
| | | return _elementLogging; |
| | | } |
| | | |
| | | public void setElementLogging(boolean elementLogging) |
| | | { |
| | | this._elementLogging = elementLogging; |
| | | } |
| | | } |
| | | package com.ximple.eofms.jobs.context;
|
| | |
|
| | | import java.util.Map;
|
| | |
|
| | | import org.quartz.JobExecutionContext;
|
| | | import org.apache.commons.logging.Log;
|
| | |
|
| | | import com.ximple.io.dgn7.Dgn7fileReader;
|
| | |
|
| | | public abstract class AbstractDgnFileJobContext
|
| | | {
|
| | | /**
|
| | | * Encoding of URL path.
|
| | | */
|
| | | protected static final String ENCODING = "UTF-8";
|
| | |
|
| | | private JobExecutionContext executionContext = null;
|
| | |
|
| | | protected String _dataPath = null;
|
| | | protected Map properties = null;
|
| | |
|
| | | private Dgn7fileReader reader = null;
|
| | | private String filename = null;
|
| | | private boolean _elementLogging;
|
| | |
|
| | | public AbstractDgnFileJobContext(String dataPath)
|
| | | {
|
| | | _dataPath = dataPath;
|
| | | }
|
| | |
|
| | | public String getDataPath()
|
| | | {
|
| | | return _dataPath;
|
| | | }
|
| | |
|
| | | public JobExecutionContext getExecutionContext()
|
| | | {
|
| | | return executionContext;
|
| | | }
|
| | |
|
| | | public void setExecutionContext(JobExecutionContext context)
|
| | | {
|
| | | executionContext = context;
|
| | | }
|
| | |
|
| | | public abstract void startTransaction();
|
| | |
|
| | | public abstract void commitTransaction();
|
| | |
|
| | | public abstract void rollbackTransaction();
|
| | |
|
| | | public abstract String getDataOutPath();
|
| | |
|
| | | public Dgn7fileReader getReader()
|
| | | {
|
| | | return this.reader;
|
| | | }
|
| | |
|
| | | public void setReader(Dgn7fileReader reader)
|
| | | {
|
| | | this.reader = reader;
|
| | | }
|
| | |
|
| | | public String getFilename()
|
| | | {
|
| | | return filename;
|
| | | }
|
| | |
|
| | | public void setFilename(String filename)
|
| | | {
|
| | | this.filename = filename;
|
| | | }
|
| | |
|
| | | public boolean getElementLogging()
|
| | | {
|
| | | return _elementLogging;
|
| | | }
|
| | |
|
| | | public void setElementLogging(boolean elementLogging)
|
| | | {
|
| | | this._elementLogging = elementLogging;
|
| | | }
|
| | |
|
| | | public abstract Log getLogger();
|
| | | }
|
| | |
| | | import java.sql.DriverManager; |
| | | import java.sql.SQLException; |
| | | import java.util.Properties; |
| | | import java.io.IOException; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | |
| | | import oracle.jdbc.OracleConnection; |
| | | |
| | | import com.ximple.eofms.jobs.context.OracleConvertShapefilesJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.OracleConvertShapefilesJobContext; |
| | | |
| | | public abstract class AbstractOracleJobContext |
| | | { |
| | | private static final String ORACLE_URL = "jdbc:oracle:thin:@"; |
| | | private static final String PROPUsrKey = "user"; |
| | | private static final String PROPPassKey = "password"; |
| | | /** |
| | | * Table Prefiex |
| | | */ |
| | |
| | | "PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )\n" + |
| | | "LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING;"; |
| | | |
| | | public static final String COPY_CONNECTIVITY_TO_WEBCHECK = "INSERT /*+ APPEND */ INTO BASEDB.CONNECTIVITY_WEBCHECK\n" + |
| | | "(FSC, UFID, N1, N2, FDR1, FDR2, DIR, OHUG,OSTATUS, PHASE, X, Y)\n" + |
| | | "SELECT FSC, UFID, N1, N2, FDR1, FDR2, DIR, OHUG, OSTATUS, PHASE, X, Y FROM BASEDB.CONNECTIVITY "; |
| | | public static final String COPY_CONNECTIVITY_TO_WEBCHECK = "INSERT /*+ APPEND */ INTO BASEDB.CONNECTIVITY_WEBCHECK\n" + |
| | | "(FSC, UFID, N1, N2, FDR1, FDR2, DIR, OHUG,OSTATUS, PHASE, X, Y)\n" + |
| | | "SELECT FSC, UFID, N1, N2, FDR1, FDR2, DIR, OHUG, OSTATUS, PHASE, X, Y FROM BASEDB.CONNECTIVITY "; |
| | | |
| | | |
| | | /** |
| | |
| | | * Encoding of URL path. |
| | | */ |
| | | protected static final String ENCODING = "UTF-8"; |
| | | private String _oracleHost; |
| | | private String _oracleInstance; |
| | | private String _oraclePort; |
| | | protected OracleDataStore sourceDataStore; |
| | | |
| | | protected String _dataPath; |
| | | private OracleConnection oracleConnection = null; |
| | | protected Properties properties; |
| | | protected boolean _elementLogging; |
| | | |
| | | public static String getCurrentURL(String oracleHost, String oraclePort, String oracleInstance) |
| | | public OracleDataStore getSourceDataStore() |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | |
| | | builder.append(ORACLE_URL); |
| | | builder.append(oracleHost); |
| | | builder.append(":"); |
| | | builder.append(oraclePort); |
| | | builder.append(":"); |
| | | builder.append(oracleInstance); |
| | | |
| | | return builder.toString(); |
| | | return sourceDataStore; |
| | | } |
| | | |
| | | public void setLogin(String userName, String password) |
| | | public void setSourceDataStore(DataStore sourceDataStore) |
| | | { |
| | | properties.put(PROPUsrKey, userName); |
| | | properties.put(PROPPassKey, password); |
| | | } |
| | | |
| | | public void setShapeData(String dataPath) |
| | | { |
| | | _dataPath = dataPath; |
| | | if ((sourceDataStore != null) && (sourceDataStore instanceof OracleDataStore)) |
| | | { |
| | | this.sourceDataStore = (OracleDataStore) sourceDataStore; |
| | | } else |
| | | { |
| | | assert sourceDataStore != null; |
| | | getLogger().warn("setSourceDataStore(datastore) need OracleDataStore but got " + |
| | | sourceDataStore.getClass().getName()); |
| | | } |
| | | } |
| | | |
| | | public OracleConnection getOracleConnection() |
| | | { |
| | | try |
| | | { |
| | | if (oracleConnection == null) |
| | | if (sourceDataStore != null) |
| | | { |
| | | oracleConnection = (OracleConnection) DriverManager.getConnection( |
| | | getCurrentURL(_oracleHost, _oraclePort, _oracleInstance), |
| | | properties); |
| | | return (OracleConnection) sourceDataStore.getConnection(Transaction.AUTO_COMMIT); |
| | | } |
| | | |
| | | return oracleConnection; |
| | | } catch (SQLException e) |
| | | } catch (IOException e) |
| | | { |
| | | OracleConvertShapefilesJobContext.logger.warn(e.getMessage(), e); |
| | | getLogger().warn(e.getMessage(), e); |
| | | } |
| | | |
| | | oracleConnection = null; |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public void closeConnection() |
| | | public void setDataPath(String dataPath) |
| | | { |
| | | try |
| | | { |
| | | if (oracleConnection != null) |
| | | { |
| | | oracleConnection.close(); |
| | | oracleConnection = null; |
| | | } |
| | | } catch (SQLException e) |
| | | { |
| | | OracleConvertShapefilesJobContext.logger.warn(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | public void setConnectionInfo(String oracleHost, String oraclePort, String oracleInstance) |
| | | { |
| | | _oracleHost = oracleHost; |
| | | _oracleInstance = oracleInstance; |
| | | _oraclePort = oraclePort; |
| | | _dataPath = dataPath; |
| | | } |
| | | |
| | | public String getDataPath() |
| | | { |
| | | return _dataPath; |
| | | } |
| | | |
| | | public String getOracleHost() |
| | | { |
| | | return _oracleHost; |
| | | } |
| | | |
| | | public String getOracleInstance() |
| | | { |
| | | return _oracleInstance; |
| | | } |
| | | |
| | | public String getOraclePort() |
| | | { |
| | | return _oraclePort; |
| | | } |
| | | |
| | | public boolean getElementLogging() |
| | |
| | | public abstract void commitTransaction(); |
| | | |
| | | public abstract void rollbackTransaction(); |
| | | |
| | | protected abstract Log getLogger(); |
| | | } |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import org.apache.commons.logging.Log; |
| | | |
| | | public class OracleUpgradeJobContext extends AbstractOracleJobContext |
| | | { |
| | |
| | | public void rollbackTransaction() |
| | | { |
| | | } |
| | | |
| | | protected Log getLogger() |
| | | { |
| | | return null; //To change body of implemented methods use File | Settings | File Templates. |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnToOraSDOJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.orasdo; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | |
| | | public abstract class AbstractDgnToOraSDOJobContext extends AbstractDgnFileJobContext |
| | | { |
| | | public AbstractDgnToOraSDOJobContext(String dataPath, Properties properties) |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleToOraSDOJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.orasdo; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | |
| | | public abstract class AbstractOracleToOraSDOJobContext extends AbstractOracleJobContext |
| | | { |
| | | public AbstractOracleToOraSDOJobContext(String dataPath, Properties properties) |
New file |
| | |
| | | package com.ximple.eofms.jobs.context.orasdo; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | |
| | | public class OracleConvertOraSDOJobContext extends AbstractOracleJobContext |
| | | { |
| | | static Log logger = LogFactory.getLog(OracleConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | |
| | | public void startTransaction() |
| | | { |
| | | } |
| | | |
| | | public void commitTransaction() |
| | | { |
| | | } |
| | | |
| | | public void rollbackTransaction() |
| | | { |
| | | } |
| | | |
| | | protected Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.util.Map; |
| | | import java.sql.Connection; |
| | | import java.io.IOException; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
copy from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/DummyFeatureConvertShpJobContext.java
copy to xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java
File was copied from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/DummyFeatureConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.net.URL; |
| | | import java.net.MalformedURLException; |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.TypeCompIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeIdDispatchableFilter; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertShpJobContext extends AbstractDgnFileJobContext |
| | | public class DummyFeatureConvertPostGISJobContext extends AbstractDgnToPostGISJobContext |
| | | { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertShpJobContext.class); |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | |
| | | private String _filterConfig; |
| | | private boolean withIndex = false; |
| | | |
| | | public DummyFeatureConvertShpJobContext(String dataPath, String filterConfig) |
| | | public DummyFeatureConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String filterConfig) |
| | | { |
| | | super(dataPath); |
| | | super(dataPath, targetDataStore); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } else if (filter instanceof TypeCompLevelIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } else if(filter instanceof TypeIdDispatchableFilter) |
| | | } else if (filter instanceof TypeIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | return dataOut; |
| | | } |
| | | |
| | | public void closeFeatureWriter() throws IOException { |
| | | public void closeFeatureWriter() throws IOException |
| | | { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) |
| | | { |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
copy from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/FeatureDgnConvertShpJobContext.java
copy to xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java
File was copied from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/FeatureDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.eofms.jobs.context.shapefile.FeatureDgnConvertShpJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | |
| | | public class FeatureDgnConvertShpJobContext extends AbstractDgnFileJobContext |
| | | public class FeatureDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext |
| | | { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | |
| | | private String _filterConfig; |
| | | private boolean withIndex = false; |
| | | |
| | | public FeatureDgnConvertShpJobContext(String dataPath, String filterConfig) |
| | | public FeatureDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String filterConfig) |
| | | { |
| | | super(dataPath); |
| | | super(dataPath, targetDataStore); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | return dataOut; |
| | | } |
| | | |
| | | public void closeFeatureWriter() throws IOException { |
| | | public void closeFeatureWriter() throws IOException |
| | | { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) |
| | | { |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
copy from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/GeneralDgnConvertShpJobContext.java
copy to xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java
File was copied from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/GeneralDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class GeneralDgnConvertShpJobContext extends AbstractDgnFileJobContext |
| | | public class GeneralDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext |
| | | { |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertShpJobContext.class); |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | public static final String SHPOUTPATH = "shpout"; |
| | |
| | | private String featureBaseName = null; |
| | | private boolean withIndex = false; |
| | | |
| | | public GeneralDgnConvertShpJobContext(String dataPath) |
| | | public GeneralDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore) |
| | | { |
| | | super(dataPath); |
| | | super(dataPath, targetDataStore); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | convertDecorator = new TWD97GeometryConverterDecorator(); |
| | | } |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CONTEXT", String.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
copy from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/IndexDgnConvertShpJobContext.java
copy to xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
File was copied from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/IndexDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.TPCLIDConverter; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class IndexDgnConvertShpJobContext extends AbstractDgnFileJobContext |
| | | public class IndexDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext |
| | | { |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertShpJobContext.class); |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TWD97GeometryConverterDecorator convertDecorator = new TWD97GeometryConverterDecorator(); |
| | |
| | | private FeatureType featureType = null; |
| | | private FeatureType featureType2 = null; |
| | | |
| | | public IndexDgnConvertShpJobContext(String dataPath) |
| | | public IndexDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore) |
| | | { |
| | | super(dataPath); |
| | | super(dataPath, targetDataStore); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | } |
| | | |
| | |
| | | { |
| | | if (typeBuilderRect == null) |
| | | { |
| | | typeBuilderRect = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("X1", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("Y1", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("X2", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("Y2", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | } |
| | |
| | | { |
| | | if (typeBuilderPnt == null) |
| | | { |
| | | typeBuilderPnt = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class)); |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleConvertPostGISJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.postgis; |
| | | |
| | | import java.util.Properties; |
| | | import java.util.HashMap; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.sql.DriverManager; |
| | | import java.sql.SQLException; |
| | | import java.net.URL; |
| | | import java.net.MalformedURLException; |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.util.Assert; |
| | | |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | |
| | | public class OracleConvertPostGISJobContext extends AbstractOracleToPostGISJobContext |
| | | { |
| | | static Log logger = LogFactory.getLog(OracleConvertShapefilesJobContext.class); |
| | | static Log logger = LogFactory.getLog(OracleConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | |
| | | static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | |
| | | private OracleElementLogger elmLogger = null; |
| | | |
| | |
| | | private JobExecutionContext executionContext; |
| | | |
| | | private String dataOut = null; |
| | | private String _convertDB = null; |
| | | private String _convertFile = null; |
| | | private String currentSchema = null; |
| | | private String pgCurrentSchema = null; |
| | | private boolean schemaChanged = false; |
| | | private String _convertElementIn = null; |
| | | |
| | | public OracleConvertPostGISJobContext(String dataPath, Properties properties, String filterConfig) |
| | | public OracleConvertPostGISJobContext(String dataPath, DataStore pgDS, String filterConfig) |
| | | { |
| | | super(dataPath, properties); |
| | | super(dataPath, pgDS); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | |
| | | postGisDataStore.createSchema(featureType); |
| | | writer = postGisDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = postGisDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public void setConvertDB(String convertDB) |
| | | { |
| | | _convertDB = convertDB; |
| | | } |
| | | |
| | | public void setConvertFile(String convertFile) |
| | | { |
| | | _convertFile = convertFile; |
| | | } |
| | | |
| | | protected OracleElementLogger getElementLogger() |
| | | { |
| | | if (elmLogger == null) |
| | |
| | | { |
| | | _convertElementIn = convertElementIn; |
| | | } |
| | | |
| | | protected Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/DummyFeatureConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.shapefile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.net.URL; |
| | | import java.net.MalformedURLException; |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.TypeCompIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter; |
| | | import com.ximple.eofms.filter.TypeIdDispatchableFilter; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertShpJobContext extends AbstractDgnFileJobContext |
| | |
| | | } else if (filter instanceof TypeCompLevelIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } else if(filter instanceof TypeIdDispatchableFilter) |
| | | } else if (filter instanceof TypeIdDispatchableFilter) |
| | | { |
| | | ((TypeCompIdDispatchableFilter) filter).getCreateStrategy(); |
| | | } |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | return dataOut; |
| | | } |
| | | |
| | | public void closeFeatureWriter() throws IOException { |
| | | public void closeFeatureWriter() throws IOException |
| | | { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) |
| | | { |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/FeatureDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.shapefile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | |
| | | public class FeatureDgnConvertShpJobContext extends AbstractDgnFileJobContext |
| | | { |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | return dataOut; |
| | | } |
| | | |
| | | public void closeFeatureWriter() throws IOException { |
| | | public void closeFeatureWriter() throws IOException |
| | | { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) |
| | | { |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
| | | |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/GeneralDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.shapefile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CONTEXT", String.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | if (!typeBuilders.containsKey(featureName)) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/IndexDgnConvertShpJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.shapefile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.TPCLIDConverter; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.eofms.util.TWD97GeometryConverterDecorator; |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | |
| | | { |
| | | if (typeBuilderRect == null) |
| | | { |
| | | typeBuilderRect = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("X1", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("Y1", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("X2", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("Y2", Double.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilderRect.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | } |
| | |
| | | { |
| | | if (typeBuilderPnt == null) |
| | | { |
| | | typeBuilderPnt = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | typeBuilderPnt.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class)); |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
File was renamed from xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleConvertShapefilesJobContext.java |
| | |
| | | package com.ximple.eofms.jobs.context; |
| | | package com.ximple.eofms.jobs.context.shapefile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.nio.charset.Charset; |
| | | import java.sql.DriverManager; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Properties; |
| | | import java.nio.charset.Charset; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | |
| | | |
| | | public class OracleConvertShapefilesJobContext extends AbstractOracleJobContext |
| | |
| | | private String dataOut = null; |
| | | private String _convertDB = null; |
| | | private String _convertFile = null; |
| | | private String _convertElementIn = null; |
| | | private String currentSchema = null; |
| | | private boolean schemaChanged = false; |
| | | private String _convertElementIn = null; |
| | | private boolean withIndex = false; |
| | | |
| | | public OracleConvertShapefilesJobContext(String filterConfig) |
| | |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | } else |
| | | { |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | |
| | | { |
| | | this.withIndex = withIndex; |
| | | } |
| | | |
| | | protected Log getLogger() |
| | | { |
| | | return logger; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | |
| | | public final class FeatureTypeBuilderUtil |
| | | { |
| | | public static FeatureTypeBuilder createNormalPointFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CONTEXT", String.class, false, 254)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalLineFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalArcFeatureTypeBuilder(String featureName) |
| | | { |
| | | return createNormalLineFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalEllipseFeatureTypeBuilder(String featureName) |
| | | { |
| | | return createNormalLineFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalIndexFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("X1", Double.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("Y1", Double.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("X2", Double.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("Y2", Double.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalIndexTextFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TPCID", String.class, false, 12)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createPointFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CONTEXT", String.class, false, 254)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createSymbolFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Float.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMBOL", String.class, false, 20)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createPolygonFeatureTypeBuilder(String featureName) |
| | | { |
| | | return createLineStringFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createLineStringFeatureTypeBuilder(String featureName) |
| | | { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createEllipseFeatureTypeBuilder(String featureName) |
| | | { |
| | | return createLineStringFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createArcFeatureTypeBuilder(String featureName) |
| | | { |
| | | return createLineStringFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class, false, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Short.class, false)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Short.class, false)); |
| | | return typeBuilder; |
| | | */ |
| | | } |
| | | } |