teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5861: * Software engineering by Intevation GmbH teichmann@5861: * teichmann@5861: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5861: * documentation coming with Dive4Elements River for details. teichmann@5861: */ teichmann@5861: teichmann@5835: package org.dive4elements.river.client.server; raimund@2455: raimund@2455: import java.io.InputStream; raimund@2455: raimund@2455: import java.util.Map; raimund@2455: import java.util.HashMap; raimund@2455: raimund@2455: import org.w3c.dom.Document; raimund@2455: import org.w3c.dom.NodeList; raimund@2455: import org.w3c.dom.Element; raimund@2455: raimund@2455: import org.apache.log4j.Logger; raimund@2455: raimund@2455: import com.google.gwt.user.server.rpc.RemoteServiceServlet; raimund@2455: teichmann@5835: import org.dive4elements.artifacts.common.utils.XMLUtils; raimund@2455: teichmann@5835: import org.dive4elements.river.client.shared.exceptions.ServerException; teichmann@5835: import org.dive4elements.river.client.client.services.MapUrlService; raimund@2455: raimund@2455: raimund@2455: public class MapUrlServiceImpl raimund@2455: extends RemoteServiceServlet raimund@2455: implements MapUrlService raimund@2455: { raimund@2455: raimund@2455: private static final Logger logger = raimund@2455: Logger.getLogger(MapUrlServiceImpl.class); raimund@2455: raimund@2455: raimund@2455: public Map getUrls() raimund@2455: throws ServerException raimund@2455: { raimund@2455: logger.info("MapUrlServiceImpl.getUrls"); raimund@2455: Map urls = new HashMap(); raimund@2455: raimund@2455: InputStream in = getServletContext().getResourceAsStream("/WEB-INF/wms-services.xml"); raimund@2455: raimund@2455: Document doc = XMLUtils.parseDocument(in); raimund@2455: raimund@2455: NodeList list = doc.getElementsByTagName("wms"); raimund@2455: for (int i = 0; i < list.getLength(); i++) { raimund@2455: Element e = (Element) list.item(i); raimund@2455: urls.put(e.getAttribute("url"), e.getAttribute("name")); raimund@2455: } raimund@2455: raimund@2455: return urls; raimund@2455: } raimund@2455: } raimund@2455: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :