01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: DatabaseAuthenticatedDeployer.java 3643 2007-01-12 15:29:45Z gbevin $
07: */
08: package com.uwyn.rife.authentication.elements;
09:
10: import com.uwyn.rife.authentication.credentialsmanagers.CredentialsManagerFactoryFactory;
11: import com.uwyn.rife.authentication.credentialsmanagers.DatabaseUsersFactory;
12: import com.uwyn.rife.authentication.remembermanagers.DatabaseRememberFactory;
13: import com.uwyn.rife.authentication.remembermanagers.RememberManagerFactoryFactory;
14: import com.uwyn.rife.authentication.sessionmanagers.DatabaseSessionsFactory;
15: import com.uwyn.rife.authentication.sessionmanagers.SessionManagerFactoryFactory;
16: import com.uwyn.rife.authentication.sessionvalidators.DatabaseSessionValidatorFactory;
17: import com.uwyn.rife.authentication.sessionvalidators.SessionValidatorFactoryFactory;
18: import com.uwyn.rife.engine.exceptions.EngineException;
19: import com.uwyn.rife.ioc.HierarchicalProperties;
20:
21: /**
22: * Deployer for {@link Authenticated} elements that by default sets up all the
23: * authentication managers for database storage.
24: *
25: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
26: * @version $Revision: 3643 $
27: * @since 1.0
28: */
29: public class DatabaseAuthenticatedDeployer extends
30: FactoryPropertyAuthenticatedDeployer {
31: public void deploy() throws EngineException {
32: HierarchicalProperties properties = getElementInfo()
33: .getProperties();
34: if (getElementInfo()
35: .isPropertyEmpty(
36: SessionManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
37: properties
38: .put(
39: SessionManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
40: DatabaseSessionsFactory.class.getName());
41: }
42: if (getElementInfo()
43: .isPropertyEmpty(
44: SessionValidatorFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
45: properties
46: .put(
47: SessionValidatorFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
48: DatabaseSessionValidatorFactory.class
49: .getName());
50: }
51: if (getElementInfo()
52: .isPropertyEmpty(
53: CredentialsManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
54: properties
55: .put(
56: CredentialsManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
57: DatabaseUsersFactory.class.getName());
58: }
59: if (getElementInfo()
60: .isPropertyEmpty(
61: RememberManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS)) {
62: properties
63: .put(
64: RememberManagerFactoryFactory.PROPERTYNAME_FACTORY_CLASS,
65: DatabaseRememberFactory.class.getName());
66: }
67:
68: super.deploy();
69: }
70: }
|