comparison flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 215:e02f50a3ad59

Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception. flys-client/trunk@1657 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 08 Apr 2011 08:51:28 +0000
parents f7967d12ce6e
children 924da6695800
comparison
equal deleted inserted replaced
214:29c6d9573ae7 215:e02f50a3ad59
18 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; 18 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
19 import de.intevation.artifacts.httpclient.http.HttpClient; 19 import de.intevation.artifacts.httpclient.http.HttpClient;
20 import de.intevation.artifacts.httpclient.http.HttpClientImpl; 20 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
21 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; 21 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
22 22
23 import de.intevation.flys.client.shared.exceptions.ServerException;
23 import de.intevation.flys.client.shared.model.Collection; 24 import de.intevation.flys.client.shared.model.Collection;
24 import de.intevation.flys.client.shared.model.CollectionItem; 25 import de.intevation.flys.client.shared.model.CollectionItem;
25 import de.intevation.flys.client.shared.model.DefaultCollection; 26 import de.intevation.flys.client.shared.model.DefaultCollection;
26 import de.intevation.flys.client.shared.model.DefaultCollectionItem; 27 import de.intevation.flys.client.shared.model.DefaultCollectionItem;
27 import de.intevation.flys.client.shared.model.DefaultOutputMode; 28 import de.intevation.flys.client.shared.model.DefaultOutputMode;
38 */ 39 */
39 public class DescribeCollectionServiceImpl 40 public class DescribeCollectionServiceImpl
40 extends RemoteServiceServlet 41 extends RemoteServiceServlet
41 implements DescribeCollectionService 42 implements DescribeCollectionService
42 { 43 {
43 public Collection describe(String uuid, String serverUrl) { 44 /** The error message key that is thrown if an error occured while
45 * describe() a Collection.*/
46 public static final String ERROR_DESCRIBE_COLLECTION =
47 "error_describe_collection";
48
49
50 public Collection describe(String uuid, String serverUrl)
51 throws ServerException
52 {
44 System.out.println("DescribeCollectionServiceImpl.describe"); 53 System.out.println("DescribeCollectionServiceImpl.describe");
45 54
46 Document describe = ClientProtocolUtils.newDescribeCollectionDocument( 55 Document describe = ClientProtocolUtils.newDescribeCollectionDocument(
47 uuid); 56 uuid);
48 57
53 describe, uuid, new DocumentResponseHandler()); 62 describe, uuid, new DocumentResponseHandler());
54 63
55 Collection c = parseCollection(response); 64 Collection c = parseCollection(response);
56 65
57 if (c == null) { 66 if (c == null) {
58 throw new NullPointerException("No collection returned."); 67 throw new ServerException(ERROR_DESCRIBE_COLLECTION);
59 } 68 }
60 69
61 return c; 70 return c;
62 } 71 }
63 catch (ConnectionException ce) { 72 catch (ConnectionException ce) {
64 System.err.println(ce.getLocalizedMessage()); 73 System.err.println(ce.getLocalizedMessage());
65 } 74 }
66 75
67 return null; 76 throw new ServerException(ERROR_DESCRIBE_COLLECTION);
68 } 77 }
69 78
70 79
71 /** 80 /**
72 * This method takes the DESCRIBE document of the Collections describe() 81 * This method takes the DESCRIBE document of the Collections describe()

http://dive4elements.wald.intevation.org