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