Oracle Application Server 10g Java Object Cache API Reference
10g Release 2 (10.1.2)

B14018-01
November 2004

oracle.ias.cache
Class CacheListLoader

java.lang.Object
  extended byoracle.ias.cache.CacheLoader
      extended byoracle.ias.cache.CacheListLoader

public abstract class CacheListLoader
extends CacheLoader

CacheListLoader is an abstract class. The application writer should extend this class to handle the loading of objects into the cache. A cache list loader can be registered for a region or group. The cache list loader differs from the CacheLoader in that the list loader will allow multiple objects to be loaded with a single call to the loader.

Since:
9.0.4
See Also:
CacheAccess.defineRegion, CacheAccess.defineGroup, CacheAccess.defineObject, CacheLoader

Constructor Summary
CacheListLoader()
           
 
Method Summary
protected  java.lang.Object[] getList(java.lang.Object handle)
          returns original list of objects submitted by the user
protected  java.lang.Object getNamedObject(java.lang.Object handle, java.lang.Object name)
          Returns the name of the object to be loaded This method allows the implementor of the loadList method to iterate through the list of Objects based on the name of the object rather than the order the objects are in the list.
protected  java.lang.Object getNextObject(java.lang.Object handle)
          returns the name of the next object in the list to be loaded This method allows the implementor of the loadList method to iterate through the list of Objects that need to be loaded
abstract  void loadList(java.lang.Object handle, java.lang.Object argument)
          This is an abstract method, applications should implement this method to customize the loading of a list of cache objects.
protected  void saveObject(java.lang.Object handle, java.lang.Object obj)
          saves the given object to the cache, associating it with the current object name as set by getNextObject or getNamedObject.
protected  boolean saveObject(java.lang.Object handle, java.lang.Object name, java.lang.Object obj)
          saves the given object to the cache, associating it with the named object.
 
Methods inherited from class oracle.ias.cache.CacheLoader
createDiskObject, createDiskObject, createStream, createStream, exceptionHandler, getFromRemote, getName, getRegion, isRemoteRequest, load, log, netSearch, netSearch, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheListLoader

public CacheListLoader()
Method Detail

loadList

public abstract void loadList(java.lang.Object handle,
                              java.lang.Object argument)
                       throws CacheException
This is an abstract method, applications should implement this method to customize the loading of a list of cache objects.

This method is called by the caching service when any of the requested objects are not in the cache. The getNextMethod must be used to iterate through the list to retrieve each object to be loaded. Only the objects not already in the cache will be loaded. The saveObject method must be used to save the object to the cache once it is created. SaveObject will associate the object with the current name.

Parameters:
handle - An internal handle object is passed in from cache service. It should only be used as the first parameter of the helper methods in this class
argument - It is an argument object for load method passed in from customer code. This object is passed in as args either in get(String name, Object args), or get(String name, String group, Object args)
Throws:
CacheException - if any error occurs.
Since:
9.0.4
See Also:
CacheAccess.loadList(Object[]), CacheAccess.loadList(Object[], Object), CacheAccess.loadList(Object[], String, Object)

getNextObject

protected final java.lang.Object getNextObject(java.lang.Object handle)
                                        throws CacheException
returns the name of the next object in the list to be loaded

This method allows the implementor of the loadList method to iterate through the list of Objects that need to be loaded

Parameters:
handle - An internal cache handle object, it is passed in as the first parameter in load(Object handle, Object argument().
Returns:
the name of the next object to be loaded or, a null if there are no more objects to be loaded.
Throws:
CacheException
Since:
9.0.4

getList

protected final java.lang.Object[] getList(java.lang.Object handle)
                                    throws CacheException
returns original list of objects submitted by the user

Parameters:
handle - An internal cache handle object, it is passed in as the first parameter in load(Object handle, Object argument().
Returns:
original list of objects submitted by the user
Throws:
CacheException
Since:
9.0.4

getNamedObject

protected final java.lang.Object getNamedObject(java.lang.Object handle,
                                                java.lang.Object name)
                                         throws CacheException
Returns the name of the object to be loaded

This method allows the implementor of the loadList method to iterate through the list of Objects based on the name of the object rather than the order the objects are in the list. If the named object is in the list and needs to be loaded, context is set so the next saveObject call will associate the loaded object with the name. If the object is not in the list or does not need to be loaded a null is returned. If saveObject is called an InvalidOperationException will be thrown.

Parameters:
handle - An internal cache handle object, it is passed in as the first parameter in loadList(Object handle, Object argument().
name - The name of the object to be loaded
Returns:
the name of the object to be loaded, null if the named object is not in the list or does not need to be loaded
Throws:
CacheException
Since:
9.0.4

saveObject

protected final void saveObject(java.lang.Object handle,
                                java.lang.Object obj)
                         throws CacheException
saves the given object to the cache, associating it with the current object name as set by getNextObject or getNamedObject. This method saves the given object to the cache, associating it with the current object name as set by getNextObject or getNamedObject. If there is no current object name set, getNextObject or getNamedObject has not been called, an InvalidOperationException will be thrown.

Parameters:
handle - An internal cache handle object, it is passed in as the first parameter in loadList(Object handle, Object argument().
obj - the object to be saved to the cache
Throws:
CacheException
Since:
9.0.4

saveObject

protected final boolean saveObject(java.lang.Object handle,
                                   java.lang.Object name,
                                   java.lang.Object obj)
                            throws CacheException
saves the given object to the cache, associating it with the named object. This method saves the given object to the cache, associating it with the named object. If the named object is not found false is returned otherwise true is returned.

Parameters:
handle - An internal cache handle object, it is passed in as the first parameter in loadList(Object handle, Object argument().
name - The name of the object to be loaded
obj - the object to be saved to the cache
Returns:
true if named object found, false otherwise
Throws:
CacheException
Since:
9.0.4

Oracle Application Server 10g Java Object Cache API Reference
10g Release 2 (10.1.2)

B14018-01
November 2004

Copyright 2004, Oracle Corporation. All Rights Reserved.