JSecurity

org.jsecurity.session.mgt.eis
Class MemorySessionDAO

java.lang.Object
  extended by org.jsecurity.session.mgt.eis.CachingSessionDAO
      extended by org.jsecurity.session.mgt.eis.MemorySessionDAO
All Implemented Interfaces:
CacheManagerAware, SessionDAO

public class MemorySessionDAO
extends CachingSessionDAO

Simple memory-based implementation of the SessionDAO that relies on its configured CacheManager for Session caching and in-memory persistence.

PLEASE NOTE the default CacheManager internal to this implementation is a HashtableCacheManager, which IS NOT RECOMMENDED for production environments.

If you want to use the MemorySessionDAO in production environments, such as those that require session data to be recoverable in case of a server restart, you should do one of two things (or both):

Since:
0.1
Author:
Les Hazlewood

Field Summary
 
Fields inherited from class org.jsecurity.session.mgt.eis.CachingSessionDAO
ACTIVE_SESSION_CACHE_NAME
 
Constructor Summary
MemorySessionDAO()
           
 
Method Summary
protected  void assignSessionId(Session session, Serializable sessionId)
           
protected  Serializable doCreate(Session session)
          Subclass hook to actually persist the given Session instance to the underlying EIS.
protected  void doDelete(Session session)
          Subclass implementation hook to permanently delete the given Session from the underlying EIS.
protected  Session doReadSession(Serializable sessionId)
          Subclass implmentation hook to actually retrieve the Session object from the underlying EIS.
protected  void doUpdate(Session session)
          Subclass implementation hook to actually persist the Session's state to the underlying EIS.
protected  Serializable generateNewSessionId()
           
 
Methods inherited from class org.jsecurity.session.mgt.eis.CachingSessionDAO
cache, cacheValidSession, create, createActiveSessionsCache, delete, ensureUncached, getActiveSessions, getActiveSessionsCache, getActiveSessionsCacheLazy, getActiveSessionsCacheName, getCachedSession, getCachedSession, getCacheManager, readSession, setActiveSessionsCache, setActiveSessionsCacheName, setCacheManager, uncache, update, verifySessionId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemorySessionDAO

public MemorySessionDAO()
Method Detail

generateNewSessionId

protected Serializable generateNewSessionId()

doCreate

protected Serializable doCreate(Session session)
Description copied from class: CachingSessionDAO
Subclass hook to actually persist the given Session instance to the underlying EIS.

Specified by:
doCreate in class CachingSessionDAO
Parameters:
session - the Session instance to persist to the EIS.
Returns:
the id of the session created in the EIS (i.e. this is almost always a primary key and should be the value returned from Session.getId().

assignSessionId

protected void assignSessionId(Session session,
                               Serializable sessionId)

doReadSession

protected Session doReadSession(Serializable sessionId)
Description copied from class: CachingSessionDAO
Subclass implmentation hook to actually retrieve the Session object from the underlying EIS.

Specified by:
doReadSession in class CachingSessionDAO
Parameters:
sessionId - the id of the Session to retrieve.
Returns:
the Session in the EIS identified by sessionId

doUpdate

protected void doUpdate(Session session)
Description copied from class: CachingSessionDAO
Subclass implementation hook to actually persist the Session's state to the underlying EIS.

Specified by:
doUpdate in class CachingSessionDAO
Parameters:
session - the session object whose state will be propagated to the EIS.

doDelete

protected void doDelete(Session session)
Description copied from class: CachingSessionDAO
Subclass implementation hook to permanently delete the given Session from the underlying EIS.

Specified by:
doDelete in class CachingSessionDAO
Parameters:
session - the session instance to permanently delete from the EIS.

JSecurity

Copyright © 2004-2008 JSecurity.