Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal
Class PortletPreferencesStoreFactory

    java.lang.Object
      org.jasig.portal.PortletPreferencesStoreFactory

    public final class PortletPreferencesStoreFactory

extends java.lang.Object

Instantiates and maintains a static singleton instance of IPortletPreferencesStore as specified by the "org.jasig.portal.PortletPreferencesStoreFactory.implementation" property in portal.properties . This class is final because it is not designed to be extended. If you need a Portlet Preference Store factory that implements some other strategy for creating and managing a PortletPreferencesStore instance, then you'll need to write a new class.

Since:
  uPortal 2.4
Version:
  $Revision: 1.9 $ $Date: 2005/05/18 18:34:44 $
Author:
  Eric Dalquist edalquist@unicon.net

Field Summary
`(package private) static java.lang.Class` | `DEFAULT_PREF_STORE_CLASS` The default IPortletPreferencesStore implementation we will use.
`private static org.apache.commons.logging.Log` | `LOG` Commons logging logger.
`static java.lang.String` | `PORTLET_PREF_STORE_PROPERTY` The name of the portal.properties property the value of which will be the fully qualified class name of the implementation of IPortletPreferencesStore that we should use.
`private static IPortletPreferencesStore` | `portletPreferencesStoreImpl` Static singleton IPortletPreferencesStore instance that we're managing.

Constructor Summary
`PortletPreferencesStoreFactory()`

Method Summary
`static IPortletPreferencesStore` | `getPortletPreferencesStoreImpl()` Returns the singleton instance of IPortletPreferencesStore specified in portal.properties, or the default implementation, or null.
`(package private) static void` | `reset()` Resets our static singleton to null, thereby resetting our state and making the next invocation of our getter method try to instantiate an IPortletPreferencesStore anew.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PORTLET_PREF_STORE_PROPERTY

    public static final java.lang.String PORTLET_PREF_STORE_PROPERTY

  The name of the portal.properties property the value of which will be the fully qualified class name of the implementation of IPortletPreferencesStore that we should use.

  See Also:
    Constant Field Values

### LOG

    private static final org.apache.commons.logging.Log LOG

  Commons logging logger.

### portletPreferencesStoreImpl

    private static IPortletPreferencesStore portletPreferencesStoreImpl

  Static singleton IPortletPreferencesStore instance that we're managing.

### DEFAULT_PREF_STORE_CLASS

    static final java.lang.Class DEFAULT_PREF_STORE_CLASS

  The default IPortletPreferencesStore implementation we will use. Default scoped to be available to our unit test. Not intended to be exported as part of the API provided by this static factory class.

Constructor Detail

### PortletPreferencesStoreFactory

    public PortletPreferencesStoreFactory()

Method Detail

### getPortletPreferencesStoreImpl

    public static IPortletPreferencesStore getPortletPreferencesStoreImpl()

  Returns the singleton instance of IPortletPreferencesStore specified in portal.properties, or the default implementation, or null. That is, this static factory creates and holds a static singleton instance of IPortletPreferencesStore. The static singleton instance it holds will be an instance of the class specified in our portal.properties property if possible. If that fails, because the property was not set or wasn't set properly or the implementation it specified is broken or for any other reason, we fall back on instantiating and using our default implementation. This method returns a reference to that static singleton. If we can instantiate neither the specified nor the default implementation, we return null. We are synchronized to address an instance of the broken double checked locking idiom that previously existed in this code. By synchronizing we ensure that every invocation of this method will either discover a fully instantiated static singleton instance of our IPortletPreferencesStore or will attempt to create and store such an implementation with immediate write-back to main memory such that the store will be available to others invoking this method. This synchronization approach is likely slightly less performant than would be an eager initialization approach, and this difference in performance probably doesn't matter at all, being drowned out by the cost of actually consulting the IPortletPreferencesStore once it is obtained.

  Returns:
    an IPortletPreferencesStore implementation, or null

### reset

    static void reset()

  Resets our static singleton to null, thereby resetting our state and making the next invocation of our getter method try to instantiate an IPortletPreferencesStore anew. This method exists to make unit testing feasible and should not be considered part of the API of this static factory class.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD