annotate flys-client/src/main/java/de/intevation/flys/client/server/GCServiceImpl.java @ 1414:3484cbfaf369

Create new Artifacts for selected WMS layers of the ExternalWMSWindow. flys-client/trunk@3304 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 22 Nov 2011 20:13:16 +0000
parents 63be3137abac
children 16f19f12a962
rev   line source
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.server;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.InputStream;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.io.IOException;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.net.MalformedURLException;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.net.URL;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import java.net.URLConnection;
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
8 import java.util.ArrayList;
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
9 import java.util.List;
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.xml.xpath.XPathConstants;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Document;
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
16 import org.w3c.dom.Node;
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
17 import org.w3c.dom.NodeList;
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.artifacts.common.utils.XMLUtils;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.client.shared.exceptions.ServerException;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.client.shared.model.Capabilities;
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
25 import de.intevation.flys.client.shared.model.ContactInformation;
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
26 import de.intevation.flys.client.shared.model.WMSLayer;
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import de.intevation.flys.client.client.services.GCService;
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 /**
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public class GCServiceImpl
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 extends RemoteServiceServlet
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 implements GCService
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public static final String ERR_GC_REQUEST_FAILED =
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 "error_gc_req_failed";
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public static final String ERR_GC_DOC_NOT_VALID =
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 "error_gc_doc_not_valid";
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 public static final String ERR_MALFORMED_URL =
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 "error_malformed_url";
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
46 public static final String XPATH_TITLE =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
47 "/WMS_Capabilities/Service/Title/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
48
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
49 public static final String XPATH_ONLINE_RESOURCE =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
50 "/WMS_Capabilities/Service/OnlineResource/@href";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
51
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
52 public static final String XPATH_CONTACT_INFORMATION =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
53 "/WMS_Capabilities/Service/ContactInformation";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
54
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
55 public static final String XPATH_CI_PERSON =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
56 "ContactPersonPrimary/ContactPerson/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
57
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
58 public static final String XPATH_CI_ORGANIZATION =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
59 "ContactPersonPrimary/ContactOrganization/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
60
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
61 public static final String XPATH_CI_ADDRESS =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
62 "ContactAddress/Address/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
63
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
64 public static final String XPATH_CI_CITY =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
65 "ContactAddress/City/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
66
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
67 public static final String XPATH_CI_POSTCODE =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
68 "ContactAddress/PostCode/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
69
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
70 public static final String XPATH_CI_PHONE =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
71 "ContactVoiceTelephone/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
72
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
73 public static final String XPATH_CI_EMAIL =
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
74 "ContactElectronicMailAddress/text()";
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
75
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public static final String XPATH_FEES =
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 "/WMS_Capabilities/Service/Fees/text()";
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 public static final String XPATH_ACCESS_CONSTRAINTS =
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 "/WMS_Capabilities/Service/AccessConstraints/text()";
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
82 public static final String XPATH_LAYERS =
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
83 "/WMS_Capabilities/Capability/Layer";
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
84
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 private Logger logger = Logger.getLogger(GCServiceImpl.class);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 public Capabilities query(String path)
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 throws ServerException
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 logger.info("GCServiceImpl.query");
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 try {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 URL url = new URL(path);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 logger.debug("Open connection to url: " + path);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 URLConnection conn = url.openConnection();
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 conn.connect();
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 InputStream is = conn.getInputStream();
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 return parseCapabilitiesResponse(is);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 catch (MalformedURLException mue) {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 logger.warn(mue, mue);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 throw new ServerException(ERR_MALFORMED_URL);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 catch (IOException ioe) {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 logger.warn(ioe, ioe);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 throw new ServerException(ERR_GC_REQUEST_FAILED);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 protected Capabilities parseCapabilitiesResponse(InputStream is)
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 throws ServerException
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 logger.debug("GCServiceImpl.parseCapabilitiesResponse");
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 Document doc = XMLUtils.parseDocument(is, false);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 if (doc == null) {
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 throw new ServerException(ERR_GC_DOC_NOT_VALID);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
129 String title = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
130 doc,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
131 XPATH_TITLE,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
132 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
133
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
134 String onlineResource = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
135 doc,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
136 XPATH_ONLINE_RESOURCE,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
137 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
138
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 String fees = (String) XMLUtils.xpath(
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 doc,
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 XPATH_FEES,
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 XPathConstants.STRING);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 String accessConstraints = (String) XMLUtils.xpath(
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 doc,
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 XPATH_ACCESS_CONSTRAINTS,
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 XPathConstants.STRING);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
149 Node contactInformation = (Node) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
150 doc,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
151 XPATH_CONTACT_INFORMATION,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
152 XPathConstants.NODE);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
153
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
154 ContactInformation ci = parseContactInformation(contactInformation);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
155
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 logger.debug("Found fees: " + fees);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 logger.debug("Found access constraints: " + accessConstraints);
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
159 NodeList layerNodes = (NodeList) XMLUtils.xpath(
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
160 doc,
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
161 XPATH_LAYERS,
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
162 XPathConstants.NODESET);
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
163
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
164 List<WMSLayer> layers = parseLayers(layerNodes, onlineResource);
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
166 return new Capabilities(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
167 title,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
168 onlineResource,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
169 ci,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
170 fees,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
171 accessConstraints,
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
172 layers);
1409
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
173 }
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
174
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
175
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
176 protected ContactInformation parseContactInformation(Node node) {
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
177 String person = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
178 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
179 XPATH_CI_PERSON,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
180 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
181
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
182 String organization = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
183 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
184 XPATH_CI_ORGANIZATION,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
185 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
186
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
187 String address = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
188 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
189 XPATH_CI_ADDRESS,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
190 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
191
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
192 String postcode = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
193 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
194 XPATH_CI_POSTCODE,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
195 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
196
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
197 String city = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
198 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
199 XPATH_CI_CITY,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
200 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
201
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
202 String phone = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
203 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
204 XPATH_CI_PHONE,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
205 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
206
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
207 String email = (String) XMLUtils.xpath(
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
208 node,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
209 XPATH_CI_EMAIL,
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
210 XPathConstants.STRING);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
211
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
212 ContactInformation ci = new ContactInformation();
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
213 ci.setPerson(person);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
214 ci.setOrganization(organization);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
215 ci.setAddress(address);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
216 ci.setPostcode(postcode);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
217 ci.setCity(city);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
218 ci.setPhone(phone);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
219 ci.setEmail(email);
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
220
ec6e4dad1279 Read and display all FLYS relevant information of Capabilities documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1408
diff changeset
221 return ci;
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 }
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
223
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
224
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
225 /**
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
226 * @param layersNode
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
227 * @param onlineResource
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
228 *
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
229 * @return
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
230 */
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
231 protected List<WMSLayer> parseLayers(
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
232 NodeList layersNode,
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
233 String onlineResource
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
234 ) {
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
235 int len = layersNode != null ? layersNode.getLength() : 0;
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
236
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
237 logger.debug("Node has " + len + " layers.");
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
238
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
239 List<WMSLayer> layers = new ArrayList<WMSLayer>(len);
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
240
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
241 for (int i = 0; i < len; i++) {
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
242 layers.add(parseLayer(layersNode.item(i), onlineResource));
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
243 }
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
244
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
245 return layers;
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
246 }
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
247
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
248
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
249 protected WMSLayer parseLayer(Node layerNode, String onlineResource) {
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
250 String title = (String) XMLUtils.xpath(
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
251 layerNode,
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
252 "Title/text()",
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
253 XPathConstants.STRING);
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
254
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
255 String name = (String) XMLUtils.xpath(
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
256 layerNode,
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
257 "Name/text()",
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
258 XPathConstants.STRING);
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
259
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
260 logger.debug("Found layers: " + title + "(" + name + ")");
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
261
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
262 NodeList layersNodes = (NodeList) XMLUtils.xpath(
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
263 layerNode,
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
264 "Layer",
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
265 XPathConstants.NODESET);
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
266
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
267 List<WMSLayer> layers = parseLayers(layersNodes, onlineResource);
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
268
1414
3484cbfaf369 Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1411
diff changeset
269 return new WMSLayer(onlineResource, title, name, layers);
1411
63be3137abac Parse and display WMS layers supported by a user specified WMS service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1409
diff changeset
270 }
1408
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 }
5b5a20e4c4e5 Added a service that loads the Capabilities of a specified WMS - display those information in the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org