Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
864:c0e13cf826d7 | 865:43f520f923a8 |
---|---|
1 package de.intevation.flys.client.server; | |
2 | |
3 import org.w3c.dom.Document; | |
4 | |
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet; | |
6 | |
7 import de.intevation.artifacts.common.utils.ClientProtocolUtils; | |
8 | |
9 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; | |
10 import de.intevation.artifacts.httpclient.http.HttpClient; | |
11 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | |
12 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; | |
13 | |
14 import de.intevation.flys.client.shared.exceptions.ServerException; | |
15 import de.intevation.flys.client.shared.model.Artifact; | |
16 import de.intevation.flys.client.client.services.DescribeArtifactService; | |
17 | |
18 | |
19 /** | |
20 * This interface provides artifact specific operation DESCRIBE. | |
21 * | |
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
23 */ | |
24 public class DescribeArtifactServiceImpl | |
25 extends RemoteServiceServlet | |
26 implements DescribeArtifactService | |
27 { | |
28 public static final String ERROR_DESCRIBE_ARTIFACT = | |
29 "error_describe_artifact"; | |
30 | |
31 | |
32 public Artifact describe(String url, String locale, Artifact artifact) | |
33 throws ServerException | |
34 { | |
35 System.out.println("DescribeArtifactServiceImpl.describe"); | |
36 | |
37 Document describe = ClientProtocolUtils.newDescribeDocument( | |
38 artifact.getUuid(), | |
39 artifact.getHash(), | |
40 true); | |
41 | |
42 HttpClient client = new HttpClientImpl(url, locale); | |
43 | |
44 try { | |
45 System.out.println("Start Http request now."); | |
46 | |
47 Document description = (Document) client.describe( | |
48 new de.intevation.artifacts.httpclient.objects.Artifact( | |
49 artifact.getUuid(), | |
50 artifact.getHash()), | |
51 describe, | |
52 new DocumentResponseHandler()); | |
53 | |
54 if (description != null) { | |
55 System.out.println("Finished Http request sucessfully!"); | |
56 | |
57 return (Artifact) new FLYSArtifactCreator().create(description); | |
58 } | |
59 } | |
60 catch (ConnectionException ce) { | |
61 ce.printStackTrace(); | |
62 } | |
63 | |
64 throw new ServerException(ERROR_DESCRIBE_ARTIFACT); | |
65 } | |
66 } | |
67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |