org.jboss.cache.loader
Class TcpDelegatingCacheLoader

java.lang.Object
  extended by org.jboss.cache.loader.AbstractCacheLoader
      extended by org.jboss.cache.loader.DelegatingCacheLoader
          extended by org.jboss.cache.loader.TcpDelegatingCacheLoader
All Implemented Interfaces:
CacheLoader

public class TcpDelegatingCacheLoader
extends DelegatingCacheLoader

DelegatingCacheLoader implementation which delegates to a remote (not in the same VM) CacheImpl using TCP/IP for communication. Example configuration for connecting to a TcpCacheServer running at myHost:12345:

 org.jboss.cache.loader.TcpDelegatingCacheLoader
 
 host=localhost
 port=2099
 
 

Version:
$Id: TcpDelegatingCacheLoader.java,v 1.7 2006/12/30 17:50:01 msurtani Exp $
Author:
Bela Ban

Field Summary
 
Fields inherited from class org.jboss.cache.loader.DelegatingCacheLoader
delegateExists, delegateGet, delegateGetChildrenNames, delegateGetKey, delegateLoadEntireState, delegatePut, delegatePutKeyVal, delegateRemove, delegateRemoveData, delegateRemoveKey, delegateStoreEntireState, putList
 
Fields inherited from class org.jboss.cache.loader.AbstractCacheLoader
cache, regionManager
 
Constructor Summary
TcpDelegatingCacheLoader()
          Default constructor.
TcpDelegatingCacheLoader(java.lang.String host, int port)
          Allows programmatic configuration.
 
Method Summary
protected  boolean delegateExists(Fqn name)
           
protected  java.util.Map delegateGet(Fqn name)
           
protected  java.util.Set delegateGetChildrenNames(Fqn fqn)
           
protected  void delegateLoadEntireState(java.io.ObjectOutputStream os)
           
protected  void delegateLoadState(Fqn subtree, java.io.ObjectOutputStream os)
           
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(java.io.ObjectInputStream is)
           
protected  void delegateStoreState(Fqn subtree, java.io.ObjectInputStream is)
           
 CacheLoaderConfig.IndividualCacheLoaderConfig getConfig()
          Gets the configuration.
 void put(java.util.List<Modification> modifications)
          Applies all modifications to the backend store.
 void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
          Allows configuration via XML config file.
 void start()
          Lifecycle method, called when the cache loader is started.
 void stop()
          Lifecycle method, called when the cache loader is stopped.
 
Methods inherited from class org.jboss.cache.loader.DelegatingCacheLoader
commit, create, destroy, exists, get, getChildrenNames, loadEntireState, loadState, prepare, put, put, put, remove, remove, removeData, rollback, storeEntireState, storeState
 
Methods inherited from class org.jboss.cache.loader.AbstractCacheLoader
getMarshaller, getNodeDataList, loadStateHelper, setCache, setRegionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpDelegatingCacheLoader

public TcpDelegatingCacheLoader()
Default constructor.


TcpDelegatingCacheLoader

public TcpDelegatingCacheLoader(java.lang.String host,
                                int port)
Allows programmatic configuration.

Parameters:
host - The host on which to look up the remote object.
port - The port on which to look up the remote object.
Method Detail

setConfig

public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
Allows configuration via XML config file.

Parameters:
base - May be an instance of the CacheLoaderConfig.IndividualCacheLoaderConfig base class, in which case the cache loader should use the CacheLoaderConfig.IndividualCacheLoaderConfig.getProperties() method to find configuration information. Alternatively, may be a type-specific subclass of CacheLoaderConfig.IndividualCacheLoaderConfig, if there is one.
See Also:
CacheLoader.setConfig(org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig)

getConfig

public CacheLoaderConfig.IndividualCacheLoaderConfig getConfig()
Description copied from interface: CacheLoader
Gets the configuration.

Returns:
the configuration, represented by a CacheLoaderConfig.IndividualCacheLoaderConfig object.

start

public void start()
           throws java.lang.Exception
Description copied from interface: CacheLoader
Lifecycle method, called when the cache loader is started.

Specified by:
start in interface CacheLoader
Overrides:
start in class DelegatingCacheLoader
Throws:
java.lang.Exception

stop

public void stop()
Description copied from interface: CacheLoader
Lifecycle method, called when the cache loader is stopped.

Specified by:
stop in interface CacheLoader
Overrides:
stop in class DelegatingCacheLoader

delegateGetChildrenNames

protected java.util.Set delegateGetChildrenNames(Fqn fqn)
                                          throws java.lang.Exception
Specified by:
delegateGetChildrenNames in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateGetChildrenNames(org.jboss.cache.Fqn)

delegateGet

protected java.util.Map delegateGet(Fqn name)
                             throws java.lang.Exception
Specified by:
delegateGet in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateGet(org.jboss.cache.Fqn)

delegateExists

protected boolean delegateExists(Fqn name)
                          throws java.lang.Exception
Specified by:
delegateExists in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateExists(org.jboss.cache.Fqn)

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
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegatePut(org.jboss.cache.Fqn,Object,Object)

delegatePut

protected void delegatePut(Fqn name,
                           java.util.Map attributes)
                    throws java.lang.Exception
Specified by:
delegatePut in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegatePut(org.jboss.cache.Fqn,java.util.Map)

put

public void put(java.util.List<Modification> modifications)
         throws java.lang.Exception
Description copied from interface: CacheLoader
Applies all modifications to the backend store. Changes may be applied in a single operation.

Specified by:
put in interface CacheLoader
Overrides:
put in class AbstractCacheLoader
Parameters:
modifications - A List of modifications
Throws:
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
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateRemove(org.jboss.cache.Fqn,Object)

delegateRemove

protected void delegateRemove(Fqn name)
                       throws java.lang.Exception
Specified by:
delegateRemove in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateRemove(org.jboss.cache.Fqn)

delegateRemoveData

protected void delegateRemoveData(Fqn name)
                           throws java.lang.Exception
Specified by:
delegateRemoveData in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateRemoveData(org.jboss.cache.Fqn)

delegateLoadEntireState

protected void delegateLoadEntireState(java.io.ObjectOutputStream os)
                                throws java.lang.Exception
Specified by:
delegateLoadEntireState in class DelegatingCacheLoader
Throws:
java.lang.Exception

delegateLoadState

protected void delegateLoadState(Fqn subtree,
                                 java.io.ObjectOutputStream os)
                          throws java.lang.Exception
Specified by:
delegateLoadState in class DelegatingCacheLoader
Throws:
java.lang.Exception

delegateStoreEntireState

protected void delegateStoreEntireState(java.io.ObjectInputStream is)
                                 throws java.lang.Exception
Specified by:
delegateStoreEntireState in class DelegatingCacheLoader
Throws:
java.lang.Exception

delegateStoreState

protected void delegateStoreState(Fqn subtree,
                                  java.io.ObjectInputStream is)
                           throws java.lang.Exception
Specified by:
delegateStoreState in class DelegatingCacheLoader
Throws:
java.lang.Exception