comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java @ 1129:da3c3e286c88

Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem. flys-artifacts/trunk@2644 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 05 Sep 2011 14:04:03 +0000
parents 727c53fd0dc7
children effe8f945c93
comparison
equal deleted inserted replaced
1128:727c53fd0dc7 1129:da3c3e286c88
60 60
61 public static final String KEEP_ARTIFACT_DIR = 61 public static final String KEEP_ARTIFACT_DIR =
62 System.getProperty("flys.uesk.keep.artifactsdir", "false"); 62 System.getProperty("flys.uesk.keep.artifactsdir", "false");
63 63
64 64
65 public static final String XPATH_SHAPEFILE_DIR =
66 "/artifact-database/floodmap/shapefile-path/@value";
67
68 public static final String WSP_ARTIFACT_UUID = "uesk.wsp.artifact"; 65 public static final String WSP_ARTIFACT_UUID = "uesk.wsp.artifact";
69 66
70 public static final String WINFO_WSP_STATE_ID = "state.winfo.waterlevel"; 67 public static final String WINFO_WSP_STATE_ID = "state.winfo.waterlevel";
71 68
72 public static final String WSPLGEN_PARAMETER_FILE = "wsplgen.par"; 69 public static final String WSPLGEN_PARAMETER_FILE = "wsplgen.par";
121 return null; 118 return null;
122 } 119 }
123 120
124 121
125 /** 122 /**
126 * Returns the shapefile path defined in the configuration.
127 *
128 * @return the shapefile path.
129 */
130 protected String getShapefilePath() {
131 String shapePath = (String) Config.getXPath(
132 XPATH_SHAPEFILE_DIR, XPathConstants.STRING);
133 shapePath = Config.replaceConfigDir(shapePath);
134
135 return shapePath;
136 }
137
138
139 /**
140 * Returns (and creates if not existing) the directory for storing WSPLEN 123 * Returns (and creates if not existing) the directory for storing WSPLEN
141 * data for the owner artifact. 124 * data for the owner artifact.
142 * 125 *
143 * @param artifact The owner Artifact. 126 * @param artifact The owner Artifact.
144 * 127 *
145 * @return the directory for WSPLEN data. 128 * @return the directory for WSPLEN data.
146 */ 129 */
147 protected File getDirectory(FLYSArtifact artifact) { 130 protected File getDirectory(FLYSArtifact artifact) {
148 String shapePath = getShapefilePath(); 131 String shapePath = FLYSUtils.getXPathString(
132 FLYSUtils.XPATH_SHAPEFILE_DIR);
149 133
150 File artifactDir = FileTools.getDirectory( 134 File artifactDir = FileTools.getDirectory(
151 shapePath, artifact.identifier()); 135 shapePath, artifact.identifier());
152 136
153 return artifactDir; 137 return artifactDir;
157 /** 141 /**
158 * Removes the directory and all its content where the required data and the 142 * Removes the directory and all its content where the required data and the
159 * results of WSPLGEN are stored. Should be called in endOfLife(). 143 * results of WSPLGEN are stored. Should be called in endOfLife().
160 */ 144 */
161 protected void removeDirectory(FLYSArtifact artifact) { 145 protected void removeDirectory(FLYSArtifact artifact) {
162 String shapePath = getShapefilePath(); 146 String shapePath = FLYSUtils.getXPathString(
163 File artifactDir = new File(shapePath, artifact.identifier()); 147 FLYSUtils.XPATH_SHAPEFILE_DIR);
148
149 File artifactDir = new File(shapePath, artifact.identifier());
164 150
165 if (artifactDir.exists()) { 151 if (artifactDir.exists()) {
166 logger.info("Delete directory: " + artifactDir.getAbsolutePath()); 152 logger.info("Delete directory: " + artifactDir.getAbsolutePath());
167 boolean success = FileTools.deleteRecursive(artifactDir); 153 boolean success = FileTools.deleteRecursive(artifactDir);
168 } 154 }

http://dive4elements.wald.intevation.org