comparison gwt-client/src/main/java/org/dive4elements/river/client/server/StepForwardServiceImpl.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
37 */ 37 */
38 public class StepForwardServiceImpl 38 public class StepForwardServiceImpl
39 extends AdvanceServiceImpl 39 extends AdvanceServiceImpl
40 implements StepForwardService 40 implements StepForwardService
41 { 41 {
42 private static final Logger logger = 42 private static final Logger log =
43 Logger.getLogger(StepForwardServiceImpl.class); 43 Logger.getLogger(StepForwardServiceImpl.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";
68 * @return the modified artifact. 68 * @return the modified artifact.
69 */ 69 */
70 public Artifact go(String locale, Artifact artifact, Data[] data) 70 public Artifact go(String locale, Artifact artifact, Data[] data)
71 throws ServerException 71 throws ServerException
72 { 72 {
73 logger.info("StepForwardServiceImpl.go"); 73 log.info("StepForwardServiceImpl.go");
74 74
75 String url = getServletContext().getInitParameter("server-url"); 75 String url = getServletContext().getInitParameter("server-url");
76 76
77 Artifact afterFeed = feed(url, locale, artifact, data); 77 Artifact afterFeed = feed(url, locale, artifact, data);
78 78
79 if (afterFeed == null) { 79 if (afterFeed == null) {
80 logger.warn("StepForwardService.feed() - FAILED"); 80 log.warn("StepForwardService.feed() - FAILED");
81 throw new ServerException(ERROR_FEED_DATA); 81 throw new ServerException(ERROR_FEED_DATA);
82 } 82 }
83 83
84 ArtifactDescription desc = afterFeed.getArtifactDescription(); 84 ArtifactDescription desc = afterFeed.getArtifactDescription();
85 String[] reachable = desc.getReachableStates(); 85 String[] reachable = desc.getReachableStates();
86 86
87 if (reachable == null || reachable.length == 0) { 87 if (reachable == null || reachable.length == 0) {
88 logger.debug("Did not find any reachable state."); 88 log.debug("Did not find any reachable state.");
89 return afterFeed; 89 return afterFeed;
90 } 90 }
91 91
92 // We use the first reachable state as default target, maybe we need to 92 // We use the first reachable state as default target, maybe we need to
93 // change this later. 93 // change this later.
110 String locale, 110 String locale,
111 Artifact artifact, 111 Artifact artifact,
112 Data[] data) 112 Data[] data)
113 throws ServerException 113 throws ServerException
114 { 114 {
115 logger.info("StepForwardServiceImpl.feed"); 115 log.info("StepForwardServiceImpl.feed");
116 116
117 Document feed = ClientProtocolUtils.newFeedDocument( 117 Document feed = ClientProtocolUtils.newFeedDocument(
118 artifact.getUuid(), 118 artifact.getUuid(),
119 artifact.getHash(), 119 artifact.getHash(),
120 createKVP(data)); 120 createKVP(data));
128 artifact.getHash()), 128 artifact.getHash()),
129 feed, 129 feed,
130 new DocumentResponseHandler()); 130 new DocumentResponseHandler());
131 131
132 if (description == null) { 132 if (description == null) {
133 logger.warn("StepForwardService.feed() - FAILED"); 133 log.warn("StepForwardService.feed() - FAILED");
134 throw new ServerException(ERROR_FEED_DATA); 134 throw new ServerException(ERROR_FEED_DATA);
135 } 135 }
136 136
137 String result = XMLUtils.xpathString( 137 String result = XMLUtils.xpathString(
138 description, 138 description,
139 XPATH_RESULT, 139 XPATH_RESULT,
140 ArtifactNamespaceContext.INSTANCE); 140 ArtifactNamespaceContext.INSTANCE);
141 141
142 if (result == null || !result.equals(OPERATION_FAILURE)) { 142 if (result == null || !result.equals(OPERATION_FAILURE)) {
143 logger.debug("StepForwardService.feed() - SUCCESS"); 143 log.debug("StepForwardService.feed() - SUCCESS");
144 return (Artifact) new FLYSArtifactCreator().create(description); 144 return (Artifact) new FLYSArtifactCreator().create(description);
145 } 145 }
146 else if (result != null && result.equals(OPERATION_FAILURE)) { 146 else if (result != null && result.equals(OPERATION_FAILURE)) {
147 String msg = XMLUtils.xpathString( 147 String msg = XMLUtils.xpathString(
148 description, 148 description,
150 ArtifactNamespaceContext.INSTANCE); 150 ArtifactNamespaceContext.INSTANCE);
151 throw new ServerException(msg); 151 throw new ServerException(msg);
152 } 152 }
153 } 153 }
154 catch (ConnectionException ce) { 154 catch (ConnectionException ce) {
155 logger.error(ce, ce); 155 log.error(ce, ce);
156 } 156 }
157 157
158 logger.warn("StepForwardService.feed() - FAILED"); 158 log.warn("StepForwardService.feed() - FAILED");
159 throw new ServerException(ERROR_FEED_DATA); 159 throw new ServerException(ERROR_FEED_DATA);
160 } 160 }
161 161
162 162
163 /** 163 /**

http://dive4elements.wald.intevation.org