org.jboss.cache.loader
Class LocalDelegatingCacheLoader

java.lang.Object
  |
  +--org.jboss.cache.loader.DelegatingCacheLoader
        |
        +--org.jboss.cache.loader.LocalDelegatingCacheLoader
All Implemented Interfaces:
CacheLoader, org.jboss.system.Service

public class LocalDelegatingCacheLoader
extends DelegatingCacheLoader

DelegatingCacheLoader implementation which delegates to a local (in the same VM) TreeCache. Sample code:

 TreeCache firstLevel=new TreeCache();
 TreeCache secondLevel=new TreeCache();
 DelegatingCacheLoader l=new DelegatingCacheLoader(secondLevel);
 l.setCache(firstLevel);
 firstLevel.setCacheLoader(l);
 secondLevel.start();
 firstLevel.start();
 

Version:
$Id: LocalDelegatingCacheLoader.java,v 1.4 2005/08/10 17:34:59 msurtani Exp $
Author:
Bela Ban, Daniel Gredler

Field Summary
 
Fields inherited from class org.jboss.cache.loader.DelegatingCacheLoader
delegateExists, delegateGet, delegateGetChildrenNames, delegateGetKey, delegateLoadEntireState, delegatePut, delegatePutKeyVal, delegateRemove, delegateRemoveData, delegateRemoveKey, delegateStoreEntireState
 
Constructor Summary
LocalDelegatingCacheLoader(TreeCache delegate)
           
 
Method Summary
protected  boolean delegateExists(Fqn name)
           
protected  java.util.Map delegateGet(Fqn name)
           
protected  java.lang.Object delegateGet(Fqn name, java.lang.Object key)
           
protected  java.util.Set delegateGetChildrenNames(Fqn fqn)
           
protected  byte[] delegateLoadEntireState()
           
protected  void delegatePut(Fqn name, java.util.Map attributes)
           
protected  java.lang.Object delegatePut(Fqn name, java.lang.Object key, java.lang.Object value)
           
protected  void delegateRemove(Fqn name)
           
protected  java.lang.Object delegateRemove(Fqn name, java.lang.Object key)
           
protected  void delegateRemoveData(Fqn name)
           
protected  void delegateStoreEntireState(byte[] state)
           
 void setCache(TreeCache cache)
          This method allows the CacheLoader to set the TreeCache, therefore allowing the CacheLoader to invoke methods of the TreeCache.
 void setConfig(java.util.Properties props)
          Sets the configuration.
 
Methods inherited from class org.jboss.cache.loader.DelegatingCacheLoader
commit, create, destroy, exists, get, get, getChildrenNames, loadEntireState, prepare, put, put, put, put, remove, remove, removeData, rollback, start, stop, storeEntireState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDelegatingCacheLoader

public LocalDelegatingCacheLoader(TreeCache delegate)
Method Detail

setConfig

public void setConfig(java.util.Properties props)
Description copied from interface: CacheLoader
Sets the configuration. Will be called before Service.create() and Service.start()

Specified by:
setConfig in interface CacheLoader
Specified by:
setConfig in class DelegatingCacheLoader
Parameters:
props - A list of properties, defined in the XML file

setCache

public void setCache(TreeCache cache)
Description copied from interface: CacheLoader
This method allows the CacheLoader to set the TreeCache, therefore allowing the CacheLoader to invoke methods of the TreeCache. It can also use the TreeCache to fetch configuration information. Alternatively, the CacheLoader could maintain its own configuration
This method will be called directly after the CacheLoader instance has been created

Specified by:
setCache in interface CacheLoader
Specified by:
setCache in class DelegatingCacheLoader
Parameters:
cache - The cache on which this loader works

delegateGetChildrenNames

protected java.util.Set delegateGetChildrenNames(Fqn fqn)
                                          throws java.lang.Exception
Specified by:
delegateGetChildrenNames in class DelegatingCacheLoader
java.lang.Exception

delegateGet

protected java.lang.Object delegateGet(Fqn name,
                                       java.lang.Object key)
                                throws java.lang.Exception
Specified by:
delegateGet in class DelegatingCacheLoader
java.lang.Exception

delegateGet

protected java.util.Map delegateGet(Fqn name)
                             throws java.lang.Exception
Specified by:
delegateGet in class DelegatingCacheLoader
java.lang.Exception

delegateExists

protected boolean delegateExists(Fqn name)
                          throws java.lang.Exception
Specified by:
delegateExists in class DelegatingCacheLoader
java.lang.Exception

delegatePut

protected java.lang.Object delegatePut(Fqn name,
                                       java.lang.Object key,
                                       java.lang.Object value)
                                throws java.lang.Exception
Specified by:
delegatePut in class DelegatingCacheLoader
java.lang.Exception

delegatePut

protected void delegatePut(Fqn name,
                           java.util.Map attributes)
                    throws java.lang.Exception
Specified by:
delegatePut in class DelegatingCacheLoader
java.lang.Exception

delegateRemove

protected java.lang.Object delegateRemove(Fqn name,
                                          java.lang.Object key)
                                   throws java.lang.Exception
Specified by:
delegateRemove in class DelegatingCacheLoader
java.lang.Exception

delegateRemove

protected void delegateRemove(Fqn name)
                       throws java.lang.Exception
Specified by:
delegateRemove in class DelegatingCacheLoader
java.lang.Exception

delegateRemoveData

protected void delegateRemoveData(Fqn name)
                           throws java.lang.Exception
Specified by:
delegateRemoveData in class DelegatingCacheLoader
java.lang.Exception

delegateLoadEntireState

protected byte[] delegateLoadEntireState()
                                  throws java.lang.Exception
Specified by:
delegateLoadEntireState in class DelegatingCacheLoader
java.lang.Exception

delegateStoreEntireState

protected void delegateStoreEntireState(byte[] state)
                                 throws java.lang.Exception
Specified by:
delegateStoreEntireState in class DelegatingCacheLoader
java.lang.Exception


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.