com.ibm.portal.resolver.cache
Interface CachedDataSourceFactory<T>

All Superinterfaces:
DataSourceFactory, DataSourceFactoryEx

public interface CachedDataSourceFactory<T>
extends DataSourceFactoryEx

Representation of a DataSourceFactoryEx that caches information based on a DataSource.

Since:
7.0

Nested Class Summary
static interface CachedDataSourceFactory.Callback<T>
          Callback used to construct a value based on the DataSource.
static interface CachedDataSourceFactory.UncacheableValue<T>
          Represents a cache value that is not stored in the cache
static interface CachedDataSourceFactory.Value<T>
          Represents the cache value.
 
Field Summary
 
Fields inherited from interface com.ibm.portal.resolver.data.DataSourceFactoryEx
DEFAULT_MODE, EMPTY_PARAMETERS
 
Method Summary
 CachedDataSourceFactory.Callback<? extends T> getCallback()
          Returns the callback interface used by this cache
 DataSourceFactoryEx getDataSourceFactory()
          Returns the factory used to execute the downstream lookups for the DataSource objects.
 CachedDataSourceFactory.Value<T> newSource(java.net.URI uri, java.lang.String mode, java.util.Map<java.lang.String,java.lang.String[]> params, Context ctx)
          Retrieves the value from a cache or constructs it by invoking the attached CachedDataSourceFactory.Callback interface.
 

Method Detail

getCallback

CachedDataSourceFactory.Callback<? extends T> getCallback()
Returns the callback interface used by this cache

Returns:
the callback

getDataSourceFactory

DataSourceFactoryEx getDataSourceFactory()
Returns the factory used to execute the downstream lookups for the DataSource objects.

Returns:
the factory used for the callbacks, not null

newSource

CachedDataSourceFactory.Value<T> newSource(java.net.URI uri,
                                           java.lang.String mode,
                                           java.util.Map<java.lang.String,java.lang.String[]> params,
                                           Context ctx)
                                           throws java.io.IOException
Retrieves the value from a cache or constructs it by invoking the attached CachedDataSourceFactory.Callback interface. The retrieved value MUST be disposed by the caller via the CachedDataSourceFactory.UncacheableValue.dispose() method.

Specified by:
newSource in interface DataSourceFactoryEx
Parameters:
uri - URI of the addressed resource
mode - mode constant
params - parameters map (String -> String[]). This map is potentially unmodifiable
ctx - Content Operations Registry (COR) context
Returns:
representation of the cached value or null. If the return value is not null then the CachedDataSourceFactory.UncacheableValue.dispose() method should be called when the value is not longer used.
Throws:
java.io.IOException - - if the data source cannot be created