Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/server/DescribeCollectionServiceImpl.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java@bc06a671ef60 |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.server; | |
2 | |
3 import org.w3c.dom.Document; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import com.google.gwt.user.server.rpc.RemoteServiceServlet; | |
8 | |
9 import de.intevation.artifacts.common.utils.ClientProtocolUtils; | |
10 | |
11 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; | |
12 import de.intevation.artifacts.httpclient.http.HttpClient; | |
13 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | |
14 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; | |
15 | |
16 import de.intevation.flys.client.shared.exceptions.ServerException; | |
17 import de.intevation.flys.client.shared.model.Collection; | |
18 | |
19 import de.intevation.flys.client.client.services.DescribeCollectionService; | |
20 | |
21 | |
22 /** | |
23 * This service implements a method that queries the DESCRIBE document of a | |
24 * specific collection and returns a Collection object with the information of | |
25 * the document. | |
26 * | |
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
28 */ | |
29 public class DescribeCollectionServiceImpl | |
30 extends RemoteServiceServlet | |
31 implements DescribeCollectionService | |
32 { | |
33 private static final Logger logger = | |
34 Logger.getLogger(DescribeCollectionServiceImpl.class); | |
35 | |
36 | |
37 /** The error message key that is thrown if an error occured while | |
38 * describe() a Collection.*/ | |
39 public static final String ERROR_DESCRIBE_COLLECTION = | |
40 "error_describe_collection"; | |
41 | |
42 | |
43 public Collection describe(String uuid, String locale) | |
44 throws ServerException | |
45 { | |
46 logger.info("DescribeCollectionServiceImpl.describe"); | |
47 | |
48 String url = getServletContext().getInitParameter("server-url"); | |
49 | |
50 Document describe = ClientProtocolUtils.newDescribeCollectionDocument( | |
51 uuid); | |
52 | |
53 HttpClient client = new HttpClientImpl(url, locale); | |
54 | |
55 try { | |
56 Document response = (Document) client.doCollectionAction( | |
57 describe, uuid, new DocumentResponseHandler()); | |
58 | |
59 Collection c = CollectionHelper.parseCollection(response); | |
60 | |
61 if (c == null) { | |
62 throw new ServerException(ERROR_DESCRIBE_COLLECTION); | |
63 } | |
64 | |
65 logger.debug("Collection successfully parsed."); | |
66 | |
67 return c; | |
68 } | |
69 catch (ConnectionException ce) { | |
70 logger.error(ce, ce); | |
71 } | |
72 | |
73 throw new ServerException(ERROR_DESCRIBE_COLLECTION); | |
74 } | |
75 } | |
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |