comparison gwt-client/src/main/java/org/dive4elements/river/client/server/GaugeInfoServiceImpl.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
39 */ 39 */
40 public class GaugeInfoServiceImpl 40 public class GaugeInfoServiceImpl
41 extends RemoteServiceServlet 41 extends RemoteServiceServlet
42 implements GaugeInfoService 42 implements GaugeInfoService
43 { 43 {
44 private static final Logger logger = 44 private static final Logger log =
45 Logger.getLogger(GaugeInfoServiceImpl.class); 45 Logger.getLogger(GaugeInfoServiceImpl.class);
46 46
47 47
48 public static final String ERROR_NO_GAUGES_FOUND = 48 public static final String ERROR_NO_GAUGES_FOUND =
49 "error_no_gaugeinfo_found"; 49 "error_no_gaugeinfo_found";
52 52
53 53
54 public List<Gauge> getGaugeInfo(String rivername, String refnumber) 54 public List<Gauge> getGaugeInfo(String rivername, String refnumber)
55 throws ServerException 55 throws ServerException
56 { 56 {
57 logger.info("GaugeInfoServiceImpl.getGaugeInfo"); 57 log.info("GaugeInfoServiceImpl.getGaugeInfo");
58 58
59 String url = getServletContext().getInitParameter("server-url"); 59 String url = getServletContext().getInitParameter("server-url");
60 60
61 Document doc = XMLUtils.newDocument(); 61 Document doc = XMLUtils.newDocument();
62 62
82 HttpClient client = new HttpClientImpl(url); 82 HttpClient client = new HttpClientImpl(url);
83 83
84 try { 84 try {
85 Document result = client.callService(url, "gaugeinfo", doc); 85 Document result = client.callService(url, "gaugeinfo", doc);
86 86
87 logger.debug("Extract gauge info now."); 87 log.debug("Extract gauge info now.");
88 List<Gauge> gauges = extractGauges(result); 88 List<Gauge> gauges = extractGauges(result);
89 89
90 if (gauges != null && gauges.size() > 0) { 90 if (gauges != null && gauges.size() > 0) {
91 return gauges; 91 return gauges;
92 } 92 }
93 } 93 }
94 catch (ConnectionException ce) { 94 catch (ConnectionException ce) {
95 logger.error(ce, ce); 95 log.error(ce, ce);
96 } 96 }
97 97
98 throw new ServerException(ERROR_NO_GAUGES_FOUND); 98 throw new ServerException(ERROR_NO_GAUGES_FOUND);
99 } 99 }
100 100
116 XPATH_GAUGES, 116 XPATH_GAUGES,
117 XPathConstants.NODESET, 117 XPathConstants.NODESET,
118 ArtifactNamespaceContext.INSTANCE); 118 ArtifactNamespaceContext.INSTANCE);
119 119
120 if (list == null || list.getLength() == 0) { 120 if (list == null || list.getLength() == 0) {
121 logger.warn("No gauges found."); 121 log.warn("No gauges found.");
122 122
123 throw new ServerException(ERROR_NO_GAUGES_FOUND); 123 throw new ServerException(ERROR_NO_GAUGES_FOUND);
124 } 124 }
125 125
126 int num = list.getLength(); 126 int num = list.getLength();
127 logger.debug("Response contains " + num + " objects."); 127 log.debug("Response contains " + num + " objects.");
128 128
129 for (int i = 0; i < num; i++) { 129 for (int i = 0; i < num; i++) {
130 Gauge obj = buildGauge((Element) list.item(i)); 130 Gauge obj = buildGauge((Element) list.item(i));
131 131
132 if (obj != null) { 132 if (obj != null) {
133 gauges.add(obj); 133 gauges.add(obj);
134 } 134 }
135 } 135 }
136 136
137 logger.debug("Retrieved " + gauges.size() + " gauges."); 137 log.debug("Retrieved " + gauges.size() + " gauges.");
138 138
139 return gauges; 139 return gauges;
140 } 140 }
141 141
142 142
151 name, 151 name,
152 Double.valueOf(lowerStr), 152 Double.valueOf(lowerStr),
153 Double.valueOf(upperStr)); 153 Double.valueOf(upperStr));
154 } 154 }
155 catch (NumberFormatException nfe) { 155 catch (NumberFormatException nfe) {
156 logger.warn("Error while Gauge creation: " + nfe.getMessage()); 156 log.warn("Error while Gauge creation: " + nfe.getMessage());
157 } 157 }
158 } 158 }
159 159
160 return null; 160 return null;
161 } 161 }

http://dive4elements.wald.intevation.org