org.jboss.cache.loader.tcp
Class TcpDelegatingCacheLoader

java.lang.Object
  extended by org.jboss.cache.loader.DelegatingCacheLoader
      extended by org.jboss.cache.loader.tcp.TcpDelegatingCacheLoader
All Implemented Interfaces:
CacheLoader, org.jboss.system.Service

public class TcpDelegatingCacheLoader
extends DelegatingCacheLoader

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

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

Version:
$Id: TcpDelegatingCacheLoader.java,v 1.5 2006/01/20 12:50:46 bela 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
 
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)
           
 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 delegatePut(java.util.List modifications)
           
protected  void delegateRemove(Fqn name)
           
protected  java.lang.Object delegateRemove(Fqn name, java.lang.Object key)
           
protected  void delegateRemoveData(Fqn name)
           
 void delegateStoreEntireState(byte[] state)
           
 void setCache(TreeCache cache)
          Allows configuration via XML config file.
 void setConfig(java.util.Properties props)
          Allows configuration via XML config file.
 void start()
           
 void stop()
           
 
Methods inherited from class org.jboss.cache.loader.DelegatingCacheLoader
commit, create, destroy, exists, get, getChildrenNames, loadEntireState, prepare, put, put, put, put, remove, remove, removeData, rollback, storeEntireState
 
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(java.util.Properties props)
Allows configuration via XML config file.

Specified by:
setConfig in interface CacheLoader
Specified by:
setConfig in class DelegatingCacheLoader
Parameters:
props - a collection of configuration properties
See Also:
DelegatingCacheLoader.setConfig(java.util.Properties)

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface org.jboss.system.Service
Overrides:
start in class DelegatingCacheLoader
Throws:
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface org.jboss.system.Service
Overrides:
stop in class DelegatingCacheLoader

setCache

public void setCache(TreeCache cache)
Allows configuration via XML config file.

Specified by:
setCache in interface CacheLoader
Specified by:
setCache in class DelegatingCacheLoader
Parameters:
cache - The cache on which this loader works
See Also:
DelegatingCacheLoader.setCache(org.jboss.cache.TreeCache)

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)

delegatePut

protected void delegatePut(java.util.List modifications)
                    throws java.lang.Exception
Specified by:
delegatePut in class DelegatingCacheLoader
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

public byte[] delegateLoadEntireState()
                               throws java.lang.Exception
Specified by:
delegateLoadEntireState in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateLoadEntireState()

delegateStoreEntireState

public void delegateStoreEntireState(byte[] state)
                              throws java.lang.Exception
Specified by:
delegateStoreEntireState in class DelegatingCacheLoader
Throws:
java.lang.Exception
See Also:
DelegatingCacheLoader.delegateStoreEntireState(byte[])


Copyright 1998-2005 JBoss Inc . All Rights Reserved.