Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java @ 819:6925d18580c0
Added more Javadoc.
gnv-artifacts/trunk@905 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 12 Apr 2010 13:12:21 +0000 |
parents | a645bd23c1c8 |
children | 47578d91c4f0 |
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 |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
3 import de.intevation.artifactdatabase.Config; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
4 import de.intevation.artifactdatabase.XMLUtils; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
5 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
6 import de.intevation.artifacts.ArtifactNamespaceContext; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
7 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
8 import de.intevation.gnv.wms.LayerInfo; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
9 |
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
|
10 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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 import java.io.Writer; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
16 |
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
|
17 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
|
18 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
|
19 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
|
20 |
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 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
|
22 |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import org.apache.log4j.Logger; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
24 |
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
|
25 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
|
26 import org.apache.velocity.VelocityContext; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
27 |
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
|
28 import org.apache.velocity.app.VelocityEngine; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
29 |
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
|
30 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
|
31 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
|
32 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
|
33 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 /** |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
35 * This class iterates over a bunch of directories, searches for meta |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
36 * information coresponding to shapefiles and creates a mapfile which is used by |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
37 * a <i>MapServer</i>. |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
38 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
39 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
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 class MapfileGenerator |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 extends Thread |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 { |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
44 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
45 * The configured template path. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
46 */ |
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
|
47 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
|
48 "/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
|
49 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
50 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
51 * The configured template mapfile. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
52 */ |
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
|
53 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
|
54 "/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
|
55 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
56 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
57 * The configured mapfile path. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
58 */ |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 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
|
60 "/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
|
61 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
62 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
63 * The configured shapefile base directory where the subdirectories for each |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
64 * artifact are stored. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
65 */ |
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
|
66 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
|
67 "/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
|
68 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
69 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
70 * The configured velocity logfile. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
71 */ |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
72 public static final String VELOCITY_LOGFILE = |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
73 "/artifact-database/velocity/logfile/@path"; |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
74 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
75 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
76 * The name of the file storing meta information coresponding to shapefiles. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
77 */ |
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
|
78 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
|
79 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
80 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
81 * The XPath to layer nodes in the meta information xml file. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
82 */ |
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
|
83 public static final String XPATH_LAYER = "/art:meta/art:layer"; |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
84 |
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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 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
|
93 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 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
|
95 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 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
|
97 |
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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
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
|
103 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
|
104 private boolean lock[]; |
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 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 private MapfileGenerator() { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 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
|
110 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
113 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
114 * A main method which can be used to create a mapfile without a running |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
115 * artifact server.<br> |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
116 * <b>NOTE:</b> This method is not implemented yet! |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
117 * |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
118 * @param args Arguments. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
119 */ |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 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
|
121 // 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
|
122 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
125 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
126 * Returns the instance of this generator. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
127 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
128 * @return the instance. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
129 */ |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 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
|
131 if (instance == null) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 instance = new MapfileGenerator(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 instance.setDaemon(true); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 instance.start(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 return instance; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
141 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
142 * Triggers the mapfile generation process. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
143 */ |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 public void update() { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 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
|
146 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
|
147 lock[0] = true; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 lock.notify(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
153 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
154 * Thread to generate a mapfile. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
155 */ |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
156 @Override |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 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
|
158 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
|
159 try { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 for (;;) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 synchronized (lock) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 while (!lock[0]) { |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 lock.wait(SLEEPTIME); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 lock[0] = false; |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 } |
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
|
167 |
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 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
|
169 generate(); |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 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
|
173 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
|
174 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
175 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
|
176 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
|
177 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
730
diff
changeset
|
179 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
180 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
181 * Method to check the existance of a template file. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
182 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
183 * @param templateID The name of a template. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
184 * @return true, of the template exists - otherwise false. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
185 */ |
724
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
186 public boolean templateExists(String templateID){ |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
187 Template template = getTemplateByName(templateID); |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
188 return template != null; |
9ba6bb85d6dd
Integrate lookup for MapFileTemplate for the different Layer.
Tim Englich <tim.englich@intevation.de>
parents:
625
diff
changeset
|
189 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
192 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
193 * Method which starts searching for meta information file and mapfile |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
194 * generation. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
195 */ |
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 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 } |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
204 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
205 * Returns the VelocityEngine used for the template mechanism. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
206 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
207 * @return the velocity engine. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
208 */ |
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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 } |
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 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
|
216 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
|
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 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
|
221 } |
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
224 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
225 * Initialize velocity. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
226 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
227 * @param engine Velocity engine. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
228 * @throws Exception if an error occured while initializing velocity. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
229 */ |
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
|
230 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
|
231 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
|
232 { |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
233 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
|
234 "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
|
235 "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
|
236 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
237 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
238 VelocityEngine.RUNTIME_LOG, |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
239 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
|
240 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
241 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
242 "resource.loader", |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
243 "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
|
244 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
245 engine.setProperty( |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
246 "file.resource.loader.path", |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
247 getTemplateBaseDir()); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
248 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
249 engine.init(); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
250 } |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
251 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
252 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
253 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
254 * Returns the path specifying the logfile for velocity. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
255 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
256 * @return Velocity logfile path. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
257 */ |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
258 protected String getVelocityLogfile() { |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
259 if (velocityLogfile == null) |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
260 velocityLogfile = Config.getStringXPath(VELOCITY_LOGFILE); |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
261 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
262 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
|
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
266 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
267 * Returns the base directory storing the templates. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
268 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
269 * @return the template base directory. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
270 */ |
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
|
271 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
|
272 if (templatePath == null) { |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
273 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
|
274 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
|
275 } |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
276 |
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
277 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
|
278 } |
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
281 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
282 * Returns a template specified by <i>model</i>. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
283 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
284 * @param model The name of the template. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
285 * @return a template. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
286 */ |
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
|
287 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
|
288 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
|
289 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
|
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 |
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 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
|
293 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
|
294 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
|
295 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
|
296 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
|
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 |
624
6a3a1da5e680
Improved velocity configuration.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
299 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
|
300 } |
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 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
|
302 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
|
303 } |
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 |
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 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
|
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 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
308 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
309 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
310 * Returns the mapfile template. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
311 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
312 * @return the mapfile template. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
313 * @throws Exception if an error occured while reading the configuration. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
314 */ |
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
|
315 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
|
316 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
|
317 { |
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 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
|
319 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
|
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
323 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
324 * Returns the base directory storing the shapefiles. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
325 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
326 * @return the shapefile base directory. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
327 */ |
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
|
328 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
|
329 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
|
330 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
|
331 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
|
332 } |
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
|
333 |
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
|
334 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
|
335 } |
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
|
336 |
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
|
337 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
338 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
339 * Returns the mapfile. |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
340 * |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
341 * @return the mapfile. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
342 */ |
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
|
343 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
|
344 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
|
345 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
|
346 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
|
347 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
|
348 } |
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
|
349 |
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
|
350 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
|
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
354 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
355 * Search for meta information file in <i>file</i> and store the layer |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
356 * information in <i>store</i> if a meta file was found. |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
357 * |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
358 * @param file The root directory to be searched for meta files. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
359 * @param store A list storing <code>LayerInfo</code> objects. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
360 */ |
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
|
361 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
|
362 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
|
363 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
|
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 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
|
366 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
|
367 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
|
368 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
|
369 } |
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 } |
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 } |
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 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
|
373 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
|
374 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
375 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
|
376 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
|
377 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
|
378 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
|
379 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
380 } |
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 } |
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 |
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
385 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
386 * Parses a meta information file and returns necessary information as |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
387 * <code>LayerInfo</code> array. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
388 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
389 * @param file Meta information file. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
390 * @return Array of LayerInfo objects. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
391 */ |
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
|
392 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
|
393 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
|
394 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
|
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 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
|
397 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
|
398 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
|
399 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
|
400 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
|
401 |
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 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
|
403 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
|
404 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
|
405 |
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 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
|
407 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
|
408 } |
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 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
|
410 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
|
411 } |
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 } |
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 |
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 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
|
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 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
418 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
419 * Parses a node storing layer information and returns them. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
420 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
421 * @param layer Node storing information about a layer. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
422 * @return a LayerInfo object. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
423 */ |
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
|
424 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
|
425 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
|
426 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
427 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
|
428 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
|
429 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
|
430 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
431 |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
436 else { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
437 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
|
438 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
724
diff
changeset
|
439 |
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
|
440 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
|
441 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
|
442 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
|
443 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
444 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
445 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
|
446 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
|
447 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
|
448 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
449 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
450 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
|
451 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
|
452 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
|
453 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
454 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
459 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
460 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
|
461 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
462 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
463 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
464 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
465 * Parses attributes in layer nodes. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
466 * |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
467 * @param node A node containing layer information. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
468 * @param xpath XPath specifying an attribute. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
469 * @return Attribute as string. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
470 */ |
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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 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
|
477 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
478 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
479 |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
480 /** |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
481 * Creates a mapfile with the layer information stored in <i>layers</i>. |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
806
diff
changeset
|
482 * |
806
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
483 * @param layers Layer information. |
2cea76f1112e
Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
798
diff
changeset
|
484 */ |
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
|
485 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
|
486 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
|
487 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
488 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
|
489 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
|
490 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
|
491 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
|
492 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
497 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
|
498 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
|
499 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
|
500 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
501 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
|
502 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
|
503 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
|
504 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
505 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
|
506 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
|
507 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
|
508 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
509 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
510 |
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
|
511 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
|
512 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
|
513 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
|
514 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
515 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
|
516 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
|
517 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
518 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
|
519 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
|
520 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
521 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
|
522 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
|
523 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 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
|
528 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
529 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
530 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
|
531 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
532 // 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
|
533 // 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
|
534 // 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
|
535 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
|
536 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
537 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
|
538 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
|
539 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
540 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
|
541 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
|
542 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
543 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
|
544 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
|
545 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
546 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
|
547 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
|
548 // 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
|
549 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
|
550 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
|
551 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
552 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
553 // 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
|
554 // 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
|
555 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
|
556 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
|
557 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
558 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
559 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
|
560 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
|
561 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
562 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
563 } |
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
564 } |
798
6cff63d0c434
Fixed vim modeline. Added some Javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
780
diff
changeset
|
565 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |