org.apache.manifoldcf.core.interfaces
Interface ICacheExecutor

All Known Implementing Classes:
AuthorityConnectionManager.AuthorityConnectionExecutor, Database.QueryCacheExecutor, ExecutorBase, Jobs.JobObjectExecutor, OutputConnectionManager.OutputConnectionExecutor, RepositoryConnectionManager.RepositoryConnectionExecutor

public interface ICacheExecutor

This interface describes an object designed to be instantiated solely for the purpose of running inside the global cache manager's execution method. The cache manager will perform all synchronization, and for objects being accessed will call either the create*() family of methods below, or the exists() method, if the object was found in the cache. For all existing objects being invalidated, the destroy() method will be called. It IS legal to specify the same object for both read and invalidate! In this case, both the create() or exists() sequence AND the destroy() method will be called. Finally, after this has been done for all of the requested objects, the execute() method will be called. Users of the cache manager will need to create objects implementing this interface when they want to operate on a set of cached objects. NOTE: Objects that are created by a cache executor must obey the following rule: A given objectDescription must always have the same invalidation keys, regardless of which cache executor object creates them, and regardless of WHEN the object is instantiated. This is required in order to ensure that the locks thrown by the cache manager are correct.


Field Summary
static java.lang.String _rcsid
           
 
Method Summary
 java.lang.Object[] create(ICacheDescription[] objectDescriptions)
          Create a set of new objects to operate on and cache.
 void execute()
          Perform the desired operation.
 void exists(ICacheDescription objectDescription, java.lang.Object cachedObject)
          Notify the implementing class of the existence of a cached version of the object.
 

Field Detail

_rcsid

static final java.lang.String _rcsid
See Also:
Constant Field Values
Method Detail

create

java.lang.Object[] create(ICacheDescription[] objectDescriptions)
                          throws ManifoldCFException
Create a set of new objects to operate on and cache. This method is called only if the specified object(s) are NOT available in the cache. The specified objects should be created and returned; if they are not created, it means that the execution cannot proceed, and the execute() method will not be called.

Parameters:
objectDescriptions - is the set of unique identifier of the object.
Returns:
the newly created objects to cache, or null, if any object cannot be created. The order of the returned objects must correspond to the order of the object descriptinos.
Throws:
ManifoldCFException

exists

void exists(ICacheDescription objectDescription,
            java.lang.Object cachedObject)
            throws ManifoldCFException
Notify the implementing class of the existence of a cached version of the object. The object is passed to this method so that the execute() method below will have it available to operate on. This method is also called for all objects that are freshly created as well.

Parameters:
objectDescription - is the unique identifier of the object.
cachedObject - is the cached object.
Throws:
ManifoldCFException

execute

void execute()
             throws ManifoldCFException
Perform the desired operation. This method is called after either createGetObject() or exists() is called for every requested object.

Throws:
ManifoldCFException