com.ibm.commerce.registry
Class StoreRegistry

java.lang.Object
  com.ibm.commerce.registry.AbstractManagedDynamicCacheRegistry
      com.ibm.commerce.registry.StoreRegistry
All Implemented Interfaces:
ElementUpdate, ManagedDynamicCache, Registry

public class StoreRegistry
extends AbstractManagedDynamicCacheRegistry

The Store registry contains the runtime cache of StoreAccessBean objects.


Field Summary
protected static StoreRegistry singleton
protected int storeSize
Constructor Summary
StoreRegistry()
Store registry constructor.
Method Summary
void addElement(java.lang.Integer storeId, StoreAccessBean bean, java.util.Hashtable aCache)
Deprecated.
java.lang.Object createKey(java.lang.String strKey)
Creates a cache key based on a key string
java.lang.String createKeyString(TypedProperty prop)
Creates a cache key based on input parameters
StoreAccessBean find(java.lang.Integer storeId)
Looks up a StoreAccessBean object from the store registry.
int getStoreCount()
Returns a count of all the stores defined.
java.util.Enumeration getStoreElements()
Deprecated.
void initialize()
Initializes the store registry.
boolean isStoreGroup(java.lang.Integer storeId)
Check if an integer is a store group ID.
void populate(LRUDynamicHashtable aCache)
Populates the cache with store objects from the data base.
void refresh()
Clears the cache.
java.lang.Object retrieve(java.lang.Object key)
Retrieves a store object from the database and add it to the cache.
static StoreRegistry singleton()
Returns a singleton object of the store registry.
void update(java.lang.String action, java.lang.Object key)
Updates a cached element.
Methods inherited from class com.ibm.commerce.registry.AbstractManagedDynamicCacheRegistry
addElement, findObject, getCache, getCacheSize, getElement, getElementCount, getElements, getEvictions, getHits, getKeys, getMisses, getUsedCacheSize, removeAllElements, removeElement, setCache, setCacheSize, setInitialCapacity, setLoadFactor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail

singleton

protected static StoreRegistry singleton

storeSize

protected int storeSize
Constructor Detail

StoreRegistry

public StoreRegistry()
Store registry constructor.
Method Detail

createKeyString

public java.lang.String createKeyString(TypedProperty prop)
                                 throws java.lang.Exception
Creates a cache key based on input parameters
Specified by:
createKeyString in interface ElementUpdate
Specified by:
createKeyString in class AbstractManagedDynamicCacheRegistry
Parameters:
prop - The input property
Returns:
a cache key
Throws:
java.lang.Exception

createKey

public java.lang.Object createKey(java.lang.String strKey)
                           throws java.lang.Exception
Creates a cache key based on a key string
Specified by:
createKey in interface ElementUpdate
Specified by:
createKey in class AbstractManagedDynamicCacheRegistry
Parameters:
strKey - key as string
Returns:
a cache key
Throws:
java.lang.Exception

retrieve

public java.lang.Object retrieve(java.lang.Object key)
                          throws java.lang.Exception
Retrieves a store object from the database and add it to the cache.
Specified by:
retrieve in class AbstractManagedDynamicCacheRegistry
Parameters:
key - - a key used to identify the object to be retrieved
Returns:
a store object
Throws:
java.lang.Exception

find

public StoreAccessBean find(java.lang.Integer storeId)
Looks up a StoreAccessBean object from the store registry. It will first check in the runtime cache, if not found, will retrieve it from the database.
Parameters:
storeId - store Id
Returns:
the StoreAccessBean or null if store is not defined

getStoreCount

public int getStoreCount()
Returns a count of all the stores defined.
Returns:
store count

getStoreElements

public java.util.Enumeration getStoreElements()
Deprecated.
Returns an enumeration of all StoreAccessBeans stored in the store registry.
Returns:
Enumeration - an enumeration of all StoreAccessBean

initialize

public void initialize()
                throws java.lang.Exception
Initializes the store registry. Sets the singleton to this instance. Registers this instance in WcsApp.storeRegistry.
Specified by:
initialize in interface Registry
Overrides:
initialize in class AbstractManagedDynamicCacheRegistry
Throws:
java.lang.Exception

refresh

public void refresh()
             throws java.lang.Exception
Clears the cache. If this instance is the singleton, then it also clears StoreRelationshipCache.instance().
Specified by:
refresh in interface Registry
Overrides:
refresh in class AbstractManagedDynamicCacheRegistry
Throws:
java.lang.Exception

update

public void update(java.lang.String action,
                   java.lang.Object key)
            throws java.lang.Exception
Updates a cached element. If this instance is the singleton, then it also removes information for the specified store from StoreRelationshipCache.instance().
Specified by:
update in interface ElementUpdate
Overrides:
update in class AbstractManagedDynamicCacheRegistry
Parameters:
action - The action performed on the registry. e.g. ECConstants.EC_REGISTRY_ELEMENT_UPDATE, ECConstants.EC_REGISTRY_ELEMENT_ADD, or ECConstants.EC_REGISTRY_ELEMENT_DELETE.
key - The Integer store identifier.
Throws:
java.lang.Exception

populate

public void populate(LRUDynamicHashtable aCache)
              throws java.lang.Exception
Populates the cache with store objects from the data base.
Specified by:
populate in class AbstractManagedDynamicCacheRegistry
Parameters:
aCache - the cache to be populated
Returns:
the object associated with the key
Throws:
java.lang.Exception

singleton

public static StoreRegistry singleton()
Returns a singleton object of the store registry.
Returns:
a singleton StoreRegistry object

addElement

public void addElement(java.lang.Integer storeId,
                       StoreAccessBean bean,
                       java.util.Hashtable aCache)
Deprecated.
Adds a StoreAccessBean to the given cache.
Parameters:
storeId - Integer
bean - StoreAccessBean
aCache - Hashtable

isStoreGroup

public boolean isStoreGroup(java.lang.Integer storeId)
Check if an integer is a store group ID.
Parameters:
storeId - the integer to be checked.

Feedback