01: /*
02: * Copyright 2001-2007 Steven Grimm <koreth[remove] at midwinter dot com> and
03: * Geert Bevin <gbevin[remove] at uwyn dot com>
04: * Distributed under the terms of either:
05: * - the common development and distribution license (CDDL), v1.0; or
06: * - the GNU Lesser General Public License, v2.1 or later
07: * $Id: FactoryPropertyAuthenticatedDeployer.java 3643 2007-01-12 15:29:45Z gbevin $
08: */
09: package com.uwyn.rife.authentication.elements;
10:
11: import com.uwyn.rife.authentication.CredentialsManager;
12: import com.uwyn.rife.authentication.RememberManager;
13: import com.uwyn.rife.authentication.SessionManager;
14: import com.uwyn.rife.authentication.SessionValidator;
15: import com.uwyn.rife.authentication.credentialsmanagers.CredentialsManagerFactoryFactory;
16: import com.uwyn.rife.authentication.remembermanagers.RememberManagerFactoryFactory;
17: import com.uwyn.rife.authentication.sessionmanagers.SessionManagerFactoryFactory;
18: import com.uwyn.rife.authentication.sessionvalidators.SessionValidatorFactoryFactory;
19: import com.uwyn.rife.engine.exceptions.PropertyValueErrorException;
20: import com.uwyn.rife.ioc.exceptions.PropertyValueException;
21:
22: /**
23: * Deployer for {@link Authenticated} elements that uses properties to determine
24: * which factory classes will create the various authentication objects.
25: *
26: * @author Steven Grimm (koreth[remove] at midwinter dot com)
27: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
28: * @version $Revision: 3643 $
29: * @see SessionManagerFactoryFactory
30: * @see SessionValidatorFactoryFactory
31: * @see CredentialsManagerFactoryFactory
32: * @see RememberManagerFactoryFactory
33: * @since 1.6
34: */
35: public class FactoryPropertyAuthenticatedDeployer extends
36: AbstractPropertyAuthenticatedDeployer {
37: public SessionManager createSessionManager() {
38: try {
39: return SessionManagerFactoryFactory
40: .getManager(getElementInfo().getProperties());
41: } catch (PropertyValueException e) {
42: throw new PropertyValueErrorException(getElementInfo()
43: .getDeclarationName(), e);
44: }
45: }
46:
47: public SessionValidator createSessionValidator() {
48: try {
49: return SessionValidatorFactoryFactory
50: .getValidator(getElementInfo().getProperties());
51: } catch (PropertyValueException e) {
52: throw new PropertyValueErrorException(getElementInfo()
53: .getDeclarationName(), e);
54: }
55: }
56:
57: public CredentialsManager createCredentialsManager() {
58: try {
59: return CredentialsManagerFactoryFactory
60: .getManager(getElementInfo().getProperties());
61: } catch (PropertyValueException e) {
62: throw new PropertyValueErrorException(getElementInfo()
63: .getDeclarationName(), e);
64: }
65: }
66:
67: public RememberManager createRememberManager() {
68: try {
69: return RememberManagerFactoryFactory
70: .getManager(getElementInfo().getProperties());
71: } catch (PropertyValueException e) {
72: throw new PropertyValueErrorException(getElementInfo()
73: .getDeclarationName(), e);
74: }
75: }
76: }
|