comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ScenarioSelect.java @ 4656:442fbb290fa8

Introduce river mapfile generation (WARNING: Changes in config xml files required!). On startup the RiverMapfileGeneratorStarter is called by the server app. The starter invokes a call to RiverMapfileGenerator.generate() which reads all available rivers from the database and generates layers for each river (in theory...uncompleted) in a river.map file. The old MapfileGenerator which generates layers that have artifact dependencies is now in ArtifactMapfileGenerator.
author Christian Lins <christian.lins@intevation.de>
date Tue, 11 Dec 2012 15:24:24 +0100
parents 8e66293c5369
children 2c1045a1e3fe
comparison
equal deleted inserted replaced
4655:cd44d28d0fbc 4656:442fbb290fa8
1 package de.intevation.flys.artifacts.states; 1 package de.intevation.flys.artifacts.states;
2
3 import de.intevation.artifactdatabase.ProtocolUtils;
4 import de.intevation.artifacts.Artifact;
5 import de.intevation.artifacts.CallContext;
6 import de.intevation.artifacts.CallMeta;
7 import de.intevation.artifacts.common.utils.FileTools;
8 import de.intevation.artifacts.common.utils.XMLUtils;
9 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
10 import de.intevation.flys.artifacts.FLYSArtifact;
11 import de.intevation.flys.artifacts.resources.Resources;
12 import de.intevation.flys.utils.FLYSUtils;
2 13
3 import java.io.File; 14 import java.io.File;
4 15
5 import org.apache.log4j.Logger; 16 import org.apache.log4j.Logger;
6
7 import org.w3c.dom.Element; 17 import org.w3c.dom.Element;
8
9 import de.intevation.artifacts.Artifact;
10 import de.intevation.artifacts.CallContext;
11 import de.intevation.artifacts.CallMeta;
12
13 import de.intevation.artifacts.common.utils.XMLUtils;
14 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
15 import de.intevation.artifacts.common.utils.FileTools;
16
17 import de.intevation.artifactdatabase.ProtocolUtils;
18
19 import de.intevation.flys.artifacts.FLYSArtifact;
20 import de.intevation.flys.artifacts.resources.Resources;
21 import de.intevation.flys.utils.FLYSUtils;
22 18
23 /** 19 /**
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
25 */ 21 */
26 public class ScenarioSelect extends DefaultState { 22 public class ScenarioSelect extends DefaultState {
103 )}; 99 )};
104 } 100 }
105 } 101 }
106 102
107 103
104 @Override
108 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { 105 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
109 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); 106 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
110 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); 107 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
111 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); 108 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
112 109
135 132
136 /** 133 /**
137 * Removes the directory and all its content where the required data and the 134 * Removes the directory and all its content where the required data and the
138 * results of WSPLGEN are stored. Should be called in endOfLife(). 135 * results of WSPLGEN are stored. Should be called in endOfLife().
139 */ 136 */
137 // FIXME: I've seen this code somewhere else...
140 protected void removeDirectory(FLYSArtifact artifact) { 138 protected void removeDirectory(FLYSArtifact artifact) {
141 String shapePath = FLYSUtils.getXPathString( 139 String shapePath = FLYSUtils.getXPathString(
142 FLYSUtils.XPATH_SHAPEFILE_DIR); 140 FLYSUtils.XPATH_FLOODMAP_SHAPEFILE_DIR);
143 141
144 File artifactDir = new File(shapePath, artifact.identifier()); 142 File artifactDir = new File(shapePath, artifact.identifier());
145 143
146 if (artifactDir.exists()) { 144 if (artifactDir.exists()) {
147 logger.debug("Delete directory: " + artifactDir.getAbsolutePath()); 145 logger.debug("Delete directory: " + artifactDir.getAbsolutePath());

http://dive4elements.wald.intevation.org