forked from geodmms/xdgnjobs

Dennis Kao
2013-10-08 0acb19829d4c4aea6d776b48f377a10e10c0a8e2
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java
@@ -10,6 +10,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
import com.ximple.eofms.filter.ElementDispatchableFilter;
@@ -32,8 +33,6 @@
import org.geotools.data.FeatureWriter;
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.shapefile.indexed.IndexType;
import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
import org.geotools.feature.SchemaException;
import org.opengis.feature.IllegalAttributeException;
import org.opengis.feature.simple.SimpleFeature;
@@ -177,15 +176,24 @@
                    ShapefileDataStore shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL(),
                            true, Charset.forName("UTF-8"));
                    */
                    ShapefileDataStore shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL());
                    /*
                    if(namespace != null) {
                        shapefileDataStore.setNamespaceURI(namespace.toString());
                    }
                    */
                    shapefileDataStore.setMemoryMapped(true);
                    // shapefileDataStore.setBufferCachingEnabled(cacheMemoryMaps);
                    shapefileDataStore.setCharset(Charset.forName("UTF-8"));
                    shapefileDataStore.setTimeZone(TimeZone.getDefault());
                    shapefileDataStore.setIndexed(true);
                    shapefileDataStore.setIndexCreationEnabled(true);
                    if (!sfile.exists()) {
                        ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
                                null, true, true, IndexType.QIX, Charset.forName("UTF-8"));
                        shapefileDataStore.createSchema(featureType);
                        writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(),
                                                                     Transaction.AUTO_COMMIT);
                    } else {
                        ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
                                null, true, true, IndexType.QIX, Charset.forName("UTF-8"));
                        writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(),
                                                                           Transaction.AUTO_COMMIT);
                    }