|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.util.jcache.CacheLoader
public abstract class CacheLoader
This class loads object into the cache with the aid of the abstract load method. Should be extended by the user to implement custom loaders, such as Database queries, Directory searches, File extraction, Net searches etc.
Constructor Summary | |
---|---|
CacheLoader()
Deprecated. |
Method Summary | |
---|---|
File |
createDiskObject(Object handle,
Attributes attributes,
String extension)
Deprecated. is called from the load object to create a disk object. |
File |
createDiskObject(Object handle,
String extension)
Deprecated. is called from the load object to create a disk object. |
OutputStream |
createStream(Object handle)
Deprecated. should be called from the load method to create a StreamAccess object. |
OutputStream |
createStream(Object handle,
Attributes attributes)
Deprecated. should be called from the load method to create a StreamAccess object. |
CacheException |
exceptionHandler(String msg,
Exception exception)
Deprecated. this method is called from the load method to convert any non CacheExceptions into CacheExceptions, with the base exception set to the original exception. |
protected Object |
getName(Object handle)
Deprecated. returns the name associated with object being loaded. |
protected String |
getRegion(Object handle)
Deprecated. return the name of the region for the object being loaded. |
abstract Object |
load(Object handle,
Object arguments)
Deprecated. this method must be implemented by the user to load objects into the cache. |
void |
log(String msg)
Deprecated. is called from the load method to record a message in the cache's log. |
protected Object |
netSearch(Object handle,
int timeout)
Deprecated. will search other caches for the object to be loaded. |
void |
setAttributes(Object handle,
Attributes attributes)
Deprecated. will cause the attributes associated with the object being loaded to be set to values provided in attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CacheLoader()
Method Detail |
---|
public abstract Object load(Object handle, Object arguments) throws CacheException
handle
- is supplied by the cache and is used by the netSearch and
setAttributes methods to access information about the object
being searched for.arguments
- is the object pass to the cache in the get method.
CacheException
public final void setAttributes(Object handle, Attributes attributes) throws CacheException
handle
- handle is the object passed into the load method.attributes
- the attributes to set.
CacheException
- if an error occurs.protected final Object getName(Object handle) throws CacheException
handle
- the handle to the object being loaded.
CacheException
- if some strange unexpected exception occur.protected final String getRegion(Object handle) throws CacheException
handle
- the handle to the object being loaded.
CacheException
- if strange unexpected exceptions occur.
NullObjectException
- if an object is discovered with required
variables which is null.protected final Object netSearch(Object handle, int timeout) throws CacheException
handle
- the handle to the object being created.timeout
- the net search timeout.
CacheException
- if a timeout occurs, or the object is not found.
NotImplementedException
- will always be thrownpublic final OutputStream createStream(Object handle) throws ObjectExistsException, InvalidArgumentException
handle
- the object passed into the load method.
ObjectExistsException
- if the object is declared as distributed,
and another cache is in the progress of loading.
InvalidArgumentException
- if some of the arguments are not valid
in this contextpublic final OutputStream createStream(Object handle, Attributes attributes) throws CacheException
handle
- the object passed into the load method.attributes
- the attributes will be set on the object by this
method. If null, default attributes are used.
CacheException
- if the object is declared as distributed, and
another cache is in the progress of loading, or any other
strange exceptions occurs.public final File createDiskObject(Object handle, String extension) throws CacheException
handle
- the object passed into the load method.extension
- The extension parameter is used as the extension to the
file name (java, class, exe etc.) If null, no extension is
added.
CacheException
- if the object is declared as distributed, and
another cache is in the progress of loading, or any other
strange exceptions occurs.public final File createDiskObject(Object handle, Attributes attributes, String extension) throws CacheException
handle
- the object passed into the load method.attributes
- the attributes will be set on the object by this
method. If null, default attributes are used.extension
- The extension parameter is used as the extension to the
file name (java, class, exe etc.) If null, no extension is
added.
CacheException
- if the object is declared as distributed, and
another cache is in the progress of loading, or any other
strange exceptions occurs.public final void log(String msg)
msg
- the message to log.public final CacheException exceptionHandler(String msg, Exception exception)
msg
- a message to provide to the CacheException.exception
- the Exception to be wrapped. If null, a default
CacheException is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |