01: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal;
07:
08: import org.jasig.portal.properties.PropertiesManager;
09: import org.apache.commons.logging.Log;
10: import org.apache.commons.logging.LogFactory;
11:
12: /**
13: * Produces an implementation of IUserIdentityStore
14: * @author Ken Weiner, kweiner@unicon.net
15: * @version $Revision: 35150 $
16: */
17: public class UserIdentityStoreFactory {
18:
19: private static final Log log = LogFactory
20: .getLog(UserIdentityStoreFactory.class);
21:
22: private static IUserIdentityStore UserIdentityStoreImpl = null;
23:
24: static {
25: // Retrieve the class name of the concrete IUserIdentityStore implementation
26: String className = PropertiesManager
27: .getProperty(
28: "org.jasig.portal.UserIdentityStoreFactory.implementation",
29: null);
30: // Fail if this is not found
31: if (className == null)
32: log
33: .error("UserIdentityStoreFactory: org.jasig.portal.UserIdentityStoreFactory.implementation must be specified in portal.properties");
34: try {
35: // Create an instance of the IUserIdentityStore as specified in portal.properties
36: UserIdentityStoreImpl = (IUserIdentityStore) Class.forName(
37: className).newInstance();
38: } catch (Exception e) {
39: log.error(
40: "UserIdentityStoreFactory: Could not instantiate "
41: + className, e);
42: }
43: }
44:
45: /**
46: * Returns an instance of the IUserIdentityStore specified in portal.properties
47: * @return an IUserIdentityStore implementation
48: */
49: public static IUserIdentityStore getUserIdentityStoreImpl() {
50: return UserIdentityStoreImpl;
51: }
52: }
|