org.jboss.cache.loader
Class LocalDelegatingCacheLoader

java.lang.Object
  extended byorg.jboss.cache.loader.DelegatingCacheLoader
      extended byorg.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.1.2.1 2005/04/04 05:44:19 bwang00 Exp $
Author:
Bela Ban, Daniel Gredler

Constructor Summary
LocalDelegatingCacheLoader(TreeCache delegate)
           
 
Method Summary
protected  boolean delegateExists(Fqn name)
           
protected  Node delegateGet(Fqn name)
           
protected  Object delegateGet(Fqn name, Object key)
           
protected  Set delegateGetChildrenNames(Fqn fqn)
           
protected  byte[] delegateLoadEntireState()
           
protected  void delegatePut(Fqn name, Map attributes)
           
protected  Object delegatePut(Fqn name, Object key, Object value)
           
protected  void delegateRemove(Fqn name)
           
protected  Object delegateRemove(Fqn name, 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(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(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

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

delegateGetChildrenNames

protected Set delegateGetChildrenNames(Fqn fqn)
                                throws Exception
Specified by:
delegateGetChildrenNames in class DelegatingCacheLoader
Throws:
Exception

delegateGet

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

delegateGet

protected Node delegateGet(Fqn name)
                    throws Exception
Specified by:
delegateGet in class DelegatingCacheLoader
Throws:
Exception

delegateExists

protected boolean delegateExists(Fqn name)
                          throws Exception
Specified by:
delegateExists in class DelegatingCacheLoader
Throws:
Exception

delegatePut

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

delegatePut

protected void delegatePut(Fqn name,
                           Map attributes)
                    throws Exception
Specified by:
delegatePut in class DelegatingCacheLoader
Throws:
Exception

delegateRemove

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

delegateRemove

protected void delegateRemove(Fqn name)
                       throws Exception
Specified by:
delegateRemove in class DelegatingCacheLoader
Throws:
Exception

delegateRemoveData

protected void delegateRemoveData(Fqn name)
                           throws Exception
Specified by:
delegateRemoveData in class DelegatingCacheLoader
Throws:
Exception

delegateLoadEntireState

protected byte[] delegateLoadEntireState()
                                  throws Exception
Specified by:
delegateLoadEntireState in class DelegatingCacheLoader
Throws:
Exception

delegateStoreEntireState

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


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.