02/28/2005
 

com.vignette.portal.cache
Class CacheAction

java.lang.Object
  |
  +--com.vignette.portal.cache.CacheAction

public abstract class CacheAction
extends Object

Is a pluggable operator for use in a CacheStrategy to support different operations during the strategy's lifecycle. Any subclass of the ActionBasedCacheStrategy takes an instance of this class and invokes it at the appropriate points in its lifecycle.

Any strategy provided by this API that extends ActionBasedCacheStrategy are guaranteed to function appropriately. Note that 3rd party strategies may not be up to date with the latest version of this class as more methods may be added in future versions of this API.

See Also:
CacheStrategy, ActionBasedCacheStrategy

Constructor Summary
CacheAction()
           
 
Method Summary
protected  Store getStore()
          Accessor for the store.
abstract  void onAction(Object key)
          This method is called when the CacheStrategy determines that action is needed for key.
abstract  void onActions(Collection keys)
          This method is called when the CacheStrategy determines that action is needed for keys.
 void onAdd(Object key, Object value, Map properties)
          Signals addition to the strategy.
 void onAddAll(Map keyValuePairs, Map properties)
          Signals addition to the strategy.
 void onGet(Object key, Map properties)
          Someone is accessing key in the CacheStrategy.
 void onGetAll(Collection keys, Map properties)
          Someone is accessing all the items mentioned in keys in the CacheStrategy.
 void onRemove(Object key)
          Signals removal from the strategy.
 void onRemoveAll()
          Signals clearing of the strategy.
 void onRemoveAll(Collection keys)
          Signals removal from the strategy.
 void setStore(Store store)
          Called at cache creation time to tie the action to a cache's Store interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheAction

public CacheAction()
Method Detail

setStore

public void setStore(Store store)

Called at cache creation time to tie the action to a cache's Store interface. Can be called only once.

There should be no reason for non-framework code to ever call this method.

Parameters:
store - Special view of the cache to which this action belongs

getStore

protected final Store getStore()

Accessor for the store.

Returns:
the Store associated with this CacheAction

onAction

public abstract void onAction(Object key)

This method is called when the CacheStrategy determines that action is needed for key.

Typical examples of this are when the key "expires" or when the cache is full and needs to remove a value that has not been used for a while.

Parameters:
key - the key for which action is needed

onActions

public abstract void onActions(Collection keys)

This method is called when the CacheStrategy determines that action is needed for keys.

Typical examples of this are when the keys "expire" or when the cache is full and needs to remove values that have not been used for a while.

Parameters:
keys - the collection of keys for which action is needed

onGet

public void onGet(Object key,
                  Map properties)
           throws CacheException

Someone is accessing key in the CacheStrategy. This will not be invoked for keys that the strategy is not monitoring.

Individual actions can use the information in properties to override their creation-time parameters.

This implementation is a no-op.

Parameters:
key - item being looked up
properties - possible overrides, can be null

onGetAll

public void onGetAll(Collection keys,
                     Map properties)
              throws CacheException

Someone is accessing all the items mentioned in keys in the CacheStrategy. This will not be invoked for keys that the strategy is not monitoring.

Individual actions can use the information in properties to override their creation-time parameters.

This implementation is a no-op.

Parameters:
keys - items being looked up
properties - possible overrides, can be null

onAdd

public void onAdd(Object key,
                  Object value,
                  Map properties)

Signals addition to the strategy. This event implies that its strategy is monitoring key so the action should also monitor the key if that is necessary for the action's function.

Individual actions can use the information in properties to override their creation-time parameters.

This method should not throw any exception since it mirrors the function of the CacheStrategy.onAdd(java.lang.Object, java.lang.Object, java.util.Map) method.

This implementation is a no-op.

Parameters:
key - key being inserted in the cache
value - value being inserted in the cache, matching key
properties - possible overrides, can be null

onAddAll

public void onAddAll(Map keyValuePairs,
                     Map properties)

Signals addition to the strategy. This event implies that its strategy is monitoring the mapping in keyValuePairs so the action should also monitor the pairs if that is necessary for the action's function.

Individual actions can use the information in properties to override their creation-time parameters.

This method should not throw any exception since it mirrors the function of the CacheStrategy.onAddAll(java.util.Map, java.util.Map) method.

This implementation is a no-op.

Parameters:
keyValuePairs - key/value pairs being added to the cache
properties - possible overrides, can be null

onRemove

public void onRemove(Object key)

Signals removal from the strategy. This event implies that its strategy has stopped monitoring key, so the action should also stop monitoring key and clean up if necessary.

This method should not throw any exception since it mirrors the function of the CacheStrategy.onRemove(java.lang.Object) method.

This implementation is a no-op.

Parameters:
key - key being removed from the strategy

onRemoveAll

public void onRemoveAll(Collection keys)

Signals removal from the strategy. This event implies that its strategy has stopped monitoring all of keys, so the action should also stop monitoring keys and clean up if necessary.

This method should not throw any exception since it mirrors the function of the CacheStrategy.onRemoveAll(java.util.Collection) method.

This implementation is a no-op.

Parameters:
keys - keys being removed from the strategy

onRemoveAll

public void onRemoveAll()

Signals clearing of the strategy. This event implies that its strategy has stopped monitoring all keys, so the action should also stop monitoring all of the keys and clean up if necessary.

This method should not throw any exception since it mirrors the function of the CacheStrategy.onRemoveAll() method.

This implementation is a no-op.


02/28/2005
 

Copyright and Trademark Notices