Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java @ 1376:28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
flys-client/trunk@3096 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 28 Oct 2011 06:12:51 +0000 |
parents | 9085cffbb7c4 |
children | f7b3d5833f3b |
comparison
equal
deleted
inserted
replaced
1375:dc715351527f | 1376:28eb4dfe2cbf |
---|---|
16 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | 16 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
17 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; | 17 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
18 | 18 |
19 import de.intevation.flys.client.shared.exceptions.ServerException; | 19 import de.intevation.flys.client.shared.exceptions.ServerException; |
20 import de.intevation.flys.client.shared.model.Collection; | 20 import de.intevation.flys.client.shared.model.Collection; |
21 import de.intevation.flys.client.shared.model.MapConfig; | |
21 | 22 |
22 import de.intevation.flys.client.client.services.MapOutputService; | 23 import de.intevation.flys.client.client.services.MapOutputService; |
23 | 24 |
24 | 25 |
25 public class MapOutputServiceImpl | 26 public class MapOutputServiceImpl |
29 | 30 |
30 private static final Logger logger = | 31 private static final Logger logger = |
31 Logger.getLogger(MapOutputServiceImpl.class); | 32 Logger.getLogger(MapOutputServiceImpl.class); |
32 | 33 |
33 | 34 |
34 public void doOut(Collection collection) | 35 public static final String ERROR_NO_MAP_CONFIG = "error_no_map_config"; |
36 | |
37 | |
38 public MapConfig doOut(Collection collection) | |
35 throws ServerException | 39 throws ServerException |
36 { | 40 { |
37 logger.info("MapOutputServiceImpl.doOut"); | 41 logger.info("MapOutputServiceImpl.doOut"); |
38 | 42 |
39 String url = getServletContext().getInitParameter("server-url"); | 43 String url = getServletContext().getInitParameter("server-url"); |
46 HttpClient client = new HttpClientImpl(url); | 50 HttpClient client = new HttpClientImpl(url); |
47 InputStream is = client.collectionOut(request, uuid, "floodmap"); | 51 InputStream is = client.collectionOut(request, uuid, "floodmap"); |
48 | 52 |
49 Document response = XMLUtils.parseDocument(is); | 53 Document response = XMLUtils.parseDocument(is); |
50 | 54 |
51 logger.debug(XMLUtils.toString(response)); | 55 return MapHelper.parseConfig(response); |
52 | |
53 // TODO parse response document and return a MapConfig object | |
54 } | 56 } |
55 catch (ConnectionException e) { | 57 catch (ConnectionException e) { |
56 logger.error(e, e); | 58 logger.error(e, e); |
57 } | 59 } |
58 catch (IOException ioe) { | 60 catch (IOException ioe) { |
59 logger.error(ioe, ioe); | 61 logger.error(ioe, ioe); |
60 } | 62 } |
63 | |
64 throw new ServerException(ERROR_NO_MAP_CONFIG); | |
61 } | 65 } |
62 } | 66 } |
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |