Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java @ 537:f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
gnv-artifacts/trunk@635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 27 Jan 2010 10:01:37 +0000 |
parents | 44415ae01ddb |
children | b248531fa20b |
comparison
equal
deleted
inserted
replaced
536:f1dc3c2f9be7 | 537:f7f97edf09ba |
---|---|
171 throws StateException | 171 throws StateException |
172 { | 172 { |
173 String outputMode = XMLUtils.xpathString( | 173 String outputMode = XMLUtils.xpathString( |
174 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); | 174 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); |
175 | 175 |
176 String mimeType = XMLUtils.xpathString( | 176 if (outputMode == null) { |
177 format, XPATH_MIME_TYPE, ArtifactNamespaceContext.INSTANCE); | |
178 | |
179 if (outputMode == null || mimeType == null) { | |
180 throw new StateException("cannot find outputMode or mime"); | 177 throw new StateException("cannot find outputMode or mime"); |
181 } | 178 } |
182 | 179 |
183 outputMode = outputMode.toLowerCase(); | 180 outputMode = outputMode.toLowerCase(); |
184 | 181 |
217 File dir = new File(p); | 214 File dir = new File(p); |
218 if (dir.isDirectory()) { | 215 if (dir.isDirectory()) { |
219 FileUtils.createZipArchive(dir, output); | 216 FileUtils.createZipArchive(dir, output); |
220 } | 217 } |
221 } | 218 } |
222 AttributedPoint2ds result = getResult(uuid, callContext); | 219 else { |
223 if (result != null | 220 AttributedPoint2ds result = getResult(uuid, callContext); |
224 && (p = writeToShapeFile(uuid, result, callContext)) != null) { | 221 if (result != null |
225 FileUtils.createZipArchive(new File(p), output); | 222 && (p = writeToShapeFile(uuid, result, callContext)) != null) { |
223 FileUtils.createZipArchive(new File(p), output); | |
224 } | |
226 } | 225 } |
227 } | 226 } |
228 catch (IOException ioe) { | 227 catch (IOException ioe) { |
229 log.error(ioe.getLocalizedMessage(), ioe); | 228 log.error(ioe.getLocalizedMessage(), ioe); |
230 } | 229 } |
310 isolines) | 309 isolines) |
311 ) { | 310 ) { |
312 log.error("writing isolines failed"); | 311 log.error("writing isolines failed"); |
313 return null; | 312 return null; |
314 } | 313 } |
315 | 314 |
316 | 315 shapeFilePath = shapeDir.getAbsolutePath(); |
317 success = true; | 316 success = true; |
317 | |
318 callContext.afterCall(CallContext.STORE); | |
319 | |
320 return shapeFilePath; | |
318 } | 321 } |
319 finally { | 322 finally { |
320 if (!success && createdDir) { | 323 if (!success && createdDir) { |
321 FileUtils.deleteRecursive(shapeDir); | 324 FileUtils.deleteRecursive(shapeDir); |
322 | 325 } |
323 } | 326 } |
324 } | |
325 | |
326 return shapeFilePath = shapeDir.getAbsolutePath(); | |
327 } | 327 } |
328 | 328 |
329 protected AttributedPoint2ds getResult(String uuid, CallContext callContext) | 329 protected AttributedPoint2ds getResult(String uuid, CallContext callContext) |
330 throws StateException | 330 throws StateException |
331 { | 331 { |