| | |
| | | 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/DigesterUtils.java -text |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/EPSG3825GeometryConverterDecorator.java -text svneol=unset#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/EPSG3826GeometryConverterDecorator.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java svneol=native#text/plain |
| | |
| | | <oracle.jdbc>true</oracle.jdbc> |
| | | <test.maxHeapSize>512M</test.maxHeapSize> |
| | | <src.output>${basedir}/target</src.output> |
| | | <java5>1.5</java5> |
| | | <xdgnio.version>1.2.2</xdgnio.version> |
| | | <gt2.version>2.7.5-1</gt2.version> |
| | | <java5>1.6</java5> |
| | | <xdgnio.version>1.3.0</xdgnio.version> |
| | | <gt.version>8.3.x</gt.version> |
| | | <failIfNoTests>false</failIfNoTests> |
| | | <stress.skip.pattern></stress.skip.pattern> |
| | | <online.skip.pattern></online.skip.pattern> |
| | |
| | | |
| | | <scm> |
| | | <connection> |
| | | scm:svn:http://www.ximple.com.tw/svn/xeofms/xspatialjob/truck/ |
| | | scm:svn:http://www.ximple.com.tw:8079/svn/xeofms/xspatialjob/truck/ |
| | | </connection> |
| | | <url>http://www.ximple.com.tw/svn/xeofms/xspatialjob/truck/</url> |
| | | <url>http://www.ximple.com.tw:8079/svn/xeofms/xspatialjob/truck/</url> |
| | | </scm> |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <packaging>pom</packaging> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <name>ximple-dgnjobs</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | | |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2010</inceptionYear> |
| | | <inceptionYear>2012</inceptionYear> |
| | | |
| | | <!-- =========================================================== --> |
| | | <!-- Issue managements and mailing lists. --> |
| | |
| | | <version>3.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-digester</groupId> |
| | | <artifactId>commons-digester</artifactId> |
| | | <version>2.1</version> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-digester3</artifactId> |
| | | <version>3.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-pool</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>3.7</version> |
| | | <version>3.8</version> |
| | | </dependency> |
| | | |
| | | <!-- geotools --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-api</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-main</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-shapefile</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-data</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-jdbc</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-oracle</artifactId> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <exclusions> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-postgis</artifactId> |
| | | <version>${gt.version}</version> |
| | | <!--exclusions> |
| | | <exclusion> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </exclusions--> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-mysql</artifactId> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-h2</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <exclusions> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <version>${gt.version}</version> |
| | | <!--exclusions> |
| | | <exclusion> |
| | | <groupId>com.h2database</groupId> |
| | | <artifactId>h2</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </exclusions--> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-wkt</artifactId> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | |
| | | <version>11.1.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | <version>8.4-702.jdbc3</version> |
| | | </dependency> |
| | | </dependency--> |
| | | <dependency> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | <version>1.5.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>5.1.18</version> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>com.h2database</groupId> |
| | | <artifactId>h2</artifactId> |
| | | <version>1.3.163</version> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <!-- EnterpriseDB --> |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>2.1.3</version> |
| | | <version>2.1.6</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>1.6.3</version> |
| | | <version>1.6.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | <version>1.6.3</version> |
| | | <version>1.6.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.awl</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.testng</groupId> |
| | | <artifactId>testng</artifactId> |
| | | <version>6.3</version> |
| | | <version>6.8</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | |
| | | <groupId>commons-collections</groupId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-digester</groupId> |
| | | <artifactId>commons-digester</artifactId> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-digester3</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-pool</groupId> |
| | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-h2</artifactId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>com.h2database</groupId> |
| | | <artifactId>h2</artifactId> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <dependency> |
| | | <groupId>xerces</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.geotools.maven</groupId> |
| | | <artifactId>gt2-build-configs</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | </dependencies> |
| | | --> |
| | |
| | | <!-- The -target argument for the Java compiler. --> |
| | | <debug>true</debug> |
| | | <!-- Whether to include debugging information. --> |
| | | <encoding>ISO-8859-1</encoding> |
| | | <encoding>UTF-8</encoding> |
| | | <!-- The -encoding argument for the Java compiler. --> |
| | | </configuration> |
| | | </plugin> |
| | |
| | | <dependency> |
| | | <groupId>org.geotools.maven</groupId> |
| | | <artifactId>gt2-build-configs</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <version>${gt.version}</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </plugin> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-maven</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-build</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <!-- =========================================================== --> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-build</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <packaging>pom</packaging> |
| | | <name>Build tools for Ximple DgnJobs</name> |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | <!-- =========================================================== --> |
| | |
| | | <!-- =========================================================== --> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnio</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-dgnio</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-elmparser</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-elmparser</name> |
| | | <url>http://maven.apache.org</url> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-jobcarrier</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-jobcarrier</name> |
| | | <url>http://maven.apache.org</url> |
| | | |
| | | <properties> |
| | | <xdgnio.version>1.2.2</xdgnio.version> |
| | | <xdgnio.version>1.3.0</xdgnio.version> |
| | | </properties> |
| | | |
| | | <scm> |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2010</inceptionYear> |
| | | <inceptionYear>2012</inceptionYear> |
| | | |
| | | <developers> |
| | | <developer> |
| | |
| | | <artifactId>gt-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-oracle</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-mysql</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <scope>test</scope> |
| | | <artifactId>gt-epsg-wkt</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <artifactId>sdoutl</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <!-- AWL --> |
| | | <dependency> |
| | |
| | | <job-data-map>
|
| | | <entry>
|
| | | <key>JOBDATA_DIR</key>
|
| | | <value>C:\Usr\Projects\XDCAD\nstpcjobs\jobdata</value>
|
| | | <value>~/Projects/XDCAD/xjobrun/nntpcjobs/jobdata</value>
|
| | | </entry>
|
| | | <entry>
|
| | | <key>PGHOST</key>
|
| | |
| | | </entry>
|
| | | <entry>
|
| | | <key>PGDATBASE</key>
|
| | | <value>pgNSTPC</value>
|
| | | <value>pgNNTPC</value>
|
| | | </entry>
|
| | | <entry>
|
| | | <key>PGPORT</key>
|
| | |
| | | </entry>
|
| | | <entry>
|
| | | <key>ORAHOST</key>
|
| | | <value>192.168.11.199</value>
|
| | | <value>192.168.11.99</value>
|
| | | </entry>
|
| | | <entry>
|
| | | <key>ORAINST</key>
|
| | |
| | | </entry>
|
| | | <entry>
|
| | | <key>ORAUSER</key>
|
| | | <value>basedb</value>
|
| | | <value>system</value>
|
| | | </entry>
|
| | | <entry>
|
| | | <key>ORAPASS</key>
|
| | | <value>basedb000</value>
|
| | | <value>simple000</value>
|
| | | </entry>
|
| | | <entry>
|
| | | <key>ORGSCHEMA</key>
|
| | |
| | | <job-data-map> |
| | | <entry> |
| | | <key>JOBDATA_DIR</key> |
| | | <value>C:\Usr\Projects\XDCAD\xjobrun\nntpcjobs\jobdata</value> |
| | | <value>/Users/ulysseskao/Projects/XDCAD/xjobrun/nntpcjobs/jobdata</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGHOST</key> |
| | |
| | | </entry> |
| | | <entry> |
| | | <key>ORGSCHEMA</key> |
| | | <value>SPATIALDB, CMMS_SPATIALDB</value> |
| | | <value>SPATIALDB</value> |
| | | <!--value>SPATIALDB, CMMS_SPATIALDB</value--> |
| | | </entry> |
| | | <entry> |
| | | <key>CONVERTDB</key> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-spatialjob</artifactId> |
| | | <version>1.2.2</version> |
| | | <version>1.3.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-spatialjob</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | | |
| | | <properties> |
| | | <xdgnio.version>1.2.2</xdgnio.version> |
| | | <xdgnio.version>1.3.0</xdgnio.version> |
| | | </properties> |
| | | |
| | | <description> |
| | |
| | | <artifactId>gt-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-oracle</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | <groupId>org.geotools.jdbc</groupId> |
| | | <artifactId>gt-jdbc-mysql</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <scope>test</scope> |
| | | <artifactId>gt-epsg-wkt</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <artifactId>sdoutl</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | </dependency> |
| | | </dependency--> |
| | | <dependency> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | |
| | | <artifactId>xedb-gt-geospatial</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <!--dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | </dependency--> |
| | | |
| | | <!-- Ximple Library --> |
| | | <dependency> |
| | |
| | | sb.append("-"); |
| | | sb.append(txtElement.getFontIndex()); |
| | | |
| | | Geometry gobj; |
| | | Geometry gobj, geomOrigin = null; |
| | | if (useTransform) { |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | |
| | | } |
| | | |
| | | if (gobj instanceof Point) { |
| | | Coordinate p = gobj.getCoordinate(); |
| | | double width = txtElement.getTextWidth(); |
| | | double height = txtElement.getTextHeight(); |
| | | |
| | | AffineTransform at = new AffineTransform(); |
| | | at.translate(width, height); |
| | | at.setToRotation(angle, p.x, p.y); |
| | | at.scale(1, 1); |
| | | |
| | | Envelope envelope = new Envelope(p); |
| | | envelope.expandBy(width / 2, height / 2); |
| | | |
| | | double[] srcPt = new double[8]; |
| | | double[] dstPt = new double[8]; |
| | | srcPt[0] = envelope.getMinX(); |
| | | srcPt[1] = envelope.getMinY(); |
| | | srcPt[2] = envelope.getMinX(); |
| | | srcPt[3] = envelope.getMaxY(); |
| | | srcPt[4] = envelope.getMaxX(); |
| | | srcPt[5] = envelope.getMaxY(); |
| | | srcPt[6] = envelope.getMaxX(); |
| | | srcPt[7] = envelope.getMinY(); |
| | | |
| | | at.transform(srcPt, 0, dstPt, 0, 4); |
| | | |
| | | Coordinate[] coords = new Coordinate[5]; |
| | | for (int i = 0; i < 4; i++) { |
| | | coords[i] = new Coordinate(dstPt[i*2], dstPt[i*2+1]); |
| | | } |
| | | coords[4] = new Coordinate(dstPt[0], dstPt[1]); |
| | | int srid = gobj.getSRID(); |
| | | gobj = geometryFactory.createPolygon(geometryFactory.createLinearRing(coords), null); |
| | | if (gobj.getSRID() != srid) { |
| | | gobj.setSRID(srid); |
| | | } |
| | | geomOrigin = gobj; |
| | | gobj = buildBoundaryPolygon(txtElement.getUserOrigin(), // txtElement.getOrigin() |
| | | txtElement.getTextWidth(), txtElement.getTextHeight(), |
| | | angle, txtElement.getJustification(), gobj.getSRID()); |
| | | } else { |
| | | gobj = null; |
| | | } |
| | |
| | | (float) txtElement.getTextHeight(), |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | sb.toString() |
| | | sb.toString(), |
| | | geomOrigin |
| | | }, null); |
| | | } else { |
| | | logger.info("CreateSymbolStrategy cannot conver " + element.toString() + "to Feature"); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Geometry buildBoundaryPolygon(Coordinate p, double symbolWidth, double symbolHeight, double rotationAngle, |
| | | int justification, int srid) { |
| | | double angle = Math.toRadians(rotationAngle); |
| | | |
| | | AffineTransform at = new AffineTransform(); |
| | | // at.translate(width, height); |
| | | at.setToRotation(angle, p.x, p.y); |
| | | at.scale(1, 1); |
| | | |
| | | double width = symbolWidth; |
| | | switch (justification) { |
| | | case TextElement.TXTJUST_LT: |
| | | case TextElement.TXTJUST_LC: |
| | | case TextElement.TXTJUST_LB: |
| | | width = width / 2; |
| | | break; |
| | | |
| | | case TextElement.TXTJUST_CT: |
| | | case TextElement.TXTJUST_CC: |
| | | case TextElement.TXTJUST_CB: |
| | | width = 0; |
| | | break; |
| | | |
| | | case TextElement.TXTJUST_RT: |
| | | case TextElement.TXTJUST_RC: |
| | | case TextElement.TXTJUST_RB: |
| | | width = -(width / 2); |
| | | break; |
| | | } |
| | | |
| | | double height = symbolHeight; |
| | | switch (justification) { |
| | | case TextElement.TXTJUST_LB: |
| | | case TextElement.TXTJUST_CB: |
| | | case TextElement.TXTJUST_RB: // bottom |
| | | height = height / 2; |
| | | break; |
| | | |
| | | case TextElement.TXTJUST_LC: |
| | | case TextElement.TXTJUST_CC: |
| | | case TextElement.TXTJUST_RC: // center |
| | | height = 0; |
| | | break; |
| | | |
| | | case TextElement.TXTJUST_LT: |
| | | case TextElement.TXTJUST_CT: |
| | | case TextElement.TXTJUST_RT: // height |
| | | height = -(height / 2); |
| | | break; |
| | | } |
| | | |
| | | |
| | | Envelope envelope = new Envelope(new Coordinate(p.x + width, p.y + height)); |
| | | envelope.expandBy(symbolWidth / 2, symbolHeight / 2); |
| | | |
| | | double[] srcPt = new double[8]; |
| | | double[] dstPt = new double[8]; |
| | | srcPt[0] = envelope.getMinX(); |
| | | srcPt[1] = envelope.getMinY(); |
| | | srcPt[2] = envelope.getMinX(); |
| | | srcPt[3] = envelope.getMaxY(); |
| | | srcPt[4] = envelope.getMaxX(); |
| | | srcPt[5] = envelope.getMaxY(); |
| | | srcPt[6] = envelope.getMaxX(); |
| | | srcPt[7] = envelope.getMinY(); |
| | | |
| | | at.transform(srcPt, 0, dstPt, 0, 4); |
| | | |
| | | Coordinate[] coords = new Coordinate[5]; |
| | | for (int i = 0; i < 4; i++) { |
| | | coords[i] = new Coordinate(dstPt[i*2], dstPt[i*2+1]); |
| | | } |
| | | coords[4] = new Coordinate(dstPt[0], dstPt[1]); |
| | | |
| | | Geometry geom = geometryFactory.createPolygon(geometryFactory.createLinearRing(coords), null); |
| | | if (geom.getSRID() != srid) { |
| | | geom.setSRID(srid); |
| | | } |
| | | return geom; |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import org.apache.commons.logging.Log; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.oracle.OracleDataStoreFactory; |
| | | import org.geotools.data.DataStoreFinder; |
| | | import org.geotools.data.oracle.OracleNGDataStoreFactory; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | |
| | | private static final String PROFILEMODE = "PROFILEMODE"; |
| | | private static final String USEZONE121 = "USEZONE121"; |
| | | |
| | | protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | protected static OracleNGDataStoreFactory dataStoreFactory = new OracleNGDataStoreFactory(); |
| | | |
| | | protected String _dataPath; |
| | | protected String _filterPath; |
| | |
| | | protected boolean _useTransform = true; |
| | | |
| | | protected int _testCount = -1; |
| | | protected OracleDataStore sourceDataStore; |
| | | protected JDBCDataStore sourceDataStore; |
| | | private boolean driverFound = true; |
| | | |
| | | private long _processTime; |
| | |
| | | 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 (!map.containsKey(OracleDataStoreFactory.MAXCONN.key)) { |
| | | map.put(OracleDataStoreFactory.MAXCONN.key, "5"); |
| | | map.put(OracleNGDataStoreFactory.HOST.key, _oracleHost); |
| | | map.put(OracleNGDataStoreFactory.PORT.key, _oraclePort); |
| | | map.put(OracleNGDataStoreFactory.DATABASE.key, _oracleInstance); |
| | | map.put(OracleNGDataStoreFactory.USER.key, _username); |
| | | map.put(OracleNGDataStoreFactory.PASSWD.key, _password); |
| | | map.put(OracleNGDataStoreFactory.DBTYPE.key, "oracle"); |
| | | map.put(OracleNGDataStoreFactory.NAMESPACE.key, null); |
| | | |
| | | if (!map.containsKey(OracleNGDataStoreFactory.MAXCONN.key)) { |
| | | map.put(OracleNGDataStoreFactory.MAXCONN.key, "5"); |
| | | } |
| | | if (!map.containsKey(OracleDataStoreFactory.MINCONN.key)) { |
| | | map.put(OracleDataStoreFactory.MINCONN.key, "1"); |
| | | if (!map.containsKey(OracleNGDataStoreFactory.MINCONN.key)) { |
| | | map.put(OracleNGDataStoreFactory.MINCONN.key, "1"); |
| | | } |
| | | |
| | | if (!dataStoreFactory.canProcess(map)) { |
| | |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try { |
| | | sourceDataStore = (OracleDataStore) dataStoreFactory.createDataStore(map); |
| | | sourceDataStore = dataStoreFactory.createDataStore(map); |
| | | } catch (IOException e) { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | 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.eofms.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | 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.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertJobContext extends AbstractDgnFileJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | package com.ximple.eofms.jobs;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileFilter;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.FileNotFoundException;
|
| | | import java.io.FilenameFilter;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.nio.BufferOverflowException;
|
| | | import java.nio.ByteBuffer;
|
| | | import java.nio.ByteOrder;
|
| | | import java.nio.channels.FileChannel;
|
| | | import java.sql.Connection;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | | import java.sql.Statement;
|
| | | import java.sql.Types;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.TreeMap;
|
| | |
|
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
|
| | | import com.ximple.eofms.jobs.context.edbgeo.FeatureDgnConvertEdbGeoJobContext;
|
| | | import com.ximple.eofms.jobs.context.edbgeo.GeneralDgnConvertEdbGeoJobContext;
|
| | |
| | | import org.apache.commons.logging.LogFactory;
|
| | | import org.geotools.data.DataStore;
|
| | | import org.geotools.data.Transaction;
|
| | | import org.geotools.data.jdbc.JDBCUtils;
|
| | | import org.geotools.data.edbgeo.PostgisDataStore;
|
| | | import org.geotools.data.edbgeo.PostgisDataStoreFactory;
|
| | | import org.geotools.data.jdbc.JDBCUtils;
|
| | | import org.geotools.feature.SchemaException;
|
| | | import org.geotools.jdbc.JDBCDataStore;
|
| | | import org.opengis.feature.IllegalAttributeException;
|
| | | import org.quartz.JobDataMap;
|
| | | import org.quartz.JobDetail;
|
| | | import org.quartz.JobExecutionContext;
|
| | | import org.quartz.JobExecutionException;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileFilter;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.FileNotFoundException;
|
| | | import java.io.FilenameFilter;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.nio.BufferOverflowException;
|
| | | import java.nio.ByteBuffer;
|
| | | import java.nio.ByteOrder;
|
| | | import java.nio.channels.FileChannel;
|
| | | import java.sql.Connection;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | | import java.sql.Statement;
|
| | | import java.sql.Types;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.TreeMap;
|
| | |
|
| | | public class OracleConvertDgn2EdbGeoJob extends AbstractOracleDatabaseJob {
|
| | | final static Log logger = LogFactory.getLog(OracleConvertDgn2EdbGeoJob.class);
|
| | |
| | | protected String _edbUseWKB;
|
| | |
|
| | | protected Map<String, String> edbProperties;
|
| | | protected PostgisDataStore targetDataStore;
|
| | | protected JDBCDataStore targetDataStore;
|
| | | // protected OracleConvertEdbGeoJobContext oracleJobContext;
|
| | |
|
| | | private long queryTime = 0;
|
| | |
| | | throw new JobExecutionException("cannot process properties-");
|
| | | }
|
| | | try {
|
| | | targetDataStore = (PostgisDataStore) dataStoreFactory.createDataStore(edbProperties);
|
| | | targetDataStore = (JDBCDataStore) dataStoreFactory.createDataStore(edbProperties);
|
| | | } catch (IOException e) {
|
| | | getLogger().warn(e.getMessage(), e);
|
| | | throw new JobExecutionException(e.getMessage(), e);
|
| | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.mysql.MySQLDataStore; |
| | | import org.geotools.data.mysql.MySQLDataStoreFactory; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.IllegalAttributeException; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | |
| | | protected String _myUseWKB; |
| | | |
| | | protected Map<String, String> myProperties; |
| | | protected MySQLDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public Log getLogger() { |
| | | return logger; |
| | |
| | | } |
| | | */ |
| | | |
| | | if (!myProperties.containsKey("max connections" /*MySQLDataStoreFactory.MAXCONN.key */)) { |
| | | myProperties.put("max connections", "2"); |
| | | if (!myProperties.containsKey(MySQLDataStoreFactory.MAXCONN.key)) { |
| | | myProperties.put(MySQLDataStoreFactory.MAXCONN.key, "2"); |
| | | } |
| | | |
| | | if (!myProperties.containsKey("min connections" /* MySQLDataStoreFactory.MINCONN.key */)) { |
| | | myProperties.put("min connections", "1"); |
| | | if (!myProperties.containsKey(MySQLDataStoreFactory.MINCONN.key)) { |
| | | myProperties.put(MySQLDataStoreFactory.MINCONN.key, "1"); |
| | | } |
| | | |
| | | /* |
| | | if (!myProperties.containsKey(MySQLDataStoreFactory.WKBENABLED.key)) { |
| | | myProperties.put(MySQLDataStoreFactory.WKBENABLED.key, "true"); |
| | | } |
| | | */ |
| | | |
| | | if (!dataStoreFactory.canProcess(myProperties)) { |
| | | getLogger().warn("cannot process properties-"); |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try { |
| | | targetDataStore = (MySQLDataStore) dataStoreFactory.createDataStore(myProperties); |
| | | targetDataStore = dataStoreFactory.createDataStore(myProperties); |
| | | } catch (IOException e) { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.data.oracle.OracleDataStoreFactory; |
| | | import org.geotools.data.oracle.OracleNGDataStoreFactory; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.IllegalAttributeException; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | |
| | | } |
| | | } |
| | | |
| | | protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | protected static OracleNGDataStoreFactory dataStoreFactory = new OracleNGDataStoreFactory(); |
| | | |
| | | protected String _sdoHost; |
| | | protected String _sdoDatabase; |
| | |
| | | protected String _sdoUseWKB; |
| | | |
| | | protected Map<String, String> sdoProperties; |
| | | protected OracleDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public Log getLogger() { |
| | | return logger; |
| | |
| | | } |
| | | |
| | | Map<String, String> remote = new TreeMap<String, String>(); |
| | | remote.put("dbtype", "OraSDO"); |
| | | remote.put("charset", "UTF-8"); |
| | | remote.put("host", _sdoHost); |
| | | remote.put("port", _sdoPort); |
| | | remote.put("database", _sdoDatabase); |
| | | remote.put("user", _sdoUsername); |
| | | remote.put("passwd", _sdoPassword); |
| | | remote.put("namespace", null); |
| | | remote.put(OracleNGDataStoreFactory.DBTYPE.key, "oracle"); |
| | | // remote.put("charset", "UTF-8"); |
| | | remote.put(OracleNGDataStoreFactory.HOST.key, _sdoHost); |
| | | remote.put(OracleNGDataStoreFactory.PORT.key, _sdoPort); |
| | | remote.put(OracleNGDataStoreFactory.DATABASE.key, _sdoDatabase); |
| | | remote.put(OracleNGDataStoreFactory.USER.key, _sdoUsername); |
| | | remote.put(OracleNGDataStoreFactory.PASSWD.key, _sdoPassword); |
| | | // remote.put("namespace", null); |
| | | sdoProperties = remote; |
| | | } |
| | | |
| | |
| | | } |
| | | */ |
| | | |
| | | if (!sdoProperties.containsKey(OracleDataStoreFactory.MAXCONN.key)) { |
| | | sdoProperties.put(OracleDataStoreFactory.MAXCONN.key, "2"); |
| | | if (!sdoProperties.containsKey(OracleNGDataStoreFactory.MAXCONN.key)) { |
| | | sdoProperties.put(OracleNGDataStoreFactory.MAXCONN.key, "2"); |
| | | } |
| | | |
| | | if (!sdoProperties.containsKey(OracleDataStoreFactory.MINCONN.key)) { |
| | | sdoProperties.put(OracleDataStoreFactory.MINCONN.key, "1"); |
| | | if (!sdoProperties.containsKey(OracleNGDataStoreFactory.MINCONN.key)) { |
| | | sdoProperties.put(OracleNGDataStoreFactory.MINCONN.key, "1"); |
| | | } |
| | | |
| | | /* |
| | |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try { |
| | | targetDataStore = (OracleDataStore) dataStoreFactory.createDataStore(sdoProperties); |
| | | targetDataStore = dataStoreFactory.createDataStore(sdoProperties); |
| | | } catch (IOException e) { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.data.postgis.PostgisNGDataStoreFactory; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.IllegalAttributeException; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobDetail; |
| | |
| | | } |
| | | } |
| | | |
| | | protected static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | protected static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); |
| | | |
| | | protected String _pgHost; |
| | | protected String _pgDatabase; |
| | |
| | | protected String _pgUseWKB; |
| | | |
| | | protected Map<String, String> pgProperties; |
| | | protected PostgisDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | // protected OracleConvertEdbGeoJobContext oracleJobContext; |
| | | |
| | | private long queryTime = 0; |
| | |
| | | } |
| | | |
| | | 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); |
| | | remote.put(PostgisNGDataStoreFactory.DBTYPE.key, "postgis"); |
| | | // remote.put("charset", "UTF-8"); |
| | | remote.put(PostgisNGDataStoreFactory.HOST.key, _pgHost); |
| | | remote.put(PostgisNGDataStoreFactory.PORT.key, _pgPort); |
| | | remote.put(PostgisNGDataStoreFactory.DATABASE.key, _pgDatabase); |
| | | remote.put(PostgisNGDataStoreFactory.USER.key, _pgUsername); |
| | | remote.put(PostgisNGDataStoreFactory.PASSWD.key, _pgPassword); |
| | | // remote.put( "namespace", null); |
| | | pgProperties = remote; |
| | | } |
| | | |
| | |
| | | } |
| | | */ |
| | | |
| | | if (!pgProperties.containsKey(PostgisDataStoreFactory.MAXCONN.key)) { |
| | | pgProperties.put(PostgisDataStoreFactory.MAXCONN.key, "5"); |
| | | if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MAXCONN.key)) { |
| | | pgProperties.put(PostgisNGDataStoreFactory.MAXCONN.key, "5"); |
| | | } |
| | | |
| | | if (!pgProperties.containsKey(PostgisDataStoreFactory.MINCONN.key)) { |
| | | pgProperties.put(PostgisDataStoreFactory.MINCONN.key, "1"); |
| | | if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MINCONN.key)) { |
| | | pgProperties.put(PostgisNGDataStoreFactory.MINCONN.key, "1"); |
| | | } |
| | | |
| | | if (!pgProperties.containsKey(PostgisDataStoreFactory.WKBENABLED.key)) { |
| | | pgProperties.put(PostgisDataStoreFactory.WKBENABLED.key, "true"); |
| | | /* |
| | | if (!pgProperties.containsKey(PostgisNGDataStoreFactory.WKBENABLED.key)) { |
| | | pgProperties.put(PostgisNGDataStoreFactory.WKBENABLED.key, "true"); |
| | | } |
| | | */ |
| | | |
| | | if (!dataStoreFactory.canProcess(pgProperties)) { |
| | | getLogger().warn("cannot process properties-"); |
| | | throw new JobExecutionException("cannot process properties-"); |
| | | } |
| | | try { |
| | | targetDataStore = (PostgisDataStore) dataStoreFactory.createDataStore(pgProperties); |
| | | targetDataStore = dataStoreFactory.createDataStore(pgProperties); |
| | | } catch (IOException e) { |
| | | getLogger().warn(e.getMessage(), e); |
| | | throw new JobExecutionException(e.getMessage(), e); |
| | |
| | |
|
| | | import java.util.Map;
|
| | |
|
| | | import com.ximple.eofms.filter.ElementDispatcher;
|
| | | import org.apache.commons.digester3.Digester;
|
| | | import org.apache.commons.digester3.binder.DigesterLoader;
|
| | | import org.apache.commons.digester3.xmlrules.FromXmlRulesModule;
|
| | | import org.apache.commons.logging.Log;
|
| | | import org.quartz.JobExecutionContext;
|
| | |
|
| | | import com.ximple.io.dgn7.Dgn7fileReader;
|
| | |
|
| | | public abstract class AbstractDgnFileJobContext {
|
| | |
|
| | | // ------------------------------ FIELDS ------------------------------
|
| | |
|
| | | /**
|
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | |
| | | public abstract class AbstractOracleJobContext { |
| | | /** |
| | |
| | | * Encoding of URL path. |
| | | */ |
| | | protected static final String ENCODING = "UTF-8"; |
| | | protected OracleDataStore sourceDataStore; |
| | | protected JDBCDataStore sourceDataStore; |
| | | |
| | | protected String _dataPath; |
| | | protected Properties properties; |
| | |
| | | this.useTransform = useTransform; |
| | | } |
| | | |
| | | public OracleDataStore getSourceDataStore() { |
| | | public JDBCDataStore getSourceDataStore() { |
| | | return sourceDataStore; |
| | | } |
| | | |
| | | public void setSourceDataStore(DataStore sourceDataStore) { |
| | | if ((sourceDataStore != null) && (sourceDataStore instanceof OracleDataStore)) { |
| | | this.sourceDataStore = (OracleDataStore) sourceDataStore; |
| | | if ((sourceDataStore != null) && (sourceDataStore instanceof JDBCDataStore)) { |
| | | this.sourceDataStore = (JDBCDataStore) sourceDataStore; |
| | | } else { |
| | | assert sourceDataStore != null; |
| | | getLogger().warn("setSourceDataStore(datastore) need OracleDataStore but got " + |
| | |
| | | import java.sql.Statement;
|
| | | import java.util.*;
|
| | |
|
| | | import com.vividsolutions.jts.geom.LinearRing;
|
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil;
|
| | | import org.geotools.data.DataSourceException;
|
| | | import org.geotools.data.DataStore;
|
| | | import org.geotools.data.SchemaNotFoundException;
|
| | | import org.geotools.data.Transaction;
|
| | | import org.geotools.data.jdbc.JDBCUtils;
|
| | | import org.geotools.data.edbgeo.PostgisDataStore;
|
| | | import org.geotools.filter.LengthFunction;
|
| | | import org.geotools.jdbc.JDBCDataStore;
|
| | | import org.geotools.referencing.NamedIdentifier;
|
| | | import org.geotools.referencing.crs.DefaultGeographicCRS;
|
| | | import org.opengis.feature.simple.SimpleFeature;
|
| | |
| | | import org.opengis.feature.type.AttributeDescriptor;
|
| | | import org.opengis.feature.type.AttributeType;
|
| | | import org.opengis.feature.type.GeometryDescriptor;
|
| | | import org.opengis.feature.type.GeometryType;
|
| | | import org.opengis.feature.type.PropertyType;
|
| | | import org.opengis.filter.BinaryComparisonOperator;
|
| | | import org.opengis.filter.Filter;
|
| | |
| | | protected static WKTWriter geometryWriter = new WKTWriter();
|
| | | protected static JtsBinaryWriter binaryWriter = new JtsBinaryWriter();
|
| | |
|
| | | private PostgisDataStore targetDataStore;
|
| | | private JDBCDataStore targetDataStore;
|
| | | // protected Connection connection;
|
| | | protected String targetSchema = "public";
|
| | |
|
| | |
| | | public AbstractDgnToEdbGeoJobContext(String dataPath, DataStore targetDataStore, String targetSchema,
|
| | | boolean profileMode, boolean useTransform) {
|
| | | super(dataPath, profileMode, useTransform);
|
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) {
|
| | | this.targetDataStore = (PostgisDataStore) targetDataStore;
|
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) {
|
| | | this.targetDataStore = (JDBCDataStore) targetDataStore;
|
| | | } else {
|
| | | getLogger().info("targetDataStore has wrong.");
|
| | | }
|
| | |
| | | setTargetSchema(targetSchema);
|
| | | }
|
| | |
|
| | | public PostgisDataStore getTargetDataStore() {
|
| | | public JDBCDataStore getTargetDataStore() {
|
| | | return targetDataStore;
|
| | | }
|
| | |
|
| | | public void setTargetDataStore(PostgisDataStore targetDataStore) {
|
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) {
|
| | | this.targetDataStore = targetDataStore;
|
| | | }
|
| | |
|
| | |
| | | return "null";
|
| | | }
|
| | |
|
| | | /*
|
| | | if (targetDataStore.isWKBEnabled()) {
|
| | | //String wkb = WKBEncoder.encodeGeometryHex(geom);
|
| | | String wkb = WKBWriter.bytesToHex(new WKBWriter().write(geom));
|
| | |
| | | }
|
| | |
|
| | | String geoText = geometryWriter.write(geom);
|
| | |
|
| | | return "GeometryFromText('" + geoText + "', " + srid + ")";
|
| | | */
|
| | | if (geom instanceof LinearRing) {
|
| | | //postgis does not handle linear rings, convert to just a line string
|
| | | geom = geom.getFactory().createLineString(((LinearRing) geom).getCoordinateSequence());
|
| | | }
|
| | | return "ST_GeomFromText('" + geom.toText() + "', " + srid + ")";
|
| | | }
|
| | |
|
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException
|
| | |
| | | import java.sql.Statement;
|
| | | import java.util.*;
|
| | |
|
| | | import com.vividsolutions.jts.geom.LinearRing;
|
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil;
|
| | | import org.geotools.data.DataSourceException;
|
| | | import org.geotools.data.DataStore;
|
| | | import org.geotools.data.SchemaNotFoundException;
|
| | | import org.geotools.data.edbgeo.PostgisDataStore;
|
| | | import org.geotools.filter.LengthFunction;
|
| | | import org.geotools.jdbc.JDBCDataStore;
|
| | | import org.geotools.referencing.NamedIdentifier;
|
| | | import org.geotools.referencing.crs.DefaultGeographicCRS;
|
| | | import org.opengis.feature.simple.SimpleFeature;
|
| | |
| | |
|
| | | protected boolean schemaEnabled = true;
|
| | |
|
| | | private PostgisDataStore targetDataStore;
|
| | | private JDBCDataStore targetDataStore;
|
| | | private String targetSchema = "public";
|
| | |
|
| | | public AbstractOracleToEdbGeoJobContext(String dataPath, DataStore targetDataStore, String targetSchema,
|
| | | boolean profileMode, boolean useTransform) {
|
| | | super(profileMode, useTransform);
|
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) {
|
| | | this.targetDataStore = (PostgisDataStore) targetDataStore;
|
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) {
|
| | | this.targetDataStore = (JDBCDataStore) targetDataStore;
|
| | | } else {
|
| | | getLogger().info("targetDataStore has wrong.");
|
| | | }
|
| | |
| | | setTargetSchema(targetSchema);
|
| | | }
|
| | |
|
| | | public PostgisDataStore getTargetDataStore() {
|
| | | public JDBCDataStore getTargetDataStore() {
|
| | | return targetDataStore;
|
| | | }
|
| | |
|
| | | public void setTargetDataStore(PostgisDataStore targetDataStore) {
|
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) {
|
| | | this.targetDataStore = targetDataStore;
|
| | | }
|
| | |
|
| | |
| | | return "null";
|
| | | }
|
| | |
|
| | | /*
|
| | | if (targetDataStore.isWKBEnabled()) {
|
| | | //String wkb = WKBEncoder.encodeGeometryHex(geom);
|
| | | String wkb = WKBWriter.bytesToHex(new WKBWriter().write(geom));
|
| | |
| | | }
|
| | |
|
| | | String geoText = geometryWriter.write(geom);
|
| | |
|
| | | return "GeometryFromText('" + geoText + "', " + srid + ")";
|
| | | */
|
| | | if (geom instanceof LinearRing) {
|
| | | //postgis does not handle linear rings, convert to just a line string
|
| | | geom = geom.getFactory().createLineString(((LinearRing) geom).getCoordinateSequence());
|
| | | }
|
| | | return "ST_GeomFromText('" + geom.toText() + "', " + srid + ")";
|
| | | }
|
| | |
|
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException
|
| | |
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.commons.digester.Digester;
|
| | | import org.apache.commons.digester.xmlrules.DigesterLoader;
|
| | | import com.ximple.eofms.util.DigesterUtils;
|
| | | import org.apache.commons.digester3.Digester;
|
| | | import org.apache.commons.logging.Log;
|
| | | import org.apache.commons.logging.LogFactory;
|
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper;
|
| | |
| | |
|
| | | private ElementDispatcher createElementDispatcher() {
|
| | | try {
|
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
|
| | | assert rulesURL != null;
|
| | | Digester digester = DigesterLoader.createDigester(rulesURL);
|
| | | URL filterURL = null;
|
| | | if (_filterConfig != null) {
|
| | | File config = new File(_filterConfig);
|
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
|
| | | }
|
| | | assert filterURL != null;
|
| | | Digester digester = DigesterUtils.getElementDigester();
|
| | | return (ElementDispatcher) digester.parse(filterURL);
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | logger.info(e.getMessage(), e);
|
| | |
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.commons.digester.Digester;
|
| | | import org.apache.commons.digester.xmlrules.DigesterLoader;
|
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
|
| | | import com.ximple.eofms.filter.ElementDispatcher;
|
| | | import com.ximple.eofms.util.DigesterUtils;
|
| | | 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 org.apache.commons.digester3.Digester;
|
| | | import org.apache.commons.logging.Log;
|
| | | import org.apache.commons.logging.LogFactory;
|
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper;
|
| | |
| | | import org.opengis.feature.simple.SimpleFeature;
|
| | | import org.opengis.feature.simple.SimpleFeatureType;
|
| | | import org.xml.sax.SAXException;
|
| | |
|
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
|
| | | import com.ximple.eofms.filter.ElementDispatcher;
|
| | | import com.ximple.io.dgn7.ComplexElement;
|
| | | import com.ximple.io.dgn7.Element;
|
| | | import com.ximple.io.dgn7.FrammeAttributeData;
|
| | | import com.ximple.io.dgn7.UserAttributeData;
|
| | |
|
| | | public class FeatureDgnConvertEdbGeoJobContext extends AbstractDgnToEdbGeoJobContext {
|
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertEdbGeoJobContext.class);
|
| | |
| | |
|
| | | private ElementDispatcher createElementDispatcher() {
|
| | | try {
|
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
|
| | | assert rulesURL != null;
|
| | | Digester digester = DigesterLoader.createDigester(rulesURL);
|
| | | URL filterURL = null;
|
| | | if (_filterConfig != null) {
|
| | | File config = new File(_filterConfig);
|
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
|
| | | }
|
| | | assert filterURL != null;
|
| | | Digester digester = DigesterUtils.getElementDigester();
|
| | | return (ElementDispatcher) digester.parse(filterURL);
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | logger.info(e.getMessage(), e);
|
| | |
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | |
|
| | | import com.edb.util.PSQLException;
|
| | | import com.vividsolutions.jts.geom.Geometry;
|
| | | import org.apache.commons.digester.Digester;
|
| | | import org.apache.commons.digester.xmlrules.DigesterLoader;
|
| | | import com.vividsolutions.jts.util.Assert;
|
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
|
| | | import com.ximple.eofms.filter.CreateFeatureTypeEventListener;
|
| | | import com.ximple.eofms.filter.ElementDispatcher;
|
| | | import com.ximple.eofms.filter.FeatureTypeEvent;
|
| | | import com.ximple.eofms.jobs.OracleElementLogger;
|
| | | import com.ximple.eofms.util.DigesterUtils;
|
| | | import com.ximple.io.dgn7.ComplexElement;
|
| | | import com.ximple.io.dgn7.Element;
|
| | | import com.ximple.io.dgn7.FrammeAttributeData;
|
| | | import org.apache.commons.digester3.Digester;
|
| | | import org.apache.commons.logging.Log;
|
| | | import org.apache.commons.logging.LogFactory;
|
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger;
|
| | | import org.apache.commons.transaction.util.LoggerFacade;
|
| | | import org.geotools.data.DataStore;
|
| | | import org.geotools.data.Transaction;
|
| | | import org.geotools.data.jdbc.JDBCUtils;
|
| | | import org.geotools.data.edbgeo.PostgisDataStoreFactory;
|
| | | import org.geotools.data.jdbc.JDBCUtils;
|
| | | import org.geotools.feature.SchemaException;
|
| | | import org.geotools.feature.type.FeatureTypeImpl;
|
| | | import org.opengis.feature.simple.SimpleFeature;
|
| | | import org.opengis.feature.simple.SimpleFeatureType;
|
| | | import com.edb.util.PSQLException;
|
| | | import org.quartz.JobExecutionContext;
|
| | | import org.xml.sax.SAXException;
|
| | |
|
| | | import com.vividsolutions.jts.util.Assert;
|
| | |
|
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
|
| | | import com.ximple.eofms.filter.CreateFeatureTypeEventListener;
|
| | | import com.ximple.eofms.filter.ElementDispatcher;
|
| | | import com.ximple.eofms.filter.FeatureTypeEvent;
|
| | | import com.ximple.eofms.jobs.OracleElementLogger;
|
| | | import com.ximple.io.dgn7.ComplexElement;
|
| | | import com.ximple.io.dgn7.Element;
|
| | | import com.ximple.io.dgn7.FrammeAttributeData;
|
| | |
|
| | | public class OracleConvertEdbGeoJobContext extends AbstractOracleToEdbGeoJobContext
|
| | | implements CreateFeatureTypeEventListener {
|
| | |
| | |
|
| | | private ElementDispatcher createElementDispatcher() {
|
| | | try {
|
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
|
| | | assert rulesURL != null;
|
| | | Digester digester = DigesterLoader.createDigester(rulesURL);
|
| | | URL filterURL = null;
|
| | | if (_filterConfig != null) {
|
| | | File config = new File(_filterConfig);
|
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
|
| | | }
|
| | | assert filterURL != null;
|
| | | Digester digester = DigesterUtils.getElementDigester();
|
| | | return (ElementDispatcher) digester.parse(filterURL);
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | logger.info(e.getMessage(), e);
|
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.mysql.MySQLDataStore; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractDgnToMySQLJobContext extends AbstractDgnFileJobContext { |
| | | protected MySQLDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public AbstractDgnToMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | this.targetDataStore = (MySQLDataStore) targetDataStore; |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } |
| | | |
| | | public MySQLDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(MySQLDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.mysql.MySQLDataStore; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractOracleToMySQLJobContext extends AbstractOracleJobContext { |
| | | protected MySQLDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public AbstractOracleToMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof MySQLDataStore)) { |
| | | this.targetDataStore = (MySQLDataStore) targetDataStore; |
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) { |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } else { |
| | | getLogger().info("targetDataStore has wrong."); |
| | | } |
| | | setDataPath(dataPath); |
| | | } |
| | | |
| | | public MySQLDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(MySQLDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | 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.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | 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.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertMySQlJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertMySQlJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class FeatureDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertMySQLJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // �P�_�O�_�ũM��� |
| | | |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractDgnToOraSDOJobContext extends AbstractDgnFileJobContext { |
| | | protected OracleDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public AbstractDgnToOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | this.targetDataStore = (OracleDataStore) targetDataStore; |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } |
| | | |
| | | public OracleDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(OracleDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractOracleToOraSDOJobContext extends AbstractOracleJobContext { |
| | | protected boolean profileMode = false; |
| | | protected OracleDataStore targetDataStore; |
| | | protected JDBCDataStore targetDataStore; |
| | | |
| | | public AbstractOracleToOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof OracleDataStore)) { |
| | | this.targetDataStore = (OracleDataStore) targetDataStore; |
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) { |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } else { |
| | | getLogger().info("targetDataStore has wrong."); |
| | | } |
| | | setDataPath(dataPath); |
| | | } |
| | | |
| | | public OracleDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(OracleDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | 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.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | 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.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertOraSDOJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class FeatureDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertOraSDOJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.vividsolutions.jts.util.Assert; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStoreFactory; |
| | | import org.geotools.data.oracle.OracleNGDataStoreFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.util.Assert; |
| | | |
| | | 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; |
| | | |
| | | public class OracleConvertOraSDOJobContext extends AbstractOracleToOraSDOJobContext { |
| | | static Log logger = LogFactory.getLog(OracleConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | |
| | | static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | static OracleNGDataStoreFactory dataStoreFactory = new OracleNGDataStoreFactory(); |
| | | |
| | | private OracleElementLogger elmLogger = null; |
| | | |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // �P�_�O�_�ũM��� |
| | | |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | |
| | | executionContext = context; |
| | | } |
| | | |
| | | /** |
| | | * �����]�Ƽg�J�� |
| | | * |
| | | * @throws IOException IO�o�Ϳ�~ |
| | | */ |
| | | public void closeFeatureWriter() throws IOException { |
| | | |
| | | for (FeatureWriter featureWriter : this.featuresWriterContext.values()) { |
| | |
| | | import java.sql.Statement; |
| | | import java.util.*; |
| | | |
| | | import com.vividsolutions.jts.geom.LinearRing; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import org.geotools.data.DataSourceException; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.data.postgis.PostGISDialect; |
| | | import org.geotools.filter.LengthFunction; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.geotools.referencing.NamedIdentifier; |
| | | import org.geotools.referencing.crs.DefaultGeographicCRS; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryDescriptor; |
| | | import org.opengis.feature.type.GeometryType; |
| | | import org.opengis.feature.type.PropertyType; |
| | | import org.opengis.filter.BinaryComparisonOperator; |
| | | import org.opengis.filter.Filter; |
| | |
| | | /** |
| | | * Well Known Text writer (from JTS). |
| | | */ |
| | | protected static WKTWriter geometryWriter = new WKTWriter(); |
| | | // protected static WKTWriter geometryWriter = new WKTWriter(); |
| | | protected static JtsBinaryWriter binaryWriter = new JtsBinaryWriter(); |
| | | |
| | | private PostgisDataStore targetDataStore; |
| | | private JDBCDataStore targetDataStore; |
| | | // protected Connection connection; |
| | | protected String targetSchema = "public"; |
| | | |
| | |
| | | public AbstractDgnToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { |
| | | this.targetDataStore = (PostgisDataStore) targetDataStore; |
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) { |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } else { |
| | | getLogger().info("targetDataStore has wrong."); |
| | | } |
| | |
| | | setTargetSchema(targetSchema); |
| | | } |
| | | |
| | | public PostgisDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(PostgisDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | |
| | | public void setTargetSchema(String schemaName) { |
| | | targetSchema = schemaName; |
| | | targetDataStore.setDatabaseSchema(targetSchema); |
| | | } |
| | | |
| | | public Connection getConnection() { |
| | | try { |
| | | return targetDataStore.getConnection(Transaction.AUTO_COMMIT); |
| | | |
| | | } catch (IOException e) |
| | | { |
| | | getLogger().warn(e.getMessage(), e); |
| | |
| | | |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryDescriptor geometryDescriptor, int srid) { |
| | | StringBuilder sql; |
| | | String typeName = getGeometrySQLTypeName(((AttributeType) geometryDescriptor.getType()).getBinding()); |
| | | String typeName = getGeometrySQLTypeName((geometryDescriptor.getType()).getBinding()); |
| | | if (typeName == null) { |
| | | getLogger().warn("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | |
| | | return "null"; |
| | | } |
| | | |
| | | /* |
| | | if (targetDataStore.isWKBEnabled()) { |
| | | //String wkb = WKBEncoder.encodeGeometryHex(geom); |
| | | String wkb = WKBWriter.bytesToHex(new WKBWriter().write(geom)); |
| | |
| | | } |
| | | |
| | | String geoText = geometryWriter.write(geom); |
| | | |
| | | return "GeometryFromText('" + geoText + "', " + srid + ")"; |
| | | */ |
| | | if (geom instanceof LinearRing) { |
| | | //postgis does not handle linear rings, convert to just a line string |
| | | geom = geom.getFactory().createLineString(((LinearRing) geom).getCoordinateSequence()); |
| | | } |
| | | return "ST_GeomFromText('" + geom.toText() + "', " + srid + ")"; |
| | | } |
| | | |
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException |
| | |
| | | import java.sql.Statement; |
| | | import java.util.*; |
| | | |
| | | import com.vividsolutions.jts.geom.LinearRing; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import org.geotools.data.DataSourceException; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.filter.LengthFunction; |
| | | import org.geotools.jdbc.JDBCDataStore; |
| | | import org.geotools.referencing.NamedIdentifier; |
| | | import org.geotools.referencing.crs.DefaultGeographicCRS; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | |
| | | /** |
| | | * Well Known Text writer (from JTS). |
| | | */ |
| | | protected static WKTWriter geometryWriter = new WKTWriter(); |
| | | // protected static WKTWriter geometryWriter = new WKTWriter(); |
| | | protected static JtsBinaryWriter binaryWriter = new JtsBinaryWriter(); |
| | | |
| | | protected boolean schemaEnabled = true; |
| | | |
| | | private PostgisDataStore targetDataStore; |
| | | private JDBCDataStore targetDataStore; |
| | | private String targetSchema = "public"; |
| | | |
| | | public AbstractOracleToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { |
| | | this.targetDataStore = (PostgisDataStore) targetDataStore; |
| | | if ((targetDataStore != null) && (targetDataStore instanceof JDBCDataStore)) { |
| | | this.targetDataStore = (JDBCDataStore) targetDataStore; |
| | | } else { |
| | | getLogger().info("targetDataStore has wrong."); |
| | | } |
| | |
| | | setTargetSchema(targetSchema); |
| | | } |
| | | |
| | | public PostgisDataStore getTargetDataStore() { |
| | | public JDBCDataStore getTargetDataStore() { |
| | | return targetDataStore; |
| | | } |
| | | |
| | | public void setTargetDataStore(PostgisDataStore targetDataStore) { |
| | | public void setTargetDataStore(JDBCDataStore targetDataStore) { |
| | | this.targetDataStore = targetDataStore; |
| | | } |
| | | |
| | |
| | | |
| | | public void setTargetSchema(String schemaName) { |
| | | targetSchema = schemaName; |
| | | targetDataStore.setDatabaseSchema(targetSchema); |
| | | } |
| | | |
| | | public Connection getConnection() { |
| | |
| | | return "null"; |
| | | } |
| | | |
| | | /* |
| | | if (targetDataStore.isWKBEnabled()) { |
| | | //String wkb = WKBEncoder.encodeGeometryHex(geom); |
| | | String wkb = WKBWriter.bytesToHex(new WKBWriter().write(geom)); |
| | |
| | | } |
| | | |
| | | String geoText = geometryWriter.write(geom); |
| | | |
| | | return "GeometryFromText('" + geoText + "', " + srid + ")"; |
| | | */ |
| | | if (geom instanceof LinearRing) { |
| | | //postgis does not handle linear rings, convert to just a line string |
| | | geom = geom.getFactory().createLineString(((LinearRing) geom).getCoordinateSequence()); |
| | | } |
| | | return "ST_GeomFromText('" + geom.toText() + "', " + srid + ")"; |
| | | } |
| | | |
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | 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.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | 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.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertPostGISJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class FeatureDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertPostGISJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | } catch (SQLException e) { |
| | | JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); |
| | | logger.error(e.getMessage(), e); |
| | | Exception nextE = e.getNextException(); |
| | | if (nextE != null) { |
| | | logger.error("getNextException:" + nextE.getMessage(), nextE); |
| | | } |
| | | } finally { |
| | | if (isProfileMode()) accumulateUpdateTime(); |
| | | } |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class IndexDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | |
| | | protected void putTextFeatureCollection(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | SimpleFeature feature = createFeature(element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | logger.info("cannot craete feature. " + element.toString() + "'" + |
| | | element.getText() + "'"); |
| | | return; |
| | | } |
| | |
| | | |
| | | feature = createFeature2(element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature2." + element.toString() + "'" + |
| | | logger.info("cannot craete feature2. " + element.toString() + "'" + |
| | | element.getText() + "'"); |
| | | return; |
| | | } |
| | |
| | | if (feature == null) { |
| | | Polygon polygon = (Polygon) element.toGeometry(geometryFactory); |
| | | if (polygon == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | logger.info("cannot craete feature. " + element.toString() + "'" + |
| | | "linear is null" + "'"); |
| | | } else { |
| | | Coordinate pt = polygon.getEnvelopeInternal().centre(); |
| | | String id = TPCLIDConverter.CoordinateToTpclId(pt); |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | logger.info("cannot craete feature. " + element.toString() + "'" + |
| | | id + "'- from pt=" + pt); |
| | | } |
| | | return; |
| | |
| | | logger.error(e.getMessage(), e); |
| | | Exception nextE = e.getNextException(); |
| | | if (nextE != null) { |
| | | logger.error(nextE.getMessage(), nextE); |
| | | logger.error("getNextException:" + nextE.getMessage(), nextE); |
| | | } |
| | | } finally { |
| | | if (isProfileMode()) this.accumulateUpdateTime(); |
| | |
| | | import java.util.Iterator; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.vividsolutions.jts.util.Assert; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.CreateFeatureTypeEventListener; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.FeatureTypeEvent; |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.type.FeatureTypeImpl; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.util.Assert; |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.CreateFeatureTypeEventListener; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.filter.FeatureTypeEvent; |
| | | import com.ximple.eofms.jobs.OracleElementLogger; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | |
| | | public class OracleConvertPostGISJobContext extends AbstractOracleToPostGISJobContext |
| | | implements CreateFeatureTypeEventListener { |
| | | static Log logger = LogFactory.getLog(OracleConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | |
| | | static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | // static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); |
| | | |
| | | private OracleElementLogger elmLogger = null; |
| | | |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | 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.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | 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.UserAttributeData; |
| | | |
| | | public class DummyFeatureConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertShpJobContext.class); |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | 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 org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class FeatureDgnConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
| | |
| | | import java.util.Iterator; |
| | | import java.util.Properties; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | |
| | | |
| | | private ElementDispatcher createElementDispatcher() { |
| | | try { |
| | | URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml"); |
| | | assert rulesURL != null; |
| | | Digester digester = DigesterLoader.createDigester(rulesURL); |
| | | URL filterURL = null; |
| | | if (_filterConfig != null) { |
| | | File config = new File(_filterConfig); |
| | |
| | | // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml"); |
| | | } |
| | | assert filterURL != null; |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | return (ElementDispatcher) digester.parse(filterURL); |
| | | } catch (UnsupportedEncodingException e) { |
| | | logger.info(e.getMessage(), e); |
New file |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.digester3.binder.DigesterLoader; |
| | | import org.apache.commons.digester3.xmlrules.FromXmlRulesModule; |
| | | |
| | | public class DigesterUtils { |
| | | protected static Digester digester = null; |
| | | protected static DigesterLoader loader = DigesterLoader.newLoader( new FromXmlRulesModule() { |
| | | @Override |
| | | protected void loadRules() { |
| | | loadXMLRules(ElementDispatcher.class.getResource("ElementDispatcherRules.xml")); |
| | | } |
| | | |
| | | } ); |
| | | |
| | | static { |
| | | digester = loader.newDigester(); |
| | | } |
| | | |
| | | public static Digester getElementDigester() { |
| | | return digester; |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import com.vividsolutions.jts.geom.*; |
| | | import java.util.ArrayList; |
| | | import java.util.TreeMap; |
| | | |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | import com.vividsolutions.jts.geom.MultiLineString; |
| | | import com.vividsolutions.jts.geom.MultiPoint; |
| | | import com.vividsolutions.jts.geom.Point; |
| | | import com.vividsolutions.jts.geom.Polygon; |
| | | import com.ximple.eofms.filter.ElementDispatcher; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.apache.commons.digester3.binder.DigesterLoader; |
| | | import org.apache.commons.digester3.xmlrules.FromXmlRulesModule; |
| | | import org.apache.log4j.LogManager; |
| | | import org.apache.log4j.Logger; |
| | | import org.geotools.feature.AttributeTypeBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.geotools.referencing.CRS; |
| | | import org.geotools.referencing.ReferencingFactoryFinder; |
| | | import org.geotools.referencing.factory.epsg.ThreadedH2EpsgFactory; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryType; |
| | | import org.opengis.referencing.FactoryException; |
| | | import org.opengis.referencing.crs.CRSFactory; |
| | | import org.opengis.referencing.crs.CoordinateReferenceSystem; |
| | | import org.opengis.referencing.cs.CSFactory; |
| | | import org.opengis.referencing.cs.CoordinateSystem; |
| | | import org.opengis.referencing.operation.MathTransform; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.TreeMap; |
| | | |
| | | public final class FeatureTypeBuilderUtil { |
| | | |
| | | protected static final String DEFAULTNAMESPACE = "http://www.ximple.com.tw/tpc/"; |
| | | |
| | | private static final Logger LOGGER = LogManager.getLogger(FeatureTypeBuilderUtil.class); |
| | | private static boolean notAllowNull = false; |
| | | protected static final String DEFAULTNAMESPACE = "http://www.ximple.com.tw/tpc/"; |
| | | private static boolean allowNull = true; |
| | | |
| | | public static boolean isNotAllowNull() { |
| | | return notAllowNull; |
| | |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20))); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "origin", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | |
| | | <?xml version='1.0' encoding="big5"?> |
| | | <!DOCTYPE digester-rules PUBLIC "-//Jakarta Apache //DTD digester-rules XML V1.0//EN" "digester-rules.dtd"> |
| | | <!DOCTYPE digester-rules PUBLIC "-//Apache Commons //DTD digester-rules XML V1.0//EN" "http://commons.apache.org/digester/dtds/digester-rules-3.0.dtd"> |
| | | <digester-rules> |
| | | <pattern value="ElementDispatcherRules"> |
| | | <object-create-rule classname="com.ximple.eofms.filter.ElementDispatcher"/> |
| | |
| | | <?xml version='1.0' encoding="big5"?> |
| | | <!DOCTYPE digester-rules PUBLIC "-//Jakarta Apache //DTD digester-rules XML V1.0//EN" "digester-rules.dtd"> |
| | | <!DOCTYPE digester-rules PUBLIC "-//Apache Commons //DTD digester-rules XML V1.0//EN" "http://commons.apache.org/digester/dtds/digester-rules-3.0.dtd"> |
| | | <digester-rules> |
| | | <pattern value="FeatureClassificationRules"> |
| | | <object-create-rule classname="com.ximple.eofms.collector.FeatureClassification"/> |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import com.ximple.eofms.util.DigesterUtils; |
| | | import org.apache.commons.digester3.Digester; |
| | | import org.geotools.TestData; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.Test; |
| | |
| | | @Test |
| | | public void testLoadRules() throws IOException { |
| | | File rules = TestData.file(this, TestRulesName); |
| | | Digester digester = DigesterLoader.createDigester(rules.toURI().toURL()); |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | // File config = TestData.file(this, TestConfigName); |
| | | // ElementDispatcher ed = (ElementDispatcher) digester.parse(config); |
| | | Assert.assertNotNull(digester); |
| | |
| | | @Test |
| | | public void testLoadConfig() throws IOException, SAXException { |
| | | File rules = TestData.file(this, TestRulesName); |
| | | Digester digester = DigesterLoader.createDigester(rules.toURI().toURL()); |
| | | Digester digester = DigesterUtils.getElementDigester(); |
| | | File config = TestData.file(this, TestConfigName); |
| | | ElementDispatcher ed = (ElementDispatcher) digester.parse(config); |
| | | Assert.assertNotNull(ed); |