Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/CapabilitiesParser.java @ 3967:0f67a915bfd9
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:32 +0200 |
parents | 40d02fbf414d |
children |
rev | line source |
---|---|
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.InputStream; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.net.MalformedURLException; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.net.URL; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import java.net.URLConnection; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import java.util.ArrayList; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import java.util.List; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.util.regex.Matcher; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.util.regex.Pattern; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import javax.xml.xpath.XPathConstants; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
16 import org.w3c.dom.Element; |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Node; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.w3c.dom.NodeList; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.apache.log4j.Logger; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.common.utils.XMLUtils; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.exceptions.ServerException; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.model.Capabilities; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.client.shared.model.ContactInformation; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.client.shared.model.WMSLayer; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 public class CapabilitiesParser { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 private static final Logger logger = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 Logger.getLogger(CapabilitiesParser.class); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public static final String ERR_GC_REQUEST_FAILED = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 "error_gc_req_failed"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 public static final String ERR_GC_DOC_NOT_VALID = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 "error_gc_doc_not_valid"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 public static final String ERR_MALFORMED_URL = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 "error_malformed_url"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 public static final String XPATH_WMS_CAPS = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 "/WMS_Capabilities"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 public static final String XPATH_WMT_CAPS = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 "/WMT_MS_Capabilities"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public static final String XPATH_TITLE = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 "Service/Title/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public static final String XPATH_ONLINE_RESOURCE = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 "Service/OnlineResource/@href"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 public static final String XPATH_CONTACT_INFORMATION = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 "Service/ContactInformation"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 public static final String XPATH_CI_PERSON = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 "ContactPersonPrimary/ContactPerson/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public static final String XPATH_CI_ORGANIZATION = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 "ContactPersonPrimary/ContactOrganization/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 public static final String XPATH_CI_ADDRESS = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 "ContactAddress/Address/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 public static final String XPATH_CI_CITY = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 "ContactAddress/City/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 public static final String XPATH_CI_POSTCODE = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 "ContactAddress/PostCode/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 public static final String XPATH_CI_PHONE = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 "ContactVoiceTelephone/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 public static final String XPATH_CI_EMAIL = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 "ContactElectronicMailAddress/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 public static final String XPATH_FEES = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 "Service/Fees/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 public static final String XPATH_ACCESS_CONSTRAINTS = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 "Service/AccessConstraints/text()"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 public static final String XPATH_LAYERS = |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 "Capability/Layer"; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 public static final Pattern SRS_PATTERN = Pattern.compile("(EPSG:\\d+)*"); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 private CapabilitiesParser() { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 public static void main(String[] args) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 logger.info("Do static Capabilities request/parsing."); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
3479
40d02fbf414d
Remove the BaseServlet class which is obsolete now
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1488
diff
changeset
|
101 String log4jProperties = System.getenv(BaseServletContextListener.LOG4J_PROPERTIES); |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 LoggingConfigurator.init(log4jProperties); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 try { |
1487
ea2aae01e7c4
Improved CapabilitiesParser to test WMS using its main() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1417
diff
changeset
|
105 Capabilities caps = getCapabilities(System.getProperty("test.wms")); |
ea2aae01e7c4
Improved CapabilitiesParser to test WMS using its main() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1417
diff
changeset
|
106 |
ea2aae01e7c4
Improved CapabilitiesParser to test WMS using its main() method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1417
diff
changeset
|
107 logger.debug(caps.toString()); |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 catch (ServerException se) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 se.printStackTrace(); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 logger.info("Finished fetching capabiltiies."); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 public static Capabilities getCapabilities(String urlStr) |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 throws ServerException |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 try { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 URL url = new URL(urlStr); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 logger.debug("Open connection to url: " + urlStr); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 URLConnection conn = url.openConnection(); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 conn.connect(); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 InputStream is = conn.getInputStream(); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 return parse(is); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 catch (MalformedURLException mue) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 logger.warn(mue, mue); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 throw new ServerException(ERR_MALFORMED_URL); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 catch (IOException ioe) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 logger.warn(ioe, ioe); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 throw new ServerException(ERR_GC_REQUEST_FAILED); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 protected static Capabilities parse(InputStream is) |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 throws ServerException |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 logger.debug("GCServiceImpl.parseCapabilitiesResponse"); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 Document doc = XMLUtils.parseDocument(is, false); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 if (doc == null) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 throw new ServerException(ERR_GC_DOC_NOT_VALID); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 return CapabilitiesParser.parse(doc); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 public static Capabilities parse(Document doc) |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 throws ServerException |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 Node capabilities = getCapabilitiesNode(doc); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 String title = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 XPATH_TITLE, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 String onlineResource = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 XPATH_ONLINE_RESOURCE, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 String fees = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 XPATH_FEES, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 String accessConstraints = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 XPATH_ACCESS_CONSTRAINTS, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 Node contactInformation = (Node) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 XPATH_CONTACT_INFORMATION, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 XPathConstants.NODE); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 ContactInformation ci = parseContactInformation(contactInformation); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 logger.debug("Found fees: " + fees); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 logger.debug("Found access constraints: " + accessConstraints); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 NodeList layerNodes = (NodeList) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 capabilities, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 XPATH_LAYERS, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 XPathConstants.NODESET); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 List<WMSLayer> layers = parseLayers(layerNodes, onlineResource); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 return new Capabilities( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 title, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 onlineResource, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 ci, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 fees, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 accessConstraints, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 layers); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 protected static Node getCapabilitiesNode(Document doc) |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 throws ServerException { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 Node capabilities = (Node) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 doc, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 XPATH_WMS_CAPS, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 XPathConstants.NODE); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 if (capabilities == null) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 logger.info("No '/WMS_Capabilities' node found."); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 logger.info("Try to find a '/WMT_MS_Capabilities' node."); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 capabilities = (Node) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 doc, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 XPATH_WMT_CAPS, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 XPathConstants.NODE); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 if (capabilities == null) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 throw new ServerException(ERR_GC_DOC_NOT_VALID); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 return capabilities; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 protected static ContactInformation parseContactInformation(Node node) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 String person = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 XPATH_CI_PERSON, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 String organization = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 XPATH_CI_ORGANIZATION, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 String address = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 XPATH_CI_ADDRESS, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 String postcode = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 XPATH_CI_POSTCODE, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 String city = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 XPATH_CI_CITY, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 String phone = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 XPATH_CI_PHONE, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 String email = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 node, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 XPATH_CI_EMAIL, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 ContactInformation ci = new ContactInformation(); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 ci.setPerson(person); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 ci.setOrganization(organization); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 ci.setAddress(address); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 ci.setPostcode(postcode); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 ci.setCity(city); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 ci.setPhone(phone); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 ci.setEmail(email); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 return ci; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 /** |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 * @param layersNode |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 * @param onlineResource |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 * |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 * @return |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 */ |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 protected static List<WMSLayer> parseLayers( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 NodeList layersNode, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 String onlineResource |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 ) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 int len = layersNode != null ? layersNode.getLength() : 0; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 logger.debug("Node has " + len + " layers."); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 List<WMSLayer> layers = new ArrayList<WMSLayer>(len); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
300 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 for (int i = 0; i < len; i++) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 layers.add(parseLayer(layersNode.item(i), onlineResource)); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
304 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
305 return layers; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
307 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
308 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
309 protected static WMSLayer parseLayer(Node layerNode, String onlineResource) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
310 String title = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
311 layerNode, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
312 "Title/text()", |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
313 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
314 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
315 String name = (String) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
316 layerNode, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
317 "Name/text()", |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
318 XPathConstants.STRING); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
319 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
320 logger.debug("Found layer: " + title + "(" + name + ")"); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 List<String> srs = parseSRS(layerNode); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
323 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 NodeList layersNodes = (NodeList) XMLUtils.xpath( |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
325 layerNode, |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
326 "Layer", |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
327 XPathConstants.NODESET); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
328 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 List<WMSLayer> layers = parseLayers(layersNodes, onlineResource); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
330 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
331 return new WMSLayer(onlineResource, title, name, srs, layers); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
332 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
333 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
334 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
335 protected static List<String> parseSRS(Node layerNode) { |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
336 NodeList srsNodes = ((Element) layerNode).getElementsByTagName("SRS"); |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
337 |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
338 if (srsNodes.getLength() == 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
339 srsNodes = ((Element) layerNode).getElementsByTagName("CRS"); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
340 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
341 if (srsNodes.getLength() == 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
342 logger.debug("No explicit SRS for this layer specified."); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
343 return null; |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
344 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
345 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
346 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
347 List<String> allSRS = new ArrayList<String>(); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
348 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
349 for (int i = 0, n = srsNodes.getLength(); i < n; i++) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
350 List<String> srs = parseSRSItem(srsNodes.item(i).getTextContent()); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
351 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
352 if (srs != null && srs.size() > 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
353 allSRS.addAll(srs); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
354 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
355 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
356 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
357 return allSRS; |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
358 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
359 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
360 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
361 protected static List<String> parseSRSItem(String srsStr) { |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
362 if (srsStr == null || srsStr.length() == 0) { |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
363 return null; |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
364 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
365 |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
366 List<String> allSRS = new ArrayList<String>(); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
367 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
368 if (srsStr.indexOf(" ") <= 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
369 String srs = getSRSFromString(srsStr); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
370 if (srs != null && srs.length() > 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
371 allSRS.add(srs); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
372 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
373 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
374 return allSRS; |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
375 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
376 |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
377 String[] splittedSrs = srsStr.split(" "); |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
378 |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
379 for (String singleSrs: splittedSrs) { |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
380 String srs = getSRSFromString(singleSrs); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
381 if (srs != null && srs.length() > 0) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
382 allSRS.add(srs); |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
383 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
384 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
385 |
1488
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
386 return allSRS; |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
387 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
388 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
389 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
390 protected static String getSRSFromString(String singleSrs) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
391 Matcher m = SRS_PATTERN.matcher(singleSrs); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
392 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
393 if (m.matches()) { |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
394 logger.debug("Found SRS '" + m.group(1) + "'"); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
395 return m.group(1); |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
396 } |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
397 |
23ffee639f7c
#431 Added support for WMS 1.3.0 projection definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1487
diff
changeset
|
398 return null; |
1417
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
399 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
400 } |
42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
401 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |