org.apache.manifoldcf.core.database
Class Database.QueryCacheExecutor

java.lang.Object
  extended by org.apache.manifoldcf.core.cachemanager.ExecutorBase
      extended by org.apache.manifoldcf.core.database.Database.QueryCacheExecutor
All Implemented Interfaces:
ICacheExecutor
Enclosing class:
Database

public static class Database.QueryCacheExecutor
extends ExecutorBase

This object is meant to execute within a cache manager call. It contains all knowledge needed to perform any query, including a parameterized one. It may (or may not) be also passed a transaction handle, depending on whether or not a transaction is currently underway. Nevertheless, all database access, save transaction setup and teardown, takes place inside this class. Even uncached queries will be done here; the cache manager will simply not keep the result around afterwards.


Field Summary
protected  Database database
           
protected  boolean needResult
           
protected  IResultSet resultset
           
 
Fields inherited from class org.apache.manifoldcf.core.cachemanager.ExecutorBase
_rcsid
 
Constructor Summary
Database.QueryCacheExecutor(Database database, boolean needResult)
           
 
Method Summary
 java.lang.Object[] create(ICacheDescription[] objectDescriptions)
          Create a new object 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.
 IResultSet getResult()
          Fetch the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

database

protected Database database

needResult

protected boolean needResult

resultset

protected IResultSet resultset
Constructor Detail

Database.QueryCacheExecutor

public Database.QueryCacheExecutor(Database database,
                                   boolean needResult)
Method Detail

getResult

public IResultSet getResult()
Fetch the result. No errors are possible at this time; they would have already occurred...


create

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

Parameters:
objectDescriptions - are the unique identifiers of the objects.
Returns:
the newly created objects to cache, or null, if any object cannot be created.
Throws:
ManifoldCFException

exists

public 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

public 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