Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/CollectionItemAttributeServiceImpl.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 | b18b32269a3f |
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 import org.w3c.dom.Element; | 4 import org.w3c.dom.Element; |
5 import org.w3c.dom.NodeList; | 5 import org.w3c.dom.NodeList; |
6 | |
7 import org.apache.log4j.Logger; | |
6 | 8 |
7 import com.google.gwt.user.server.rpc.RemoteServiceServlet; | 9 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
8 | 10 |
9 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; | 11 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
10 import de.intevation.artifacts.httpclient.http.HttpClient; | 12 import de.intevation.artifacts.httpclient.http.HttpClient; |
29 */ | 31 */ |
30 public class CollectionItemAttributeServiceImpl | 32 public class CollectionItemAttributeServiceImpl |
31 extends RemoteServiceServlet | 33 extends RemoteServiceServlet |
32 implements CollectionItemAttributeService | 34 implements CollectionItemAttributeService |
33 { | 35 { |
36 private static final Logger logger = | |
37 Logger.getLogger(CollectionItemAttributeServiceImpl.class); | |
38 | |
39 | |
34 public static final String XPATH_RESULT = "/art:result/text()"; | 40 public static final String XPATH_RESULT = "/art:result/text()"; |
35 | 41 |
36 public static final String OPERATION_FAILURE = "FAILED"; | 42 public static final String OPERATION_FAILURE = "FAILED"; |
37 | 43 |
38 public static final String ERROR_NO_STYLES_FOUND = | 44 public static final String ERROR_NO_STYLES_FOUND = |
44 String artifact, | 50 String artifact, |
45 String url, | 51 String url, |
46 String locale) | 52 String locale) |
47 throws ServerException | 53 throws ServerException |
48 { | 54 { |
49 System.out.println( | 55 logger.info( |
50 "CollectionItemAttributeServiceImpl.getCollectionItemAttribute"); | 56 "CollectionItemAttributeServiceImpl.getCollectionItemAttribute"); |
51 | 57 |
52 Document requestDoc = XMLUtils.newDocument(); | 58 Document requestDoc = XMLUtils.newDocument(); |
53 | 59 |
54 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | 60 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
75 collection.identifier(), | 81 collection.identifier(), |
76 new DocumentResponseHandler()); | 82 new DocumentResponseHandler()); |
77 return readXML (res, artifact); | 83 return readXML (res, artifact); |
78 } | 84 } |
79 catch (ConnectionException ce) { | 85 catch (ConnectionException ce) { |
80 System.err.println(ce.getLocalizedMessage()); | 86 logger.error(ce, ce); |
81 } | 87 } |
82 | 88 |
83 throw new ServerException(ERROR_NO_STYLES_FOUND); | 89 throw new ServerException(ERROR_NO_STYLES_FOUND); |
84 } | 90 } |
85 | 91 |
90 String url, | 96 String url, |
91 String locale, | 97 String locale, |
92 CollectionItemAttribute attributes) | 98 CollectionItemAttribute attributes) |
93 throws ServerException | 99 throws ServerException |
94 { | 100 { |
95 System.out.println( | 101 logger.info( |
96 "CollectionItemAttributeServiceImpl.setCollectionItemAttribute"); | 102 "CollectionItemAttributeServiceImpl.setCollectionItemAttribute"); |
97 | 103 |
98 Document doc = writeXML(attributes, artifact); | 104 Document doc = writeXML(attributes, artifact); |
99 | 105 |
100 try { | 106 try { |
105 new DocumentResponseHandler()); | 111 new DocumentResponseHandler()); |
106 | 112 |
107 return; | 113 return; |
108 } | 114 } |
109 catch (ConnectionException ce) { | 115 catch (ConnectionException ce) { |
110 System.err.println(ce.getLocalizedMessage()); | 116 logger.error(ce, ce); |
111 } | 117 throw new ServerException(ce.getLocalizedMessage()); |
112 throw new ServerException(""); | 118 } |
113 } | 119 } |
114 | 120 |
115 protected CollectionItemAttribute readXML(Document doc, String artifact) | 121 protected CollectionItemAttribute readXML(Document doc, String artifact) |
116 throws ServerException | 122 throws ServerException |
117 { | 123 { |