org.jboss.web.tomcat.service.session.distributedcache.impl.jbc
Class AbstractJBossCacheService<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

java.lang.Object
  extended by org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AbstractJBossCacheService<T>
All Implemented Interfaces:
org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T>
Direct Known Subclasses:
AttributeBasedJBossCacheService, FieldBasedJBossCacheService, SessionBasedJBossCacheService

public abstract class AbstractJBossCacheService<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>
extends Object
implements org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T>

Abstract base implementation of DistributedCacheManager.


Field Summary
static Integer ATTRIBUTE_KEY
           
protected  org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager batchingManager
           
static String BUDDY_BACKUP
           
static org.jboss.cache.Fqn<String> BUDDY_BACKUP_FQN
           
protected  String cacheConfigName_
           
protected  JBossCacheWrapper cacheWrapper_
           
protected  String combinedPath_
          Context path for webapp + hostName; this + session id is a unique combo.
static String FQN_DELIMITER
           
protected static Set<Integer> INTERNAL_KEYS
           
protected  org.jboss.logging.Logger log_
           
static Integer METADATA_KEY
           
static String SESSION
           
static Integer TIMESTAMP_KEY
           
static Integer VERSION_KEY
           
 
Constructor Summary
protected AbstractJBossCacheService(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager localManager)
           
protected AbstractJBossCacheService(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager localManager, org.jboss.cache.Cache<Object,Object> cache)
           
 
Method Summary
 void evictSession(String realId)
           
 void evictSession(String realId, String dataOwner)
           
 org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager getBatchingManager()
          Get specfically the BatchModeTransactionManager.
static org.jboss.cache.Fqn<String> getBuddyBackupSessionFqn(String dataOwner, String contextHostPath, String sessionId)
           
protected  org.jboss.cache.Cache<Object,Object> getCache()
           
protected  Set<String> getChildrenNames(org.jboss.cache.Fqn<String> fqn)
           
static String getCombinedPath(String hostname, String contextPath)
           
protected  org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getDistributableSessionData(String realId, Map<Object,Object> distributedCacheData, boolean includeAttributes)
          Extracts the contents of distributedCacheData.
protected  org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager getManager()
           
protected  Object getMarshalledValue(Object value)
           
protected abstract  Map<String,Object> getSessionAttributes(String realId, Map<Object,Object> distributedCacheData)
          Returns the session attributes, possibly using the passed in distributedCacheData as a source.
 org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad)
           
 org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes)
           
static org.jboss.cache.Fqn<String> getSessionFqn(String contextHostPath, String sessionId)
           
 Map<String,String> getSessionIds()
          Gets the ids of all sessions in the underlying cache.
protected  Object getUnMarshalledValue(Object obj)
           
protected  org.jboss.cache.Fqn<String> getWebappFqn()
           
 boolean isMarshallingAvailable()
          Gets whether TreeCache-based marshalling is available
 boolean isPassivationEnabled()
           
protected  void releaseCacheToManager(String cacheConfigName)
           
 void removeSession(String realId)
           
 void removeSessionLocal(String realId)
           
 void removeSessionLocal(String realId, String dataOwner)
           
protected  void removeSessionRegion(String realId, org.jboss.cache.Fqn<String> fqn)
          Extension point to allow subclasses to remove per-session JBC regions.
 void sessionCreated(String realId)
           
protected  void setCache(org.jboss.cache.Cache<Object,Object> cache)
           
protected  void setupSessionRegion(org.jboss.cache.Fqn<String> fqn)
          Extension point to allow subclasses to add per-session JBC regions.
 void start()
           
 void stop()
           
protected abstract  void storeSessionAttributes(Map<Object,Object> dataMap, T sessionData)
           
 void storeSessionData(T sessionData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager
getAttribute, getAttributeKeys, getAttributes, getSupportsAttributeOperations, putAttribute, putAttribute, removeAttribute, removeAttributeLocal
 

Field Detail

BUDDY_BACKUP

public static final String BUDDY_BACKUP
See Also:
Constant Field Values

BUDDY_BACKUP_FQN

public static final org.jboss.cache.Fqn<String> BUDDY_BACKUP_FQN

SESSION

public static final String SESSION
See Also:
Constant Field Values

VERSION_KEY

public static final Integer VERSION_KEY

TIMESTAMP_KEY

public static final Integer TIMESTAMP_KEY

METADATA_KEY

public static final Integer METADATA_KEY

ATTRIBUTE_KEY

public static final Integer ATTRIBUTE_KEY

INTERNAL_KEYS

protected static final Set<Integer> INTERNAL_KEYS

FQN_DELIMITER

public static final String FQN_DELIMITER
See Also:
Constant Field Values

log_

protected org.jboss.logging.Logger log_

combinedPath_

protected String combinedPath_
Context path for webapp + hostName; this + session id is a unique combo.


batchingManager

protected org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager batchingManager

cacheWrapper_

protected JBossCacheWrapper cacheWrapper_

cacheConfigName_

protected String cacheConfigName_
Constructor Detail

AbstractJBossCacheService

protected AbstractJBossCacheService(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager localManager)
                             throws org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException
Throws:
org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException

AbstractJBossCacheService

protected AbstractJBossCacheService(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager localManager,
                                    org.jboss.cache.Cache<Object,Object> cache)
Method Detail

getCombinedPath

public static String getCombinedPath(String hostname,
                                     String contextPath)

getSessionFqn

public static org.jboss.cache.Fqn<String> getSessionFqn(String contextHostPath,
                                                        String sessionId)

getBuddyBackupSessionFqn

public static org.jboss.cache.Fqn<String> getBuddyBackupSessionFqn(String dataOwner,
                                                                   String contextHostPath,
                                                                   String sessionId)

getManager

protected org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager getManager()

getCache

protected org.jboss.cache.Cache<Object,Object> getCache()

setCache

protected void setCache(org.jboss.cache.Cache<Object,Object> cache)

start

public void start()
Specified by:
start in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

stop

public void stop()
Specified by:
stop in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

getBatchingManager

public org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager getBatchingManager()
Get specfically the BatchModeTransactionManager.

Specified by:
getBatchingManager in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

isMarshallingAvailable

public boolean isMarshallingAvailable()
Gets whether TreeCache-based marshalling is available


sessionCreated

public void sessionCreated(String realId)
Specified by:
sessionCreated in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

getSessionData

public org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getSessionData(String realId,
                                                                                                                 boolean initialLoad)
Specified by:
getSessionData in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

storeSessionData

public void storeSessionData(T sessionData)
Specified by:
storeSessionData in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

setupSessionRegion

protected void setupSessionRegion(org.jboss.cache.Fqn<String> fqn)
Extension point to allow subclasses to add per-session JBC regions.

Parameters:
session - the session
fqn - the fqn for the session

storeSessionAttributes

protected abstract void storeSessionAttributes(Map<Object,Object> dataMap,
                                               T sessionData)

removeSessionRegion

protected void removeSessionRegion(String realId,
                                   org.jboss.cache.Fqn<String> fqn)
Extension point to allow subclasses to remove per-session JBC regions.

Parameters:
session - the session
fqn - the fqn for the session

removeSession

public void removeSession(String realId)
Specified by:
removeSession in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

removeSessionLocal

public void removeSessionLocal(String realId)
Specified by:
removeSessionLocal in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

removeSessionLocal

public void removeSessionLocal(String realId,
                               String dataOwner)
Specified by:
removeSessionLocal in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

evictSession

public void evictSession(String realId)
Specified by:
evictSession in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

evictSession

public void evictSession(String realId,
                         String dataOwner)
Specified by:
evictSession in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

getSessionData

public org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getSessionData(String realId,
                                                                                                                 String dataOwner,
                                                                                                                 boolean includeAttributes)
Specified by:
getSessionData in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

getSessionIds

public Map<String,String> getSessionIds()
Gets the ids of all sessions in the underlying cache.

Specified by:
getSessionIds in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>
Returns:
Map containing all of the session ids of sessions in the cache (with any jvmRoute removed) as keys, and the identifier of the data owner for the session as value (or a null value if buddy replication is not enabled.) Will not return null.

getChildrenNames

protected Set<String> getChildrenNames(org.jboss.cache.Fqn<String> fqn)

isPassivationEnabled

public boolean isPassivationEnabled()
Specified by:
isPassivationEnabled in interface org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T extends org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData>

getWebappFqn

protected org.jboss.cache.Fqn<String> getWebappFqn()

getDistributableSessionData

protected org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData getDistributableSessionData(String realId,
                                                                                                                                 Map<Object,Object> distributedCacheData,
                                                                                                                                 boolean includeAttributes)
Extracts the contents of distributedCacheData. Note: This operation may alter the contents of the passed in map. If this is unacceptable, pass in a defensive copy.


getSessionAttributes

protected abstract Map<String,Object> getSessionAttributes(String realId,
                                                           Map<Object,Object> distributedCacheData)
Returns the session attributes, possibly using the passed in distributedCacheData as a source. Note: This operation may alter the contents of the passed in map. If this is unacceptable, pass in a defensive copy.


releaseCacheToManager

protected void releaseCacheToManager(String cacheConfigName)

getMarshalledValue

protected Object getMarshalledValue(Object value)

getUnMarshalledValue

protected Object getUnMarshalledValue(Object obj)


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.