diff artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java @ 9751:308a0d822d18 3.2.x

Keep configuration and data in distinct directories This allows having distinct volumes for configuration and data (artifact database, generated mapfiles and shapefiles, etc.). While at it, cleanup MapServer configuration a little bit.
author Tom Gottfried <tom@intevation.de>
date Tue, 11 Oct 2022 11:42:09 +0200
parents afad1fac70fb
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java	Mon Oct 10 15:29:44 2022 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/MapfileGenerator.java	Tue Oct 11 11:42:09 2022 +0200
@@ -37,6 +37,9 @@
  */
 public abstract class MapfileGenerator
 {
+    private static final String XPATH_MAPSERVER_TEMPLATES_PATH =
+        "/artifact-database/mapserver/templates/@path";
+
     public static final String WSPLGEN_RESULT_SHAPE   = "wsplgen.shp";
     public static final String WSPLGEN_LINES_SHAPE    = "barrier_lines.shp";
     public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp";
@@ -123,15 +126,14 @@
 
         engine.setProperty(
             "file.resource.loader.path",
-            getMapserverTemplatePath());
+            RiverUtils.getXPathString(XPATH_MAPSERVER_TEMPLATES_PATH)
+        );
 
         engine.init();
     }
 
     protected abstract String getVelocityLogfile();
 
-    protected abstract String getMapserverTemplatePath();
-
     protected VelocityContext getVelocityContext() {
         VelocityContext context = new VelocityContext();
 
@@ -213,7 +215,7 @@
     {
         if (shapefileDirectory == null) {
             String path = RiverUtils.getXPathString(
-                RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
+                RiverUtils.XPATH_MAPFILES_PATH);
 
             if (path != null) {
                 shapefileDirectory = new File(path);
@@ -244,7 +246,6 @@
     }
 
 
-
     protected List<String> parseLayers(File[] dirs) {
         List<String> layers = new ArrayList<String>();
 
@@ -274,8 +275,6 @@
     }
 
 
-
-
     /**
      * Creates a layer snippet which might be included in the mapfile.
      *

http://dive4elements.wald.intevation.org