comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java @ 791:23877dd69444

Added javadoc in Context package. gnv-artifacts/trunk@873 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 31 Mar 2010 09:30:34 +0000
parents c4156275c1e1
children feae2f9d6c6f
comparison
equal deleted inserted replaced
790:f198e4620546 791:23877dd69444
39 import org.w3c.dom.Document; 39 import org.w3c.dom.Document;
40 import org.w3c.dom.Element; 40 import org.w3c.dom.Element;
41 import org.w3c.dom.NodeList; 41 import org.w3c.dom.NodeList;
42 42
43 /** 43 /**
44 * This factory class is used to create new GNVArtfactContext objects,
45 * initialize required components and put them into the created context object
46 * for being available in the application.
47 *
44 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> 48 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
45 * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a> 49 * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a>
46 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> 50 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
47 */ 51 */
48 public class GNVArtifactContextFactory implements ArtifactContextFactory { 52 public class GNVArtifactContextFactory implements ArtifactContextFactory {
49 /** 53 /**
50 * the logger, used to log exceptions and additonaly information 54 * the logger, used to log exceptions and additonaly information
51 */ 55 */
52 private static Logger log = Logger.getLogger(GNVArtifactContext.class); 56 private static Logger log = Logger.getLogger(GNVArtifactContext.class);
53 57
58 /**
59 *
60 */
54 public static final String XPATH_GEOBACKEND_CONFIGURATION = 61 public static final String XPATH_GEOBACKEND_CONFIGURATION =
55 "artifact-database/geo-backend/backend-configuration"; 62 "artifact-database/geo-backend/backend-configuration";
56 63
64 /**
65 *
66 */
57 public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION = 67 public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION =
58 "artifact-database/geo-backend/query-configuration"; 68 "artifact-database/geo-backend/query-configuration";
59 69
60 private final static String CACHECONFIGNODEPATH = 70 private final static String CACHECONFIGNODEPATH =
61 "/artifact-database/ehcache/configuration"; 71 "/artifact-database/ehcache/configuration";
62 72
63 private final static String CHARTCONFIGNODEPATH = 73 private final static String CHARTCONFIGNODEPATH =
64 "/artifact-database/gnv/charttemplate/configuration"; 74 "/artifact-database/gnv/charttemplate/configuration";
65 75
76 /**
77 *
78 */
66 public final static String PALETTES_PATH = 79 public final static String PALETTES_PATH =
67 "/artifact-database/gnv/palettes"; 80 "/artifact-database/gnv/palettes";
68 81
82 /**
83 *
84 */
69 public final static String PALETTE_ITEMS = 85 public final static String PALETTE_ITEMS =
70 "palette"; 86 "palette";
71 87
88 /**
89 *
90 */
72 public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = 91 public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES =
73 "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number"; 92 "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number";
74 93
94 /**
95 *
96 */
75 public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION = 97 public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION =
76 "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation"; 98 "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation";
77 99
100 /**
101 *
102 */
78 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES = 103 public final static String HORIZONTAL_CROSS_SECTION_SAMPLES =
79 "/artifact-database/gnv/horizontal-cross-section/samples/@number"; 104 "/artifact-database/gnv/horizontal-cross-section/samples/@number";
80 105
106 /**
107 *
108 */
81 public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS = 109 public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS =
82 "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds"; 110 "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds";
83 111
112 /**
113 *
114 */
84 public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH = 115 public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH =
85 "/artifact-database/gnv/shapefile-directory/@path"; 116 "/artifact-database/gnv/shapefile-directory/@path";
86 117
118 /**
119 *
120 */
87 public final static String VERTICAL_CROSS_SECTION_SAMPLES = 121 public final static String VERTICAL_CROSS_SECTION_SAMPLES =
88 "/artifact-database/gnv/vertical-cross-section/samples"; 122 "/artifact-database/gnv/vertical-cross-section/samples";
89 123
124 /**
125 *
126 */
90 public final static String VERTICAL_CROSS_SECTION_FILTERS = 127 public final static String VERTICAL_CROSS_SECTION_FILTERS =
91 "/artifact-database/gnv/vertical-cross-section/filters/filter"; 128 "/artifact-database/gnv/vertical-cross-section/filters/filter";
92 129
130 /**
131 *
132 */
93 public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION = 133 public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION =
94 "/artifact-database/gnv/vertical-cross-section/ground/@interpolation"; 134 "/artifact-database/gnv/vertical-cross-section/ground/@interpolation";
95 135
136 /**
137 *
138 */
96 public final static String VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR = 139 public final static String VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR =
97 "/artifact-database/gnv/vertical-cross-section/ground/@fill-color"; 140 "/artifact-database/gnv/vertical-cross-section/ground/@fill-color";
98 141
142 /**
143 *
144 */
99 public final static String XPATH_MAPSERVER_PATH = 145 public final static String XPATH_MAPSERVER_PATH =
100 "/artifact-database/mapserver/server/@path"; 146 "/artifact-database/mapserver/server/@path";
101 147
148 /**
149 *
150 */
102 public final static String XPATH_MAP_PATH = 151 public final static String XPATH_MAP_PATH =
103 "/artifact-database/mapserver/map/@path"; 152 "/artifact-database/mapserver/map/@path";
104 153
105 /** 154 /**
106 * Constructor 155 * Constructor
109 super(); 158 super();
110 log.debug("GNVArtifactContextFactory.Constructor"); 159 log.debug("GNVArtifactContextFactory.Constructor");
111 } 160 }
112 161
113 /** 162 /**
163 * Create a new {@link GNVArtifactContext} object and initialize all
164 * components required by the application.
165 *
166 * @param config
167 * @return GNVArtifactContext
114 * @see de.intevation.artifacts.ArtifactContextFactory#createArtifactContext(org.w3c.dom.Document) 168 * @see de.intevation.artifacts.ArtifactContextFactory#createArtifactContext(org.w3c.dom.Document)
115 */ 169 */
116 public Object createArtifactContext(Document config) { 170 public Object createArtifactContext(Document config) {
117 GNVArtifactContext returnValue = null; 171 GNVArtifactContext returnValue = null;
118 try { 172 try {
161 log.error(e, e); 215 log.error(e, e);
162 } 216 }
163 return returnValue; 217 return returnValue;
164 } 218 }
165 219
220 /**
221 *
222 * @param config
223 * @param context
224 */
166 protected void configureVerticalCrossSection( 225 protected void configureVerticalCrossSection(
167 Document config, 226 Document config,
168 GNVArtifactContext context 227 GNVArtifactContext context
169 ) { 228 ) {
170 log.info("configuration of vertical cross section"); 229 log.info("configuration of vertical cross section");
173 configureVerticalCrossSectionGroundInterpolation(config, context); 232 configureVerticalCrossSectionGroundInterpolation(config, context);
174 configureVerticalCrossSectionGroundFillColor(config, context); 233 configureVerticalCrossSectionGroundFillColor(config, context);
175 } 234 }
176 235
177 236
237 /**
238 *
239 * @param config
240 */
178 protected void configureCache(Document config) { 241 protected void configureCache(Document config) {
179 String cacheConfigurationFile = Config.getStringXPath( 242 String cacheConfigurationFile = Config.getStringXPath(
180 config, CACHECONFIGNODEPATH); 243 config, CACHECONFIGNODEPATH);
181 244
182 if (cacheConfigurationFile != null 245 if (cacheConfigurationFile != null
189 CacheFactory cf = CacheFactory.getInstance(); 252 CacheFactory cf = CacheFactory.getInstance();
190 cf.initializeCache(cacheConfigurationFile); 253 cf.initializeCache(cacheConfigurationFile);
191 } 254 }
192 } 255 }
193 256
257 /**
258 *
259 * @param config
260 * @param context
261 */
194 protected void configureVerticalCrossSectionGroundFillColor( 262 protected void configureVerticalCrossSectionGroundFillColor(
195 Document config, 263 Document config,
196 GNVArtifactContext context 264 GNVArtifactContext context
197 ) { 265 ) {
198 log.info("configuration of vertical cross section ground fill color"); 266 log.info("configuration of vertical cross section ground fill color");
221 GNVArtifactContext 289 GNVArtifactContext
222 .VERTICAL_CROSS_SECTION_GROUND_FILL_KEY, 290 .VERTICAL_CROSS_SECTION_GROUND_FILL_KEY,
223 fill); 291 fill);
224 } 292 }
225 293
294 /**
295 *
296 * @param config
297 * @param context
298 */
226 protected void configureVerticalCrossSectionGroundInterpolation( 299 protected void configureVerticalCrossSectionGroundInterpolation(
227 Document config, 300 Document config,
228 GNVArtifactContext context 301 GNVArtifactContext context
229 ) { 302 ) {
230 log.info("configuration of vertical cross section ground interpolation"); 303 log.info("configuration of vertical cross section ground interpolation");
244 GNVArtifactContext 317 GNVArtifactContext
245 .VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY, 318 .VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY,
246 interpolation); 319 interpolation);
247 } 320 }
248 321
322 /**
323 *
324 * @param config
325 * @param context
326 */
249 protected void configureVerticalCrossSectionFilters( 327 protected void configureVerticalCrossSectionFilters(
250 Document config, 328 Document config,
251 GNVArtifactContext context 329 GNVArtifactContext context
252 ) { 330 ) {
253 log.info("configuration of vertical cross section filters"); 331 log.info("configuration of vertical cross section filters");
296 context.put( 374 context.put(
297 GNVArtifactContext.VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY, 375 GNVArtifactContext.VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY,
298 Collections.unmodifiableList(filterFactories)); 376 Collections.unmodifiableList(filterFactories));
299 } 377 }
300 378
379 /**
380 *
381 * @param config
382 * @param context
383 */
301 protected void configureVerticalCrossSectionSamples( 384 protected void configureVerticalCrossSectionSamples(
302 Document config, 385 Document config,
303 GNVArtifactContext context 386 GNVArtifactContext context
304 ) { 387 ) {
305 log.info("configuration of vertical cross section samples"); 388 log.info("configuration of vertical cross section samples");
340 GNVArtifactContext.VERTICAL_CROSS_SECTION_SAMPLES_KEY, 423 GNVArtifactContext.VERTICAL_CROSS_SECTION_SAMPLES_KEY,
341 sampleSize); 424 sampleSize);
342 425
343 } 426 }
344 427
428 /**
429 *
430 * @param config
431 * @param context
432 */
345 protected void configureHorizontalCrossSectionProfile( 433 protected void configureHorizontalCrossSectionProfile(
346 Document config, 434 Document config,
347 GNVArtifactContext context 435 GNVArtifactContext context
348 ) 436 )
349 { 437 {
373 context.put( 461 context.put(
374 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY, 462 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY,
375 samples); 463 samples);
376 } 464 }
377 465
466 /**
467 *
468 * @param config
469 * @param context
470 */
378 protected void configureHorizontalCrossSection( 471 protected void configureHorizontalCrossSection(
379 Document config, 472 Document config,
380 GNVArtifactContext context 473 GNVArtifactContext context
381 ) { 474 ) {
382 log.info("configuration of horizontal cross section"); 475 log.info("configuration of horizontal cross section");
385 configureHorizontalCrossSectionExtrapolation(config, context); 478 configureHorizontalCrossSectionExtrapolation(config, context);
386 configureHorizontalCrossSectionResultShapeFilePath(config, context); 479 configureHorizontalCrossSectionResultShapeFilePath(config, context);
387 configureHorizontalCrossSectionGroundInterpolation(config, context); 480 configureHorizontalCrossSectionGroundInterpolation(config, context);
388 } 481 }
389 482
483 /**
484 *
485 * @param config
486 * @param context
487 */
390 protected void configureHorizontalCrossSectionExtrapolation( 488 protected void configureHorizontalCrossSectionExtrapolation(
391 Document config, 489 Document config,
392 GNVArtifactContext context 490 GNVArtifactContext context
393 ) 491 )
394 { 492 {
421 GNVArtifactContext 519 GNVArtifactContext
422 .HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY, 520 .HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY,
423 extrapolationRounds); 521 extrapolationRounds);
424 } 522 }
425 523
524 /**
525 *
526 * @param config
527 * @param context
528 */
426 protected void configureHorizontalCrossSectionGroundInterpolation( 529 protected void configureHorizontalCrossSectionGroundInterpolation(
427 Document config, 530 Document config,
428 GNVArtifactContext context 531 GNVArtifactContext context
429 ) 532 )
430 { 533 {
447 GNVArtifactContext 550 GNVArtifactContext
448 .HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY, 551 .HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY,
449 interpolation); 552 interpolation);
450 } 553 }
451 554
555 /**
556 *
557 * @param config
558 * @param context
559 */
452 protected void configureHorizontalCrossSectionResultShapeFilePath( 560 protected void configureHorizontalCrossSectionResultShapeFilePath(
453 Document config, 561 Document config,
454 GNVArtifactContext context 562 GNVArtifactContext context
455 ) 563 )
456 { 564 {
479 GNVArtifactContext 587 GNVArtifactContext
480 .HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY, 588 .HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY,
481 dir); 589 dir);
482 } 590 }
483 591
592 /**
593 *
594 * @param config
595 * @param context
596 */
484 protected void configureHorizontalCrossSectionSamples( 597 protected void configureHorizontalCrossSectionSamples(
485 Document config, 598 Document config,
486 GNVArtifactContext context 599 GNVArtifactContext context
487 ) 600 )
488 { 601 {
512 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY, 625 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY,
513 samples); 626 samples);
514 } 627 }
515 628
516 629
630 /**
631 *
632 * @param config
633 * @param context
634 */
517 protected void configureChartTemplate( 635 protected void configureChartTemplate(
518 Document config, 636 Document config,
519 GNVArtifactContext context 637 GNVArtifactContext context
520 ) { 638 ) {
521 log.info("Initialisation of chart template"); 639 log.info("Initialisation of chart template");
544 } 662 }
545 663
546 context.put(GNVArtifactContext.CHART_TEMPLATE_KEY, theme); 664 context.put(GNVArtifactContext.CHART_TEMPLATE_KEY, theme);
547 } 665 }
548 666
667 /**
668 *
669 * @param config
670 * @param context
671 */
549 protected void configurePalettes( 672 protected void configurePalettes(
550 Document config, 673 Document config,
551 GNVArtifactContext context 674 GNVArtifactContext context
552 ) { 675 ) {
553 log.info("configure palettes"); 676 log.info("configure palettes");
612 735
613 context.put(GNVArtifactContext.PALETTES_KEY, palettes); 736 context.put(GNVArtifactContext.PALETTES_KEY, palettes);
614 } 737 }
615 738
616 739
740 /**
741 *
742 * @param config
743 * @param context
744 */
617 protected void configureMapserver( 745 protected void configureMapserver(
618 Document config, 746 Document config,
619 GNVArtifactContext context 747 GNVArtifactContext context
620 ) { 748 ) {
621 log.info("read configuration of mapserver."); 749 log.info("read configuration of mapserver.");
631 context.put(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY, mapPath); 759 context.put(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY, mapPath);
632 } 760 }
633 } 761 }
634 762
635 /** 763 /**
636 * @param filePath 764 * Read some properties from config file specified by <code>filePath</code>.
637 * @return 765 *
638 * @throws FileNotFoundException 766 * @param filePath Path to a cofig file.
639 * @throws IOException 767 * @return Properties contained in <code>filePath</code>.
768 * @throws FileNotFoundException if file specified by filePath is not
769 * existing.
770 * @throws IOException if an error occured while reading from file.
640 */ 771 */
641 private Properties getProperties(String filePath) 772 private Properties getProperties(String filePath)
642 throws FileNotFoundException, IOException 773 throws FileNotFoundException, IOException
643 { 774 {
644 InputStream inputStream = null; 775 InputStream inputStream = null;
654 catch (IOException ioe) {} 785 catch (IOException ioe) {}
655 } 786 }
656 } 787 }
657 } 788 }
658 } 789 }
790 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org