public class ExperimentRegistry extends AbstractManagedDynamicCacheRegistry
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
The name of this class.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
ExperimentRegistry()
The default constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
createKey(java.lang.String strKey)
This method creates a cache key from the string representation of the key.
|
java.lang.String |
createKeyString(TypedProperty prop)
This method creates a string representation of a cache key based on the input
properties.
|
ExperimentCache |
getCachedExperiment(java.lang.Integer experimentId)
This method returns the cached experiment object with the given experiment ID.
|
java.util.ArrayList |
getCachedExperiments(java.lang.Integer storeElementTypeId,
java.lang.Integer storeId,
java.sql.Timestamp currentTime)
This method takes a store element type ID, store ID, and the current time, and
according to the experiment schedule, populates the cached experiment object
class with the content of the experiments that will be shown to all store elements
of the given type in the given store.
|
static ExperimentRegistry |
getInstance()
This method returns an instance of this registry class.
|
int |
getRandomNumber(int maxLimit)
This method returns a randomly generated integer value between 0 (inclusive) and the
specified value (exclusive).
|
void |
populate(com.ibm.commerce.registry.LRUDynamicHashtable aCache)
This method populates the given cache object during server start up and refresh of
this cache.
|
void |
refresh()
This method refreshes registry entries from the database.
|
void |
refresh(CommandContext commandContext)
This method performs a refresh to the entire experiment cache.
|
java.lang.Object |
retrieve(java.lang.Object key)
This method retrieves an experiment of the given key from the database, populates
its data into an experiment cache object and returns it to the caller of this method.
|
void |
update(CommandContext commandContext,
java.lang.String actionType,
java.lang.Integer experimentId,
java.lang.String experimentStatus)
This method performs an update to the specified experiment in the cache.
|
void |
update(java.lang.String action,
java.lang.Object key)
This method updates an element in the registry.
|
addElement, findObject, getCache, getCacheSize, getElement, getElementCount, getElements, getEvictions, getHits, getKeys, getMisses, getUsedCacheSize, initialize, removeAllElements, removeElement, setCache, setCacheSize, setInitialCapacity, setLoadFactor
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public ExperimentRegistry()
public java.lang.Object createKey(java.lang.String strKey) throws java.lang.Exception
createKey
in interface ElementUpdate
createKey
in class AbstractManagedDynamicCacheRegistry
strKey
- The string representation of a cache key.java.lang.Exception
- Thrown whenever an exception is encountered in this method.public java.lang.String createKeyString(TypedProperty prop) throws java.lang.Exception
createKeyString
in interface ElementUpdate
createKeyString
in class AbstractManagedDynamicCacheRegistry
prop
- The input properties.java.lang.Exception
- Thrown whenever an exception is encountered in this method.public ExperimentCache getCachedExperiment(java.lang.Integer experimentId)
experimentId
- The ID of the experiment.public java.util.ArrayList getCachedExperiments(java.lang.Integer storeElementTypeId, java.lang.Integer storeId, java.sql.Timestamp currentTime)
storeElementTypeId
- The ID of the store element type.storeId
- The ID of the store.currentTime
- The time for the evaluation.public static ExperimentRegistry getInstance()
public int getRandomNumber(int maxLimit)
maxLimit
- The bound on the random number to be returned.public void populate(com.ibm.commerce.registry.LRUDynamicHashtable aCache) throws java.lang.Exception
populate
in class AbstractManagedDynamicCacheRegistry
aCache
- The cache object.java.lang.Exception
- Thrown whenever an exception is encountered in this method.public void refresh() throws java.lang.Exception
refresh
in interface Registry
refresh
in class AbstractManagedDynamicCacheRegistry
java.lang.Exception
- Thrown whenever an exception is encountered in this method.public void refresh(CommandContext commandContext) throws ECException
commandContext
- The command context.ECException
- Thrown when an error occurs while accessing the runtime
command context.public java.lang.Object retrieve(java.lang.Object key) throws java.lang.Exception
retrieve
in class AbstractManagedDynamicCacheRegistry
key
- The ID of the experiment which is used as the key to identify an
experiment.java.lang.Exception
- Thrown whenever an exception is encountered in this method.public void update(java.lang.String action, java.lang.Object key) throws java.lang.Exception
update
in interface ElementUpdate
update
in class AbstractManagedDynamicCacheRegistry
action
- The action to be applied to the cached element.key
- The cache key.java.lang.Exception
- Thrown whenever an exception is encountered in this method.public void update(CommandContext commandContext, java.lang.String actionType, java.lang.Integer experimentId, java.lang.String experimentStatus) throws ECException
commandContext
- The command context.actionType
- The type of action to be performed to the experiment cache in the
registry.experimentId
- The ID of the experiment to be added or updated.experimentStatus
- The new status value of the given experiment, if the status
needs to be updated; null otherwise.ECException
- Thrown when an error occurs while accessing the runtime
command context.