org.jboss.web.tomcat.tc5.session
Class JBossCacheService

java.lang.Object
  extended byorg.jboss.web.tomcat.tc5.session.JBossCacheService
All Implemented Interfaces:
TreeCacheListener (src)

public class JBossCacheService
extends java.lang.Object
implements TreeCacheListener (src)

A wrapper class to JBossCache. This is currently needed to handle various operations such as


Field Summary
static java.lang.String ATTRIBUTE
           
static java.lang.String KEY
           
protected static Logger (src) log_
           
static java.lang.String SESSION
           
 
Constructor Summary
JBossCacheService()
           
 
Method Summary
protected  void _evict(Fqn (src)  fqn)
          Wrapper to embed retyr logic.
protected  java.lang.Object _get(Fqn (src)  fqn, java.lang.String id)
          Wrapper to embed retyr logic.
protected  void _put(Fqn (src)  fqn, java.util.Map map)
          Wrapper to embed retry logic.
protected  java.lang.Object _put(Fqn (src)  fqn, java.lang.String id, java.lang.Object value)
          Wrapper to embed retry logic.
protected  void _remove(Fqn (src)  fqn)
          Wrapper to embed retry logic.
protected  java.lang.Object _remove(Fqn (src)  fqn, java.lang.String id)
          Wrapper to embed retyr logic.
 void cacheStarted(TreeCache (src)  cache)
          Called when the cache is started.
 void cacheStopped(TreeCache (src)  cache)
          Called when the cache is stopped.
 boolean exists(java.lang.String id)
           
 java.util.List findSessionIDs()
          Find session ids for the whole Manager instance.
 java.lang.Object getAttribute(java.lang.String id, java.lang.String key)
           
 java.util.Set getAttributeKeys(java.lang.String id)
          Obtain the keys associated with this fqn.
 java.util.Map getAttributes(java.lang.String id)
          Return all attributes associated with this session id.
protected  java.lang.String getIdFromFqn(Fqn (src)  fqn)
           
 java.util.List getNewSessionsInStore()
          Retrieve the new sessions in the underlying cache.
 java.lang.Object getSession(java.lang.String id)
           
 void nodeCreated(Fqn (src)  fqn)
          Called when a node is created
protected  void nodeDirty(Fqn (src)  fqn)
           
 void nodeEvicted(Fqn (src)  fqn)
          Called when a node is evicted (not the same as remove()).
 void nodeLoaded(Fqn (src)  fqn)
          Called when a node is loaded into memory via the CacheLoader.
 void nodeModified(Fqn (src)  fqn)
          Called when a node is modified, e.g., one (key, value) pair in the internal map storage has been modified.
 void nodeRemoved(Fqn (src)  fqn)
          Called when a node is removed.
 void nodeVisited(Fqn (src)  fqn)
          Called when a node is visisted, i.e., get().
 void putAttribute(java.lang.String id, java.util.Map map)
           
 java.lang.Object putAttribute(java.lang.String id, java.lang.String key, java.lang.Object value)
           
 void putSession(java.lang.String id, java.lang.Object session)
           
 java.lang.Object removeAttribute(java.lang.String id, java.lang.String key)
           
 void removeAttributeLocal(java.lang.String id)
           
 void removeAttributes(java.lang.String id)
           
 java.lang.Object removeSession(java.lang.String id)
           
 void removeSessionLocal(java.lang.String id)
           
 void start(java.lang.ClassLoader tcl, JBossCacheManager (src)  manager)
           
 void stop()
           
 void viewChange(View new_view)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log_

protected static Logger (src)  log_

SESSION

public static final java.lang.String SESSION
See Also:
Constant Field Values (src)

ATTRIBUTE

public static final java.lang.String ATTRIBUTE
See Also:
Constant Field Values (src)

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values (src)
Constructor Detail

JBossCacheService

public JBossCacheService()
                  throws ClusteringNotSupportedException (src) 
Method Detail

start

public void start(java.lang.ClassLoader tcl,
                  JBossCacheManager (src)  manager)

stop

public void stop()

findSessionIDs

public java.util.List findSessionIDs()
Find session ids for the whole Manager instance. Note that this also depends on the web app path setting.

Returns:
Empty list if not found.

getSession

public java.lang.Object getSession(java.lang.String id)

putSession

public void putSession(java.lang.String id,
                       java.lang.Object session)

removeSession

public java.lang.Object removeSession(java.lang.String id)

removeSessionLocal

public void removeSessionLocal(java.lang.String id)

exists

public boolean exists(java.lang.String id)

getAttribute

public java.lang.Object getAttribute(java.lang.String id,
                                     java.lang.String key)

putAttribute

public java.lang.Object putAttribute(java.lang.String id,
                                     java.lang.String key,
                                     java.lang.Object value)

putAttribute

public void putAttribute(java.lang.String id,
                         java.util.Map map)

removeAttributes

public void removeAttributes(java.lang.String id)

removeAttribute

public java.lang.Object removeAttribute(java.lang.String id,
                                        java.lang.String key)

removeAttributeLocal

public void removeAttributeLocal(java.lang.String id)

getAttributeKeys

public java.util.Set getAttributeKeys(java.lang.String id)
Obtain the keys associated with this fqn. Note that it is not the fqn children.

Returns:

getAttributes

public java.util.Map getAttributes(java.lang.String id)
Return all attributes associated with this session id. Return empty map if not found.

Parameters:
id -
Returns:

getNewSessionsInStore

public java.util.List getNewSessionsInStore()
Retrieve the new sessions in the underlying cache. Return size 0 if not found.


_get

protected java.lang.Object _get(Fqn (src)  fqn,
                                java.lang.String id)
Wrapper to embed retyr logic.

Parameters:
fqn -
id -
Returns:

_put

protected java.lang.Object _put(Fqn (src)  fqn,
                                java.lang.String id,
                                java.lang.Object value)
Wrapper to embed retry logic.

Parameters:
fqn -
id -
value -
Returns:

_put

protected void _put(Fqn (src)  fqn,
                    java.util.Map map)
Wrapper to embed retry logic.

Parameters:
fqn -
map -

_remove

protected java.lang.Object _remove(Fqn (src)  fqn,
                                   java.lang.String id)
Wrapper to embed retyr logic.

Parameters:
fqn -
id -
Returns:

_remove

protected void _remove(Fqn (src)  fqn)
Wrapper to embed retry logic.

Parameters:
fqn -

_evict

protected void _evict(Fqn (src)  fqn)
Wrapper to embed retyr logic.

Parameters:
fqn -

nodeCreated

public void nodeCreated(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is created

Specified by:
nodeCreated in interface TreeCacheListener (src)
Parameters:
fqn -

nodeRemoved

public void nodeRemoved(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is removed.

Specified by:
nodeRemoved in interface TreeCacheListener (src)
Parameters:
fqn -

nodeLoaded

public void nodeLoaded(Fqn (src)  fqn)
Called when a node is loaded into memory via the CacheLoader. This is not the same as nodeCreated(Fqn).

Specified by:
nodeLoaded in interface TreeCacheListener (src)

nodeModified

public void nodeModified(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is modified, e.g., one (key, value) pair in the internal map storage has been modified.

Specified by:
nodeModified in interface TreeCacheListener (src)
Parameters:
fqn -

nodeDirty

protected void nodeDirty(Fqn (src)  fqn)

getIdFromFqn

protected java.lang.String getIdFromFqn(Fqn (src)  fqn)

nodeVisited

public void nodeVisited(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is visisted, i.e., get().

Specified by:
nodeVisited in interface TreeCacheListener (src)
Parameters:
fqn -

cacheStarted

public void cacheStarted(TreeCache (src)  cache)
Description copied from interface: TreeCacheListener (src)
Called when the cache is started.

Specified by:
cacheStarted in interface TreeCacheListener (src)
Parameters:
cache -

cacheStopped

public void cacheStopped(TreeCache (src)  cache)
Description copied from interface: TreeCacheListener (src)
Called when the cache is stopped.

Specified by:
cacheStopped in interface TreeCacheListener (src)
Parameters:
cache -

viewChange

public void viewChange(View new_view)
Specified by:
viewChange in interface TreeCacheListener (src)

nodeEvicted

public void nodeEvicted(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is evicted (not the same as remove()).

Specified by:
nodeEvicted in interface TreeCacheListener (src)
Parameters:
fqn -