02/28/2005
 

com.vignette.portal.cache
Class PassivationStorageHandler

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

public abstract class PassivationStorageHandler
extends Object

Handles external storage to support passivation. This is a base class provides the interface for PassivatingCacheAction.


Constructor Summary
PassivationStorageHandler()
           
 
Method Summary
abstract  void clear(Object key, Object storeLookupKey)
          Clears the value from the external storage location that was previously stored, using key and storeLookupKey.
abstract  Object reload(Object key, Object storeLookupKey)
          Reloads the value previously stored, using the key and storeLookupKey.
abstract  Object store(Object key, Object value)
          Stores value and maps key to an external storage key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PassivationStorageHandler

public PassivationStorageHandler()
Method Detail

store

public abstract Object store(Object key,
                             Object value)
                      throws CacheException

Stores value and maps key to an external storage key.

The key provided may not be an appropriate way of locating the data in the external storage location. The handler can choose to use a more approriate storage key which it returns to the caller. The handler will receive this storage key in later calls to its PassivationStorageHandler.reload(java.lang.Object, java.lang.Object) and PassivationStorageHandler.clear(java.lang.Object, java.lang.Object) methods. This method must always return a non-null value, which could simply be key.

Parameters:
key - the key that the cache uses to refer to the value
value - the value that the cache wants passivated
Returns:
a non-null store lookup key for use in later retrieval

reload

public abstract Object reload(Object key,
                              Object storeLookupKey)
                       throws CacheException

Reloads the value previously stored, using the key and storeLookupKey.

The reload operation should also clear the data from its external storage location as the value will be managed in memory from this point on (or until it is passivated again). If an exception is thrown, do not remove the value from external storage so the cache can try again.

Parameters:
key - the key that the cache uses to refer to the value
storeLookupKey - the key returned by the PassivationStorageHandler.store(java.lang.Object, java.lang.Object) method
Returns:
the previously stored value, based on the keys

clear

public abstract void clear(Object key,
                           Object storeLookupKey)

Clears the value from the external storage location that was previously stored, using key and storeLookupKey.

This is used when the value related to the key is no longer being managed, but does not need to be returned. An example of this is during the CacheAction.onRemove(java.lang.Object) event. The reason for using this method, rather than calling PassivationStorageHandler.reload(java.lang.Object, java.lang.Object) and discarding the value, is that retrieving the value might be less efficient than simply reclaiming its storage space.

Note that the method cannot throw an exception. The caller no longer cares about this value. Whether its storage was properly reclaimed or not is an internal matter for the implementation.

Parameters:
key - the key that the cache uses to refer to the value
storeLookupKey - the key returned by the PassivationStorageHandler.store(java.lang.Object, java.lang.Object) method

02/28/2005
 

Copyright and Trademark Notices