changeset 537:f7f97edf09ba

Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts. gnv-artifacts/trunk@635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 27 Jan 2010 10:01:37 +0000
parents f1dc3c2f9be7
children f4e20322461b
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java
diffstat 2 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue Jan 26 18:32:12 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Jan 27 10:01:37 2010 +0000
@@ -1,3 +1,13 @@
+2010-01-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue164
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Applied patch of SLT to remove shape files and directories of out-dated
+	  artifacts. Therefor we need to store the artifact after an 'out' operation 
+	  - which is actually a read only operation - explicitly into the artifact
+	  database to keep the directory path.
+
 2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Tue Jan 26 18:32:12 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Wed Jan 27 10:01:37 2010 +0000
@@ -173,10 +173,7 @@
         String outputMode = XMLUtils.xpathString(
             format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
 
-        String mimeType = XMLUtils.xpathString(
-            format, XPATH_MIME_TYPE, ArtifactNamespaceContext.INSTANCE);
-
-        if (outputMode == null || mimeType == null) {
+        if (outputMode == null) {
             throw new StateException("cannot find outputMode or mime");
         }
 
@@ -219,10 +216,12 @@
                     FileUtils.createZipArchive(dir, output);
                 }
             }
-            AttributedPoint2ds result = getResult(uuid, callContext);
-            if (result != null
-            && (p = writeToShapeFile(uuid, result, callContext)) != null) {
-                FileUtils.createZipArchive(new File(p), output);
+            else {
+                AttributedPoint2ds result = getResult(uuid, callContext);
+                if (result != null
+                && (p = writeToShapeFile(uuid, result, callContext)) != null) {
+                    FileUtils.createZipArchive(new File(p), output);
+                }
             }
         }
         catch (IOException ioe) {
@@ -312,18 +311,19 @@
                 log.error("writing isolines failed");
                 return null;
             }
-                
 
+            shapeFilePath = shapeDir.getAbsolutePath();
             success = true;
+
+            callContext.afterCall(CallContext.STORE);
+
+            return shapeFilePath;
         }
         finally {
             if (!success && createdDir) {
                 FileUtils.deleteRecursive(shapeDir);
-
             }
         }
-
-        return shapeFilePath = shapeDir.getAbsolutePath();
     }
 
     protected AttributedPoint2ds getResult(String uuid, CallContext callContext)

http://dive4elements.wald.intevation.org