com.ibm.portal.resolver.cache
Interface CachedDataSourceFactory.Callback<T>
- Enclosing interface:
- CachedDataSourceFactory<T>
-
public static interface CachedDataSourceFactory.Callback<T>
Callback used to construct a value based on the DataSource. The
implementation SHOULD dispose the data source.
- Since:
- 7.0
- Note:
This interface is designed to be implemented by clients. |
createValue
T createValue(DataSource ds,
boolean bIsCached,
Context ctx)
throws java.io.IOException
- Constructs the cached value based on the DataSource and the
COR context. This method is called in case of a cache miss, the
DataSource is the result of a COR lookup to the requested
URI. The caching characteristics depend on the DataSource and
cannot be modified in this callback. The callback becomes the owner
of the DataSource and either needs to dispose it during this
call or as a consequence of disposing the return value.
- Parameters:
- ds - the source DataSource, not null. The
callback becomes the owner of the DataSource.
- bIsCached - if true the created value is meant to. be
stored in a cache and will be accessed multiple times (in
case of subsequent cache hits). The value also needs to be
serializable in case of cache replication. If
false the value is not cached and will only
be accessed one single time. The
disposeValue(Object) will be called if the value
is no longer in use.
- ctx - the COR context for the transformation, no
null
- Returns:
- the data to be cached.
- Throws:
- java.io.IOException
disposeValue
void disposeValue(T value)
- Releases data associates with the cache value. This method is
guaranteed to be called for uncacheable values, but may also be
called for cache values that are discarded from the cache. This
however is not guaranteed.
- Parameters:
- value - value to dispose, not null