From f26cdb4382420cb98e96237914cf21ae351ceecb Mon Sep 17 00:00:00 2001
From: ?? ? <ulysseskao@ximple.com.tw>
Date: Mon, 17 Mar 2008 17:31:01 +0800
Subject: [PATCH] update for EOFM-17

---
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeIdHandlerStrategy.java           |   39 ++++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatcher.java               |   31 +++
 ximple-spatialjob/pom.xml                                                                  |   22 ++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java         |   55 +-----
 .gitattributes                                                                             |   11 +
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java         |   57 ++++++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateLineStringStrategy.java        |   30 +++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatchableStrategy.java     |   12 +
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateFeatureTypeStrategy.java       |    9 +
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompLevelIdHandlerStrategy.java  |   46 +++++
 /dev/null                                                                                  |   12 -
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompIdHandlerStrategy.java       |   43 +++++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java     |    5 
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractFLinkageHandlerStrategy.java |   27 +++
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateTextStrategy.java              |   35 ++++
 15 files changed, 373 insertions(+), 61 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index e290121..c0b7501 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -41,11 +41,20 @@
 ximple-jobcarrier/src/main/resources/quartz_jobs.xml svneol=native#text/xml
 ximple-jobcarrier/src/test/java/com/ximple/eofms/XQuartzJobCarrierTest.java svneol=native#text/plain
 ximple-spatialjob/pom.xml svneol=native#text/xml
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractFLinkageHandlerStrategy.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java svneol=native#text/plain
-ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DgnElementListener.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateFeatureTypeStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateLineStringStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateTextStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatchableStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatcher.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleUpgradeBlob2UDTJob.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompIdHandlerStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompLevelIdHandlerStrategy.java svneol=native#text/plain
+ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeIdHandlerStrategy.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/util/BinConverter.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/util/Bits.java svneol=native#text/plain
 ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java svneol=native#text/plain
diff --git a/ximple-spatialjob/pom.xml b/ximple-spatialjob/pom.xml
index 3bbb6e9..f4e83fa 100644
--- a/ximple-spatialjob/pom.xml
+++ b/ximple-spatialjob/pom.xml
@@ -146,6 +146,11 @@
         <version>1.1.1</version>
       </dependency>
       <dependency>
+        <groupId>commons-transaction</groupId>
+        <artifactId>commons-transaction</artifactId>
+        <version>1.2</version>
+      </dependency>
+      <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <version>1.2.15</version>
@@ -273,7 +278,22 @@
       <artifactId>commons-collections</artifactId>
       <groupId>commons-collections</groupId>
     </dependency>
-
+    <dependency>
+      <groupId>commons-digester</groupId>
+      <artifactId>commons-digester</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-pool</groupId>
+      <artifactId>commons-pool</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-transaction</groupId>
+      <artifactId>commons-transaction</artifactId>
+    </dependency>
     <dependency>
       <artifactId>log4j</artifactId>
       <groupId>log4j</groupId>
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractFLinkageHandlerStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractFLinkageHandlerStrategy.java
new file mode 100644
index 0000000..4fb9b53
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractFLinkageHandlerStrategy.java
@@ -0,0 +1,27 @@
+package com.ximple.eofms.jobs;
+
+import java.util.List;
+
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public abstract class AbstractFLinkageHandlerStrategy implements ElementDispatchableStrategy
+{
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                FrammeAttributeData featureLinkage = (FrammeAttributeData) anUsrData;
+                return featureLinkage;
+            }
+        }
+        return null;
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateFeatureTypeStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateFeatureTypeStrategy.java
new file mode 100644
index 0000000..c529090
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateFeatureTypeStrategy.java
@@ -0,0 +1,9 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SchemaException;
+
+public interface CreateFeatureTypeStrategy
+{
+    public FeatureType createFeatureElement(String featureName) throws SchemaException;
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateLineStringStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateLineStringStrategy.java
new file mode 100644
index 0000000..d573c43
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateLineStringStrategy.java
@@ -0,0 +1,30 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.AttributeTypeFactory;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.SchemaException;
+import org.opengis.geometry.Geometry;
+
+public class CreateLineStringStrategy implements CreateFeatureTypeStrategy
+{
+    FeatureTypeBuilder typeBuilder = null;
+
+    public FeatureType createFeatureElement(String featureName) throws SchemaException
+    {
+        if (typeBuilder == null)
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName);
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class));
+        }
+        return typeBuilder.getFeatureType();
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateTextStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateTextStrategy.java
new file mode 100644
index 0000000..fca43bd
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/CreateTextStrategy.java
@@ -0,0 +1,35 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.AttributeTypeFactory;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.SchemaException;
+import org.opengis.geometry.Geometry;
+
+public class CreateTextStrategy implements CreateFeatureTypeStrategy
+{
+    FeatureTypeBuilder typeBuilder = null;
+
+    public FeatureType createFeatureElement(String featureName) throws SchemaException
+    {
+        if (typeBuilder == null)
+        {
+            typeBuilder = FeatureTypeBuilder.newInstance(featureName);
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", String.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class));
+            typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class));
+        }
+        return typeBuilder.getFeatureType();
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DgnElementListener.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DgnElementListener.java
deleted file mode 100644
index afcb981..0000000
--- a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DgnElementListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ximple.eofms.jobs;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Ulysses
- * Date: 2008/3/14
- * Time: �U�� 12:40:58
- * To change this template use File | Settings | File Templates.
- */
-public interface DgnElementListener
-{
-}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatchableStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatchableStrategy.java
new file mode 100644
index 0000000..e3c882f
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatchableStrategy.java
@@ -0,0 +1,12 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.SchemaException;
+
+import com.ximple.io.dgn7.Element;
+
+public interface ElementDispatchableStrategy
+{
+    public boolean isDispatchable(Element element);
+
+    public void execute(Element element) throws SchemaException;
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatcher.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatcher.java
new file mode 100644
index 0000000..e19b4c7
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/ElementDispatcher.java
@@ -0,0 +1,31 @@
+package com.ximple.eofms.jobs;
+
+import java.util.LinkedList;
+
+import com.ximple.io.dgn7.Element;
+
+public class ElementDispatcher
+{
+    private LinkedList<ElementDispatchableStrategy> rules;
+
+    public ElementDispatcher()
+    {
+        rules = new LinkedList<ElementDispatchableStrategy>();
+    }
+
+    public void addRule(ElementDispatchableStrategy rule)
+    {
+        rules.add(rule);
+    }
+
+    public void execute(Element element)
+    {
+        for (ElementDispatchableStrategy rule : rules)
+        {
+            if (rule.isDispatchable(element))
+            {
+                rule.execute(element);
+            }
+        }
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java
new file mode 100644
index 0000000..b0afc7f
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java
@@ -0,0 +1,5 @@
+package com.ximple.eofms.jobs;
+
+public interface GeometryCoordinateDecorator
+{
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
index 5fee393..4e410fa 100644
--- a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
@@ -1,9 +1,6 @@
 package com.ximple.eofms.jobs;
 
-import java.io.File;
-import java.io.IOException;
 import java.math.BigDecimal;
-import java.net.MalformedURLException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.sql.ResultSet;
@@ -17,19 +14,7 @@
 import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.geotools.data.FeatureWriter;
-import org.geotools.data.Transaction;
-import org.geotools.data.shapefile.ShapefileDataStore;
-import org.geotools.feature.AttributeTypeFactory;
 import org.geotools.feature.Feature;
-import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureCollections;
-import org.geotools.feature.FeatureType;
-import org.geotools.feature.FeatureTypeBuilder;
-import org.geotools.feature.IllegalAttributeException;
-import org.geotools.feature.SchemaException;
-import org.geotools.feature.SimpleFeature;
-import org.opengis.geometry.Geometry;
 import org.quartz.JobDetail;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -48,7 +33,6 @@
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.ElementType;
 import com.ximple.io.dgn7.IElementHandler;
-import com.ximple.io.dgn7.LineElement;
 import com.ximple.util.PrintfFormat;
 
 /**
@@ -73,6 +57,8 @@
             this.second = second;
         }
     }
+
+    GeometryFactory _geomFactory = new GeometryFactory();
 
     public Log getLogger()
     {
@@ -132,6 +118,7 @@
             {
                 // OracleConnection connection = jobContext.getOracleConnection();
                 // connection.commit();
+                jobContext.commit();
                 System.gc();
             }
         }
@@ -250,7 +237,9 @@
 
             try
             {
-                onBinaryElement(raw);
+                Element element = fetchBinaryElement(raw);
+                jobContext.putFeatureCollection(element);
+
             } catch (Dgn7fileException e)
             {
                 logger.warn("Dgn7Exception", e);
@@ -293,7 +282,8 @@
 
             try
             {
-                onBinaryElement(rawDest);
+                Element element = fetchBinaryElement(rawDest);
+                // Feature feature = convertElementToFeature(element);
             } catch (Dgn7fileException e)
             {
                 logger.warn("Dgn7Exception:" + e.getMessage(), e);
@@ -301,7 +291,7 @@
         }
     }
 
-    private void onBinaryElement(byte[] raws) throws Dgn7fileException
+    private Element fetchBinaryElement(byte[] raws) throws Dgn7fileException
     {
         ByteBuffer buffer = ByteBuffer.wrap(raws);
         buffer.order(ByteOrder.LITTLE_ENDIAN);
@@ -358,36 +348,20 @@
             }
         }
 
-        Feature feature = convertElementToFeature(dgnElement);
+        return dgnElement;
     }
 
     private Feature convertElementToFeature(Element dgnElement)
     {
-        GeometryFactory geomFactory = new GeometryFactory();
-        FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance("Line");
-
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", String.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class));
-        typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class));
 
         // typeBuilder.setNamespace(new URI(""));
+        /*
         Feature feature = null;
         try
         {
             FeatureType featureType = typeBuilder.getFeatureType();
             feature = featureType.create(new Object[]{
-                    ((LineElement) dgnElement).toGeometry(geomFactory)
+                    ((LineElement) dgnElement).toGeometry(_geomFactory)
             });
 
             FeatureCollection features = FeatureCollections.newCollection();
@@ -412,6 +386,7 @@
         {
             logger.warn(e.getMessage(), e);
         }
+        */
 
 
         return null;
@@ -435,8 +410,4 @@
         return true;
     }
 
-    public FeatureCollection loopupFeatureCollection(String name)
-    {
-        return null;
-    }
 }
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
index fee578a..1b0a17a 100644
--- a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
@@ -6,10 +6,16 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.geotools.feature.AttributeTypeFactory;
+import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.opengis.geometry.Geometry;
 
 import com.vividsolutions.jts.util.Assert;
 
 import oracle.jdbc.OracleConnection;
+
+import com.ximple.io.dgn7.Element;
 
 public class OracleConvertJobContext
 {
@@ -173,7 +179,7 @@
             + "    END;";
 
     protected static final String TRG_ELMINDEX =
-                    "CREATE OR REPLACE TRIGGER \"%s\".\"%s\"\n"
+            "CREATE OR REPLACE TRIGGER \"%s\".\"%s\"\n"
                     + "    AFTER INSERT OR UPDATE OR DELETE ON \"%s\".\"%s\"\n"
                     + "    REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW\n"
                     + "    BEGIN\n"
@@ -202,10 +208,6 @@
 
     protected static final String SMTM_GRANTOBJECTTYPE = "GRANT EXECUTE ANY TYPE TO \"" + UDT_SCHEMA + "\"";
 
-    private String _oracleHost;
-    private String _oracleInstance;
-    private String _oraclePort;
-
     static
     {
         try
@@ -231,12 +233,26 @@
         return builder.toString();
     }
 
+    private String _oracleHost;
+    private String _oracleInstance;
+    private String _oraclePort;
+
     private OracleConnection oracleConnection = null;
     private Properties properties;
+
+    private ElementDispatcher elementDispatcher;
 
     public OracleConvertJobContext()
     {
         properties = new Properties();
+        elementDispatcher = createElementDispatcher();
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        ElementDispatcher dispatcher = new ElementDispatcher();
+        dispatcher.addRule(new TypeCompIdHandlerStrategy(106, 0));
+        return dispatcher;
     }
 
     public void setLogin(String userName, String password)
@@ -288,4 +304,35 @@
         _oracleInstance = oracleInstance;
         _oraclePort = oraclePort;
     }
+
+    public FeatureCollection putFeatureCollection(Element element)
+    {
+        return null;
+    }
+
+    public FeatureCollection createFeatureCollection(Element element)
+    {
+        FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance("Line");
+
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", String.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class));
+        typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class));
+        return null;
+    }
+
+    public void commit()
+    {
+
+    }
 }
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompIdHandlerStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompIdHandlerStrategy.java
new file mode 100644
index 0000000..cf77a3f
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompIdHandlerStrategy.java
@@ -0,0 +1,43 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SchemaException;
+
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+
+public class TypeCompIdHandlerStrategy extends AbstractFLinkageHandlerStrategy
+{
+    private String name;
+    private int tid;
+    private int cid;
+    private CreateFeatureTypeStrategy createStrategy;
+
+    public TypeCompIdHandlerStrategy(String fname,
+                                     CreateFeatureTypeStrategy createStrategy,
+                                     int tid, int compid)
+    {
+        this.name = fname;
+        this.tid = tid;
+        this.cid = compid;
+        this.createStrategy = createStrategy;
+    }
+
+    public boolean isDispatchable(Element element)
+    {
+        FrammeAttributeData featureLinkage = getFeatureLinkage(element);
+        return featureLinkage != null && tid == featureLinkage.getFsc() &&
+                (cid == featureLinkage.getComponentID());
+    }
+
+    public void execute(Element element)
+    {
+        try
+        {
+            FeatureType ftype = createStrategy.createFeatureElement(name);
+        } catch (SchemaException e)
+        {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompLevelIdHandlerStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompLevelIdHandlerStrategy.java
new file mode 100644
index 0000000..c937241
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeCompLevelIdHandlerStrategy.java
@@ -0,0 +1,46 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SchemaException;
+
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+
+public class TypeCompLevelIdHandlerStrategy extends AbstractFLinkageHandlerStrategy
+{
+    private String name;
+    private int tid;
+    private int cid;
+    private int lid;
+    private CreateFeatureTypeStrategy createStrategy;
+
+    public TypeCompLevelIdHandlerStrategy(String fname,
+                                          CreateFeatureTypeStrategy createStrategy,
+                                          int tid, int compid, int level)
+    {
+        this.name = fname;
+        this.tid = tid;
+        this.cid = compid;
+        this.lid = level;
+        this.createStrategy = createStrategy;
+    }
+
+    public boolean isDispatchable(Element element)
+    {
+        FrammeAttributeData featureLinkage = getFeatureLinkage(element);
+        return featureLinkage != null && tid == featureLinkage.getFsc() &&
+                (cid == featureLinkage.getComponentID()) &&
+                (lid == element.getLevelIndex());
+    }
+
+    public void execute(Element element)
+    {
+        try
+        {
+            FeatureType ftype = createStrategy.createFeatureElement(name);
+        } catch (SchemaException e)
+        {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeIdHandlerStrategy.java b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeIdHandlerStrategy.java
new file mode 100644
index 0000000..86b36d8
--- /dev/null
+++ b/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TypeIdHandlerStrategy.java
@@ -0,0 +1,39 @@
+package com.ximple.eofms.jobs;
+
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SchemaException;
+
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+
+public class TypeIdHandlerStrategy extends AbstractFLinkageHandlerStrategy
+{
+    private String name;
+    private int tid;
+    private CreateFeatureTypeStrategy createStrategy;
+
+    public TypeIdHandlerStrategy(String fname, CreateFeatureTypeStrategy createStrategy,
+                                 int tid)
+    {
+        this.name = fname;
+        this.tid = tid;
+        this.createStrategy = createStrategy;
+    }
+
+    public boolean isDispatchable(Element element)
+    {
+        FrammeAttributeData featureLinkage = getFeatureLinkage(element);
+        return featureLinkage != null && tid == featureLinkage.getFsc();
+    }
+
+    public void execute(Element element)
+    {
+        try
+        {
+            FeatureType ftype = createStrategy.createFeatureElement(name);
+        } catch (SchemaException e)
+        {
+            e.printStackTrace();
+        }
+    }
+}

--
Gitblit v0.0.0-SNAPSHOT