comparison flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java @ 3303:96daa8a4c48f

Fix and workaround NullPointerExceptions flys-artifacts/trunk@4988 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Fri, 13 Jul 2012 10:54:56 +0000
parents 453d2d0c4258
children 1b41dc00b1f7
comparison
equal deleted inserted replaced
3302:453d2d0c4258 3303:96daa8a4c48f
1 package de.intevation.flys.utils; 1 package de.intevation.flys.utils;
2
3 import de.intevation.artifacts.CallContext;
4 import de.intevation.artifacts.common.utils.Config;
5 import de.intevation.flys.artifacts.FLYSArtifact;
6 import de.intevation.flys.artifacts.model.LayerInfo;
7 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
8 import de.intevation.flys.artifacts.model.map.WMSLayerFacet;
9 import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet;
10 import de.intevation.flys.artifacts.resources.Resources;
2 11
3 import java.io.File; 12 import java.io.File;
4 import java.io.FileNotFoundException; 13 import java.io.FileNotFoundException;
5 import java.io.FileWriter; 14 import java.io.FileWriter;
6 import java.io.FilenameFilter; 15 import java.io.FilenameFilter;
15 import org.apache.velocity.VelocityContext; 24 import org.apache.velocity.VelocityContext;
16 import org.apache.velocity.app.VelocityEngine; 25 import org.apache.velocity.app.VelocityEngine;
17 import org.geotools.data.shapefile.ShpFiles; 26 import org.geotools.data.shapefile.ShpFiles;
18 import org.geotools.data.shapefile.shp.ShapefileHeader; 27 import org.geotools.data.shapefile.shp.ShapefileHeader;
19 import org.geotools.data.shapefile.shp.ShapefileReader; 28 import org.geotools.data.shapefile.shp.ShapefileReader;
20
21 import de.intevation.artifacts.CallContext;
22 import de.intevation.artifacts.common.utils.Config;
23 import de.intevation.flys.artifacts.FLYSArtifact;
24 import de.intevation.flys.artifacts.model.LayerInfo;
25 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
26 import de.intevation.flys.artifacts.model.map.WMSLayerFacet;
27 import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet;
28 import de.intevation.flys.artifacts.resources.Resources;
29 29
30 /** 30 /**
31 * This class iterates over a bunch of directories, searches for meta 31 * This class iterates over a bunch of directories, searches for meta
32 * information coresponding to shapefiles and creates a mapfile which is used by 32 * information coresponding to shapefiles and creates a mapfile which is used by
33 * a <i>MapServer</i>. 33 * a <i>MapServer</i>.
65 private String mapServerUrl; 65 private String mapServerUrl;
66 private String templatePath; 66 private String templatePath;
67 private String velocityLogfile; 67 private String velocityLogfile;
68 68
69 private VelocityEngine velocityEngine; 69 private VelocityEngine velocityEngine;
70 private boolean lock[]; 70 private final boolean lock[];
71 71
72 72
73 73
74 private MapfileGenerator() { 74 private MapfileGenerator() {
75 lock = new boolean[1]; 75 lock = new boolean[1];
608 layerinfo.setType(wms.getGeometryType()); 608 layerinfo.setType(wms.getGeometryType());
609 layerinfo.setFilter(wms.getFilter()); 609 layerinfo.setFilter(wms.getFilter());
610 layerinfo.setData(wms.getData()); 610 layerinfo.setData(wms.getData());
611 layerinfo.setTitle(wms.getDescription()); 611 layerinfo.setTitle(wms.getDescription());
612 layerinfo.setStyle(style); 612 layerinfo.setStyle(style);
613 layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent())); 613 if(wms.getExtent() != null) {
614 layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent()));
615 }
614 layerinfo.setConnection(wms.getConnection()); 616 layerinfo.setConnection(wms.getConnection());
615 layerinfo.setConnectionType(wms.getConnectionType()); 617 layerinfo.setConnectionType(wms.getConnectionType());
616 layerinfo.setLabelItem(wms.getLabelItem()); 618 layerinfo.setLabelItem(wms.getLabelItem());
617 layerinfo.setSrid(wms.getSrid()); 619 layerinfo.setSrid(wms.getSrid());
618 620

http://dive4elements.wald.intevation.org