annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeArtifactServiceImpl.java @ 865:43f520f923a8

Remove the loading panel when its Artifact's background process is finished. flys-client/trunk@2672 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 08 Sep 2011 07:44:05 +0000
parents
children ab8eb2f544f2
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
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 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
6
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 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
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.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
10 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
11 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
12 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
13
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.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
15 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
16 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
17
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
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 * 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
21 *
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 * @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
23 */
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 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
25 extends RemoteServiceServlet
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 implements DescribeArtifactService
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 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
29 "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
30
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 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
33 throws ServerException
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 System.out.println("DescribeArtifactServiceImpl.describe");
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 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
38 artifact.getUuid(),
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 artifact.getHash(),
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 true);
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 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
43
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 try {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 System.out.println("Start Http request now.");
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 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
48 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
49 artifact.getUuid(),
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 artifact.getHash()),
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 describe,
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 new DocumentResponseHandler());
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 if (description != null) {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 System.out.println("Finished Http request sucessfully!");
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 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
58 }
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 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
61 ce.printStackTrace();
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
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 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
65 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org