Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java @ 230:6de435235927
Added error messages that are displayed during the feed operation.
flys-client/trunk@1720 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 13:27:49 +0000 |
parents | 924da6695800 |
children | ab8eb2f544f2 |
comparison
equal
deleted
inserted
replaced
229:924da6695800 | 230:6de435235927 |
---|---|
29 extends AdvanceServiceImpl | 29 extends AdvanceServiceImpl |
30 implements StepForwardService | 30 implements StepForwardService |
31 { | 31 { |
32 /** XPath that points to the result type of a feed or advance operation.*/ | 32 /** XPath that points to the result type of a feed or advance operation.*/ |
33 public static final String XPATH_RESULT = "/art:result/@art:type"; | 33 public static final String XPATH_RESULT = "/art:result/@art:type"; |
34 | |
35 /** XPath that points to the result type of a feed or advance operation.*/ | |
36 public static final String XPATH_RESULT_MSG = "/art:result/text()"; | |
34 | 37 |
35 /** A constant that marks errors.*/ | 38 /** A constant that marks errors.*/ |
36 public static final String OPERATION_FAILURE = "FAILURE"; | 39 public static final String OPERATION_FAILURE = "FAILURE"; |
37 | 40 |
38 /** The error message key that is thrown if an error occured while feeding | 41 /** The error message key that is thrown if an error occured while feeding |
99 Document feed = ClientProtocolUtils.newFeedDocument( | 102 Document feed = ClientProtocolUtils.newFeedDocument( |
100 artifact.getUuid(), | 103 artifact.getUuid(), |
101 artifact.getHash(), | 104 artifact.getHash(), |
102 createKVP(data)); | 105 createKVP(data)); |
103 | 106 |
104 XMLDebug.out(feed); | |
105 | |
106 HttpClient client = new HttpClientImpl(url, locale); | 107 HttpClient client = new HttpClientImpl(url, locale); |
107 | 108 |
108 try { | 109 try { |
109 Document description = (Document) client.feed( | 110 Document description = (Document) client.feed( |
110 new de.intevation.artifacts.httpclient.objects.Artifact( | 111 new de.intevation.artifacts.httpclient.objects.Artifact( |
126 if (result == null || !result.equals(OPERATION_FAILURE)) { | 127 if (result == null || !result.equals(OPERATION_FAILURE)) { |
127 System.out.println("StepForwardService.feed() - SUCCESS"); | 128 System.out.println("StepForwardService.feed() - SUCCESS"); |
128 return (Artifact) new FLYSArtifactCreator().create(description); | 129 return (Artifact) new FLYSArtifactCreator().create(description); |
129 } | 130 } |
130 else if (result != null && result.equals(OPERATION_FAILURE)) { | 131 else if (result != null && result.equals(OPERATION_FAILURE)) { |
131 throw new ServerException(ERROR_FEED_DATA); | 132 String msg = XMLUtils.xpathString( |
133 description, | |
134 XPATH_RESULT_MSG, | |
135 ArtifactNamespaceContext.INSTANCE); | |
136 throw new ServerException(msg); | |
132 } | 137 } |
133 } | 138 } |
134 catch (ConnectionException ce) { | 139 catch (ConnectionException ce) { |
135 System.err.println(ce.getLocalizedMessage()); | 140 System.err.println(ce.getLocalizedMessage()); |
136 } | 141 } |