comparison 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
comparison
equal deleted inserted replaced
9750:432934cda171 9751:308a0d822d18
35 * 35 *
36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
37 */ 37 */
38 public abstract class MapfileGenerator 38 public abstract class MapfileGenerator
39 { 39 {
40 private static final String XPATH_MAPSERVER_TEMPLATES_PATH =
41 "/artifact-database/mapserver/templates/@path";
42
40 public static final String WSPLGEN_RESULT_SHAPE = "wsplgen.shp"; 43 public static final String WSPLGEN_RESULT_SHAPE = "wsplgen.shp";
41 public static final String WSPLGEN_LINES_SHAPE = "barrier_lines.shp"; 44 public static final String WSPLGEN_LINES_SHAPE = "barrier_lines.shp";
42 public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp"; 45 public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp";
43 public static final String WSPLGEN_USER_SHAPE = "user-rgd.shp"; 46 public static final String WSPLGEN_USER_SHAPE = "user-rgd.shp";
44 47
121 "resource.loader", 124 "resource.loader",
122 "file"); 125 "file");
123 126
124 engine.setProperty( 127 engine.setProperty(
125 "file.resource.loader.path", 128 "file.resource.loader.path",
126 getMapserverTemplatePath()); 129 RiverUtils.getXPathString(XPATH_MAPSERVER_TEMPLATES_PATH)
130 );
127 131
128 engine.init(); 132 engine.init();
129 } 133 }
130 134
131 protected abstract String getVelocityLogfile(); 135 protected abstract String getVelocityLogfile();
132
133 protected abstract String getMapserverTemplatePath();
134 136
135 protected VelocityContext getVelocityContext() { 137 protected VelocityContext getVelocityContext() {
136 VelocityContext context = new VelocityContext(); 138 VelocityContext context = new VelocityContext();
137 139
138 try { 140 try {
211 public File getShapefileBaseDir() 213 public File getShapefileBaseDir()
212 throws FileNotFoundException, IOException 214 throws FileNotFoundException, IOException
213 { 215 {
214 if (shapefileDirectory == null) { 216 if (shapefileDirectory == null) {
215 String path = RiverUtils.getXPathString( 217 String path = RiverUtils.getXPathString(
216 RiverUtils.XPATH_FLOODMAP_SHAPEFILE_DIR); 218 RiverUtils.XPATH_MAPFILES_PATH);
217 219
218 if (path != null) { 220 if (path != null) {
219 shapefileDirectory = new File(path); 221 shapefileDirectory = new File(path);
220 } 222 }
221 223
240 242
241 // TODO ONLY RETURN DIRECTORIES OF THE SPECIFIED USER 243 // TODO ONLY RETURN DIRECTORIES OF THE SPECIFIED USER
242 244
243 return artifactDirs; 245 return artifactDirs;
244 } 246 }
245
246 247
247 248
248 protected List<String> parseLayers(File[] dirs) { 249 protected List<String> parseLayers(File[] dirs) {
249 List<String> layers = new ArrayList<String>(); 250 List<String> layers = new ArrayList<String>();
250 251
270 } 271 }
271 } 272 }
272 273
273 return layers; 274 return layers;
274 } 275 }
275
276
277 276
278 277
279 /** 278 /**
280 * Creates a layer snippet which might be included in the mapfile. 279 * Creates a layer snippet which might be included in the mapfile.
281 * 280 *

http://dive4elements.wald.intevation.org