annotate artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java @ 293:a367a0d011af

Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact. artifacts/trunk@2331 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 14 Jul 2011 14:22:23 +0000
parents 39c0ff00d188
children b0a949d3fe09
rev   line source
100
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
1 /*
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
3 *
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
5 * Read the file LGPL.txt coming with the software for details
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
7 */
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
8
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 package de.intevation.artifactdatabase;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
207
b2115f484edb Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 155
diff changeset
11 import de.intevation.artifacts.common.utils.Config;
b2115f484edb Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 155
diff changeset
12
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
13 import de.intevation.artifacts.ArtifactCollectionFactory;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
14 import de.intevation.artifacts.ArtifactContextFactory;
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
15 import de.intevation.artifacts.ArtifactFactory;
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
16 import de.intevation.artifacts.CallContext;
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
17 import de.intevation.artifacts.GlobalContext;
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
18 import de.intevation.artifacts.Hook;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
19 import de.intevation.artifacts.ServiceFactory;
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
20 import de.intevation.artifacts.UserFactory;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
21
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
22
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
23 import de.intevation.artifactdatabase.rest.HTTPServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
24
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
25 import java.util.ArrayList;
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
26 import java.util.List;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
27
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
28 import org.apache.log4j.Logger;
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
29
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 import org.w3c.dom.Document;
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
31 import org.w3c.dom.Node;
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 import org.w3c.dom.NodeList;
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
33
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 /**
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 * Bootstrap facility for the global context and the artifact factories.
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 *
77
48d1a9a082c2 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 71
diff changeset
37 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 */
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 public class FactoryBootstrap
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
41 private static Logger logger = Logger.getLogger(FactoryBootstrap.class);
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
42
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
43 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
44 * XPath to figure out the class name of the context factory from
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
45 * the global configuration.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
46 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 public static final String CONTEXT_FACTORY =
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 "/artifact-database/factories/context-factory/text()";
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
50 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
51 * The name of the default context factory.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
52 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 public static final String DEFAULT_CONTEXT_FACTORY =
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 "de.intevation.artifactdatabase.DefaultArtifactContextFactory";
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
56 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
57 * XPath to figure out the names of the artifact factories from
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
58 * the global configuration to be exposed by the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
59 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 public static final String ARTIFACT_FACTORIES =
16
635310c6a20e Bug fixed in in XPath Expression.
Tim Englich <tim.englich@intevation.de>
parents: 10
diff changeset
61 "/artifact-database/factories/artifact-factories/artifact-factory";
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
63 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
64 * XPath to figure out the names of the service factories from
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
65 * the global configuration to build the services offered by the
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
66 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
67 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
68 public static final String SERVICE_FACTORIES =
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
69 "/artifact-database/factories/service-factories/service-factory";
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
70
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
71 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
72 * XPath to figure out the class name of the user factory from global
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
73 * configuration.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
74 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
75 public static final String USER_FACTORY =
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
76 "/artifact-database/factories/user-factory";
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
77
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
78 /**
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
79 * The name of the default user factory.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
80 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
81 public static final String DEFAULT_USER_FACTORY =
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
82 "de.intevation.artifactdatabase.DefaultUserFactory";
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
83
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
84 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
85 * XPath to figure out the class name of the collection factory from global
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
86 * configuration.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
87 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
88 public static final String COLLECTION_FACTORY =
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
89 "/artifact-database/factories/collection-factory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
90
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
91 /**
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
92 * The name of the default user factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
93 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
94 public static final String DEFAULT_COLLECTION_FACTORY =
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
95 "de.intevation.artifactdatabase.DefaultArtifactCollectionFactory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
96
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
97 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
98 * XPath to figure out the secret used to sign the artifact exports
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
99 * made by the artfifact database server.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
100 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
101 public static final String EXPORT_SECRET =
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
102 "/artifact-database/export-secret/text()";
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
103
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
104 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
105 * XPAth that points to a configuration node for a CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
106 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
107 public static final String CALLCONTEXT_LISTENER =
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
108 "/artifact-database/callcontext-listener";
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
109
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
110 /**
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
111 * XPath that points to configuration nodes for hooks.
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
112 */
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
113 public static final String HOOKS =
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
114 "/artifact-database/hooks/hook";
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
115
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
116 public static final String HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
117 "/artifact-database/rest-server/http-server/text()";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
118
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
119 public static final String DEFAULT_HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
120 "de.intevation.artifactdatabase.rest.Standalone";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
121
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
122 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
123 * Default export signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
124 * <strong>PLEASE CHANGE THE SECRET VIA THE XPATH EXPORT_SECRET
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
125 * IN THE CONFIGURATION.</strong>.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
126 */
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
127 public static final String DEFAULT_EXPORT_SECRET =
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
128 "!!!CHANGE ME! I'M NO SECRET!!!";
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
129
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
130 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
131 * Reference to the global context build by the global context factory.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
132 */
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
133 protected GlobalContext context;
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
135 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
136 * List of the artifact factories to be exposed by the
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
137 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
138 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139 protected ArtifactFactory [] artifactFactories;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
141 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
142 * List of service factories which creates services that are
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
143 * exposed by the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
144 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
145 protected ServiceFactory [] serviceFactories;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
146
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
147 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
148 * The factory that is used to create and list users.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
149 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
150 protected UserFactory userFactory;
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
151
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
152 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
153 * The factory that is used to create new artifact collections.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
154 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
155 protected ArtifactCollectionFactory collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
156
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
157 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
158 * The CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
159 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
160 protected CallContext.Listener callContextListener;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
161
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
162 protected List<Hook> postFeedHooks;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
163
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
164 protected List<Hook> postAdvanceHooks;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
165
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
166 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
167 * byte array holding the export signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
168 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
169 protected byte [] exportSecret;
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
170
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
171 protected HTTPServer httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
172
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
173
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
174 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
175 * Default constructor
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
176 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177 public FactoryBootstrap() {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180 void buildContext() {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 String className = Config.getStringXPath(
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 CONTEXT_FACTORY, DEFAULT_CONTEXT_FACTORY);
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 ArtifactContextFactory factory = null;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 try {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
187 Class clazz = Class.forName(className);
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 factory = (ArtifactContextFactory)clazz.newInstance();
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
191 logger.error(cnfe.getLocalizedMessage(), cnfe);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
194 logger.error(ie.getLocalizedMessage(), ie);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
195 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
197 logger.error(cce.getLocalizedMessage(), cce);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
198 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
200 logger.error(iae.getLocalizedMessage(), iae);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203 if (factory == null) {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 factory = new DefaultArtifactContextFactory();
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
207 logger.info("Using class '" + factory.getClass().getName()
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
208 + "' for context creation.");
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
209
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 context = factory.createArtifactContext(Config.getConfig());
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
213
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
214 /**
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
215 * Scans the global configuration to load the configured collection factory
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
216 * and sets it up.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
217 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
218 protected void loadCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
219
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
220 logger.info("loading collection factory.");
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
221
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
222 Node factory = Config.getNodeXPath(COLLECTION_FACTORY);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
223
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
224 String className = Config.getStringXPath(
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
225 factory, "text()", DEFAULT_COLLECTION_FACTORY);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
226
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
227 try {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
228 Class clazz = Class.forName(className);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
229 collectionFactory = (ArtifactCollectionFactory) clazz.newInstance();
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
230
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
231 collectionFactory.setup(Config.getConfig(), factory);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
232 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
233 catch (ClassNotFoundException cnfe) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
234 logger.error(cnfe.getLocalizedMessage(), cnfe);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
235 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
236 catch (InstantiationException ie) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
237 logger.error(ie.getLocalizedMessage(), ie);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
238 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
239 catch (ClassCastException cce) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
240 logger.error(cce.getLocalizedMessage(), cce);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
241 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
242 catch (IllegalAccessException iae) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
243 logger.error(iae.getLocalizedMessage(), iae);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
244 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
245 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
246
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
247 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
248 * Scans the global configuration to load the configured
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
249 * artifact factories and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
250 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
251 protected void loadArtifactFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
252
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
253 logger.info("loading artifact factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
254
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
255 ArrayList loadedFactories = new ArrayList();
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
256
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
257 NodeList nodes = Config.getNodeSetXPath(ARTIFACT_FACTORIES);
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
259 if (nodes == null) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
260 logger.warn("No factories found");
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
261 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
262
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 Document config = Config.getConfig();
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
265 for (int i = 0, N = nodes != null ? nodes.getLength() : 0; i < N; ++i) {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
266 String className = nodes.item(i).getTextContent().trim();
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268 ArtifactFactory factory = null;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
270 try {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 Class clazz = Class.forName(className);
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272 factory = (ArtifactFactory)clazz.newInstance();
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
275 logger.error(cnfe.getLocalizedMessage(), cnfe);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
276 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
278 logger.error(ie.getLocalizedMessage(), ie);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
281 logger.error(cce.getLocalizedMessage(), cce);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
282 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
283 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
284 logger.error(iae.getLocalizedMessage(), iae);
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 if (factory != null) {
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
288 factory.setup(config, nodes.item(i));
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
289 loadedFactories.add(factory);
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
290 logger.info("Registering '"
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
291 + factory.getName() + "' as artifact factory.");
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295 artifactFactories = (ArtifactFactory [])loadedFactories.toArray(
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 new ArtifactFactory[loadedFactories.size()]);
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
298
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
299 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
300 * Scans the global configuration for the configured service factories
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
301 * and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
302 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
303 protected void loadServiceFactories() {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
304
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
305 logger.info("loading service factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
306
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
307 ArrayList loadedFactories = new ArrayList();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
308
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
309 NodeList nodes = Config.getNodeSetXPath(SERVICE_FACTORIES);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
310
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
311 if (nodes == null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
312 logger.warn("No factories found");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
313 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
314
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
315 Document config = Config.getConfig();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
316
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
317 for (int i = 0, N = nodes != null ? nodes.getLength() : 0; i < N; ++i) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
318 String className = nodes.item(i).getTextContent().trim();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
319
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
320 ServiceFactory factory = null;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
321
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
322 try {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
323 Class clazz = Class.forName(className);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
324 factory = (ServiceFactory)clazz.newInstance();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
325 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
326 catch (ClassNotFoundException cnfe) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
327 logger.error(cnfe.getLocalizedMessage(), cnfe);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
328 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
329 catch (InstantiationException ie) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
330 logger.error(ie.getLocalizedMessage(), ie);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
331 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
332 catch (ClassCastException cce) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
333 logger.error(cce.getLocalizedMessage(), cce);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
334 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
335 catch (IllegalAccessException iae) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
336 logger.error(iae.getLocalizedMessage(), iae);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
337 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
338
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
339 if (factory != null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
340 factory.setup(config, nodes.item(i));
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
341 loadedFactories.add(factory);
94
5332d956729c Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 89
diff changeset
342 logger.info( "Registering '" + factory.getName()
5332d956729c Brought all line lengths of non Javadoc lines below 80.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 89
diff changeset
343 + "' as service factory.");
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
344 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
345 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
346
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
347 serviceFactories = (ServiceFactory [])loadedFactories.toArray(
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
348 new ServiceFactory[loadedFactories.size()]);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
349 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
350
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
351
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
352 /**
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
353 * Scans the global configuration for the configured user factory.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
354 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
355 protected void loadUserFactory() {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
356 logger.info("loading user factory");
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
357
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
358 Node factory = Config.getNodeXPath(USER_FACTORY);
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
359
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
360 String className = Config.getStringXPath(
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
361 factory, "text()", DEFAULT_USER_FACTORY);
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
362
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
363 try {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
364 Class clazz = Class.forName(className);
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
365 userFactory = (UserFactory) clazz.newInstance();
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
366
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
367 userFactory.setup(Config.getConfig(), factory);
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
368 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
369 catch (ClassNotFoundException cnfe) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
370 logger.error(cnfe.getLocalizedMessage(), cnfe);
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
371 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
372 catch (InstantiationException ie) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
373 logger.error(ie.getLocalizedMessage(), ie);
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
374 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
375 catch (ClassCastException cce) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
376 logger.error(cce.getLocalizedMessage(), cce);
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
377 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
378 catch (IllegalAccessException iae) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
379 logger.error(iae.getLocalizedMessage(), iae);
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
380 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
381 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
382
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
383
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
384 protected void loadCallContextListener() {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
385 logger.info("loading CallContext.Listener");
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
386
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
387 Node listener = Config.getNodeXPath(CALLCONTEXT_LISTENER);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
388
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
389 if (listener == null) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
390 return;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
391 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
392
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
393 String className = Config.getStringXPath(listener, "text()");
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
394
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
395 try {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
396 Class clazz = Class.forName(className);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
397 callContextListener = (CallContext.Listener) clazz.newInstance();
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
398
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
399 callContextListener.setup(Config.getConfig(), listener);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
400 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
401 catch (ClassNotFoundException cnfe) {
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
402 logger.error(cnfe.getLocalizedMessage(), cnfe);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
403 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
404 catch (InstantiationException ie) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
405 logger.error(ie.getLocalizedMessage(), ie);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
406 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
407 catch (ClassCastException cce) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
408 logger.error(cce.getLocalizedMessage(), cce);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
409 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
410 catch (IllegalAccessException iae) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
411 logger.error(iae.getLocalizedMessage(), iae);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
412 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
413 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
414
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
415 protected void loadHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
416 logger.info("loading HTTPServer");
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
417
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
418 String className = Config.getStringXPath(
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
419 HTTP_SERVER, DEFAULT_HTTP_SERVER);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
420
265
d52947ce8629 XMLUtils.xpathString() returns empty string not null.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 263
diff changeset
421 logger.info("using HTTP server: " + className);
d52947ce8629 XMLUtils.xpathString() returns empty string not null.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 263
diff changeset
422
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
423 try {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
424 Class clazz = Class.forName(className);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
425 httpServer = (HTTPServer)clazz.newInstance();
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
426
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
427 httpServer.setup(Config.getConfig());
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
428 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
429 catch (ClassNotFoundException cnfe) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
430 logger.error(cnfe.getLocalizedMessage(), cnfe);
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
431 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
432 catch (InstantiationException ie) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
433 logger.error(ie.getLocalizedMessage(), ie);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
434 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
435 catch (ClassCastException cce) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
436 logger.error(cce.getLocalizedMessage(), cce);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
437 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
438 catch (IllegalAccessException iae) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
439 logger.error(iae.getLocalizedMessage(), iae);
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
440 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
441 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
442
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
443 protected void loadHooks() {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
444 logger.info("loading hooks");
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
445
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
446 postFeedHooks = new ArrayList<Hook>();
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
447 postAdvanceHooks = new ArrayList<Hook>();
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
448
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
449 NodeList nodes = Config.getNodeSetXPath(HOOKS);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
450
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
451 for (int i = 0, len = nodes.getLength(); i < len; i++) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
452 Node cfg = nodes.item(i);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
453 String applies = Config.getStringXPath(cfg, "@applies");
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
454
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
455 if (applies == null || applies.length() == 0) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
456 continue;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
457 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
458
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
459 Hook hook = loadHook(cfg);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
460 String[] apply = applies.split(",");
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
461
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
462 for (String a: apply) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
463 a = a.trim().toLowerCase();
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
464
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
465 if (a.equals("post-feed")) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
466 postFeedHooks.add(hook);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
467 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
468 else if (a.equals("post-advance")) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
469 postAdvanceHooks.add(hook);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
470 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
471 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
472 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
473 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
474
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
475 protected Hook loadHook(Node hookCfg) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
476 if (hookCfg == null) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
477 return null;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
478 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
479
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
480 Hook hook = null;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
481
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
482 String className = Config.getStringXPath(hookCfg, "@class");
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
483
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
484 try {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
485 Class clazz = Class.forName(className);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
486 hook = (Hook) clazz.newInstance();
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
487
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
488 hook.setup(hookCfg);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
489 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
490 catch (ClassNotFoundException cnfe) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
491 logger.error(cnfe.getLocalizedMessage(), cnfe);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
492 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
493 catch (InstantiationException ie) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
494 logger.error(ie.getLocalizedMessage(), ie);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
495 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
496 catch (ClassCastException cce) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
497 logger.error(cce.getLocalizedMessage(), cce);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
498 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
499 catch (IllegalAccessException iae) {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
500 logger.error(iae.getLocalizedMessage(), iae);
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
501 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
502
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
503 return hook;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
504 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
505
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
506 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
507 * Fetches the export signing secret from the global configuration.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
508 * If none is found if defaults to the DEFAULT_EXORT_SECRET which
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
509 * is insecure.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
510 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
511 protected void setupExportSecret() {
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
512 String secret = Config.getStringXPath(EXPORT_SECRET);
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
513
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
514 if (secret == null) {
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
515 logger.warn("NO EXPORT SECRET SET! USING INSECURE DEFAULT!");
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
516 secret = DEFAULT_EXPORT_SECRET;
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
517 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
518
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
519 exportSecret = StringUtils.getUTF8Bytes(secret);
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
520 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
521
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
522 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
523 * Loads all the dynamic classes configured by the global configuration.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
524 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
525 public void boot() {
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
526 setupExportSecret();
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
527 buildContext();
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
528 loadCollectionFactory();
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
529 loadArtifactFactories();
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
530 loadServiceFactories();
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
531 loadUserFactory();
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
532 loadCallContextListener();
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
533 loadHTTPServer();
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
534 loadHooks();
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
535 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
536
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
537 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
538 * Returns the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
539 *
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
540 * @return the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
541 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
542 public ArtifactCollectionFactory getArtifactCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
543 return collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
544 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
545
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
546 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
547 * Returns the list of ready to use artifact factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
548 * @return The list of artifact factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
549 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
550 public ArtifactFactory [] getArtifactFactories() {
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
551 return artifactFactories;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
552 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
553
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
554 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
555 * Returns the ready to use service factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
556 * @return The list of service factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
557 */
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
558 public ServiceFactory [] getServiceFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
559 return serviceFactories;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
560 }
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
561
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
562 /**
127
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
563 * Returns the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
564 *
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
565 * @return the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
566 */
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
567 public UserFactory getUserFactory() {
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
568 return userFactory;
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
569 }
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
570
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
571 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
572 * Returns the global context created by the global context factory.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
573 * @return The global context.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
574 */
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
575 public GlobalContext getContext() {
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
576 return context;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
577 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
578
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
579 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
580 * Returns the signing secret to be used when ex- and importing
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
581 * artifacts from and into the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
582 * @return the byte array containg the signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
583 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
584 public byte [] getExportSecret() {
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
585 return exportSecret;
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
586 }
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
587
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
588 /**
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
589 * Returns a CallContext.Listener if configured or null.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
590 *
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
591 * @return a CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
592 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
593 public CallContext.Listener getCallContextListener() {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
594 return callContextListener;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
595 }
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
596
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
597 public List<Hook> getPostFeedHooks() {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
598 return postFeedHooks;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
599 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
600
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
601 public List<Hook> getPostAdvanceHooks() {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
602 return postAdvanceHooks;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
603 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
604
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
605 public HTTPServer getHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
606 return httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
607 }
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
608 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
609 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org