Mercurial > dive4elements > framework
changeset 130:147610c43863
The UserFactory got a setup() method that is called while bootstrap.
artifacts/trunk@1354 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 02 Mar 2011 07:36:00 +0000 |
parents | 10d726907419 |
children | 82809c5992e1 |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java artifacts/src/main/java/de/intevation/artifacts/UserFactory.java |
diffstat | 5 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Mar 02 07:28:20 2011 +0000 +++ b/ChangeLog Wed Mar 02 07:36:00 2011 +0000 @@ -1,3 +1,16 @@ +2011-03-02 Ingo Weinzierl <ingo@intevation.de> + + * artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java, + artifacts/src/main/java/de/intevation/artifacts/UserFactory.java: Added + a setup method like the artifact factories have. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java: + Added an import statement for the UserFactory that was missing here. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java: + The setup() method of the UserFactory is called after the concrete + factory class has been instantiated. + 2011-03-02 Ingo Weinzierl <ingo@intevation.de> * artifacts/pom.xml: Bugfix: We are able to compile the artifacts package
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Mar 02 07:28:20 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Mar 02 07:36:00 2011 +0000 @@ -20,6 +20,7 @@ import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.Service; import de.intevation.artifacts.ServiceFactory; +import de.intevation.artifacts.UserFactory; import java.io.IOException; import java.io.OutputStream;
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java Wed Mar 02 07:28:20 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java Wed Mar 02 07:36:00 2011 +0000 @@ -11,6 +11,7 @@ import org.apache.log4j.Logger; import org.w3c.dom.Document; +import org.w3c.dom.Node; import de.intevation.artifacts.User; import de.intevation.artifacts.UserFactory; @@ -35,6 +36,11 @@ } + public void setup(Document config, Node factoryNode) { + logger.debug("DefaultUserFactory.setup"); + } + + /** * This method creates a new DefaultUser with the given identifier, name and * role.
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java Wed Mar 02 07:28:20 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java Wed Mar 02 07:36:00 2011 +0000 @@ -18,6 +18,7 @@ import org.apache.log4j.Logger; import org.w3c.dom.Document; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** @@ -62,7 +63,7 @@ * configuration. */ public static final String USER_FACTORY = - "/artfifact-database/factories/user-factory/text()"; + "/artfifact-database/factories/user-factory"; /** * The name of the default user factory. @@ -263,12 +264,16 @@ protected void loadUserFactory() { logger.info("loading user factory"); + Node factory = Config.getNodeXPath(USER_FACTORY); + String className = Config.getStringXPath( - USER_FACTORY, DEFAULT_USER_FACTORY); + factory, "text()", DEFAULT_USER_FACTORY); try { Class clazz = Class.forName(className); userFactory = (UserFactory) clazz.newInstance(); + + userFactory.setup(Config.getConfig(), factory); } catch (ClassNotFoundException cnfe) { logger.error(cnfe.getLocalizedMessage(), cnfe);
--- a/artifacts/src/main/java/de/intevation/artifacts/UserFactory.java Wed Mar 02 07:28:20 2011 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/UserFactory.java Wed Mar 02 07:36:00 2011 +0000 @@ -8,11 +8,14 @@ package de.intevation.artifacts; import org.w3c.dom.Document; +import org.w3c.dom.Node; import java.io.Serializable; public interface UserFactory { + void setup(Document config, Node factoryNode); + User createUser(String identifier, String name, Document role, Object context); void deleteUser(User user, Object context);