Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/MapUrlServiceImpl.java @ 9757:d536a2184ddf 3.2.x
Put WMS services config in line with other config files
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 12 Oct 2022 15:42:04 +0200 |
parents | 0a5239a1e46e |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server; |
2455 | 10 |
9757
d536a2184ddf
Put WMS services config in line with other config files
Tom Gottfried <tom@intevation.de>
parents:
9726
diff
changeset
|
11 import java.io.File; |
2455 | 12 |
13 import java.util.Map; | |
14 import java.util.HashMap; | |
15 | |
16 import org.w3c.dom.Document; | |
17 import org.w3c.dom.NodeList; | |
18 import org.w3c.dom.Element; | |
19 | |
9726 | 20 import org.apache.logging.log4j.Logger; |
21 import org.apache.logging.log4j.LogManager; | |
2455 | 22 |
23 import com.google.gwt.user.server.rpc.RemoteServiceServlet; | |
24 | |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.artifacts.common.utils.XMLUtils; |
2455 | 26 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.river.client.shared.exceptions.ServerException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.river.client.client.services.MapUrlService; |
2455 | 29 |
30 | |
31 public class MapUrlServiceImpl | |
32 extends RemoteServiceServlet | |
33 implements MapUrlService | |
34 { | |
35 | |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
36 private static final Logger log = |
9726 | 37 LogManager.getLogger(MapUrlServiceImpl.class); |
2455 | 38 |
39 | |
40 public Map<String, String> getUrls() | |
41 throws ServerException | |
42 { | |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
43 log.info("MapUrlServiceImpl.getUrls"); |
2455 | 44 Map<String, String> urls = new HashMap<String, String>(); |
45 | |
9757
d536a2184ddf
Put WMS services config in line with other config files
Tom Gottfried <tom@intevation.de>
parents:
9726
diff
changeset
|
46 File file = new File( |
d536a2184ddf
Put WMS services config in line with other config files
Tom Gottfried <tom@intevation.de>
parents:
9726
diff
changeset
|
47 getServletContext().getInitParameter("wms-services-file")); |
2455 | 48 |
9757
d536a2184ddf
Put WMS services config in line with other config files
Tom Gottfried <tom@intevation.de>
parents:
9726
diff
changeset
|
49 Document doc = XMLUtils.parseDocument(file); |
2455 | 50 |
51 NodeList list = doc.getElementsByTagName("wms"); | |
52 for (int i = 0; i < list.getLength(); i++) { | |
53 Element e = (Element) list.item(i); | |
54 urls.put(e.getAttribute("url"), e.getAttribute("name")); | |
55 } | |
56 | |
57 return urls; | |
58 } | |
59 } | |
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |