ca.uhn.cache.proxy
Interface IMethodAdapter

All Known Subinterfaces:
IListeningMethodAdapter
All Known Implementing Classes:
AbstractMethodAdapter

public interface IMethodAdapter

Adapts the arguments and return values of a particular Java method to work with a ISemanticCache. It is assumed that the Java method corresponds to some query, and the return value corresponds to the results of the query, which are to be cached.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:53:24 $ by $Author: bryan_tripp $
Author:
Bryan Tripp

Method Summary
 java.lang.Object[] getArgs(java.lang.Object[] theOriginalArgs, IQuery theQuery)
          Note that the query parameters returned by this method can be more general than necessary, if extraneous data are filtered by includeInResults().
 java.lang.Class[] getArgTypes()
           
 IDataInspector getDataInspector()
           
 int getMaxGroups()
           
 java.lang.String getMethodName()
           
 IQuery getParamsFromArgs(java.lang.Object[] theMethodArgs)
           
 CacheReasonEnum getReason(java.lang.Object[] theMethodArgs)
           
 boolean includeInResults(java.lang.Object theDataItem, java.lang.Object[] theMethodArgs)
          The cache may return more data than needed.
 

Method Detail

getMethodName

public java.lang.String getMethodName()
Returns:
the name of the adapted Java method

getArgTypes

public java.lang.Class[] getArgTypes()
Returns:
the argument types of the adapted Java method

getMaxGroups

public int getMaxGroups()
Returns:
the maximum number of calls to the source system (remainder queries) that should be executed per single method call. Generally, the more are allowed, the less they will span data that are already cached.

getParamsFromArgs

public IQuery getParamsFromArgs(java.lang.Object[] theMethodArgs)
Parameters:
theMethodArgs - arguments of a query method call, constituting the query parameters expected by the underlying system
Returns:
corresponding IQuery that defines the same scope of data as the method args, or an encompassing scope, but are in terms of a IParamSpace

getArgs

public java.lang.Object[] getArgs(java.lang.Object[] theOriginalArgs,
                                  IQuery theQuery)
Note that the query parameters returned by this method can be more general than necessary, if extraneous data are filtered by includeInResults().

Parameters:
theOriginalArgs - the original arguments submitted by a caller to the query method
theQuery - defines the remainder query (i.e. data that are not in the cache)
Returns:
a new set of method arguments in the same form as the original ones, but with a new scope that corresponds to the remainder query

includeInResults

public boolean includeInResults(java.lang.Object theDataItem,
                                java.lang.Object[] theMethodArgs)
The cache may return more data than needed. This method is used to eliminate extraneous data items from the results.

Parameters:
theDataItem - a candidate for a query result
theMethodArgs - method arguments defining query parameters
Returns:
true iff the given candidate should be returned to the caller (judged according to args)

getReason

public CacheReasonEnum getReason(java.lang.Object[] theMethodArgs)
Parameters:
theMethodArgs - method arguments defining query parameters
Returns:
reason for caching data, if this can be determined from the args (defaults to CacheReasonEnum.QUERY if nothing more specific is known)

getDataInspector

public IDataInspector getDataInspector()
Returns:
a helper that knows things about data items


Copyright © 2004-2005 University Health Network. All Rights Reserved.