annotate artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java @ 292:39c0ff00d188

Introduced a hook concept - currently used for 'post-feed' and 'post-advance'. artifacts/trunk@2327 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 13 Jul 2011 13:12:08 +0000
parents d52947ce8629
children a367a0d011af
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;
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
17 import de.intevation.artifacts.Hook;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
18 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
19 import de.intevation.artifacts.UserFactory;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
20
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
21
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
22 import de.intevation.artifactdatabase.rest.HTTPServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
23
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
24 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
25 import java.util.List;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
26
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
27 import org.apache.log4j.Logger;
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
28
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
29 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
30 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
31 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
32
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
33 /**
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 * 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
35 *
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
36 * @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
37 */
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 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
39 {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
40 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
41
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
42 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
43 * 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
44 * the global configuration.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
45 */
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
46 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
47 "/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
48
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
49 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
50 * 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
51 */
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
52 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
53 "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
54
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
55 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
56 * 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
57 * 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
58 */
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
59 public static final String ARTIFACT_FACTORIES =
16
635310c6a20e Bug fixed in in XPath Expression.
Tim Englich <tim.englich@intevation.de>
parents: 10
diff changeset
60 "/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
61
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
62 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
63 * 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
64 * 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
65 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
66 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
67 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
68 "/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
69
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
70 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
71 * 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
72 * configuration.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
73 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
74 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
75 "/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
76
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 * 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
79 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
80 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
81 "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
82
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
83 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
84 * 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
85 * configuration.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
86 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
87 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
88 "/artifact-database/factories/collection-factory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
89
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 * 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
92 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
93 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
94 "de.intevation.artifactdatabase.DefaultArtifactCollectionFactory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
95
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
96 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
97 * 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
98 * made by the artfifact database server.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
99 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
100 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
101 "/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
102
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
103 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
104 * 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
105 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
106 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
107 "/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
108
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
109 /**
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
110 * 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
111 */
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
112 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
113 "/artifact-database/hooks/hook";
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
114
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
115 public static final String HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
116 "/artifact-database/rest-server/http-server/text()";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
117
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
118 public static final String DEFAULT_HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
119 "de.intevation.artifactdatabase.rest.Standalone";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
120
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
121 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
122 * Default export signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
123 * <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
124 * IN THE CONFIGURATION.</strong>.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
125 */
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
126 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
127 "!!!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
128
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
129 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
130 * 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
131 */
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
132 protected Object 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
133
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
134 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
135 * 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
136 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
137 */
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
138 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
139
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
140 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
141 * 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
142 * exposed by the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
143 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
144 protected ServiceFactory [] serviceFactories;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
145
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
146 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
147 * 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
148 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
149 protected UserFactory userFactory;
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
150
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
151 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
152 * 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
153 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
154 protected ArtifactCollectionFactory collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
156 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
157 * The CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
158 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
159 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
160
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
161 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
162
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
163 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
164
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
165 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
166 * 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
167 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
168 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
169
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
170 protected HTTPServer httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
171
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
172
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
173 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
174 * Default constructor
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
175 */
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
176 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
177 }
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 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
180 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
181 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
182
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 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
184
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 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
186 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
187 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
188 }
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 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
190 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
191 }
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 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
193 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
194 }
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 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
196 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
197 }
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 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
199 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
200 }
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 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
203 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
204 }
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
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
206 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
207 + "' for context creation.");
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
208
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
209 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
210 }
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
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
212
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 * 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
215 * and sets it up.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
216 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
217 protected void loadCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
218
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
219 logger.info("loading collection factory.");
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
220
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
221 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
222
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
223 String className = Config.getStringXPath(
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
224 factory, "text()", DEFAULT_COLLECTION_FACTORY);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
225
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
226 try {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
227 Class clazz = Class.forName(className);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
228 collectionFactory = (ArtifactCollectionFactory) clazz.newInstance();
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
229
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
230 collectionFactory.setup(Config.getConfig(), factory);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
231 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
232 catch (ClassNotFoundException cnfe) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
233 logger.error(cnfe.getLocalizedMessage(), cnfe);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
234 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
235 catch (InstantiationException ie) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
236 logger.error(ie.getLocalizedMessage(), ie);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
237 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
238 catch (ClassCastException cce) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
239 logger.error(cce.getLocalizedMessage(), cce);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
240 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
241 catch (IllegalAccessException iae) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
242 logger.error(iae.getLocalizedMessage(), iae);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
243 }
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
246 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
247 * 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
248 * artifact factories and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
249 */
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
250 protected void loadArtifactFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
251
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
252 logger.info("loading artifact factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
253
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
254 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
255
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 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
257
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
258 if (nodes == null) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
259 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
260 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
261
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
262 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
263
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
264 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
265 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
266
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 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
268
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 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
270 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
271 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
272 }
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 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
274 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
275 }
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 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
277 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
278 }
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 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
280 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
281 }
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 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
283 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
284 }
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 if (factory != null) {
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
287 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
288 loadedFactories.add(factory);
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
289 logger.info("Registering '"
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
290 + 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
291 }
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 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
295 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
296 }
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
298 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
299 * 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
300 * and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
301 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
302 protected void loadServiceFactories() {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
303
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
304 logger.info("loading service factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
305
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
306 ArrayList loadedFactories = new ArrayList();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
307
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
308 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
309
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
310 if (nodes == null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
311 logger.warn("No factories found");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
312 }
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 Document config = Config.getConfig();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
315
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
316 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
317 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
318
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
319 ServiceFactory factory = null;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
320
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
321 try {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
322 Class clazz = Class.forName(className);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
323 factory = (ServiceFactory)clazz.newInstance();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
324 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
325 catch (ClassNotFoundException cnfe) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
326 logger.error(cnfe.getLocalizedMessage(), cnfe);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
327 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
328 catch (InstantiationException ie) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
329 logger.error(ie.getLocalizedMessage(), ie);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
330 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
331 catch (ClassCastException cce) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
332 logger.error(cce.getLocalizedMessage(), cce);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
333 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
334 catch (IllegalAccessException iae) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
335 logger.error(iae.getLocalizedMessage(), iae);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
336 }
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 if (factory != null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
339 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
340 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
341 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
342 + "' as service factory.");
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
343 }
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 serviceFactories = (ServiceFactory [])loadedFactories.toArray(
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
347 new ServiceFactory[loadedFactories.size()]);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
348 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
349
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
350
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 * 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
353 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
354 protected void loadUserFactory() {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
355 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
356
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
357 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
358
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
359 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
360 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
361
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
362 try {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
363 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
364 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
365
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
366 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
367 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
368 catch (ClassNotFoundException cnfe) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
369 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
370 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
371 catch (InstantiationException ie) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
372 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
373 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
374 catch (ClassCastException cce) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
375 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
376 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
377 catch (IllegalAccessException iae) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
378 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
379 }
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
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
382
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
383 protected void loadCallContextListener() {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
384 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
385
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
386 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
387
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
388 if (listener == null) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
389 return;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
390 }
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 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
393
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
394 try {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
395 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
396 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
397
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
398 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
399 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
400 catch (ClassNotFoundException cnfe) {
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
401 logger.error(cnfe.getLocalizedMessage(), cnfe);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
402 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
403 catch (InstantiationException ie) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
404 logger.error(ie.getLocalizedMessage(), ie);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
405 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
406 catch (ClassCastException cce) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
407 logger.error(cce.getLocalizedMessage(), cce);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
408 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
409 catch (IllegalAccessException iae) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
410 logger.error(iae.getLocalizedMessage(), iae);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
411 }
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 protected void loadHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
415 logger.info("loading HTTPServer");
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
416
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
417 String className = Config.getStringXPath(
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
418 HTTP_SERVER, DEFAULT_HTTP_SERVER);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
419
265
d52947ce8629 XMLUtils.xpathString() returns empty string not null.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 263
diff changeset
420 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
421
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
422 try {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
423 Class clazz = Class.forName(className);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
424 httpServer = (HTTPServer)clazz.newInstance();
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
425
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
426 httpServer.setup(Config.getConfig());
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
427 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
428 catch (ClassNotFoundException cnfe) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
429 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
430 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
431 catch (InstantiationException ie) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
432 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
433 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
434 catch (ClassCastException cce) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
435 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
436 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
437 catch (IllegalAccessException iae) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
438 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
439 }
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
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
442 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
443 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
444
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
445 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
446 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
447
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
448 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
449
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
450 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
451 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
452 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
453
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
454 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
455 continue;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
456 }
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 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
459 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
460
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
461 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
462 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
463
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
464 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
465 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
466 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
467 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
468 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
469 }
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 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
475 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
476 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
477 }
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 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
480
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
481 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
482
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
483 try {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
484 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
485 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
486
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
487 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
488 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
489 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
490 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
491 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
492 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
493 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
494 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
495 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
496 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
497 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
498 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
499 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
500 }
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 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
503 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
504
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
505 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
506 * 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
507 * 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
508 * is insecure.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
509 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
510 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
511 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
512
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
513 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
514 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
515 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
516 }
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 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
519 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
520
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
521 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
522 * 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
523 */
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
524 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
525 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
526 buildContext();
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
527 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
528 loadArtifactFactories();
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
529 loadServiceFactories();
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
530 loadUserFactory();
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
531 loadCallContextListener();
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
532 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
533 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
534 }
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
536 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
537 * Returns the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
538 *
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
539 * @return the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
540 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
541 public ArtifactCollectionFactory getArtifactCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
542 return collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
543 }
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 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
546 * 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
547 * @return The list of artifact factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
548 */
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
549 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
550 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
551 }
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
553 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
554 * 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
555 * @return The list of service factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
556 */
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
557 public ServiceFactory [] getServiceFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
558 return serviceFactories;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
559 }
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
560
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
561 /**
127
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
562 * Returns the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
563 *
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
564 * @return the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
565 */
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
566 public UserFactory getUserFactory() {
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
567 return userFactory;
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
568 }
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 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
571 * 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
572 * @return The global context.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
573 */
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
574 public Object getContext() {
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
575 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
576 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
577
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
578 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
579 * 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
580 * 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
581 * @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
582 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
583 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
584 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
585 }
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
586
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 * 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
589 *
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
590 * @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
591 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
592 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
593 return callContextListener;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
594 }
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
595
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
596 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
597 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
598 }
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 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
601 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
602 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
603
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
604 public HTTPServer getHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
605 return httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
606 }
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
607 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
608 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org