Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java @ 8254:c87c87544cc6
Made call context injectors a list of comma separated classes.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 10 Sep 2014 12:42:39 +0200 |
parents | 9667900536b6 |
children | c57b0400ac98 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5152
diff
changeset
|
9 package org.dive4elements.river.artifacts.context; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
11 import java.io.File; |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
12 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import java.util.ArrayList; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
14 import java.util.HashMap; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.util.List; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
16 import java.util.Map; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import javax.xml.xpath.XPathConstants; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.apache.log4j.Logger; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
21 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
22 import org.dive4elements.artifactdatabase.state.State; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
23 import org.dive4elements.artifactdatabase.state.StateEngine; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
24 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
25 import org.dive4elements.artifactdatabase.transition.Transition; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
26 import org.dive4elements.artifactdatabase.transition.TransitionEngine; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
27 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
28 import org.dive4elements.artifacts.ArtifactContextFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
29 import org.dive4elements.artifacts.GlobalContext; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
30 |
8219
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
31 import org.dive4elements.artifacts.ContextInjector; |
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
32 |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
33 import org.dive4elements.artifacts.common.utils.Config; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
34 import org.dive4elements.artifacts.common.utils.ElementConverter; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
35 import org.dive4elements.artifacts.common.utils.XMLUtils; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
36 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
37 import org.dive4elements.river.artifacts.model.Module; |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
38 import org.dive4elements.river.artifacts.model.RiverFactory; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
39 import org.dive4elements.river.artifacts.model.ZoomScale; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
40 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
41 import org.dive4elements.river.artifacts.states.StateFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
42 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
43 import org.dive4elements.river.artifacts.transitions.TransitionFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
44 |
7226
8ab618dda850
Made lookup for generators a class of its own. First step to use it as a compat filter for facets, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7099
diff
changeset
|
45 import org.dive4elements.river.exports.GeneratorLookup; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
46 import org.dive4elements.river.exports.OutGenerator; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
47 |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
48 import org.dive4elements.river.model.River; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
49 import org.dive4elements.river.themes.Theme; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
50 import org.dive4elements.river.themes.ThemeFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
51 import org.dive4elements.river.themes.ThemeGroup; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
52 import org.dive4elements.river.themes.ThemeMapping; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
53 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 import org.w3c.dom.Document; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 import org.w3c.dom.Element; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
56 import org.w3c.dom.Node; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 import org.w3c.dom.NodeList; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 * The ArtifactContextFactory is used to initialize basic components and put |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * them into the global context of the application. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
65 public class RiverContextFactory implements ArtifactContextFactory { |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
67 /** The log that is used in this class. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
68 private static Logger log = Logger.getLogger(RiverContextFactory.class); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 /** The XPath to the artifacts configured in the configuration. */ |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 public static final String XPATH_ARTIFACTS = |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 "/artifact-database/artifacts/artifact"; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 /** The XPath to the name of the artifact. */ |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
75 public static final String XPATH_ARTIFACT_NAME = "/artifact/@name"; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 /** The XPath to the xlink ref in an artifact configuration. */ |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 public static final String XPATH_XLINK = "xlink:href"; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 /** The XPath to the transitions configured in the artifact config. */ |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 public static final String XPATH_TRANSITIONS = |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 "/artifact/states/transition"; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
84 /** The XPath to the states configured in the artifact config. */ |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
85 public static final String XPATH_STATES = |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
86 "/artifact/states/state"; |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
87 |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
88 public static final String XPATH_OUTPUT_GENERATORS = |
8157
1ccbd7f81c7d
Allow deeper nesting of output-generators in conf.xml. This allows better separation of concerns of different generator types.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8093
diff
changeset
|
89 "/artifact-database/output-generators//output-generator"; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
90 |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
91 public static final String XPATH_THEME_CONFIG = |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
92 "/artifact-database/flys/themes/configuration/text()"; |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
93 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
94 public static final String XPATH_THEMES = |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
95 "theme"; |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
96 |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
97 public static final String XPATH_THEME_GROUPS = |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
98 "/themes/themegroup"; |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
99 |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
100 public static final String XPATH_THEME_MAPPINGS = |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
101 "/themes/mappings/mapping"; |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
102 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
103 public static final String XPATH_RIVER_WMS = |
1062
ee105e5d5ead
Repaired broken river wms initialization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
104 "/artifact-database/floodmap/river"; |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
105 |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
106 public static final String XPATH_MODULES = "/artifact-database/modules/module"; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
107 |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
108 private static final String XPATH_ZOOM_SCALES = "/artifact-database/options/zoom-scales/zoom-scale"; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
109 |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
110 private static final String XPATH_DGM_PATH = "/artifact-database/options/dgm-path/text()"; |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
111 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
112 private static GlobalContext GLOBAL_CONTEXT_INSTANCE; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
113 |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
114 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 /** |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
116 * Creates a new D4EArtifactContext object and initialize all |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 * components required by the application. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 * @param config The artifact server configuration. |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
120 * @return a D4EArtifactContext. |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 */ |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
122 @Override |
939
32d0a543e3e8
Adapted a method signature of FLYSContextFactory to apply the changes in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
345
diff
changeset
|
123 public GlobalContext createArtifactContext(Document config) { |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
124 RiverContext context = new RiverContext(config); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 configureTransitions(config, context); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
127 configureStates(config, context); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
128 configureOutGenerators(config, context); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
129 configureThemes(config, context); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
130 configureThemesMappings(config, context); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
131 configureFloodmapWMS(config, context); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
132 configureModules(config, context); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
133 configureZoomScales(config, context); |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
134 configureDGMPath(config, context); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
136 synchronized (RiverContextFactory.class) { |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
137 GLOBAL_CONTEXT_INSTANCE = context; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
138 } |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
139 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 return context; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
143 public static synchronized GlobalContext getGlobalContext() { |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
144 return GLOBAL_CONTEXT_INSTANCE; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
145 } |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
146 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
148 private void configureDGMPath(Document config, RiverContext context) { |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
149 String dgmPath = (String) XMLUtils.xpath( |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
150 config, |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
151 XPATH_DGM_PATH, |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
152 XPathConstants.STRING); |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
153 |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
154 context.put("dgm-path", dgmPath); |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
155 } |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
156 |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
157 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
158 protected void configureZoomScales(Document config, RiverContext context) { |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
159 NodeList list = (NodeList)XMLUtils.xpath( |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
160 config, |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
161 XPATH_ZOOM_SCALES, |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
162 XPathConstants.NODESET); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
163 ZoomScale scale = new ZoomScale(); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
164 for (int i = 0; i < list.getLength(); i++) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
165 Element element = (Element)list.item(i); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
166 String river = "default"; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
167 double range = 0d; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
168 double radius = 10d; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
169 if (element.hasAttribute("river")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
170 river = element.getAttribute("river"); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
171 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
172 if (!element.hasAttribute("range")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
173 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
174 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
175 else { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
176 String r = element.getAttribute("range"); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
177 try { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
178 range = Double.parseDouble(r); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
179 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
180 catch (NumberFormatException nfe) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
181 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
182 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
183 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
184 if (!element.hasAttribute("radius")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
185 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
186 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
187 else { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
188 String r = element.getAttribute("radius"); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
189 try { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
190 radius = Double.parseDouble(r); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
191 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
192 catch (NumberFormatException nfe) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
193 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
194 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
195 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
196 scale.addRange(river, range, radius); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
197 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
198 context.put("zoomscale", scale); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
199 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
200 |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
201 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 * This method initializes the transition configuration. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 * @param config the config document. |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
206 * @param context the RiverContext. |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
208 protected void configureTransitions(Document config, RiverContext context) { |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 TransitionEngine engine = new TransitionEngine(); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
211 List<Document> artifacts = getArtifactConfigurations(config); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
212 log.info("Found " + artifacts.size() + " artifacts in the config."); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 for (Document doc: artifacts) { |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 String artName = (String) XMLUtils.xpath( |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 doc, XPATH_ARTIFACT_NAME, XPathConstants.STRING); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
219 NodeList list = (NodeList) XMLUtils.xpath( |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 doc, XPATH_TRANSITIONS, XPathConstants.NODESET); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
222 if (list == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
223 log.warn("The artifact " + artName + |
2141
79a94c4171cb
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1828
diff
changeset
|
224 " has no transitions configured."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
225 continue; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
228 int trans = list.getLength(); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
230 log.info( |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 "Artifact '" + artName + "' has " + trans + " transitions."); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 for (int i = 0; i < trans; i++) { |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
234 Transition t = TransitionFactory.createTransition(list.item(i)); |
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
235 String s = t.getFrom(); |
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
236 engine.addTransition(s, t); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
240 context.put(RiverContext.TRANSITION_ENGINE_KEY, engine); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 * This method returns all artifact documents defined in |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 * <code>config</code>. <br>NOTE: The artifact configurations need to be |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 * stored in own files referenced by an xlink. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 * @param config The global configuration. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 * @return an array of Artifact configurations. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 */ |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
253 protected List<Document> getArtifactConfigurations(Document config) { |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 NodeList artifacts = (NodeList) XMLUtils.xpath( |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 config, XPATH_ARTIFACTS, XPathConstants.NODESET); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 int count = artifacts.getLength(); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
259 ArrayList<Document> docs = new ArrayList<Document>(count); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 for (int i = 0; i < count; i++) { |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 Element tmp = (Element) artifacts.item(i); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 String xlink = tmp.getAttribute(XPATH_XLINK); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 xlink = Config.replaceConfigDir(xlink); |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
267 File file = new File(xlink); |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
268 if (!file.isFile() || !file.canRead()) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
269 log.warn("Artifact configuration '" + file + "' not found."); |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
270 continue; |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
271 } |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
272 |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
273 Document doc = XMLUtils.parseDocument(file); |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
274 if (doc != null) { |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
275 docs.add(doc); |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
276 } |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 } |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
278 return docs; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 } |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
280 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
281 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
282 /** |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
283 * This method initializes the transition configuration. |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
284 * |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
285 * @param config the config document. |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
286 * @param context the RiverContext. |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
287 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
288 protected void configureStates(Document config, RiverContext context) { |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
289 StateEngine engine = new StateEngine(); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
290 |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
291 List<Document> artifacts = getArtifactConfigurations(config); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
292 log.info("Found " + artifacts.size() + " artifacts in the config."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
293 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
294 for (Document doc: artifacts) { |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
295 List<State> states = new ArrayList<State>(); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
296 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
297 String artName = (String) XMLUtils.xpath( |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
298 doc, XPATH_ARTIFACT_NAME, XPathConstants.STRING); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
299 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
300 NodeList stateList = (NodeList) XMLUtils.xpath( |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
301 doc, XPATH_STATES, XPathConstants.NODESET); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
302 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
303 if (stateList == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
304 log.warn("The artifact " + artName + |
2141
79a94c4171cb
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1828
diff
changeset
|
305 " has no states configured."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
306 continue; |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
307 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
308 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
309 int count = stateList.getLength(); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
310 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
311 log.info( |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
312 "Artifact '" + artName + "' has " + count + " states."); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
313 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
314 for (int i = 0; i < count; i++) { |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
315 states.add(StateFactory.createState( |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
316 stateList.item(i))); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
317 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
318 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
319 engine.addStates(artName, states); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
320 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
321 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
322 context.put(RiverContext.STATE_ENGINE_KEY, engine); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
323 } |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
324 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
325 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
326 /** |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
327 * This method intializes the provided output generators. |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
328 * |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
329 * @param config the config document. |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
330 * @param context the RiverContext. |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
331 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
332 protected void configureOutGenerators(Document config, RiverContext context){ |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
333 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
334 NodeList outGenerators = (NodeList) XMLUtils.xpath( |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
335 config, |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
336 XPATH_OUTPUT_GENERATORS, |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
337 XPathConstants.NODESET); |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
338 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
339 int num = outGenerators == null ? 0 : outGenerators.getLength(); |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
340 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
341 if (num == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
342 log.warn("No output generators configured in this application."); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
343 return; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
344 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
345 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
346 log.info("Found " + num + " configured output generators."); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
347 |
7226
8ab618dda850
Made lookup for generators a class of its own. First step to use it as a compat filter for facets, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7099
diff
changeset
|
348 GeneratorLookup generators = new GeneratorLookup(); |
7037
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6933
diff
changeset
|
349 |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
350 int idx = 0; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
351 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
352 for (int i = 0; i < num; i++) { |
7037
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6933
diff
changeset
|
353 Element item = (Element)outGenerators.item(i); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
354 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
355 String names = item.getAttribute("names").trim(); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
356 String clazz = item.getAttribute("class").trim(); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
357 String converter = item.getAttribute("converter").trim(); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
358 String injectors = item.getAttribute("injectors").trim(); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
359 |
7074
a2abd87c0d3b
Trim "names" and "class" attribute of out generators before using.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7073
diff
changeset
|
360 if (names.isEmpty() || clazz.isEmpty()) { |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
361 continue; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
362 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
363 |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
364 Class<OutGenerator> generatorClass = null; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
365 |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
366 try { |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
367 generatorClass = (Class<OutGenerator>)Class.forName(clazz); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
368 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
369 catch (ClassNotFoundException cnfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
370 log.error(cnfe, cnfe); |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
371 continue; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
372 } |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
373 |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
374 Object cfg = null; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
375 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
376 if (!converter.isEmpty()) { |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
377 try { |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
378 ElementConverter ec = |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
379 (ElementConverter)Class.forName(converter) |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
380 .newInstance(); |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
381 cfg = ec.convert(item); |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
382 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
383 catch (ClassNotFoundException cnfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
384 log.error(cnfe, cnfe); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
385 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
386 catch (InstantiationException ie) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
387 log.error(ie); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
388 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
389 catch (IllegalAccessException iae) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
390 log.error(iae); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
391 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
392 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
393 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
394 List<ContextInjector> cis = null; |
8219
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
395 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
396 if (!injectors.isEmpty()) { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
397 cis = new ArrayList<ContextInjector>(); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
398 for (String injector: injectors.split("[\\s,]+")) { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
399 try { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
400 ContextInjector ci = (ContextInjector)Class.forName(injector) |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
401 .newInstance(); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
402 ci.setup(item); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
403 cis.add(ci); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
404 } |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
405 catch (ClassNotFoundException cnfe) { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
406 log.error(cnfe, cnfe); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
407 } |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
408 catch (InstantiationException ie) { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
409 log.error(ie); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
410 } |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
411 catch (IllegalAccessException iae) { |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
412 log.error(iae); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
413 } |
8219
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
414 } |
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
415 } |
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
416 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
417 for (String key: names.split("[\\s,]+")) { |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
418 if (!(key = key.trim()).isEmpty()) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
419 generators.putGenerator(key, generatorClass, cfg, cis); |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
420 idx++; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
421 } |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
422 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
423 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
424 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
425 log.info("Successfully loaded " + idx + " output generators."); |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
426 context.put(RiverContext.OUTGENERATORS_KEY, generators); |
7227
744df5a03337
Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7226
diff
changeset
|
427 context.put(RiverContext.FACETFILTER_KEY, generators); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
428 } |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
429 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
430 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
431 /** |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
432 * This methods reads the configured themes and puts them into the |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
433 * RiverContext. |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
434 * |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
435 * @param config The global configuration. |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
436 * @param context The RiverContext. |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
437 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
438 protected void configureThemes(Document config, RiverContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
439 log.debug("RiverContextFactory.configureThemes"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
440 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
441 Document cfg = getThemeConfig(config); |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
442 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
443 NodeList themeGroups = (NodeList) XMLUtils.xpath( |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
444 cfg, XPATH_THEME_GROUPS, XPathConstants.NODESET); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
445 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
446 int groupNum = themeGroups != null ? themeGroups.getLength() : 0; |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
447 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
448 if (groupNum == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
449 log.warn("There are no theme groups configured!"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
450 } |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3239
diff
changeset
|
451 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
452 log.info("Found " + groupNum + " theme groups in configuration"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
453 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
454 List<ThemeGroup> groups = new ArrayList<ThemeGroup>(); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
455 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
456 for (int g = 0; g < groupNum; g++) { |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
457 Element themeGroup = (Element) themeGroups.item(g); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
458 NodeList themes = (NodeList) XMLUtils.xpath( |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
459 themeGroup, XPATH_THEMES, XPathConstants.NODESET); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
460 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
461 int num = themes != null ? themes.getLength() : 0; |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
462 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
463 if (num == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
464 log.warn("There are no themes configured!"); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
465 return; |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
466 } |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
467 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
468 log.info("Theme group has " + num + " themes."); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
469 |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
470 Map<String, Theme> theThemes = new HashMap<String, Theme>(); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
471 |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
472 for (int i = 0; i < num; i++) { |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
473 Node theme = themes.item(i); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
474 |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
475 Theme theTheme = ThemeFactory.createTheme(cfg, theme); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
476 |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
477 if (theme != null) { |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
478 theThemes.put(theTheme.getName(), theTheme); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
479 } |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
480 } |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
481 String gName = themeGroup.getAttribute("name"); |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
482 groups.add(new ThemeGroup(gName, theThemes)); |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3239
diff
changeset
|
483 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
484 log.info( |
3239
fb11bd37ddb8
Improved the structure of themes.xml; moved theme groups to own XML files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2742
diff
changeset
|
485 "Initialized " + theThemes.size() + "/" + num + " themes " + |
fb11bd37ddb8
Improved the structure of themes.xml; moved theme groups to own XML files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2742
diff
changeset
|
486 "of theme-group '" + gName + "'"); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
487 } |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
488 context.put(RiverContext.THEMES, groups); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
489 } |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
490 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
491 /** |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
492 * This method is used to retrieve the theme configuration document. |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
493 * |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
494 * @param config The global configuration. |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
495 * |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
496 * @return the theme configuration. |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
497 */ |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
498 protected Document getThemeConfig(Document config) { |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
499 String themeConfig = (String) XMLUtils.xpath( |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
500 config, |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
501 XPATH_THEME_CONFIG, |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
502 XPathConstants.STRING); |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
503 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
504 themeConfig = Config.replaceConfigDir(themeConfig); |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
505 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
506 log.debug("Parse theme cfg: " + themeConfig); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
507 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
508 return XMLUtils.parseDocument(new File(themeConfig)); |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
509 } |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
510 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
511 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
512 protected void configureThemesMappings(Document cfg, RiverContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
513 log.debug("RiverContextFactory.configureThemesMappings"); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
514 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
515 Document config = getThemeConfig(cfg); |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
516 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
517 NodeList mappings = (NodeList) XMLUtils.xpath( |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
518 config, XPATH_THEME_MAPPINGS, XPathConstants.NODESET); |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
519 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
520 int num = mappings != null ? mappings.getLength() : 0; |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
521 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
522 if (num == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
523 log.warn("No theme <--> facet mappins found!"); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
524 return; |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
525 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
526 |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
527 Map<String, List<ThemeMapping>> mapping = |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
528 new HashMap<String, List<ThemeMapping>>(); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
529 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
530 for (int i = 0; i < num; i++) { |
2742
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
531 Element node = (Element)mappings.item(i); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
532 |
2742
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
533 String from = node.getAttribute("from"); |
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
534 String to = node.getAttribute("to"); |
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
535 String pattern = node.getAttribute("pattern"); |
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
536 String masterAttrPattern = node.getAttribute("masterAttr"); |
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
537 String outputPattern = node.getAttribute("output"); |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
538 |
2742
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
539 if (from.length() > 0 && to.length() > 0) { |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
540 List<ThemeMapping> tm = mapping.get(from); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
541 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
542 if (tm == null) { |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
543 tm = new ArrayList<ThemeMapping>(); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
544 mapping.put(from, tm); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
545 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
546 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
547 tm.add(new ThemeMapping( |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1826
diff
changeset
|
548 from, to, pattern, masterAttrPattern, outputPattern)); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
549 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
550 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
551 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
552 log.debug("Found " + mapping.size() + " theme mappings."); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
553 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
554 context.put(RiverContext.THEME_MAPPING, mapping); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
555 } |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
556 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
557 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
558 /** |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
559 * Reads configured floodmap river WMSs from floodmap.xml and |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
560 * loads them into the given RiverContext. |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
561 * @param cfg |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
562 * @param context |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
563 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
564 protected void configureFloodmapWMS(Document cfg, RiverContext context) { |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
565 Map<String, String> riverWMS = new HashMap<String, String>(); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
566 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
567 NodeList rivers = (NodeList) XMLUtils.xpath( |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
568 cfg, XPATH_RIVER_WMS, XPathConstants.NODESET); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
569 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
570 int num = rivers != null ? rivers.getLength() : 0; |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
571 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
572 for (int i = 0; i < num; i++) { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
573 Element e = (Element) rivers.item(i); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
574 |
1062
ee105e5d5ead
Repaired broken river wms initialization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
575 String river = e.getAttribute("name"); |
ee105e5d5ead
Repaired broken river wms initialization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
576 String url = XMLUtils.xpathString(e, "river-wms/@url", null); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
577 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
578 if (river != null && url != null) { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
579 riverWMS.put(river, url); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
580 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
581 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
582 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
583 log.debug("Found " + riverWMS.size() + " river WMS."); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
584 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
585 context.put(RiverContext.RIVER_WMS, riverWMS); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
586 } |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
587 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
588 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
589 /** |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
590 * This method initializes the modules configuration. |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
591 * |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
592 * @param config the config document. |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
593 * @param context the RiverContext. |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
594 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
595 protected void configureModules(Document cfg, RiverContext context) { |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
596 NodeList modulenodes = (NodeList) XMLUtils.xpath( |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
597 cfg, XPATH_MODULES, XPathConstants.NODESET); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
598 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
599 int num = modulenodes != null ? modulenodes.getLength() : 0; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
600 ArrayList<Module> modules = new ArrayList<Module>(num); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
601 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
602 for (int i = 0; i < num; i++) { |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
603 Element e = (Element) modulenodes.item(i); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
604 String modulename = e.getAttribute("name"); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
605 String attrselected = e.getAttribute("selected"); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
606 boolean selected = attrselected == null ? false : |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
607 attrselected.equalsIgnoreCase("true"); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
608 log.debug("Loaded module " + modulename); |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
609 NodeList children = e.getChildNodes(); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
610 List<String> rivers = new ArrayList<String>(children.getLength()); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
611 for (int j = 0; j < children.getLength(); j++) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
612 if (children.item(j).getNodeType() != Node.ELEMENT_NODE) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
613 continue; |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
614 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
615 Element ce = (Element)children.item(j); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
616 if (ce.hasAttribute("uuid")) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
617 rivers.add(ce.getAttribute("uuid")); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
618 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
619 else if (ce.hasAttribute("name")) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
620 List<River> allRivers = RiverFactory.getRivers(); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
621 String name = ce.getAttribute("name"); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
622 for (River r: allRivers) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
623 if (name.equals(r.getName())) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
624 rivers.add(r.getModelUuid()); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
625 break; |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
626 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
627 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
628 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
629 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
630 modules.add(new Module(modulename, selected, rivers)); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
631 } |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
632 context.put(RiverContext.MODULES, modules); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
633 } |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
634 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
635 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |