changeset 3306:1b41dc00b1f7

Create shapefile directory instead of shapefile 'file' flys-artifacts/trunk@4992 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Fri, 13 Jul 2012 12:41:44 +0000
parents b24920235944
children 81a98f360553
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
diffstat 6 files changed, 47 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 13 12:41:44 2012 +0000
@@ -1,3 +1,8 @@
+2012-07-13	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/utils/MapfileGenerator.java:
+	  Create shapefile directory instead of shapefile 'file'.
+
 2012-07-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Jul 13 12:41:44 2012 +0000
@@ -2,49 +2,39 @@
 
 import de.intevation.artifactdatabase.ArtifactDatabaseImpl;
 import de.intevation.artifactdatabase.DefaultArtifact;
-
+import de.intevation.artifactdatabase.ProtocolUtils;
 import de.intevation.artifactdatabase.data.DefaultStateData;
 import de.intevation.artifactdatabase.data.StateData;
-
 import de.intevation.artifactdatabase.state.DefaultFacet;
 import de.intevation.artifactdatabase.state.DefaultOutput;
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.artifactdatabase.state.Output;
 import de.intevation.artifactdatabase.state.State;
 import de.intevation.artifactdatabase.state.StateEngine;
-
 import de.intevation.artifactdatabase.transition.TransitionEngine;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactDatabase;
 import de.intevation.artifacts.ArtifactDatabaseException;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
-
+import de.intevation.artifacts.Message;
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
-
 import de.intevation.artifacts.common.utils.XMLUtils;
-
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
 import de.intevation.flys.artifacts.cache.CacheFactory;
-
 import de.intevation.flys.artifacts.context.FLYSContext;
-
+import de.intevation.flys.artifacts.model.CalculationMessage;
 import de.intevation.flys.artifacts.states.DefaultState;
 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
-
-import de.intevation.artifactdatabase.ProtocolUtils;
-
 import de.intevation.flys.utils.FLYSUtils;
 
-import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
-import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
@@ -54,14 +44,10 @@
 import net.sf.ehcache.Cache;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.Node;
-
-import de.intevation.artifacts.Message;
-import de.intevation.flys.artifacts.model.CalculationMessage;
+import org.w3c.dom.NodeList;
 
 /**
  * The default FLYS artifact with convenience added.
@@ -266,7 +252,7 @@
      * @return Mapping of state-ids to facets.
      */
     protected Map<String, List<Facet>> cloneFacets() {
-        Map copy = new HashMap<String, List<Facet>>();
+        Map<String, List<Facet>> copy = new HashMap<String, List<Facet>>();
 
         for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) {
             List<Facet> facets      = entry.getValue();
@@ -422,6 +408,7 @@
      *
      * @return the description of this artifact.
      */
+    @Override
     public Document describe(Document data, CallContext context) {
         logger.debug("Describe: the current state is: " + getCurrentStateId());
 
@@ -557,6 +544,7 @@
      *
      * @return a document that contains a SUCCESS or FAILURE message.
      */
+    @Override
     public Document advance(Document target, CallContext context) {
         Document doc = XMLUtils.newDocument();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Jul 13 12:41:44 2012 +0000
@@ -1,28 +1,24 @@
 package de.intevation.flys.artifacts.model.map;
 
+import com.vividsolutions.jts.geom.Envelope;
+
+import de.intevation.artifactdatabase.state.DefaultFacet;
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+import de.intevation.flys.utils.GeometryUtils;
+
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import com.vividsolutions.jts.geom.Envelope;
-
-import de.intevation.artifacts.Artifact;
-import de.intevation.artifacts.ArtifactNamespaceContext;
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
-
-import de.intevation.artifactdatabase.state.DefaultFacet;
-import de.intevation.artifactdatabase.state.Facet;
-
-import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
-import de.intevation.flys.utils.GeometryUtils;
-
 
 public class WMSLayerFacet
 extends      DefaultFacet
@@ -101,6 +97,9 @@
         if (extent != null) {
             this.extent = extent;
         }
+        else {
+            logger.debug("setExtent(): extent is null");
+        }
     }
 
 
@@ -121,6 +120,7 @@
     }
 
 
+    @Override
     public Object getData(Artifact artifact, CallContext context) {
         return null;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Jul 13 12:41:44 2012 +0000
@@ -1,16 +1,5 @@
 package de.intevation.flys.exports;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 import com.vividsolutions.jts.geom.Envelope;
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
@@ -30,6 +19,17 @@
 import de.intevation.flys.utils.MapfileGenerator;
 import de.intevation.flys.utils.ThemeUtil;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
 
 public class MapGenerator implements OutGenerator, FacetTypes {
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Fri Jul 13 12:41:44 2012 +0000
@@ -284,14 +284,14 @@
 
 
     public static boolean writeShapefile(File shape,
-        SimpleFeatureType featureType, FeatureCollection collection) {
+        SimpleFeatureType featureType, FeatureCollection<?, ?> collection) {
         return writeShapefile(shape, featureType, collection,
             featureType.getCoordinateReferenceSystem());
     }
 
 
     public static boolean writeShapefile(File shape,
-        SimpleFeatureType featureType, FeatureCollection collection,
+        SimpleFeatureType featureType, FeatureCollection<?, ?> collection,
         CoordinateReferenceSystem crs) {
         if (collection.isEmpty()) {
             logger.warn("Shapefile is not written - no features given!");
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Fri Jul 13 11:14:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Fri Jul 13 12:41:44 2012 +0000
@@ -302,7 +302,7 @@
      * configured.
      */
     public File getShapefileBaseDir()
-    throws    FileNotFoundException, IOException
+            throws FileNotFoundException, IOException
     {
         if (shapefileDirectory == null) {
             String path = FLYSUtils.getXPathString(
@@ -317,7 +317,7 @@
             }
 
             if (!shapefileDirectory.exists()) {
-                shapefileDirectory.createNewFile();
+                shapefileDirectory.mkdirs();
             }
         }
 
@@ -326,7 +326,7 @@
 
 
     protected File[] getUserDirs()
-    throws    FileNotFoundException, IOException
+            throws FileNotFoundException, IOException
     {
         File   baseDir      = getShapefileBaseDir();
         File[] artifactDirs = baseDir.listFiles();
@@ -421,8 +421,8 @@
     {
         logger.debug("createBarriersLayer");
 
-        String uuid = flys.identifier();
-        File   dir  = new File(getShapefileBaseDir(), uuid);
+        //String uuid = flys.identifier();
+        //File   dir  = new File(getShapefileBaseDir(), uuid);
 
         createBarriersLineLayer(flys, wms);
         createBarriersPolygonLayer(flys, wms);

http://dive4elements.wald.intevation.org