comparison artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.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 a56fe3bc6700
children e701ef544ffa
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
29 import org.geotools.data.shapefile.shp.ShapefileHeader; 29 import org.geotools.data.shapefile.shp.ShapefileHeader;
30 import org.geotools.data.shapefile.shp.ShapefileReader; 30 import org.geotools.data.shapefile.shp.ShapefileReader;
31 31
32 public class ArtifactMapfileGenerator extends MapfileGenerator { 32 public class ArtifactMapfileGenerator extends MapfileGenerator {
33 33
34 private static Logger logger = Logger.getLogger(ArtifactMapfileGenerator.class); 34 private static Logger log = Logger.getLogger(ArtifactMapfileGenerator.class);
35 35
36 public static final String FLOODMAP_UESK_KEY = 36 public static final String FLOODMAP_UESK_KEY =
37 "floodmap.uesk"; 37 "floodmap.uesk";
38 38
39 public static final String FLOODMAP_UESK_DEF = 39 public static final String FLOODMAP_UESK_DEF =
61 @Override 61 @Override
62 public void generate() throws IOException 62 public void generate() throws IOException
63 { 63 {
64 File[] userDirs = getUserDirs(); 64 File[] userDirs = getUserDirs();
65 List<String> layers = parseLayers(userDirs); 65 List<String> layers = parseLayers(userDirs);
66 logger.info("Found " + layers.size() + " layers for user mapfile."); 66 log.info("Found " + layers.size() + " layers for user mapfile.");
67 67
68 writeMapfile(layers); 68 writeMapfile(layers);
69 } 69 }
70 70
71 /** 71 /**
80 WSPLGENLayerFacet wms, 80 WSPLGENLayerFacet wms,
81 String style, 81 String style,
82 CallContext context 82 CallContext context
83 ) throws FileNotFoundException, IOException 83 ) throws FileNotFoundException, IOException
84 { 84 {
85 logger.debug("createUeskLayer"); 85 log.debug("createUeskLayer");
86 86
87 String identifier = flys.identifier(); 87 String identifier = flys.identifier();
88 88
89 DGMAccess access = new DGMAccess(flys); 89 DGMAccess access = new DGMAccess(flys);
90 90
114 114
115 String name = MS_LAYER_PREFIX + wms.getName(); 115 String name = MS_LAYER_PREFIX + wms.getName();
116 116
117 Template template = getTemplateByName(WSPLGEN_LAYER_TEMPLATE); 117 Template template = getTemplateByName(WSPLGEN_LAYER_TEMPLATE);
118 if (template == null) { 118 if (template == null) {
119 logger.warn("Template '" + WSPLGEN_LAYER_TEMPLATE + "' found."); 119 log.warn("Template '" + WSPLGEN_LAYER_TEMPLATE + "' found.");
120 return; 120 return;
121 } 121 }
122 122
123 try { 123 try {
124 File dir = new File(getShapefileBaseDir(), identifier); 124 File dir = new File(getShapefileBaseDir(), identifier);
125 writeLayer(layerinfo, new File(dir, name), template); 125 writeLayer(layerinfo, new File(dir, name), template);
126 } 126 }
127 catch (FileNotFoundException fnfe) { 127 catch (FileNotFoundException fnfe) {
128 logger.error(fnfe, fnfe); 128 log.error(fnfe, fnfe);
129 logger.warn("Unable to write layer: " + name); 129 log.warn("Unable to write layer: " + name);
130 } 130 }
131 } 131 }
132 132
133 133
134 /** 134 /**
139 * @param wms The WMSLayerFacet that contains information for the layer. 139 * @param wms The WMSLayerFacet that contains information for the layer.
140 */ 140 */
141 public void createUserShapeLayer(D4EArtifact flys, WMSLayerFacet wms) 141 public void createUserShapeLayer(D4EArtifact flys, WMSLayerFacet wms)
142 throws FileNotFoundException, IOException 142 throws FileNotFoundException, IOException
143 { 143 {
144 logger.debug("createUserShapeLayer"); 144 log.debug("createUserShapeLayer");
145 145
146 String uuid = flys.identifier(); 146 String uuid = flys.identifier();
147 File dir = new File(getShapefileBaseDir(), uuid); 147 File dir = new File(getShapefileBaseDir(), uuid);
148 File test = new File(dir, WSPLGEN_USER_SHAPE); 148 File test = new File(dir, WSPLGEN_USER_SHAPE);
149 149
150 if (!test.exists() || !test.canRead()) { 150 if (!test.exists() || !test.canRead()) {
151 logger.debug("No user layer existing."); 151 log.debug("No user layer existing.");
152 return; 152 return;
153 } 153 }
154 154
155 File userShape = new File(dir, WSPLGEN_USER_SHAPE); 155 File userShape = new File(dir, WSPLGEN_USER_SHAPE);
156 ShpFiles sf = new ShpFiles(userShape); 156 ShpFiles sf = new ShpFiles(userShape);
184 // layer name. Should be refactored... 184 // layer name. Should be refactored...
185 String nameUser = MS_LAYER_PREFIX + "user-rgd"; 185 String nameUser = MS_LAYER_PREFIX + "user-rgd";
186 186
187 Template tpl = getTemplateByName(SHP_LAYER_TEMPLATE); 187 Template tpl = getTemplateByName(SHP_LAYER_TEMPLATE);
188 if (tpl == null) { 188 if (tpl == null) {
189 logger.warn("Template '" + SHP_LAYER_TEMPLATE + "' found."); 189 log.warn("Template '" + SHP_LAYER_TEMPLATE + "' found.");
190 return; 190 return;
191 } 191 }
192 192
193 try { 193 try {
194 writeLayer(info, new File(dir, nameUser), tpl); 194 writeLayer(info, new File(dir, nameUser), tpl);
195 } 195 }
196 catch (FileNotFoundException fnfe) { 196 catch (FileNotFoundException fnfe) {
197 logger.error(fnfe, fnfe); 197 log.error(fnfe, fnfe);
198 logger.warn("Unable to write layer: " + nameUser); 198 log.warn("Unable to write layer: " + nameUser);
199 } 199 }
200 200
201 } 201 }
202 202
203 203
213 WMSDBLayerFacet wms, 213 WMSDBLayerFacet wms,
214 String style 214 String style
215 ) 215 )
216 throws FileNotFoundException, IOException 216 throws FileNotFoundException, IOException
217 { 217 {
218 logger.debug("createDatabaseLayer"); 218 log.debug("createDatabaseLayer");
219 219
220 LayerInfo layerinfo = new LayerInfo(); 220 LayerInfo layerinfo = new LayerInfo();
221 layerinfo.setName(wms.getName() + "-" + flys.identifier()); 221 layerinfo.setName(wms.getName() + "-" + flys.identifier());
222 layerinfo.setType(wms.getGeometryType()); 222 layerinfo.setType(wms.getGeometryType());
223 layerinfo.setFilter(wms.getFilter()); 223 layerinfo.setFilter(wms.getFilter());
234 234
235 String name = MS_LAYER_PREFIX + wms.getName(); 235 String name = MS_LAYER_PREFIX + wms.getName();
236 236
237 Template template = getTemplateByName(DB_LAYER_TEMPLATE); 237 Template template = getTemplateByName(DB_LAYER_TEMPLATE);
238 if (template == null) { 238 if (template == null) {
239 logger.warn("Template '" + DB_LAYER_TEMPLATE + "' found."); 239 log.warn("Template '" + DB_LAYER_TEMPLATE + "' found.");
240 return; 240 return;
241 } 241 }
242 242
243 try { 243 try {
244 File dir = new File(getShapefileBaseDir(), flys.identifier()); 244 File dir = new File(getShapefileBaseDir(), flys.identifier());
245 writeLayer(layerinfo, new File(dir, name), template); 245 writeLayer(layerinfo, new File(dir, name), template);
246 } 246 }
247 catch (FileNotFoundException fnfe) { 247 catch (FileNotFoundException fnfe) {
248 logger.error(fnfe, fnfe); 248 log.error(fnfe, fnfe);
249 logger.warn("Unable to write layer: " + name); 249 log.warn("Unable to write layer: " + name);
250 } 250 }
251 } 251 }
252 252
253 @Override 253 @Override
254 protected String getMapfilePath() { 254 protected String getMapfilePath() {

http://dive4elements.wald.intevation.org