From 0ffea4eece9090db61ff0042ac26a6cb2a356cab Mon Sep 17 00:00:00 2001
From: ?? ? <ulysseskao@ximple.com.tw>
Date: Tue, 06 May 2008 16:28:31 +0800
Subject: [PATCH] update for EOFM-73

---
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
index 66e41ce..163163b 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
@@ -42,6 +42,8 @@
     static Log logger = LogFactory.getLog(OracleConvertJobContext.class);
     static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
 
+    private static final String SHPOUTPATH = "shpout";
+
     static
     {
         try
@@ -62,6 +64,8 @@
     private PessimisticMapWrapper txFeaturesContext;
 
     private JobExecutionContext executionContext;
+
+    private String dataOut = null;
 
     public OracleConvertJobContext(String filterConfig)
     {
@@ -116,7 +120,7 @@
 
     public void putFeatureCollection(Element element)
     {
-        //�P�_�O�_�ũM����
+        // �P�_�O�_�ũM����
         Feature feature = elementDispatcher.execute(element);
         if (feature == null)
         {
@@ -170,15 +174,14 @@
 
     private void updateDataStore()
     {
-        // todo:
-        Iterator it = featuresContext.keySet().iterator();  
+        Iterator it = featuresContext.keySet().iterator();
 
         try
         {
             while (it.hasNext())
             {
                 FeatureType featureType = (FeatureType) it.next();
-                File sfile = new File(_dataPath + "\\" + featureType.getTypeName());
+                File sfile = new File(getDataOutPath() + "\\" + featureType.getTypeName());
                 logger.debug("Begin Save shapefile:" + sfile.toURI());
 
                 FeatureWriter writer = null;
@@ -232,6 +235,10 @@
         executionContext = context;
     }
 
+    /**
+     * �����]�Ƽg�J��
+     * @throws IOException IO�o�Ϳ��~
+     */
     public void closeFeatureWrite() throws IOException {
        Iterator iter =   this.featuresWriterContext.values().iterator();
 
@@ -243,4 +250,25 @@
 
         this.featuresWriterContext = null;
     }
+
+    /**
+     * ���o��ƿ�X���|
+     * @return ���|���r��
+     */
+    public String getDataOutPath()
+    {
+        if (dataOut == null)
+        {
+            File outPath = new File(getDataPath(), SHPOUTPATH);
+            if (!outPath.exists())
+            {
+                outPath.mkdir();
+            } else if (!outPath.isDirectory())
+            {
+                outPath.mkdir();
+            }
+            dataOut = getDataPath() + SHPOUTPATH;
+        }
+        return dataOut;
+    }
 }

--
Gitblit v0.0.0-SNAPSHOT