annotate flys-client/src/main/java/de/intevation/flys/client/server/MapUrlServiceImpl.java @ 5170:c1b60f8c3390

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

http://dive4elements.wald.intevation.org