annotate gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java @ 953:4b64b4d1f0cf

Add more Javadocs gnv/trunk@1097 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 18 May 2010 07:32:45 +0000
parents 57fa8019fbdc
children 28a0628b11b0
rev   line source
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.action.mapviewer.parser;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
3 import java.io.InputStream;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
4 import java.util.ArrayList;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
5 import java.util.Collection;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
6
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
7 import org.apache.log4j.Logger;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
8 import org.w3c.dom.Document;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
9 import org.w3c.dom.Element;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
10 import org.w3c.dom.NodeList;
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
11
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import de.intevation.gnv.artifactdatabase.objects.map.Layer;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import de.intevation.gnv.artifactdatabase.objects.map.MapService;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import de.intevation.gnv.util.XMLUtils;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 /**
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
19 * This class provides an XMl-Parser which try's to create an DOM from
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
20 * an given Inputstream. Is this is possible it try to read the required
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
21 * informations e.g. Mapservices, Layer, SRID and Geometry from the
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
22 * document.
684
57fa8019fbdc Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 683
diff changeset
23 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 public class XMLExternalCallParser implements ExternalCallParser {
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
26
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 * the logger, used to log exceptions and additonaly information
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 private static Logger log = Logger.getLogger(XMLExternalCallParser.class);
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
31
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 private static String XPATH_GEOMETRY = "/gnviewer/location/data";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 private static String XPATH_SRS = "/gnviewer/location/srs";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 private static String XPATH_MAPSERVICES_NODESET = "/gnviewer/mapservices/mapservice";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 private static String XPATH_LAYER = "layer";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 private static String ATTRIBUTE_ID = "id";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 private static String ATTRIBUTE_NAME = "name";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 private static String ATTRIBUTE_TYPE = "type";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 private static String ATTRIBUTE_URL = "url";
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
40
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
41 /**
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
42 * The geometry which was parsed from the document.
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
43 */
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 private String geometry = null;
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
45
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
46 /**
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
47 * The srid which was parsed from the document.
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
48 */
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 private String srs = null;
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
50
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
51 /**
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
52 * The mapservices that were parsed from the document.
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
53 */
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 private Collection<MapService> mapServices = null;
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
55
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
56 /**
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
57 * The inputstream where the data should be read from.
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
58 */
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 private InputStream inputStream = null;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 * Constructor
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
63 * @param inputStream The stream where the data should be read from
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 public XMLExternalCallParser(InputStream inputStream) {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 this.inputStream = inputStream;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 public String getGeometry() {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 return this.geometry;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 public Collection<MapService> getMapServices() {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 return this.mapServices;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 public void parse() throws ExternalCallParserException {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 if (inputStream != null){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 XMLUtils xmlUtils = new XMLUtils();
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 Document document = xmlUtils.readDocument(this.inputStream);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 if (document != null){
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
82
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
83 this.geometry = xmlUtils.getStringXPath(document,
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
84 XPATH_GEOMETRY);
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 this.srs = xmlUtils.getStringXPath(document, XPATH_SRS);
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
86 NodeList mapservicesNodes =
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
87 xmlUtils.getNodeSetXPath(document,
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
88 XPATH_MAPSERVICES_NODESET);
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 if (mapservicesNodes != null){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 this.mapServices = new ArrayList<MapService>(mapservicesNodes.getLength());
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 for (int i = 0; i < mapservicesNodes.getLength(); i++){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 Element mapserviceNode = (Element)mapservicesNodes.item(i);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 String mapserviceID = mapserviceNode.getAttribute(ATTRIBUTE_ID);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 String mapserviceType = mapserviceNode.getAttribute(ATTRIBUTE_TYPE);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 String mapserviceUrl = mapserviceNode.getAttribute(ATTRIBUTE_URL);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 NodeList layerNodes = xmlUtils.getNodeSetXPath(mapserviceNode, XPATH_LAYER);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 Collection<Layer> layer = null;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 if (layerNodes != null && layerNodes.getLength() > 0){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 layer = new ArrayList<Layer>(layerNodes.getLength());
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 layer = this.extractLayer(layer, null, layerNodes);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 }else{
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 log.debug("No Layer given for this Mapservice");
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
104 MapService mapService =
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 new DefaultMapService(mapserviceID, layer,
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 mapserviceType, mapserviceUrl);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 this.mapServices.add(mapService);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
109
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 }else{
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
111 String errMsg = "XML-Document does not contain any " +
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
112 "Mapservices which are required.";
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 log.error(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 throw new ExternalCallParserException(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
116
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 }else{
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
118 String errMsg = "XML-Document could not " +
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
119 "be read from InputStream.";
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 log.error(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 throw new ExternalCallParserException(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 }else{
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 String errMsg = "No InputStream given for parsing the Call.";
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 log.error(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 throw new ExternalCallParserException(errMsg);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
129
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 * This Method extracts all Layers and put them into the Collection.
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
132 * @param layer the collection where the layer should be add to.
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
133 * @param groupId the id of the group of the layers
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
134 * @param layerNodes the Nodes which should contain the intormations
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
135 * about layers
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
136 * @return the layer
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 */
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
138 private Collection<Layer> extractLayer(Collection<Layer> layer,
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
139 String groupId,
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
140 NodeList layerNodes){
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 for (int i = 0; i < layerNodes.getLength(); i++){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 Element layerNode = (Element)layerNodes.item(i);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 String id = layerNode.getAttribute(ATTRIBUTE_ID);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 String name = layerNode.getAttribute(ATTRIBUTE_NAME);
953
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
145 NodeList localLayerNodes = XMLUtils.getNodeSetXPath(layerNode,
4b64b4d1f0cf Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 684
diff changeset
146 XPATH_LAYER);
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
147 Layer tmpLayer = new DefaultLayer(id, name,
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
148 (localLayerNodes != null &&
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 402
diff changeset
149 localLayerNodes.getLength() > 0),
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 groupId);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 layer.add(tmpLayer);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 if (localLayerNodes != null && localLayerNodes.getLength() > 0){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 layer = this.extractLayer(layer, id, localLayerNodes);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 return layer;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 public String getSRS() {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 return this.srs;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 }

http://dive4elements.wald.intevation.org