Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/server/FeedServiceImpl.java @ 8203:238fc722f87a
sed 's/logger/log/g' src/**/*.java
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 13:19:22 +0200 |
parents | ea9eef426962 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8202:e4606eae8ea5 | 8203:238fc722f87a |
---|---|
38 */ | 38 */ |
39 public class FeedServiceImpl | 39 public class FeedServiceImpl |
40 extends RemoteServiceServlet | 40 extends RemoteServiceServlet |
41 implements FeedService | 41 implements FeedService |
42 { | 42 { |
43 private static final Logger logger = Logger.getLogger(FeedServiceImpl.class); | 43 private static final Logger log = Logger.getLogger(FeedServiceImpl.class); |
44 | 44 |
45 | 45 |
46 /** XPath that points to the result type of a feed or advance operation.*/ | 46 /** XPath that points to the result type of a feed or advance operation.*/ |
47 public static final String XPATH_RESULT = "/art:result/@art:type"; | 47 public static final String XPATH_RESULT = "/art:result/@art:type"; |
48 | 48 |
70 String locale, | 70 String locale, |
71 Artifact artifact, | 71 Artifact artifact, |
72 Data[] data) | 72 Data[] data) |
73 throws ServerException | 73 throws ServerException |
74 { | 74 { |
75 logger.info("StepForwardServiceImpl.feed"); | 75 log.info("StepForwardServiceImpl.feed"); |
76 | 76 |
77 String url = getServletContext().getInitParameter("server-url"); | 77 String url = getServletContext().getInitParameter("server-url"); |
78 | 78 |
79 Document feed = ClientProtocolUtils.newFeedDocument( | 79 Document feed = ClientProtocolUtils.newFeedDocument( |
80 artifact.getUuid(), | 80 artifact.getUuid(), |
90 artifact.getHash()), | 90 artifact.getHash()), |
91 feed, | 91 feed, |
92 new DocumentResponseHandler()); | 92 new DocumentResponseHandler()); |
93 | 93 |
94 if (description == null) { | 94 if (description == null) { |
95 logger.warn("StepForwardService.feed() - FAILED"); | 95 log.warn("StepForwardService.feed() - FAILED"); |
96 throw new ServerException(ERROR_FEED_DATA); | 96 throw new ServerException(ERROR_FEED_DATA); |
97 } | 97 } |
98 | 98 |
99 String result = XMLUtils.xpathString( | 99 String result = XMLUtils.xpathString( |
100 description, | 100 description, |
101 XPATH_RESULT, | 101 XPATH_RESULT, |
102 ArtifactNamespaceContext.INSTANCE); | 102 ArtifactNamespaceContext.INSTANCE); |
103 | 103 |
104 if (result == null || !result.equals(OPERATION_FAILURE)) { | 104 if (result == null || !result.equals(OPERATION_FAILURE)) { |
105 logger.debug("StepForwardService.feed() - SUCCESS"); | 105 log.debug("StepForwardService.feed() - SUCCESS"); |
106 return (Artifact) new FLYSArtifactCreator().create(description); | 106 return (Artifact) new FLYSArtifactCreator().create(description); |
107 } | 107 } |
108 else if (result != null && result.equals(OPERATION_FAILURE)) { | 108 else if (result != null && result.equals(OPERATION_FAILURE)) { |
109 String msg = XMLUtils.xpathString( | 109 String msg = XMLUtils.xpathString( |
110 description, | 110 description, |
112 ArtifactNamespaceContext.INSTANCE); | 112 ArtifactNamespaceContext.INSTANCE); |
113 throw new ServerException(msg); | 113 throw new ServerException(msg); |
114 } | 114 } |
115 } | 115 } |
116 catch (ConnectionException ce) { | 116 catch (ConnectionException ce) { |
117 logger.error(ce, ce); | 117 log.error(ce, ce); |
118 } | 118 } |
119 | 119 |
120 logger.warn("StepForwardService.feed() - FAILED"); | 120 log.warn("StepForwardService.feed() - FAILED"); |
121 throw new ServerException(ERROR_FEED_DATA); | 121 throw new ServerException(ERROR_FEED_DATA); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 /** | 125 /** |
135 String locale, | 135 String locale, |
136 List<Artifact> artifacts, | 136 List<Artifact> artifacts, |
137 Data[] data) | 137 Data[] data) |
138 throws ServerException | 138 throws ServerException |
139 { | 139 { |
140 logger.info("StepForwardServiceImpl.feedMany"); | 140 log.info("StepForwardServiceImpl.feedMany"); |
141 | 141 |
142 String url = getServletContext().getInitParameter("server-url"); | 142 String url = getServletContext().getInitParameter("server-url"); |
143 | 143 |
144 List<Artifact> resultArtifacts = new ArrayList<Artifact>(); | 144 List<Artifact> resultArtifacts = new ArrayList<Artifact>(); |
145 | 145 |
146 for (Artifact artifact: artifacts) { | 146 for (Artifact artifact: artifacts) { |
147 logger.info("feedMany: Relay to StepForwardServiceImpl.feed"); | 147 log.info("feedMany: Relay to StepForwardServiceImpl.feed"); |
148 Artifact fedArtifact = feed(locale, artifact, data); | 148 Artifact fedArtifact = feed(locale, artifact, data); |
149 resultArtifacts.add(fedArtifact); | 149 resultArtifacts.add(fedArtifact); |
150 } | 150 } |
151 | 151 |
152 return resultArtifacts; | 152 return resultArtifacts; |