annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/ShapeFacet.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 0a5239a1e46e
children
rev   line source
8858
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
2 * Software engineering by Intevation GmbH
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
3 *
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
6 * documentation coming with Dive4Elements River for details.
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
7 */
a805211690f7 Fix license headers.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
8
5912
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.artifacts.model.map;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import java.io.File;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8858
diff changeset
13 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8858
diff changeset
14 import org.apache.logging.log4j.LogManager;
5912
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import org.dive4elements.artifactdatabase.state.DefaultFacet;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import org.dive4elements.artifacts.Artifact;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import org.dive4elements.artifacts.CallContext;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 import org.dive4elements.river.artifacts.D4EArtifact;
9751
308a0d822d18 Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents: 9726
diff changeset
19 import org.dive4elements.river.utils.RiverUtils;
5912
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 public class ShapeFacet
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 extends DefaultFacet
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 {
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8858
diff changeset
25 private static Logger log = LogManager.getLogger(ShapeFacet.class);
5912
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 /**
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 * Defaults to ADVANCE Compute type.
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 * @param name Name of the facet.
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 * @param description maybe localized description of the facet.
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 */
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 public ShapeFacet(String name, String description) {
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 super(name, description);
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 }
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 /**
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 * Return computation result.
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 */
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 @Override
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 public Object getData(Artifact artifact, CallContext context) {
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 D4EArtifact flys = (D4EArtifact)artifact;
9751
308a0d822d18 Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents: 9726
diff changeset
42 String baseDir = RiverUtils.getXPathString(
308a0d822d18 Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents: 9726
diff changeset
43 RiverUtils.XPATH_MAPFILES_PATH);
5912
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 baseDir += "/" + flys.identifier();
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 File shapeDir = new File(baseDir);
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 if (shapeDir.exists()) {
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 return shapeDir;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 }
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 return null;
81bdb5c4414d New exporter and facet for wsplgen calculation result.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 }
5919
c35323148b98 Removed obsolete artifacts.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5912
diff changeset
51 }

http://dive4elements.wald.intevation.org