Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeArtifactServiceImpl.java @ 1417:42d6cf6e10b7
Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
flys-client/trunk@3325 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 28 Nov 2011 15:55:26 +0000 |
parents | ab8eb2f544f2 |
children | bc06a671ef60 |
rev | line source |
---|---|
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.w3c.dom.Document; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
5 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
6 |
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.httpclient.http.HttpClient; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.client.shared.exceptions.ServerException; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.client.shared.model.Artifact; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.client.client.services.DescribeArtifactService; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * This interface provides artifact specific operation DESCRIBE. |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 */ |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public class DescribeArtifactServiceImpl |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 extends RemoteServiceServlet |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 implements DescribeArtifactService |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
30 private static final Logger logger = |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
31 Logger.getLogger(DescribeArtifactServiceImpl.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
32 |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
33 |
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public static final String ERROR_DESCRIBE_ARTIFACT = |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 "error_describe_artifact"; |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public Artifact describe(String url, String locale, Artifact artifact) |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 throws ServerException |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
41 logger.info("DescribeArtifactServiceImpl.describe"); |
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 Document describe = ClientProtocolUtils.newDescribeDocument( |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 artifact.getUuid(), |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 artifact.getHash(), |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 true); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 HttpClient client = new HttpClientImpl(url, locale); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 try { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
51 logger.debug("Start Http request now."); |
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 Document description = (Document) client.describe( |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 new de.intevation.artifacts.httpclient.objects.Artifact( |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 artifact.getUuid(), |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 artifact.getHash()), |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 describe, |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 new DocumentResponseHandler()); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 if (description != null) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
865
diff
changeset
|
61 logger.debug("Finished Http request sucessfully!"); |
865
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return (Artifact) new FLYSArtifactCreator().create(description); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 catch (ConnectionException ce) { |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 ce.printStackTrace(); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 } |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 throw new ServerException(ERROR_DESCRIBE_ARTIFACT); |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 } |
43f520f923a8
Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |