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 IChannelRegistryStore
14: * @author Ken Weiner, kweiner@unicon.net
15: * @version $Revision: 35150 $
16: */
17: public class ChannelRegistryStoreFactory {
18:
19: private static final Log log = LogFactory
20: .getLog(ChannelRegistryStoreFactory.class);
21:
22: private static IChannelRegistryStore channelRegistryStoreImpl = null;
23:
24: static {
25: // Retrieve the class name of the concrete IChannelRegistryStore implementation
26: String className = PropertiesManager
27: .getProperty(
28: "org.jasig.portal.ChannelRegistryStoreFactory.implementation",
29: null);
30:
31: // Fail if this is not found
32: if (className == null)
33: log
34: .error("ChannelRegistryStoreFactory: org.jasig.portal.ChannelRegistryStoreFactory.implementation must be specified in portal.properties");
35: try {
36: // Create an instance of the IChannelRegistryStore as specified in portal.properties
37: channelRegistryStoreImpl = (IChannelRegistryStore) Class
38: .forName(className).newInstance();
39: } catch (Exception e) {
40: log.error(
41: "ChannelRegistryStoreFactory: Could not instantiate "
42: + className, e);
43: }
44: }
45:
46: /**
47: * Returns an instance of the IChannelRegistryStore specified in portal.properties
48: * @return an IChannelRegistryStore implementation
49: */
50: public static IChannelRegistryStore getChannelRegistryStoreImpl() {
51: return channelRegistryStoreImpl;
52: }
53: }
|