Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java @ 743:a4b66195d55a
Modified the Workflow of Product Layer for Contis and Nauthis that the Data that was sent by the Mapviewer-Interface take effect.
gnv-artifacts/trunk@782 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 16 Mar 2010 08:51:50 +0000 |
parents | 452fad121560 |
children | 9a828e5a2390 |
rev | line source |
---|---|
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.utils; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
3 import java.io.File; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
4 import java.io.FileNotFoundException; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
5 import java.io.FileWriter; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
6 import java.io.IOException; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
7 import java.io.StringWriter; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
8 import java.io.Writer; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
9 import java.util.ArrayList; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
10 import java.util.Date; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
11 import java.util.List; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
12 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
13 import javax.xml.xpath.XPathConstants; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
14 |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
16 import org.apache.velocity.Template; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
17 import org.apache.velocity.VelocityContext; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
18 import org.apache.velocity.app.VelocityEngine; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
19 import org.w3c.dom.Document; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
20 import org.w3c.dom.Node; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
21 import org.w3c.dom.NodeList; |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
724
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
23 import de.intevation.artifactdatabase.Config; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
24 import de.intevation.artifactdatabase.XMLUtils; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
25 import de.intevation.artifacts.ArtifactNamespaceContext; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
26 import de.intevation.gnv.wms.LayerInfo; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
27 |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
28 |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 /** |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 */ |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public class MapfileGenerator |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 extends Thread |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 { |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
35 public static final String TEMPLATE_PATH = |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
36 "/artifact-database/gnv/map-generator/templates/path/text()"; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
37 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
38 public static final String TEMPLATE_MAPFILE = |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
39 "/artifact-database/gnv/map-generator/templates/maptemplate/text()"; |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public static final String MAPFILE_PATH = |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
42 "/artifact-database/gnv/map-generator/mapfile/@path"; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
43 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
44 public static final String SHAPEFILE_BASE_DIR = |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
45 "/artifact-database/gnv/shapefile-directory/@path"; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
46 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
47 public static final String VELOCITY_LOGFILE = |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
48 "/artifact-database/velocity/logfile/@path"; |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
49 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
50 public static final String META_FILE_NAME = "meta.xml"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
51 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
52 public static final String XPATH_LAYER = "/art:meta/art:layer"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
53 public static final String XPATH_LAYER_NAME = "art:name"; |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
54 public static final String XPATH_LAYER_TITLE = "art:title"; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
55 public static final String XPATH_LAYER_TYPE = "art:type"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
56 public static final String XPATH_LAYER_DATA = "art:data"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
57 public static final String XPATH_LAYER_STATUS = "art:status"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
58 public static final String XPATH_LAYER_MODEL = "art:model"; |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 protected static final long SLEEPTIME = 10 * 1000L; // 10 seconds |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 private static Logger logger = Logger.getLogger(MapfileGenerator.class); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 private static MapfileGenerator instance; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
66 private File mapfile; |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
67 private String shapefileDirectory; |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
68 private String templatePath; |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
69 private String velocityLogfile; |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
70 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
71 private VelocityEngine velocityEngine; |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 private boolean lock[]; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 private MapfileGenerator() { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 lock = new boolean[1]; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 public static void main(String[] args) { |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
82 // TODO IMPLEMENT ME |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 public static synchronized MapfileGenerator getInstance() { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 if (instance == null) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 instance = new MapfileGenerator(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 instance.setDaemon(true); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 instance.start(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 return instance; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 public void update() { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 synchronized (lock) { |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
99 logger.debug("update"); |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 lock[0] = true; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 lock.notify(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 public void run() { |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
107 logger.debug("Start MapfileGenerator thread..."); |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 try { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 for (;;) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 synchronized (lock) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 while (!lock[0]) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 lock.wait(SLEEPTIME); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 lock[0] = false; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
116 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
117 logger.debug("Start sync process now..."); |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 generate(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 catch (InterruptedException ie) { |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
122 logger.debug("MapfileGenerator thread got an interrupt."); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
123 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
124 finally { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
125 logger.debug("THREAD END"); |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
724
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
128 |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
129 public boolean templateExists(String templateID){ |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
130 Template template = getTemplateByName(templateID); |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
131 return template != null; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
132 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
135 protected void generate() { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
136 File basedir = new File(getShapefileBaseDir()); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
137 List layers = new ArrayList(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
138 searchMetaInformation(basedir, layers); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
139 writeMapfile(layers); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
140 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
141 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
142 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
143 protected VelocityEngine getVelocityEngine() { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
144 if (velocityEngine == null) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
145 velocityEngine = new VelocityEngine(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
146 try { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
147 setupVelocity(velocityEngine); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
148 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
149 catch (Exception e) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
150 logger.error(e, e); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
151 return null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
152 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
153 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
154 return velocityEngine; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
155 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
156 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
157 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
158 protected void setupVelocity(VelocityEngine engine) |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
159 throws Exception |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
160 { |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
161 engine.setProperty( |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
162 "input.encoding", |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
163 "UTF-8"); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
164 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
165 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
166 VelocityEngine.RUNTIME_LOG, |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
167 getVelocityLogfile()); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
168 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
169 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
170 "resource.loader", |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
171 "file"); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
172 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
173 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
174 "file.resource.loader.path", |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
175 getTemplateBaseDir()); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
176 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
177 engine.init(); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
178 } |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
179 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
180 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
181 protected String getVelocityLogfile() { |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
182 if (velocityLogfile == null) |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
183 velocityLogfile = Config.getStringXPath(VELOCITY_LOGFILE); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
184 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
185 return velocityLogfile; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
186 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
187 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
188 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
189 protected String getTemplateBaseDir() { |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
190 if (templatePath == null) { |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
191 templatePath = Config.getStringXPath(TEMPLATE_PATH); |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
192 templatePath = Config.replaceConfigDir(templatePath); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
193 } |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
194 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
195 return templatePath; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
196 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
197 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
198 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
199 protected Template getTemplateByName(String model) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
200 if (model.indexOf(".vm") < 0) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
201 model = model.concat(".vm"); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
202 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
203 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
204 try { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
205 VelocityEngine engine = getVelocityEngine(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
206 if (engine == null) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
207 logger.error("Error while fetching VelocityEngine."); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
208 return null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
209 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
210 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
211 return engine.getTemplate(model); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
212 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
213 catch (Exception e) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
214 logger.warn(e, e); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
215 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
216 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
217 return null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
218 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
219 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
220 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
221 protected Template getMapfileTemplate() |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
222 throws Exception |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
223 { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
224 String mapfileName = Config.getStringXPath(TEMPLATE_MAPFILE); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
225 return getTemplateByName(mapfileName); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
226 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
227 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
228 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
229 protected String getShapefileBaseDir() { |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
230 if (shapefileDirectory == null) { |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
231 shapefileDirectory = Config.getStringXPath(SHAPEFILE_BASE_DIR); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
232 shapefileDirectory = Config.replaceConfigDir(shapefileDirectory); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
233 } |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
234 |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
235 return shapefileDirectory; |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
236 } |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
237 |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
238 |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
239 protected File getMapfile() { |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
240 if (mapfile == null) { |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
241 String tmp = Config.getStringXPath(MAPFILE_PATH); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
242 tmp = Config.replaceConfigDir(tmp); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
243 mapfile = new File(tmp); |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
244 } |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
245 |
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
246 return mapfile; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
247 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
248 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
249 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
250 protected void searchMetaInformation(File file, List store) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
251 if (file.isDirectory()) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
252 File[] files = file.listFiles(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
253 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
254 if (files != null && files.length != 0) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
255 int size = files.length; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
256 for (File tmp: files) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
257 searchMetaInformation(tmp, store); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
258 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
259 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
260 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
261 else if (file.getName().equals(META_FILE_NAME)) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
262 LayerInfo[] info = parseMeta(file); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
263 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
264 int infoSize = info.length; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
265 for (int j = 0; j < infoSize; j++) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
266 if (info[j] != null) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
267 store.add(info[j]); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
268 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
269 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
270 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
271 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
272 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
273 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
274 protected LayerInfo[] parseMeta(File file) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
275 Document meta = XMLUtils.parseDocument(file); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
276 List layers = new ArrayList(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
277 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
278 NodeList layerset = (NodeList) XMLUtils.xpath( |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
279 meta, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
280 XPATH_LAYER, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
281 XPathConstants.NODESET, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
282 ArtifactNamespaceContext.INSTANCE); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
283 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
284 int size = layerset.getLength(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
285 for (int i = 0; i < size; i++) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
286 LayerInfo info = parseLayer(layerset.item(i)); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
287 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
288 if (info != null && !info.isEmpty() && !info.isBroken()) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
289 layers.add(info); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
290 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
291 else { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
292 logger.warn("Found broken LayerInfo object."); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
293 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
294 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
295 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
296 return (LayerInfo[]) layers.toArray(new LayerInfo[layers.size()]); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
297 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
298 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
299 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
300 protected LayerInfo parseLayer(Node layer) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
301 LayerInfo info = new LayerInfo(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
302 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
303 String name = parseLayerAttr(layer, XPATH_LAYER_NAME); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
304 if (name != null && !name.equals("")) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
305 info.setName(name); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
306 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
307 |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
308 String title = parseLayerAttr(layer, XPATH_LAYER_TITLE); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
309 if (title != null && !title.equals("")) { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
310 info.setTitle(title); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
311 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
312 else { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
313 info.setTitle(name); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
314 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
315 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
316 String model = parseLayerAttr(layer, XPATH_LAYER_MODEL); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
317 if (model != null && !model.equals("")) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
318 info.setModel(model); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
319 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
320 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
321 String type = parseLayerAttr(layer, XPATH_LAYER_TYPE); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
322 if (type != null && !type.equals("")) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
323 info.setType(type); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
324 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
325 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
326 String data = parseLayerAttr(layer, XPATH_LAYER_DATA); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
327 if (data != null && !data.equals("")) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
328 info.setData(data); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
329 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
330 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
331 String status = parseLayerAttr(layer, XPATH_LAYER_STATUS); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
332 if (status != null && !status.equals("")) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
333 info.setStatus(status); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
334 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
335 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
336 return info; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
337 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
338 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
339 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
340 protected String parseLayerAttr(Node node, String xpath) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
341 return (String) XMLUtils.xpath( |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
342 node, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
343 xpath, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
344 XPathConstants.STRING, |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
345 ArtifactNamespaceContext.INSTANCE); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
346 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
347 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
348 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
349 protected void writeMapfile(List layers) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
350 String tmpMapName = "mapfile" + new Date().getTime(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
351 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
352 int layersize = layers.size(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
353 StringBuilder sb = new StringBuilder(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
354 StringWriter sw = null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
355 LayerInfo info = null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
356 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
357 for (int i = 0; i < layersize; i++) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
358 sw = new StringWriter(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
359 info = (LayerInfo) layers.get(i); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
360 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
361 Template layerTemplate = getTemplateByName(info.getModel()); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
362 VelocityContext context = new VelocityContext(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
363 context.put("info", info); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
364 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
365 try { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
366 layerTemplate.merge(context, sw); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
367 sb.append(sw.toString()); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
368 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
369 catch (IOException ioe) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
370 logger.warn("Error while filling layer template."); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
371 logger.warn(ioe, ioe); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
372 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
373 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
374 |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
375 File map = getMapfile(); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
376 Writer writer = null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
377 File tmp = null; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
378 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
379 try { |
625
40ead2d2a08d
Restructured configuration, removed duplicated entry and store config information in MapfileGenerator to avoid reading config file every time while updating mapfile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
624
diff
changeset
|
380 tmp = new File(map.getParent(), tmpMapName); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
381 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
382 tmp.createNewFile(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
383 writer = new FileWriter(tmp); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
384 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
385 VelocityContext context = new VelocityContext(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
386 context.put("LAYERS", sb.toString()); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
387 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
388 Template mapTemplate = getMapfileTemplate(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
389 if (mapTemplate == null) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
390 logger.warn("No mapfile template found."); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
391 return; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
392 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
393 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
394 mapTemplate.merge(context, writer); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
395 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
396 // we need to create a temporary mapfile first und rename it into |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
397 // real mapfile because we don't run into race conditions on this |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
398 // way. (iw) |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
399 tmp.renameTo(map); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
400 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
401 catch (FileNotFoundException fnfe) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
402 logger.error(fnfe, fnfe); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
403 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
404 catch (IOException ioe) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
405 logger.error(ioe, ioe); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
406 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
407 catch (Exception e) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
408 logger.error(e, e); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
409 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
410 finally { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
411 try { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
412 // close file writer |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
413 if (writer != null) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
414 writer.close(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
415 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
416 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
417 // remove temporary mapfile if an error occured and it still |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
418 // exists |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
419 if (tmp.exists()) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
420 tmp.delete(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
421 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
422 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
423 catch (IOException ioe) { |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
424 logger.debug(ioe, ioe); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
425 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
426 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
427 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
428 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
429 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |