annotate artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java @ 301:b0a949d3fe09

Moved StringUtils to common package. Added some Override annotations. artifacts/trunk@2394 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 22 Jul 2011 09:36:04 +0000
parents a367a0d011af
children 40b64b4aafce
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
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
123 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
124 * Default export signing secret.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
125 * <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
126 * IN THE CONFIGURATION.</strong>.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
127 */
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
128 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
129 "!!!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
130
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
131 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
132 * 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
133 */
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
134 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
135
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
136 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
137 * 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
138 * artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
139 */
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
140 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
141
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
142 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
143 * 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
144 * exposed by the artifact database.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
145 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
146 protected ServiceFactory [] serviceFactories;
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
147
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
148 /**
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
149 * 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
150 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
151 protected UserFactory userFactory;
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
152
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
153 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
154 * 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
155 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
156 protected ArtifactCollectionFactory collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
157
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
158 /**
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
159 * The CallContext.Listener.
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
160 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
161 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
162
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
163 protected List<Hook> postFeedHooks;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
164
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
165 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
166
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
167 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
168 * 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
169 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
170 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
171
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
172 protected HTTPServer httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
173
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
174
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
175 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
176 * Default constructor
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
177 */
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
178 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
179 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 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
182 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
183 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
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 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
186
8f2de197bce2 Added 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 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
188 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
189 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
190 }
8f2de197bce2 Added 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 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
192 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
193 }
8f2de197bce2 Added 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 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
195 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
196 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
198 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
199 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
201 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
202 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203
8f2de197bce2 Added 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 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
205 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
206 }
8f2de197bce2 Added 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
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
208 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
209 + "' for context creation.");
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
210
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
211 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
212 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
214
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
215 /**
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
216 * 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
217 * and sets it up.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
218 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
219 protected void loadCollectionFactory() {
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 logger.info("loading collection factory.");
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
222
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
223 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
224
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
225 String className = Config.getStringXPath(
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
226 factory, "text()", DEFAULT_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 try {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
229 Class clazz = Class.forName(className);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
230 collectionFactory = (ArtifactCollectionFactory) clazz.newInstance();
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
231
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
232 collectionFactory.setup(Config.getConfig(), factory);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
233 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
234 catch (ClassNotFoundException cnfe) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
235 logger.error(cnfe.getLocalizedMessage(), cnfe);
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 catch (InstantiationException ie) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
238 logger.error(ie.getLocalizedMessage(), ie);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
239 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
240 catch (ClassCastException cce) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
241 logger.error(cce.getLocalizedMessage(), cce);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
242 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
243 catch (IllegalAccessException iae) {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
244 logger.error(iae.getLocalizedMessage(), iae);
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
245 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
246 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
247
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
248 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
249 * 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
250 * artifact factories and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
251 */
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
252 protected void loadArtifactFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
253
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
254 logger.info("loading artifact factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
255
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
256 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
257
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258 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
259
10
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
260 if (nodes == null) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
261 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
262 }
e8626caac353 * Made Artifact life cycle symmetric: setup/endOfLife.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 7
diff changeset
263
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
264 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
265
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
266 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
267 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
268
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269 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
270
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 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
272 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
273 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
274 }
8f2de197bce2 Added 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 catch (ClassNotFoundException cnfe) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
276 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
277 }
8f2de197bce2 Added 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 catch (InstantiationException ie) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
279 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
280 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 catch (ClassCastException cce) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
282 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
283 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
284 catch (IllegalAccessException iae) {
17
5a6b6a3debc7 Integrated logging into artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 16
diff changeset
285 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
286 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287
8f2de197bce2 Added 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 if (factory != null) {
19
1259d192e3c3 * New configuration based on config directory
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 17
diff changeset
289 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
290 loadedFactories.add(factory);
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
291 logger.info("Registering '"
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
292 + 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
293 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 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
297 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
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
300 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
301 * 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
302 * and sets them up.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
303 */
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
304 protected void loadServiceFactories() {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
305
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
306 logger.info("loading service factories");
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
307
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
308 ArrayList loadedFactories = new ArrayList();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
309
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
310 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
311
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
312 if (nodes == null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
313 logger.warn("No factories found");
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
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
316 Document config = Config.getConfig();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
317
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
318 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
319 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
320
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
321 ServiceFactory factory = null;
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 try {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
324 Class clazz = Class.forName(className);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
325 factory = (ServiceFactory)clazz.newInstance();
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
326 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
327 catch (ClassNotFoundException cnfe) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
328 logger.error(cnfe.getLocalizedMessage(), cnfe);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
329 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
330 catch (InstantiationException ie) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
331 logger.error(ie.getLocalizedMessage(), ie);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
332 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
333 catch (ClassCastException cce) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
334 logger.error(cce.getLocalizedMessage(), cce);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
335 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
336 catch (IllegalAccessException iae) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
337 logger.error(iae.getLocalizedMessage(), iae);
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
338 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
339
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
340 if (factory != null) {
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
341 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
342 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
343 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
344 + "' as service factory.");
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
345 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
346 }
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
347
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
348 serviceFactories = (ServiceFactory [])loadedFactories.toArray(
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
349 new ServiceFactory[loadedFactories.size()]);
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
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
352
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
353 /**
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
354 * 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
355 */
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
356 protected void loadUserFactory() {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
357 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
358
130
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
359 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
360
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
361 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
362 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
363
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
364 try {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
365 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
366 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
367
147610c43863 The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
368 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
369 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
370 catch (ClassNotFoundException cnfe) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
371 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
372 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
373 catch (InstantiationException ie) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
374 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
375 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
376 catch (ClassCastException cce) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
377 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
378 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
379 catch (IllegalAccessException iae) {
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
380 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
381 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
382 }
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
383
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
384
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
385 protected void loadCallContextListener() {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
386 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
387
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
388 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
389
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
390 if (listener == null) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
391 return;
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
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
394 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
395
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
396 try {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
397 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
398 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
399
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
400 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
401 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
402 catch (ClassNotFoundException cnfe) {
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
403 logger.error(cnfe.getLocalizedMessage(), cnfe);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
404 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
405 catch (InstantiationException ie) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
406 logger.error(ie.getLocalizedMessage(), ie);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
407 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
408 catch (ClassCastException cce) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
409 logger.error(cce.getLocalizedMessage(), cce);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
410 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
411 catch (IllegalAccessException iae) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
412 logger.error(iae.getLocalizedMessage(), iae);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
413 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
414 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
415
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
416 protected void loadHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
417 logger.info("loading HTTPServer");
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 String className = Config.getStringXPath(
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
420 HTTP_SERVER, DEFAULT_HTTP_SERVER);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
421
265
d52947ce8629 XMLUtils.xpathString() returns empty string not null.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 263
diff changeset
422 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
423
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
424 try {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
425 Class clazz = Class.forName(className);
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
426 httpServer = (HTTPServer)clazz.newInstance();
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
427
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
428 httpServer.setup(Config.getConfig());
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
429 }
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
430 catch (ClassNotFoundException cnfe) {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
431 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
432 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
433 catch (InstantiationException ie) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
434 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
435 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
436 catch (ClassCastException cce) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
437 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
438 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
439 catch (IllegalAccessException iae) {
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
440 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
441 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
442 }
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
443
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
444 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
445 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
446
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
447 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
448 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
449
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
450 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
451
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
452 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
453 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
454 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
455
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
456 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
457 continue;
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
458 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
459
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
460 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
461 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
462
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
463 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
464 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
465
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
466 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
467 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
468 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
469 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
470 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
471 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
472 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
473 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
474 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
475
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
476 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
477 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
478 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
479 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
480
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
481 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
482
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
483 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
484
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
485 try {
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
486 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
487 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
488
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
489 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
490 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
491 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
492 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
493 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
494 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
495 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
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 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
498 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
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 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
501 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
502 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
503
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
504 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
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
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
507 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
508 * 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
509 * 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
510 * is insecure.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
511 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
512 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
513 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
514
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
515 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
516 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
517 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
518 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
519
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
520 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
521 }
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
522
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
523 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
524 * 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
525 */
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
526 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
527 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
528 buildContext();
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
529 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
530 loadArtifactFactories();
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
531 loadServiceFactories();
125
cee54e52000c Added the registration of the UserFactory to the bootstrap process.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 100
diff changeset
532 loadUserFactory();
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
533 loadCallContextListener();
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
534 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
535 loadHooks();
5
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
536 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
537
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
538 /**
155
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
539 * Returns the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
540 *
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
541 * @return the artifact collection factory.
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
542 */
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
543 public ArtifactCollectionFactory getArtifactCollectionFactory() {
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
544 return collectionFactory;
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
545 }
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
546
f797093c60bd Made a (single one) artifact collection factory configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 130
diff changeset
547 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
548 * 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
549 * @return The list of artifact factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
550 */
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
551 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
552 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
553 }
8f2de197bce2 Added config to artifact database and modelled bootstap of artifact factories on top of this.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
554
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
555 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
556 * 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
557 * @return The list of service factories.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
558 */
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
559 public ServiceFactory [] getServiceFactories() {
71
c99da6837be0 Load service factories and services during bootstrap.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 70
diff changeset
560 return serviceFactories;
70
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
561 }
ce488c1d3fc4 Serve services over artifact database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 19
diff changeset
562
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
563 /**
127
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
564 * Returns the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
565 *
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
566 * @return the user factory.
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
567 */
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
568 public UserFactory getUserFactory() {
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
569 return userFactory;
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
570 }
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
571
0245a87df368 Made the user factory available in the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 125
diff changeset
572 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
573 * 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
574 * @return The global context.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
575 */
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
576 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
577 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
578 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
579
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
580 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 79
diff changeset
581 * 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
582 * 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
583 * @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
584 */
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
585 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
586 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
587 }
249
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
588
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
589 /**
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
590 * 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
591 *
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
592 * @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
593 */
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
594 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
595 return callContextListener;
c47a640cfdae Enhanced the bootstrap - the CallContext.Listener is initialized (if configured).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 207
diff changeset
596 }
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
597
292
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
598 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
599 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
600 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
601
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
602 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
603 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
604 }
39c0ff00d188 Introduced a hook concept - currently used for 'post-feed' and 'post-advance'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 265
diff changeset
605
263
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
606 public HTTPServer getHTTPServer() {
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
607 return httpServer;
c0fb96f88ad1 Make used HTTP server exchangeable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 249
diff changeset
608 }
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
609 }
79
f69e5b87f05f Implementation to export artifacts as xml (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 77
diff changeset
610 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org