2455
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import java.io.InputStream; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import java.util.Map; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import java.util.HashMap; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import java.util.Enumeration; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import org.w3c.dom.Document; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.NodeList; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Element; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifacts.httpclient.http.HttpClient; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.exceptions.ServerException; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.model.Collection; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.client.client.services.MapUrlService; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 public class MapUrlServiceImpl |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 extends RemoteServiceServlet |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 implements MapUrlService |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 { |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 private static final Logger logger = |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 Logger.getLogger(MapUrlServiceImpl.class); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 public Map<String, String> getUrls() |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 throws ServerException |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 { |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 logger.info("MapUrlServiceImpl.getUrls"); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 Map<String, String> urls = new HashMap<String, String>(); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 InputStream in = getServletContext().getResourceAsStream("/WEB-INF/wms-services.xml"); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 Document doc = XMLUtils.parseDocument(in); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 NodeList list = doc.getElementsByTagName("wms"); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 for (int i = 0; i < list.getLength(); i++) { |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 Element e = (Element) list.item(i); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 urls.put(e.getAttribute("url"), e.getAttribute("name")); |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 } |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 return urls; |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 } |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 } |
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |