From 4232697d04382033c02cc51295da5d1be9e6978f Mon Sep 17 00:00:00 2001
From: ?? ? <ulysseskao@ximple.com.tw>
Date: Thu, 13 Mar 2008 15:09:53 +0800
Subject: [PATCH] EOFM-14

---
 /dev/null                                                                    |   13 --
 ximple-spatialjob/pom.xml                                                    |  229 ++++++++++++++++++++++++++++++++++++++-------
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ConvertDgn2ShpJob.java |   51 ++++++++++
 .gitattributes                                                               |    2 
 4 files changed, 243 insertions(+), 52 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index 1e0f3b4..9d6a37a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -30,5 +30,5 @@
 ximple-jobcarrier/src/main/java/com/ximple/eofms/App.java svneol=native#text/plain
 ximple-jobcarrier/src/test/java/com/ximple/eofms/AppTest.java svneol=native#text/plain
 ximple-spatialjob/pom.xml svneol=native#text/xml
-ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/App.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ConvertDgn2ShpJob.java svneol=native#text/plain
 ximple-spatialjob/src/test/java/com/ximple/eofms/jobs/AppTest.java svneol=native#text/plain
diff --git a/ximple-spatialjob/pom.xml b/ximple-spatialjob/pom.xml
index 0a0dcc6..d9599af 100644
--- a/ximple-spatialjob/pom.xml
+++ b/ximple-spatialjob/pom.xml
@@ -1,16 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  
+
   <properties>
     <oracle.jdbc>true</oracle.jdbc>
     <test.maxHeapSize>512M</test.maxHeapSize>
     <src.output>${basedir}/target</src.output>
     <java5>1.5</java5>
+    <xdgnio.version>0.0.1</xdgnio.version>
+    <gt.version>2.4.1</gt.version>
   </properties>
-  
+
   <profiles>
     <profile>
       <id>java5</id>
@@ -37,30 +39,30 @@
       </distributionManagement>
     </profile>
   </profiles>
-  
+
   <scm>
     <connection>
       scm:svn:http://www.ximple.com.tw/svn/xeofms/xspatialjob/truck/
     </connection>
     <url>http://www.ximple.com.tw/svn/xeofms/xspatialjob/truck/</url>
   </scm>
-  
+
   <groupId>com.ximple.eofms</groupId>
   <artifactId>ximple-spatialjob</artifactId>
   <packaging>jar</packaging>
   <version>0.0.1</version>
   <name>ximple-spatialjob</name>
   <url>http://www.ximple.com.tw</url>
-  
+
   <description>Ximple Spatial Data Job for Quartz</description>
-  
+
   <organization>
     <name>Ximple</name>
     <url>http://www.ximple.com.tw</url>
   </organization>
-  
+
   <inceptionYear>2008</inceptionYear>
-  
+
   <!-- =========================================================== -->
   <!--     Issue managements and mailing lists.                    -->
   <!-- =========================================================== -->
@@ -68,27 +70,27 @@
     <system>JIRA</system>
     <url>http://www.ximple.com.tw/jira/browse/EOFMS</url>
   </issueManagement>
-  
+
   <!-- =========================================================== -->
   <!--    Continuous Integration                                   -->
   <!-- =========================================================== -->
   <ciManagement>
     <system>continuum</system>
   </ciManagement>
-  
+
   <mailingLists>
     <mailingList>
     </mailingList>
   </mailingLists>
-  
+
   <developers>
     <developer>
     </developer>
   </developers>
-  
+
   <contributors>
   </contributors>
-  
+
   <!-- =========================================================== -->
   <!--     Dependency Management                                   -->
   <!--     If a POM declares one of those dependencies, then it    -->
@@ -97,18 +99,32 @@
   <!-- =========================================================== -->
   <dependencyManagement>
     <dependencies>
+      <!-- GeoAPI and its dependencies -->
+      <dependency>
+        <groupId>org.opengis</groupId>
+        <artifactId>geoapi-nogenerics</artifactId>
+        <version>2.1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>javax.units</groupId>
+        <artifactId>jsr108</artifactId>
+        <version>0.01</version>
+      </dependency>
+
       <dependency>
         <groupId>com.vividsolutions</groupId>
         <artifactId>jts</artifactId>
         <version>1.9</version>
       </dependency>
-      
+
       <!-- Apache -->
+      <!--
       <dependency>
         <groupId>commons-beanutils</groupId>
         <artifactId>commons-beanutils</artifactId>
         <version>1.7</version>
       </dependency>
+      -->
       <dependency>
         <groupId>commons-collections</groupId>
         <artifactId>commons-collections</artifactId>
@@ -140,7 +156,62 @@
         <artifactId>poi-contrib</artifactId>
         <version>3.0.1-FINAL</version>
       </dependency>
-      
+
+      <!-- geotools -->
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2</artifactId>
+        <version>${gt.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2-api</artifactId>
+        <version>${gt.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2-main</artifactId>
+        <version>${gt.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2-sample-data</artifactId>
+        <version>${gt.version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2-data</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>gt2-referencing</artifactId>
+        <version>${gt.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>jdom</groupId>
+        <artifactId>jdom</artifactId>
+        <version>1.0</version>
+      </dependency>
+
+      <dependency>
+        <groupId>velocity</groupId>
+        <artifactId>velocity</artifactId>
+        <version>1.4</version>
+      </dependency>
+
+      <!-- We need this to make the referencing module useful -->
+      <dependency>
+        <groupId>org.geotools</groupId>
+        <artifactId>gt2-epsg-hsql</artifactId>
+        <version>${gt.version}</version>
+        <scope>test</scope>
+      </dependency>
+
       <!-- ORACLE -->
       <!-- Download and install into your own repo -->
       <dependency>
@@ -148,34 +219,125 @@
         <groupId>com.oracle</groupId>
         <version>11.1.0</version>
       </dependency>
-      
+
       <!-- opensymphony -->
       <dependency>
         <groupId>opensymphony</groupId>
         <artifactId>quartz</artifactId>
         <version>1.6.0</version>
       </dependency>
-      
+
       <!-- Ximple Library -->
       <dependency>
         <artifactId>ximple-dgnio</artifactId>
         <groupId>com.ximple</groupId>
-        <version>{$project.version}</version>
+        <version>${xdgnio.version}</version>
       </dependency>
-      
+
       <!-- Tests or legacy -->
       <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
-        <!--
-          <classifier>jdk15</classifier>
-          <version>5.7</version>
-        -->
-        <version>5.5</version>
+        <version>5.7</version>
         <scope>test</scope>
       </dependency>
     </dependencies>
   </dependencyManagement>
+
+  <!-- =========================================================== -->
+  <!--     Dependencies to be inherited by all modules.            -->
+  <!-- =========================================================== -->
+  <dependencies>
+    <dependency>
+      <artifactId>geoapi-nogenerics</artifactId>
+      <groupId>org.opengis</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>jsr108</artifactId>
+      <groupId>javax.units</groupId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.vividsolutions</groupId>
+      <artifactId>jts</artifactId>
+    </dependency>
+
+    <!-- Apache -->
+    <dependency>
+      <artifactId>commons-collections</artifactId>
+      <groupId>commons-collections</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>log4j</artifactId>
+      <groupId>log4j</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>gt2-api</artifactId>
+      <groupId>org.geotools</groupId>
+    </dependency>
+    <dependency>
+      <artifactId>gt2-main</artifactId>
+      <groupId>org.geotools</groupId>
+    </dependency>
+    <dependency>
+      <artifactId>gt2-sample-data</artifactId>
+      <groupId>org.geotools</groupId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <artifactId>gt2-data</artifactId>
+      <groupId>org.geotools</groupId>
+    </dependency>
+
+    <!-- because main and sample-data depend on referencing we need a tie breaker -->
+    <dependency>
+      <artifactId>gt2-referencing</artifactId>
+      <groupId>org.geotools</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>jdom</artifactId>
+      <groupId>jdom</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>velocity</artifactId>
+      <groupId>velocity</groupId>
+    </dependency>
+
+    <!-- We need this to make the referencing module useful -->
+    <dependency>
+      <artifactId>gt2-epsg-hsql</artifactId>
+      <groupId>org.geotools</groupId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- ORACLE -->
+    <dependency>
+      <artifactId>ojdbc5</artifactId>
+      <groupId>com.oracle</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>quartz</artifactId>
+      <groupId>opensymphony</groupId>
+    </dependency>
+
+    <!-- Ximple Library -->
+    <dependency>
+      <artifactId>ximple-dgnio</artifactId>
+      <groupId>com.ximple</groupId>
+    </dependency>
+
+    <dependency>
+      <artifactId>testng</artifactId>
+      <groupId>org.testng</groupId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 
   <!-- =========================================================== -->
   <!--     Build Configuration                                     -->
@@ -263,21 +425,12 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.2</version>
-          <!-- Current version is 2.3, but it cause the following exception:
-
-                    Running org.geotools.gce.imagepyramid.ImagePyramidReaderTest
-                    Error: Could not find mediaLib accelerator wrapper classes. Continuing in pure Java mode.
-                    Occurs in: com.sun.media.jai.mlib.MediaLibAccessor
-                    java.lang.NoClassDefFoundError: com/sun/medialib/mlib/Image
-                        at com.sun.media.jai.mlib.MediaLibAccessor.setUseMlib(MediaLibAccessor.java:245)
-                        at com.sun.media.jai.mlib.MlibAffineRIF.create(MlibAffineRIF.java:71)
-                    -->
+          <version>2.4.2</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-report-plugin</artifactId>
-          <version>2.3</version>
+          <version>2.4.2</version>
         </plugin>
 
         <!-- http://www.ibiblio.org/maven2/org/codehaus/mojo/ -->
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/App.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/App.java
deleted file mode 100644
index 4e63ef3..0000000
--- a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/App.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ximple.eofms.jobs;
-
-/**
- * Hello world!
- *
- */
-public class App 
-{
-    public static void main( String[] args )
-    {
-        System.out.println( "Hello World!" );
-    }
-}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ConvertDgn2ShpJob.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ConvertDgn2ShpJob.java
new file mode 100644
index 0000000..23a9524
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ConvertDgn2ShpJob.java
@@ -0,0 +1,51 @@
+package com.ximple.eofms.jobs;
+
+import java.io.File;
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.Job;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ *
+ */
+public class ConvertDgn2ShpJob implements Job
+{
+    static Log logger = LogFactory.getLog(ConvertDgn2ShpJob.class);
+
+    public void execute(JobExecutionContext context) throws JobExecutionException
+    {
+        // Every job has its own job detail
+        JobDetail jobDetail = context.getJobDetail();
+
+        // The name is defined in the job definition
+        String jobName = jobDetail.getName();
+
+        // Log the time the job started
+        logger.info(jobName + " fired at " + new Date());
+
+        // The directory to scan is stored in the job map
+        JobDataMap dataMap = jobDetail.getJobDataMap();
+        String dirName = dataMap.getString("SHPDATA_DIR");
+
+        // Validate the required input
+        if (dirName == null)
+        {
+            throw new JobExecutionException("Directory not configured");
+        }
+
+        // Make sure the directory exists
+        File dir = new File(dirName);
+        if (!dir.exists())
+        {
+            throw new JobExecutionException("Invalid Dir " + dirName);
+        }
+
+
+    }
+}

--
Gitblit v0.0.0-SNAPSHOT