Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 54e515504a3f |
children | c26fb37899ca 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
101 "/themes/mappings/mapping"; | 101 "/themes/mappings/mapping"; |
102 | 102 |
103 public static final String XPATH_RIVER_WMS = | 103 public static final String XPATH_RIVER_WMS = |
104 "/artifact-database/floodmap/river"; | 104 "/artifact-database/floodmap/river"; |
105 | 105 |
106 public static final String XPATH_MODULES = "/artifact-database/modules/module"; | 106 public static final String XPATH_MODULES = |
107 | 107 "/artifact-database/modules/module"; |
108 private static final String XPATH_ZOOM_SCALES = "/artifact-database/options/zoom-scales/zoom-scale"; | 108 |
109 | 109 private static final String XPATH_ZOOM_SCALES = |
110 private static final String XPATH_DGM_PATH = "/artifact-database/options/dgm-path/text()"; | 110 "/artifact-database/options/zoom-scales/zoom-scale"; |
111 | |
112 private static final String XPATH_DGM_PATH = | |
113 "/artifact-database/options/dgm-path/text()"; | |
111 | 114 |
112 private static GlobalContext GLOBAL_CONTEXT_INSTANCE; | 115 private static GlobalContext GLOBAL_CONTEXT_INSTANCE; |
113 | 116 |
114 | 117 |
115 /** | 118 /** |
203 * This method initializes the transition configuration. | 206 * This method initializes the transition configuration. |
204 * | 207 * |
205 * @param config the config document. | 208 * @param config the config document. |
206 * @param context the RiverContext. | 209 * @param context the RiverContext. |
207 */ | 210 */ |
208 protected void configureTransitions(Document config, RiverContext context) { | 211 protected void configureTransitions( |
212 Document config, | |
213 RiverContext context | |
214 ) { | |
209 TransitionEngine engine = new TransitionEngine(); | 215 TransitionEngine engine = new TransitionEngine(); |
210 | 216 |
211 List<Document> artifacts = getArtifactConfigurations(config); | 217 List<Document> artifacts = getArtifactConfigurations(config); |
212 log.info("Found " + artifacts.size() + " artifacts in the config."); | 218 log.info("Found " + artifacts.size() + " artifacts in the config."); |
213 | 219 |
229 | 235 |
230 log.info( | 236 log.info( |
231 "Artifact '" + artName + "' has " + trans + " transitions."); | 237 "Artifact '" + artName + "' has " + trans + " transitions."); |
232 | 238 |
233 for (int i = 0; i < trans; i++) { | 239 for (int i = 0; i < trans; i++) { |
234 Transition t = TransitionFactory.createTransition(list.item(i)); | 240 Transition t = TransitionFactory.createTransition( |
241 list.item(i)); | |
235 String s = t.getFrom(); | 242 String s = t.getFrom(); |
236 engine.addTransition(s, t); | 243 engine.addTransition(s, t); |
237 } | 244 } |
238 } | 245 } |
239 | 246 |
265 xlink = Config.replaceConfigDir(xlink); | 272 xlink = Config.replaceConfigDir(xlink); |
266 | 273 |
267 if (!xlink.isEmpty()) { | 274 if (!xlink.isEmpty()) { |
268 File file = new File(xlink); | 275 File file = new File(xlink); |
269 if (!file.isFile() || !file.canRead()) { | 276 if (!file.isFile() || !file.canRead()) { |
270 log.warn("Artifact configuration '" + file + "' not found."); | 277 log.warn("Artifact configuration '" |
278 + file + "' not found."); | |
271 } else { | 279 } else { |
272 Document doc = XMLUtils.parseDocument(file); | 280 Document doc = XMLUtils.parseDocument(file); |
273 if (doc != null) { | 281 if (doc != null) { |
274 docs.add(doc); | 282 docs.add(doc); |
275 } | 283 } |
333 * This method intializes the provided output generators. | 341 * This method intializes the provided output generators. |
334 * | 342 * |
335 * @param config the config document. | 343 * @param config the config document. |
336 * @param context the RiverContext. | 344 * @param context the RiverContext. |
337 */ | 345 */ |
338 protected void configureOutGenerators(Document config, RiverContext context){ | 346 protected void configureOutGenerators( |
339 | 347 Document config, |
348 RiverContext context | |
349 ) { | |
340 NodeList outGenerators = (NodeList) XMLUtils.xpath( | 350 NodeList outGenerators = (NodeList) XMLUtils.xpath( |
341 config, | 351 config, |
342 XPATH_OUTPUT_GENERATORS, | 352 XPATH_OUTPUT_GENERATORS, |
343 XPathConstants.NODESET); | 353 XPathConstants.NODESET); |
344 | 354 |
401 | 411 |
402 if (!injectors.isEmpty()) { | 412 if (!injectors.isEmpty()) { |
403 cis = new ArrayList<ContextInjector>(); | 413 cis = new ArrayList<ContextInjector>(); |
404 for (String injector: injectors.split("[\\s,]+")) { | 414 for (String injector: injectors.split("[\\s,]+")) { |
405 try { | 415 try { |
406 ContextInjector ci = (ContextInjector)Class.forName(injector) | 416 ContextInjector ci = (ContextInjector)Class |
417 .forName(injector) | |
407 .newInstance(); | 418 .newInstance(); |
408 ci.setup(item); | 419 ci.setup(item); |
409 cis.add(ci); | 420 cis.add(ci); |
410 } | 421 } |
411 catch (ClassNotFoundException cnfe) { | 422 catch (ClassNotFoundException cnfe) { |
509 | 520 |
510 themeConfig = Config.replaceConfigDir(themeConfig); | 521 themeConfig = Config.replaceConfigDir(themeConfig); |
511 | 522 |
512 log.debug("Parse theme cfg: " + themeConfig); | 523 log.debug("Parse theme cfg: " + themeConfig); |
513 | 524 |
514 return XMLUtils.parseDocument(new File(themeConfig), true, XMLUtils.CONF_RESOLVER); | 525 return XMLUtils.parseDocument( |
515 } | 526 new File(themeConfig), true, XMLUtils.CONF_RESOLVER); |
516 | 527 } |
517 | 528 |
518 protected void configureThemesMappings(Document cfg, RiverContext context) { | 529 |
530 protected void configureThemesMappings( | |
531 Document cfg, | |
532 RiverContext context | |
533 ) { | |
519 log.debug("RiverContextFactory.configureThemesMappings"); | 534 log.debug("RiverContextFactory.configureThemesMappings"); |
520 | 535 |
521 Document config = getThemeConfig(cfg); | 536 Document config = getThemeConfig(cfg); |
522 | 537 |
523 NodeList mappings = (NodeList) XMLUtils.xpath( | 538 NodeList mappings = (NodeList) XMLUtils.xpath( |