Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 894daf8a6fa4 |
children | b9a8463ac636 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Fri Sep 05 12:54:58 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Fri Sep 05 12:58:17 2014 +0200 @@ -71,8 +71,8 @@ extends DefaultState implements FacetTypes { - /** The logger that is used in this state. */ - private static Logger logger = Logger.getLogger(FloodMapState.class); + /** The log that is used in this state. */ + private static Logger log = Logger.getLogger(FloodMapState.class); public static final String KEEP_ARTIFACT_DIR = @@ -122,7 +122,7 @@ Object context, CallMeta callMeta ) { - logger.info("Initialize State with Artifact: " + orig.identifier()); + log.info("Initialize State with Artifact: " + orig.identifier()); copyShapeDir(orig, owner); modifyFacets(orig, owner, context, callMeta); @@ -132,7 +132,7 @@ amfg.generate(); } catch (IOException e) { - logger.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } @@ -154,7 +154,7 @@ D4EArtifact flys = (D4EArtifact) owner; List<Facet> facets = flys.getFacets(); if (facets == null || facets.isEmpty()) { - logger.warn("No facets for '" + OUTPUT_NAME + "' given!"); + log.warn("No facets for '" + OUTPUT_NAME + "' given!"); return; } @@ -173,7 +173,7 @@ wms.addLayer(newLayer); - logger.debug( + log.debug( "Replaced layer: " + layer + " with " + newLayer); } } @@ -190,12 +190,12 @@ List<Facet> facets, Object old ) { - logger.debug("FloodMapState.computeAdvance"); + log.debug("FloodMapState.computeAdvance"); File artifactDir = getDirectory(artifact); if (artifactDir == null) { - logger.error("Could not create directory for WSPLGEN results!"); + log.error("Could not create directory for WSPLGEN results!"); return null; } @@ -227,7 +227,7 @@ "wsplgen.job.error", "wsplgen.job.error")); - logger.error("No WSPLGEN processing has been started!"); + log.error("No WSPLGEN processing has been started!"); return null; } @@ -280,21 +280,21 @@ File artifactDir = new File(shapePath, artifact.identifier()); if (artifactDir.exists()) { - logger.info("Delete directory: " + artifactDir.getAbsolutePath()); + log.info("Delete directory: " + artifactDir.getAbsolutePath()); if (!FileTools.deleteRecursive(artifactDir)) { - logger.warn("Could not delete directory: " + log.warn("Could not delete directory: " + artifactDir.getAbsolutePath()); } } else { - logger.debug("There is no directory to remove."); + log.debug("There is no directory to remove."); } } @Override public void endOfLife(Artifact artifact, Object callContext) { - logger.info("FloodMapState.endOfLife: " + artifact.identifier()); + log.info("FloodMapState.endOfLife: " + artifact.identifier()); D4EArtifact flys = (D4EArtifact) artifact; @@ -310,7 +310,7 @@ CallContext context, WSPLGENCalculation calculation ) { - logger.debug("FloodMapState.prepareWSPLGENJob"); + log.debug("FloodMapState.prepareWSPLGENJob"); String scenario = artifact.getDataAsString("scenario"); WSPLGENJob job = new WSPLGENJob( @@ -351,10 +351,10 @@ return job; } catch (IOException ioe) { - logger.warn("Cannot write PAR file: " + ioe.getMessage()); + log.warn("Cannot write PAR file: " + ioe.getMessage()); } catch (IllegalArgumentException iae) { - logger.warn("Cannot write PAR file: " + iae.getMessage()); + log.warn("Cannot write PAR file: " + iae.getMessage()); } return null; @@ -368,7 +368,7 @@ WSPLGENJob job) { File line = new File(dir, HWS_LINES_SHAPE); boolean lines = line.exists(); - logger.debug("shp file exists: " + lines); + log.debug("shp file exists: " + lines); if (lines) { job.addLin(dir + "/" + HWS_LINES_SHAPE); facetCreator.createShapeFacet(I18N_HWS_LINES_OFFICIAL, @@ -377,7 +377,7 @@ } File point = new File(dir, HWS_POINT_SHAPE); boolean points = point.exists(); - logger.debug("shp file exists: " + points); + log.debug("shp file exists: " + points); if (points) { facetCreator.createShapeFacet(I18N_HWS_POINTS_OFFICIAL, MapfileGenerator.MS_LAYER_PREFIX + HWS_POINTS, @@ -422,7 +422,7 @@ MapfileGenerator.MS_LAYER_PREFIX + HWS_LINES, FLOODMAP_HWS_LINES,2); } - else logger.warn("no lines written"); + else log.warn("no lines written"); } @@ -454,11 +454,11 @@ generator.generate(); } catch(FileNotFoundException fnfe) { - logger.warn("Could not find mapfile for hws layer"); + log.warn("Could not find mapfile for hws layer"); } catch (Exception ioe) { - logger.warn("Could not create mapfile for hws layer"); - logger.warn(Arrays.toString(ioe.getStackTrace())); + log.warn("Could not create mapfile for hws layer"); + log.warn(Arrays.toString(ioe.getStackTrace())); } } @@ -505,7 +505,7 @@ protected void setGel(D4EArtifact artifact, WSPLGENJob job) { String gel = artifact.getDataAsString("scenario"); - logger.debug("Selected gel = '" + gel + "'"); + log.debug("Selected gel = '" + gel + "'"); if (gel == null || gel.length() == 0) { job.setGel(WSPLGENJob.GEL_NOSPERRE); @@ -544,7 +544,7 @@ String geoJSON = access.getGeoJSON(); if (geoJSON == null || geoJSON.length() == 0) { - logger.debug("No barrier features in parameterization existing."); + log.debug("No barrier features in parameterization existing."); return; } @@ -557,7 +557,7 @@ List<SimpleFeature> features = GeometryUtils.parseGeoJSON(geoJSON, ft); if (features == null || features.isEmpty()) { - logger.debug("No barrier features extracted."); + log.debug("No barrier features extracted."); return; } @@ -578,7 +578,7 @@ fcs[0]); if (l) { - logger.debug( + log.debug( "Successfully created barrier line shapefile. " + "Write shapefile path into WSPLGEN job."); createMapfile( @@ -591,7 +591,7 @@ MapfileGenerator.MS_BARRIERS_PREFIX); if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) { - logger.debug("WSPLGEN will not use barrier features."); + log.debug("WSPLGEN will not use barrier features."); } else { job.addLin(shapeLines.getAbsolutePath()); @@ -605,7 +605,7 @@ if (p) { - logger.debug( + log.debug( "Successfully created barrier polygon shapefile. " + "Write shapefile path into WSPLGEN job."); createMapfile( @@ -618,7 +618,7 @@ MapfileGenerator.MS_BARRIERS_PREFIX); if (scenario.equals(WSPLGENJob.GEL_NOSPERRE)) { - logger.debug("WSPLGEN will not use barrier features."); + log.debug("WSPLGEN will not use barrier features."); } else { job.addLin(shapePolys.getAbsolutePath()); @@ -639,7 +639,7 @@ ) { File archive = new File(dir, WSPLGEN_USER_RGD_SHAPE); boolean exists = archive.exists(); - logger.debug("shp file exists: " + exists); + log.debug("shp file exists: " + exists); if (exists) { job.addLin(dir + "/" + WSPLGEN_USER_RGD_SHAPE); facetCreator.createShapeFacet(FacetCreator.I18N_USERSHAPE, @@ -680,12 +680,12 @@ polygons.add(feature); } else { - logger.warn("Feature not supported: " + geom.getClass()); + log.warn("Feature not supported: " + geom.getClass()); } } - logger.debug("Found " + lines.size() + " barrier lines."); - logger.debug("Found " + polygons.size() + " barrier polygons."); + log.debug("Found " + lines.size() + " barrier lines."); + log.debug("Found " + polygons.size() + " barrier polygons."); return new FeatureCollection[] { lines, polygons }; } @@ -695,7 +695,7 @@ SimpleFeature feature, Geometry geom ) { - logger.debug("Apply elevations for: " + geom.getClass()); + log.debug("Apply elevations for: " + geom.getClass()); List<Double> elevations = extractElevations(feature); int numPoints = geom.getNumPoints(); @@ -704,7 +704,7 @@ String typ = (String) feature.getAttribute("typ"); if (numPoints > numElevation) { - logger.warn("More vertices in Geometry than elevations given."); + log.warn("More vertices in Geometry than elevations given."); } Coordinate[] c = geom.getCoordinates(); @@ -739,7 +739,7 @@ list.add(Double.parseDouble(elevations[i])); } catch (NumberFormatException nfe) { - logger.warn("Error while parsing elevation at pos: " + i); + log.warn("Error while parsing elevation at pos: " + i); if (typ != null && typ.equals("Graben")) { list.add(new Double(-9999.0)); } @@ -764,11 +764,11 @@ axes = RiverAxis.getRiverAxis(river); } catch (HibernateException iae) { - logger.warn("No valid river axis found for " + river); + log.warn("No valid river axis found for " + river); return; } if (axes == null || axes.isEmpty()) { - logger.warn("Could not find river axis for: '" + river + "'"); + log.warn("Could not find river axis for: '" + river + "'"); return; } @@ -809,7 +809,7 @@ List<CrossSectionTrack> cst = CrossSectionTrack.getCrossSectionTrack(river, WSPLGEN_QPS_NAME); - logger.debug("Found " + cst.size() + " CrossSectionTracks."); + log.debug("Found " + cst.size() + " CrossSectionTracks."); Object[][] attrs = new Object[2][]; attrs[0] = new Object[] { "ELEVATION", Double.class }; @@ -853,7 +853,7 @@ DGM dgm = access.getDGM(); if (dgm == null) { - logger.warn("Could not find specified DGM."); + log.warn("Could not find specified DGM."); return; } @@ -872,7 +872,7 @@ protected void setArea(D4EArtifact artifact, File dir, WSPLGENJob job) { String useFloodplain = artifact.getDataAsString("use_floodplain"); if (!Boolean.valueOf(useFloodplain)) { - logger.debug("WSPLGEN will not use floodplain."); + log.debug("WSPLGEN will not use floodplain."); return; } @@ -884,13 +884,13 @@ Floodplain plain = Floodplain.getFloodplain(river); if (plain == null) { - logger.debug("No flood plain for river '" + river + "'"); + log.debug("No flood plain for river '" + river + "'"); return; } Polygon polygon = plain.getGeom(); if (polygon == null) { - logger.warn("Floodplain has no geometry."); + log.warn("Floodplain has no geometry."); return; } @@ -926,7 +926,7 @@ protected WQKms getWQKms(D4EArtifact flys, CallContext cc) { String wspString = flys.getDataAsString(WSP_ARTIFACT); if (wspString == null) { - logger.debug("getWQKms(): wspString == null"); + log.debug("getWQKms(): wspString == null"); return null; } String[] parts = wspString.split(";"); @@ -942,7 +942,7 @@ ? RiverUtils.getArtifact(otherArtifact, cc) : flys; - logger.debug("Use waterlevel provided by Artifact: " + src.identifier()); + log.debug("Use waterlevel provided by Artifact: " + src.identifier()); // The state actually depends on the kind of artifact. E.g. StaticWQKmsArtifact needs other state Object computed = src.compute( @@ -981,7 +981,7 @@ return wqkms; } - logger.warn("getWQKms cannot handle " + computed.getClass() + " " + src.getClass()); + log.warn("getWQKms cannot handle " + computed.getClass() + " " + src.getClass()); return null; } @@ -992,12 +992,12 @@ File dir, WSPLGENJob job) { - logger.debug("FloodMapState.setWsp"); + log.debug("FloodMapState.setWsp"); WQKms data = getWQKms(artifact, context); if (data == null) { - logger.warn("No WST data found!"); + log.warn("No WST data found!"); return; } @@ -1008,7 +1008,7 @@ boolean writeWspTag = true; double[] buf = new double[4]; - logger.debug("Add WST column: " + data.getName()); + log.debug("Add WST column: " + data.getName()); writer.addColumn(data.getName()); if (writeWspTag) { @@ -1032,7 +1032,7 @@ job.setWsp(wspFile.getAbsolutePath()); } catch (FileNotFoundException fnfe) { - logger.warn("Error while writing wsp file: " + fnfe.getMessage()); + log.warn("Error while writing wsp file: " + fnfe.getMessage()); } finally { if (fout != null) {