Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java @ 1365:4c65c5b60a86
First step of refactoring the map creation - implemented a MapOutputService.
flys-client/trunk@3066 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 25 Oct 2011 10:29:37 +0000 |
parents | |
children | ab8eb2f544f2 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapOutputServiceImpl.java Tue Oct 25 10:29:37 2011 +0000 @@ -0,0 +1,56 @@ +package de.intevation.flys.client.server; + +import java.io.InputStream; +import java.io.IOException; + +import org.w3c.dom.Document; + +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +import de.intevation.artifacts.common.utils.ClientProtocolUtils; +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.artifacts.httpclient.http.HttpClient; +import de.intevation.artifacts.httpclient.http.HttpClientImpl; +import de.intevation.artifacts.httpclient.exceptions.ConnectionException; + +import de.intevation.flys.client.shared.exceptions.ServerException; +import de.intevation.flys.client.shared.model.Collection; + +import de.intevation.flys.client.client.services.MapOutputService; + + +public class MapOutputServiceImpl +extends RemoteServiceServlet +implements MapOutputService +{ + + public void doOut(Collection collection, String serverUrl) + throws ServerException + { + System.out.println("MapOutputServiceImpl.doGet"); + + String uuid = collection.identifier(); + + try { + Document request = ClientProtocolUtils.newOutCollectionDocument( + uuid, "floodmap", "floodmap"); + + HttpClient client = new HttpClientImpl(serverUrl); + InputStream is = client.collectionOut(request, uuid, "floodmap"); + + Document response = XMLUtils.parseDocument(is); + + // TODO parse response document and return a MapConfig object + } + catch (ConnectionException e) { + e.printStackTrace(); + System.err.println(e.getMessage()); + } + catch (IOException ioe) { + ioe.printStackTrace(); + System.err.println(ioe.getMessage()); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :