comparison gwt-client/src/main/java/org/dive4elements/river/client/server/SedimentLoadInfoServiceImpl.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 4a12fd5c9e29
children f54c4b858213
comparison
equal deleted inserted replaced
8202:e4606eae8ea5 8203:238fc722f87a
32 /** Service to fetch info about sediment load. */ 32 /** Service to fetch info about sediment load. */
33 public class SedimentLoadInfoServiceImpl 33 public class SedimentLoadInfoServiceImpl
34 extends RemoteServiceServlet 34 extends RemoteServiceServlet
35 implements SedimentLoadInfoService 35 implements SedimentLoadInfoService
36 { 36 {
37 private static final Logger logger = 37 private static final Logger log =
38 Logger.getLogger(SedimentLoadInfoServiceImpl.class); 38 Logger.getLogger(SedimentLoadInfoServiceImpl.class);
39 39
40 public static final String ERROR_NO_SEDIMENTLOADINFO_FOUND = 40 public static final String ERROR_NO_SEDIMENTLOADINFO_FOUND =
41 "error_no_sedimentloadinfo_found"; 41 "error_no_sedimentloadinfo_found";
42 42
47 String type, 47 String type,
48 double startKm, 48 double startKm,
49 double endKm) 49 double endKm)
50 throws ServerException 50 throws ServerException
51 { 51 {
52 logger.info("SedimentLoadInfoServiceImpl.getSedimentLoadInfo"); 52 log.info("SedimentLoadInfoServiceImpl.getSedimentLoadInfo");
53 53
54 String url = getServletContext().getInitParameter("server-url"); 54 String url = getServletContext().getInitParameter("server-url");
55 55
56 Document doc = XMLUtils.newDocument(); 56 Document doc = XMLUtils.newDocument();
57 57
79 HttpClient client = new HttpClientImpl(url, locale); 79 HttpClient client = new HttpClientImpl(url, locale);
80 80
81 try { 81 try {
82 Document result = client.callService(url, "sedimentloadinfo", doc); 82 Document result = client.callService(url, "sedimentloadinfo", doc);
83 83
84 logger.debug("Extract sedimentload info objects now."); 84 log.debug("Extract sedimentload info objects now.");
85 SedimentLoadInfoObject[] objects = 85 SedimentLoadInfoObject[] objects =
86 extractSedimentLoadInfoObjects(result); 86 extractSedimentLoadInfoObjects(result);
87 87
88 if (objects != null && objects.length > 0) { 88 if (objects != null && objects.length > 0) {
89 return objects; 89 return objects;
90 } 90 }
91 } 91 }
92 catch (ConnectionException ce) { 92 catch (ConnectionException ce) {
93 logger.error(ce, ce); 93 log.error(ce, ce);
94 } 94 }
95 95
96 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND); 96 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND);
97 } 97 }
98 98
109 throws ServerException 109 throws ServerException
110 { 110 {
111 NodeList list = result.getElementsByTagName("sedimentload"); 111 NodeList list = result.getElementsByTagName("sedimentload");
112 112
113 if (list == null || list.getLength() == 0) { 113 if (list == null || list.getLength() == 0) {
114 logger.warn("No sedimentload info found."); 114 log.warn("No sedimentload info found.");
115 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND); 115 throw new ServerException(ERROR_NO_SEDIMENTLOADINFO_FOUND);
116 } 116 }
117 117
118 int num = list.getLength(); 118 int num = list.getLength();
119 logger.debug("Response contains " + num + " objects."); 119 log.debug("Response contains " + num + " objects.");
120 120
121 List<SedimentLoadInfoObject> objects = 121 List<SedimentLoadInfoObject> objects =
122 new ArrayList<SedimentLoadInfoObject>(num); 122 new ArrayList<SedimentLoadInfoObject>(num);
123 123
124 for (int i = 0; i < num; i++) { 124 for (int i = 0; i < num; i++) {
128 if (obj != null) { 128 if (obj != null) {
129 objects.add(obj); 129 objects.add(obj);
130 } 130 }
131 } 131 }
132 132
133 logger.debug("Retrieved " + objects.size() + " sediment loads."); 133 log.debug("Retrieved " + objects.size() + " sediment loads.");
134 134
135 return (SedimentLoadInfoObject[]) 135 return (SedimentLoadInfoObject[])
136 objects.toArray(new SedimentLoadInfoObject[num]); 136 objects.toArray(new SedimentLoadInfoObject[num]);
137 } 137 }
138 138
152 152
153 if (desc.length() > 0 && date.length() > 0) { 153 if (desc.length() > 0 && date.length() > 0) {
154 return new SedimentLoadInfoObjectImpl(desc, date); 154 return new SedimentLoadInfoObjectImpl(desc, date);
155 } 155 }
156 156
157 logger.warn("Invalid sediment load info object found."); 157 log.warn("Invalid sediment load info object found.");
158 158
159 return null; 159 return null;
160 } 160 }
161 } 161 }
162 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 162 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org