annotate artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java @ 304:40b64b4aafce

Added lifetime listeners to be called when system is up and is going down. artifacts/trunk@2410 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 27 Jul 2011 13:51:30 +0000
parents b0a949d3fe09
children d96bcb40dbf9
rev   line source
100
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
1 /*
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
3 *
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
5 * Read the file LGPL.txt coming with the software for details
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
7 */
933bbc9fc11f Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 94
diff changeset
8
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 package de.intevation.artifactdatabase;
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
207
b2115f484edb Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 155
diff changeset
11 import de.intevation.artifacts.common.utils.Config;
b2115f484edb Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 155
diff changeset
12
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
13 import de.intevation.artifacts.ArtifactCollectionFactory;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
14 import de.intevation.artifacts.ArtifactContextFactory;
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
15 import de.intevation.artifacts.ArtifactFactory;
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
16 import de.intevation.artifacts.CallContext;
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
17 import de.intevation.artifacts.GlobalContext;
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
18 import de.intevation.artifacts.Hook;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
19 import de.intevation.artifacts.ServiceFactory;
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
20 import de.intevation.artifacts.UserFactory;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
21
301
b0a949d3fe09 Moved StringUtils to common package. Added some Override annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 293
diff changeset
22 import de.intevation.artifacts.common.utils.StringUtils;
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
23
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
24 import de.intevation.artifactdatabase.rest.HTTPServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
25
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
26 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
27 import java.util.List;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
28
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
29 import org.apache.log4j.Logger;
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
30
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.Document;
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
32 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
33 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
34
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
35 /**
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 * 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
37 *
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
38 * @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
39 */
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 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
41 {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
42 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
43
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
44 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
45 * 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
46 * the global configuration.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
47 */
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
48 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
49 "/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
50
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
51 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
52 * 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
53 */
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
54 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
55 "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
56
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
57 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
58 * 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
59 * 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
60 */
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 public static final String ARTIFACT_FACTORIES =
16
635310c6a20e Bug fixed in in XPath Expression.
Tim Englich <tim.englich@intevation.de>
parents: 10
diff changeset
62 "/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
63
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
64 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
65 * 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
66 * 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
67 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
68 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
69 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
70 "/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
71
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
72 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
73 * 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
74 * configuration.
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
75 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
76 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
77 "/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
78
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 * 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
81 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
82 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
83 "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
84
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
85 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
86 * 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
87 * configuration.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
88 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
89 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
90 "/artifact-database/factories/collection-factory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
91
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
92 /**
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
93 * 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
94 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
95 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
96 "de.intevation.artifactdatabase.DefaultArtifactCollectionFactory";
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
97
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
98 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
99 * 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
100 * made by the artfifact database server.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
101 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
102 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
103 "/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
104
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
105 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
106 * 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
107 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
108 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
109 "/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
110
292
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 * 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
113 */
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
114 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
115 "/artifact-database/hooks/hook";
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
116
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
117 public static final String HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
118 "/artifact-database/rest-server/http-server/text()";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
119
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
120 public static final String DEFAULT_HTTP_SERVER =
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
121 "de.intevation.artifactdatabase.rest.Standalone";
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
122
304
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
123 public static final String LIFETIME_LISTENERS =
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
124 "/artifact-database/lifetime-listeners/listener";
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
125
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
126 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
127 * Default export signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
128 * <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
129 * IN THE CONFIGURATION.</strong>.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
130 */
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
131 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
132 "!!!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
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 * 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
136 */
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
137 protected GlobalContext context;
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
139 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
140 * 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
141 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
142 */
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
143 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
144
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
145 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
146 * 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
147 * exposed by the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
148 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
149 protected ServiceFactory [] serviceFactories;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
150
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
151 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
152 * 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
153 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
154 protected UserFactory userFactory;
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
155
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
156 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
157 * 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
158 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
159 protected ArtifactCollectionFactory collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
160
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
161 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
162 * The CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
163 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
164 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
165
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
166 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
167
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
168 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
169
304
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
170 protected List<LifetimeListener> lifetimeListeners;
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
171
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
172 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
173 * 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
174 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
175 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
176
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
177 protected HTTPServer httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
178
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
179
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
180 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
181 * Default constructor
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
182 */
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
183 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
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
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 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
187 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
188 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
189
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 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
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 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
193 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
194 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
195 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
197 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
198 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
200 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
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 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
203 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
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 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
206 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
207 }
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
208
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 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
210 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
211 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
213 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
214 + "' for context creation.");
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
215
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
216 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
217 }
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
218
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
219
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
220 /**
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
221 * 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
222 * and sets it up.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
223 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
224 protected void loadCollectionFactory() {
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 logger.info("loading collection factory.");
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
227
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
228 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
229
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
230 String className = Config.getStringXPath(
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
231 factory, "text()", DEFAULT_COLLECTION_FACTORY);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
232
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
233 try {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
234 Class clazz = Class.forName(className);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
235 collectionFactory = (ArtifactCollectionFactory) clazz.newInstance();
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
236
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
237 collectionFactory.setup(Config.getConfig(), factory);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
238 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
239 catch (ClassNotFoundException cnfe) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
240 logger.error(cnfe.getLocalizedMessage(), cnfe);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
241 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
242 catch (InstantiationException ie) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
243 logger.error(ie.getLocalizedMessage(), ie);
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 catch (ClassCastException cce) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
246 logger.error(cce.getLocalizedMessage(), cce);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
247 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
248 catch (IllegalAccessException iae) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
249 logger.error(iae.getLocalizedMessage(), iae);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
250 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
251 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
252
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
253 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
254 * 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
255 * artifact factories and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
256 */
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
257 protected void loadArtifactFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
258
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
259 logger.info("loading artifact factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
260
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
261 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
262
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 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
264
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
265 if (nodes == null) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
266 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
267 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
268
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
269 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
270
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
271 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
272 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
273
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 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
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 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
277 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
278 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
279 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
281 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
282 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
283 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
284 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
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 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
287 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
288 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
289 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
290 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
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 if (factory != null) {
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
294 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
295 loadedFactories.add(factory);
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
296 logger.info("Registering '"
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
297 + 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
298 }
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
299 }
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
300
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
301 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
302 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
303 }
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
304
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
305 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
306 * 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
307 * and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
308 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
309 protected void loadServiceFactories() {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
310
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
311 logger.info("loading service factories");
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 ArrayList loadedFactories = new ArrayList();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
314
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
315 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
316
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
317 if (nodes == null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
318 logger.warn("No factories found");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
319 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
320
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
321 Document config = Config.getConfig();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
322
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
323 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
324 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
325
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
326 ServiceFactory factory = null;
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 try {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
329 Class clazz = Class.forName(className);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
330 factory = (ServiceFactory)clazz.newInstance();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
331 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
332 catch (ClassNotFoundException cnfe) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
333 logger.error(cnfe.getLocalizedMessage(), cnfe);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
334 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
335 catch (InstantiationException ie) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
336 logger.error(ie.getLocalizedMessage(), ie);
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 catch (ClassCastException cce) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
339 logger.error(cce.getLocalizedMessage(), cce);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
340 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
341 catch (IllegalAccessException iae) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
342 logger.error(iae.getLocalizedMessage(), iae);
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 if (factory != null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
346 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
347 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
348 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
349 + "' as service factory.");
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
350 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
351 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
352
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
353 serviceFactories = (ServiceFactory [])loadedFactories.toArray(
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
354 new ServiceFactory[loadedFactories.size()]);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
355 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
356
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
357
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
358 /**
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
359 * 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
360 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
361 protected void loadUserFactory() {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
362 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
363
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
364 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
365
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
366 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
367 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
368
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
369 try {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
370 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
371 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
372
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
373 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
374 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
375 catch (ClassNotFoundException cnfe) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
376 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
377 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
378 catch (InstantiationException ie) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
379 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
380 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
381 catch (ClassCastException cce) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
382 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
383 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
384 catch (IllegalAccessException iae) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
385 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
386 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
387 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
388
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
389
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
390 protected void loadCallContextListener() {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
391 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
392
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
393 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
394
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
395 if (listener == null) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
396 return;
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
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
399 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
400
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
401 try {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
402 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
403 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
404
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
405 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
406 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
407 catch (ClassNotFoundException cnfe) {
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
408 logger.error(cnfe.getLocalizedMessage(), cnfe);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
409 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
410 catch (InstantiationException ie) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
411 logger.error(ie.getLocalizedMessage(), ie);
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 catch (ClassCastException cce) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
414 logger.error(cce.getLocalizedMessage(), cce);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
415 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
416 catch (IllegalAccessException iae) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
417 logger.error(iae.getLocalizedMessage(), iae);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
418 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
419 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
420
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
421 protected void loadHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
422 logger.info("loading HTTPServer");
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
423
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
424 String className = Config.getStringXPath(
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
425 HTTP_SERVER, DEFAULT_HTTP_SERVER);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
426
265
d52947ce8629 XMLUtils.xpathString() returns empty string not null.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 263
diff changeset
427 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
428
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
429 try {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
430 Class clazz = Class.forName(className);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
431 httpServer = (HTTPServer)clazz.newInstance();
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
432
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
433 httpServer.setup(Config.getConfig());
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
434 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
435 catch (ClassNotFoundException cnfe) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
436 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
437 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
438 catch (InstantiationException ie) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
439 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
440 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
441 catch (ClassCastException cce) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
442 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
443 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
444 catch (IllegalAccessException iae) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
445 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
446 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
447 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
448
304
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
449 protected void loadLifetimeListeners() {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
450 logger.info("loading lifetime listeners");
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
451
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
452 NodeList nodes = Config.getNodeSetXPath(LIFETIME_LISTENERS);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
453
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
454 if (nodes == null) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
455 logger.debug("no lifetime listeners configure");
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
456 return;
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
457 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
458
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
459 List<LifetimeListener> ltls = new ArrayList<LifetimeListener>();
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
460
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
461 for (int i = 0, N = nodes.getLength(); i < N; ++i) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
462 Node node = nodes.item(i);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
463 String className = node.getTextContent();
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
464 if (className == null
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
465 || (className = className.trim()).length() == 0) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
466 continue;
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
467 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
468 try {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
469 Class clazz = Class.forName(className);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
470 LifetimeListener listener =
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
471 (LifetimeListener)clazz.newInstance();
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
472
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
473 listener.setup(Config.getConfig());
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
474
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
475 lifetimeListeners.add(listener);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
476 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
477 catch (ClassNotFoundException cnfe) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
478 logger.error(cnfe.getLocalizedMessage(), cnfe);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
479 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
480 catch (InstantiationException ie) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
481 logger.error(ie.getLocalizedMessage(), ie);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
482 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
483 catch (ClassCastException cce) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
484 logger.error(cce.getLocalizedMessage(), cce);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
485 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
486 catch (IllegalAccessException iae) {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
487 logger.error(iae.getLocalizedMessage(), iae);
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
488 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
489 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
490
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
491 lifetimeListeners = ltls;
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
492 }
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
493
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
494 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
495 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
496
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
497 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
498 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
499
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
500 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
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 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
503 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
504 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
505
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
506 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
507 continue;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
508 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
509
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
510 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
511 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
512
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
513 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
514 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
515
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
516 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
517 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
518 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
519 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
520 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
521 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
522 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
523 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
524 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
525
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
526 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
527 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
528 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
529 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
530
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
531 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
532
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
533 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
534
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
535 try {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
536 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
537 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
538
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
539 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
540 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
541 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
542 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
543 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
544 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
545 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
546 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
547 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
548 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
549 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
550 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
551 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
552 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
553
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
554 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
555 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
556
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
557 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
558 * 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
559 * 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
560 * is insecure.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
561 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
562 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
563 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
564
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
565 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
566 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
567 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
568 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
569
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
570 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
571 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
572
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
573 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
574 * 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
575 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
576 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
577 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
578 buildContext();
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
579 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
580 loadArtifactFactories();
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
581 loadServiceFactories();
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
582 loadUserFactory();
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
583 loadCallContextListener();
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
584 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
585 loadHooks();
304
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
586 loadLifetimeListeners();
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
587 }
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
588
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
589 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
590 * Returns the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
591 *
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
592 * @return the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
593 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
594 public ArtifactCollectionFactory getArtifactCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
595 return collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
596 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
597
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
598 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
599 * 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
600 * @return The list of artifact factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
601 */
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
602 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
603 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
604 }
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
605
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
606 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
607 * 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
608 * @return The list of service factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
609 */
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
610 public ServiceFactory [] getServiceFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
611 return serviceFactories;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
612 }
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
613
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
614 /**
127
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
615 * Returns the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
616 *
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
617 * @return the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
618 */
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
619 public UserFactory getUserFactory() {
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
620 return userFactory;
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
621 }
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
622
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
623 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
624 * 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
625 * @return The global context.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
626 */
293
a367a0d011af Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 292
diff changeset
627 public GlobalContext getContext() {
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
628 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
629 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
630
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
631 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
632 * 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
633 * 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
634 * @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
635 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
636 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
637 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
638 }
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
639
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
640 /**
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
641 * 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
642 *
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
643 * @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
644 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
645 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
646 return callContextListener;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
647 }
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
648
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
649 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
650 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
651 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
652
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
653 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
654 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
655 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
656
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
657 public HTTPServer getHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
658 return httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
659 }
304
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
660
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
661 public List<LifetimeListener> getLifetimeListeners() {
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
662 return lifetimeListeners;
40b64b4aafce Added lifetime listeners to be called when system is up and is going down.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 301
diff changeset
663 }
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
664 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
665 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org