Source Code Cross Referenced for SimpleSessionManagerFactory.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » authentication » sessionmanagers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » rife 1.6.1 » com.uwyn.rife.authentication.sessionmanagers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
03:         * Steven Grimm <koreth[remove] at midwinter 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: SimpleSessionManagerFactory.java 3643 2007-01-12 15:29:45Z gbevin $
08:         */
09:        package com.uwyn.rife.authentication.sessionmanagers;
10:
11:        import com.uwyn.rife.authentication.SessionManager;
12:        import com.uwyn.rife.authentication.elements.exceptions.UnknownSessionManagerFactoryClassException;
13:        import com.uwyn.rife.ioc.HierarchicalProperties;
14:        import com.uwyn.rife.ioc.exceptions.MandatoryPropertyMissingException;
15:        import com.uwyn.rife.ioc.exceptions.PropertyValueException;
16:        import java.util.HashMap;
17:
18:        /**
19:         * Simple caching session manager factory. This keeps a cache of session manager
20:         * instances by name. This is used, for example, to create
21:         * {@link MemorySessions} objects; it may be used for any session manager that
22:         * doesn't require configuration information at startup time.
23:         * <p>
24:         * Element properties used:
25:         * <dl>
26:         * <dt>{@value #PROPERTYNAME_MANAGER_CLASS}</dt>
27:         * <dd>Name of the session manager class. If the class name is not fully
28:         * qualified, the package name
29:         * {@code com.uwyn.rife.authentication.sessionmanagers}
30:         * will be assumed.</dd>
31:         * <dt>{@value #PROPERTYNAME_MANAGER_ID}</dt>
32:         * <dd>Unique ID for this session manager instance. Optional. Use this if you
33:         * need different elements to maintain separate session stores.</dd>
34:         * </dl>
35:         * <p>
36:         * If you need logic other than a simple "new" for your session managers,
37:         * implement {@link SessionManagerFactory} instead.
38:         * 
39:         * @author Steven Grimm (koreth[remove] at midwinter dot com)
40:         * @author Geert Bevin (gbevin[remove] at uwyn dot com)
41:         * @version $Revision: 3643 $
42:         * @see SessionManager
43:         * @see SessionManagerFactory
44:         * @since 1.6
45:         */
46:        public class SimpleSessionManagerFactory implements 
47:                SessionManagerFactory {
48:            /** Element property that specifies the ID for a session manager instance. */
49:            public static final String PROPERTYNAME_MANAGER_ID = "sessionmanager_id";
50:
51:            /** Element property that specifies the class name for session managers. */
52:            public static final String PROPERTYNAME_MANAGER_CLASS = "sessionmanager_class";
53:
54:            private static HashMap<String, SessionManager> mSessionManagers = new HashMap<String, SessionManager>();
55:
56:            public SessionManager getManager(HierarchicalProperties properties)
57:                    throws PropertyValueException {
58:                String className = properties
59:                        .getValueString(PROPERTYNAME_MANAGER_CLASS);
60:                if (null == className) {
61:                    throw new MandatoryPropertyMissingException(
62:                            PROPERTYNAME_MANAGER_CLASS);
63:                }
64:                if (className.indexOf(".") < 0) {
65:                    className = SimpleSessionManagerFactory.class.getPackage()
66:                            .getName()
67:                            + "." + className;
68:                }
69:
70:                // Include the class name in the cache key so we don't give the caller
71:                // an unexpected session manager class if there's an identifier
72:                // collision (e.g. because the caller isn't specifying an ID
73:                // explicitly.)
74:                String identifier = className
75:                        + ":"
76:                        + properties
77:                                .getValueString(PROPERTYNAME_MANAGER_ID, "");
78:
79:                SessionManager session_manager = mSessionManagers
80:                        .get(identifier);
81:
82:                if (null == session_manager) {
83:                    try {
84:                        Class<SessionManager> clazz = (Class) Class
85:                                .forName(className);
86:                        session_manager = clazz.newInstance();
87:                        mSessionManagers.put(identifier, session_manager);
88:                    } catch (Exception e) {
89:                        throw new UnknownSessionManagerFactoryClassException(
90:                                className, e);
91:                    }
92:                }
93:
94:                return session_manager;
95:            }
96:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.