comparison flys-client/src/main/java/de/intevation/flys/client/server/FeedServiceImpl.java @ 1367:ab8eb2f544f2

Replaced stdout and stderr logging with log4j loggers in server classes. flys-client/trunk@3069 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 25 Oct 2011 12:31:15 +0000
parents 3d379e6b9a5f
children bc06a671ef60
comparison
equal deleted inserted replaced
1366:d0eb2202ffbe 1367:ab8eb2f544f2
1 package de.intevation.flys.client.server; 1 package de.intevation.flys.client.server;
2 2
3 import org.w3c.dom.Document; 3 import org.w3c.dom.Document;
4
5 import org.apache.log4j.Logger;
4 6
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet; 7 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
6 8
7 import de.intevation.artifacts.common.ArtifactNamespaceContext; 9 import de.intevation.artifacts.common.ArtifactNamespaceContext;
8 import de.intevation.artifacts.common.utils.ClientProtocolUtils; 10 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
25 */ 27 */
26 public class FeedServiceImpl 28 public class FeedServiceImpl
27 extends RemoteServiceServlet 29 extends RemoteServiceServlet
28 implements FeedService 30 implements FeedService
29 { 31 {
32 private static final Logger logger = Logger.getLogger(FeedServiceImpl.class);
33
34
30 /** XPath that points to the result type of a feed or advance operation.*/ 35 /** XPath that points to the result type of a feed or advance operation.*/
31 public static final String XPATH_RESULT = "/art:result/@art:type"; 36 public static final String XPATH_RESULT = "/art:result/@art:type";
32 37
33 /** XPath that points to the result type of a feed or advance operation.*/ 38 /** XPath that points to the result type of a feed or advance operation.*/
34 public static final String XPATH_RESULT_MSG = "/art:result/text()"; 39 public static final String XPATH_RESULT_MSG = "/art:result/text()";
56 String locale, 61 String locale,
57 Artifact artifact, 62 Artifact artifact,
58 Data[] data) 63 Data[] data)
59 throws ServerException 64 throws ServerException
60 { 65 {
61 System.out.println("StepForwardServiceImpl.feed"); 66 logger.info("StepForwardServiceImpl.feed");
62 67
63 Document feed = ClientProtocolUtils.newFeedDocument( 68 Document feed = ClientProtocolUtils.newFeedDocument(
64 artifact.getUuid(), 69 artifact.getUuid(),
65 artifact.getHash(), 70 artifact.getHash(),
66 createKVP(data)); 71 createKVP(data));
74 artifact.getHash()), 79 artifact.getHash()),
75 feed, 80 feed,
76 new DocumentResponseHandler()); 81 new DocumentResponseHandler());
77 82
78 if (description == null) { 83 if (description == null) {
79 System.err.println("StepForwardService.feed() - FAILED"); 84 logger.warn("StepForwardService.feed() - FAILED");
80 throw new ServerException(ERROR_FEED_DATA); 85 throw new ServerException(ERROR_FEED_DATA);
81 } 86 }
82 87
83 String result = XMLUtils.xpathString( 88 String result = XMLUtils.xpathString(
84 description, 89 description,
85 XPATH_RESULT, 90 XPATH_RESULT,
86 ArtifactNamespaceContext.INSTANCE); 91 ArtifactNamespaceContext.INSTANCE);
87 92
88 if (result == null || !result.equals(OPERATION_FAILURE)) { 93 if (result == null || !result.equals(OPERATION_FAILURE)) {
89 System.out.println("StepForwardService.feed() - SUCCESS"); 94 logger.debug("StepForwardService.feed() - SUCCESS");
90 return (Artifact) new FLYSArtifactCreator().create(description); 95 return (Artifact) new FLYSArtifactCreator().create(description);
91 } 96 }
92 else if (result != null && result.equals(OPERATION_FAILURE)) { 97 else if (result != null && result.equals(OPERATION_FAILURE)) {
93 String msg = XMLUtils.xpathString( 98 String msg = XMLUtils.xpathString(
94 description, 99 description,
96 ArtifactNamespaceContext.INSTANCE); 101 ArtifactNamespaceContext.INSTANCE);
97 throw new ServerException(msg); 102 throw new ServerException(msg);
98 } 103 }
99 } 104 }
100 catch (ConnectionException ce) { 105 catch (ConnectionException ce) {
101 System.err.println(ce.getLocalizedMessage()); 106 logger.error(ce, ce);
102 } 107 }
103 108
104 System.err.println("StepForwardService.feed() - FAILED"); 109 logger.warn("StepForwardService.feed() - FAILED");
105 throw new ServerException(ERROR_FEED_DATA); 110 throw new ServerException(ERROR_FEED_DATA);
106 } 111 }
107 112
108 113
109 /** 114 /**

http://dive4elements.wald.intevation.org