comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/MapInfoService.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents af13ceeba52a
children 5e38e2924c07
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
50 50
51 private static final String XPATH_RIVER_WMS = 51 private static final String XPATH_RIVER_WMS =
52 "/artifact-database/*[local-name()=$maptype]/river[@name=$river]/river-wms"; 52 "/artifact-database/*[local-name()=$maptype]/river[@name=$river]/river-wms";
53 53
54 54
55 /** The logger used in this service.*/ 55 /** The log used in this service.*/
56 private static Logger logger = Logger.getLogger(MapInfoService.class); 56 private static Logger log = Logger.getLogger(MapInfoService.class);
57 57
58 58
59 /** 59 /**
60 * The default constructor. 60 * The default constructor.
61 */ 61 */
84 public Document processXML( 84 public Document processXML(
85 Document data, 85 Document data,
86 GlobalContext globalContext, 86 GlobalContext globalContext,
87 CallMeta callMeta 87 CallMeta callMeta
88 ) { 88 ) {
89 logger.debug("MapInfoService.process"); 89 log.debug("MapInfoService.process");
90 90
91 Document result = XMLUtils.newDocument(); 91 Document result = XMLUtils.newDocument();
92 ElementCreator cr = new ElementCreator(result, null, null); 92 ElementCreator cr = new ElementCreator(result, null, null);
93 93
94 Element mapinfo = cr.create("mapinfo"); 94 Element mapinfo = cr.create("mapinfo");
95 result.appendChild(mapinfo); 95 result.appendChild(mapinfo);
96 96
97 String river = extractRiver(data); 97 String river = extractRiver(data);
98 if (river == null || river.length() == 0) { 98 if (river == null || river.length() == 0) {
99 logger.warn("Cannot generate information: river is empty!"); 99 log.warn("Cannot generate information: river is empty!");
100 return result; 100 return result;
101 } 101 }
102 102
103 String mapType = extractMaptype(data); 103 String mapType = extractMaptype(data);
104 if (mapType == null 104 if (mapType == null
111 mapinfo.appendChild(root); 111 mapinfo.appendChild(root);
112 112
113 Envelope env = GeometryUtils.getRiverBoundary(river); 113 Envelope env = GeometryUtils.getRiverBoundary(river);
114 if (env != null) { 114 if (env != null) {
115 String bounds = GeometryUtils.jtsBoundsToOLBounds(env); 115 String bounds = GeometryUtils.jtsBoundsToOLBounds(env);
116 if (logger.isDebugEnabled()) { 116 if (log.isDebugEnabled()) {
117 logger.debug("River '" + river + "' bounds: " + bounds); 117 log.debug("River '" + river + "' bounds: " + bounds);
118 } 118 }
119 119
120 Element bbox = cr.create("bbox"); 120 Element bbox = cr.create("bbox");
121 cr.addAttr(bbox, "value", bounds); 121 cr.addAttr(bbox, "value", bounds);
122 root.appendChild(bbox); 122 root.appendChild(bbox);
132 Element srid = cr.create("srid"); 132 Element srid = cr.create("srid");
133 cr.addAttr(srid, "value", sridStr); 133 cr.addAttr(srid, "value", sridStr);
134 root.appendChild(srid); 134 root.appendChild(srid);
135 } 135 }
136 136
137 if (logger.isDebugEnabled()) { 137 if (log.isDebugEnabled()) {
138 logger.debug("processXML: " + XMLUtils.toString(root)); 138 log.debug("processXML: " + XMLUtils.toString(root));
139 } 139 }
140 140
141 root.appendChild( 141 root.appendChild(
142 createWMSElement("background-wms", 142 createWMSElement("background-wms",
143 XPATH_RIVER_BACKGROUND, vars, cr)); 143 XPATH_RIVER_BACKGROUND, vars, cr));
154 String elementName, 154 String elementName,
155 String xpath, 155 String xpath,
156 Map<String, String> vars, 156 Map<String, String> vars,
157 ElementCreator cr) 157 ElementCreator cr)
158 { 158 {
159 logger.debug("createWMSElement()"); 159 log.debug("createWMSElement()");
160 160
161 Element el = cr.create(elementName); 161 Element el = cr.create(elementName);
162 Element wms = (Element)getNodeXPath(xpath, vars); 162 Element wms = (Element)getNodeXPath(xpath, vars);
163 163
164 if (wms != null) { 164 if (wms != null) {
165 cr.addAttr(el, "url", wms.getAttribute("url")); 165 cr.addAttr(el, "url", wms.getAttribute("url"));
166 cr.addAttr(el, "layers", wms.getAttribute("layers")); 166 cr.addAttr(el, "layers", wms.getAttribute("layers"));
167 167
168 logger.debug("createWMSElement: " + XMLUtils.toString(el)); 168 log.debug("createWMSElement: " + XMLUtils.toString(el));
169 } 169 }
170 else { 170 else {
171 logger.debug("createWMSElement: wms == null"); 171 log.debug("createWMSElement: wms == null");
172 } 172 }
173 173
174 return el; 174 return el;
175 } 175 }
176 176

http://dive4elements.wald.intevation.org