changeset 759:93489a0c1328

Added a cleanup mechanism to do some things before an artifact is being exported (issue208). gnv-artifacts/trunk@811 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 22 Mar 2010 09:15:05 +0000
parents be24dd9b5d03
children f82e57a60124
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java
diffstat 5 files changed, 45 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Fri Mar 19 13:20:04 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Mar 22 09:15:05 2010 +0000
@@ -1,3 +1,24 @@
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue208 (Added a cleanup mechanism to do some things before exporting an
+	  artifact)
+
+	* src/main/java/de/intevation/gnv/state/State.java: Added a cleanup method
+	  to remove special data stored at this state while processing an 
+	  'out'-target.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Default
+	  implementation of this cleanup method - nothing is done here so far.
+	  Override this method in states which should remove data before being
+	  exported.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Overrides this cleanup method to remove the current shapefile path.
+
+	* src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java:
+	  Call cleanup method of the current state if the cleanup method of this
+	  artifact itself is called.
+
 2010-03-19  Tim Englich  <tim.englich@intevation.de>
 
 	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml: 
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java	Fri Mar 19 13:20:04 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java	Mon Mar 22 09:15:05 2010 +0000
@@ -10,8 +10,8 @@
 import de.intevation.gnv.artifacts.GNVArtifactBase;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author Tim Englich (tim.englich@intevation.de)
+ * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
  */
 public class HorizontalCrossSectionMeshArtifact extends GNVArtifactBase {
     /**
@@ -33,7 +33,7 @@
         log.debug("HorizontalCrossSectionMeshArtifact.Constructor");
         this.name = "horizontalCrossSectionMesh";
     }
-    
+
 
    /**
     * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String, 
@@ -46,4 +46,13 @@
         log.debug("HorizontalCrossSectionMeshArtifact.setup");
         super.setup(identifier, factory, context, data);
     }
+
+
+    @Override
+    public void cleanup(Object context) {
+        if (current != null)
+            current.cleanup(context);
+
+        super.cleanup(context);
+    }
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java	Fri Mar 19 13:20:04 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java	Mon Mar 22 09:15:05 2010 +0000
@@ -63,4 +63,6 @@
     public void setPreSettings(Map<String,InputData> preSettings);
 
     public Map<String,InputData> getPreSettings();
+
+    public void cleanup(Object context);
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Fri Mar 19 13:20:04 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Mon Mar 22 09:15:05 2010 +0000
@@ -1044,5 +1044,9 @@
 
     public void endOfLife(Object globalContext) {
     }
+
+
+    public void cleanup(Object context) {
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Fri Mar 19 13:20:04 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Mon Mar 22 09:15:05 2010 +0000
@@ -762,5 +762,11 @@
             ? palettes
             : new HashMap<Integer, PaletteManager>();
     }
+
+
+    @Override
+    public void cleanup(Object context) {
+        resetShapeFilePath();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org