| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shiro.session.mgt.AbstractSessionManager
org.apache.shiro.session.mgt.AbstractNativeSessionManager
org.apache.shiro.session.mgt.AbstractValidatingSessionManager
org.apache.shiro.session.mgt.DefaultSessionManager
public class DefaultSessionManager
Default business-tier implementation of a ValidatingSessionManager.  All session CRUD operations are
 delegated to an internal SessionDAO.
| Field Summary | |
|---|---|
| protected  SessionDAO | sessionDAO | 
| Fields inherited from class org.apache.shiro.session.mgt.AbstractValidatingSessionManager | 
|---|
| DEFAULT_SESSION_VALIDATION_INTERVAL, sessionValidationInterval, sessionValidationScheduler, sessionValidationSchedulerEnabled | 
| Fields inherited from class org.apache.shiro.session.mgt.AbstractSessionManager | 
|---|
| DEFAULT_GLOBAL_SESSION_TIMEOUT, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND | 
| Constructor Summary | |
|---|---|
| DefaultSessionManager() | |
| Method Summary | |
|---|---|
| protected  void | afterExpired(Session session) | 
| protected  void | afterStopped(Session session) | 
| protected  void | create(Session session)Persists the given session instance to an underlying EIS (Enterprise Information System). | 
| protected  void | delete(Session session) | 
| protected  Session | doCreateSession(SessionContext context) | 
| protected  Collection<Session> | getActiveSessions() | 
|  SessionDAO | getSessionDAO() | 
|  SessionFactory | getSessionFactory()Returns the SessionFactoryused to generate newSessioninstances. | 
| protected  Serializable | getSessionId(SessionKey sessionKey) | 
|  boolean | isDeleteInvalidSessions()Returns trueif sessions should be automatically deleted after they are discovered to be invalid,falseif invalid sessions will be manually deleted by some process external to Shiro's control. | 
| protected  Session | newSessionInstance(SessionContext context) | 
| protected  void | onChange(Session session) | 
| protected  void | onExpiration(Session session) | 
| protected  void | onStop(Session session) | 
| protected  Session | retrieveSession(SessionKey sessionKey)Looks up a session from the underlying data store based on the specified session key. | 
| protected  Session | retrieveSessionFromDataSource(Serializable sessionId) | 
|  void | setCacheManager(CacheManager cacheManager)Sets the available CacheManager instance on this component. | 
|  void | setDeleteInvalidSessions(boolean deleteInvalidSessions)Sets whether or not sessions should be automatically deleted after they are discovered to be invalid. | 
|  void | setSessionDAO(SessionDAO sessionDAO) | 
|  void | setSessionFactory(SessionFactory sessionFactory)Sets the SessionFactoryused to generate newSessioninstances. | 
| Methods inherited from class org.apache.shiro.session.mgt.AbstractNativeSessionManager | 
|---|
| applyGlobalSessionTimeout, beforeInvalidNotification, checkValid, createExposedSession, createExposedSession, getAttribute, getAttributeKeys, getHost, getLastAccessTime, getSession, getSessionListeners, getStartTimestamp, getTimeout, isValid, notifyExpiration, notifyStart, notifyStop, onStart, onStop, removeAttribute, setAttribute, setSessionListeners, setTimeout, start, stop, touch | 
| Methods inherited from class org.apache.shiro.session.mgt.AbstractSessionManager | 
|---|
| getGlobalSessionTimeout, setGlobalSessionTimeout | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.shiro.session.mgt.SessionManager | 
|---|
| getSession, start | 
| Field Detail | 
|---|
protected SessionDAO sessionDAO
| Constructor Detail | 
|---|
public DefaultSessionManager()
| Method Detail | 
|---|
public void setSessionDAO(SessionDAO sessionDAO)
public SessionDAO getSessionDAO()
public SessionFactory getSessionFactory()
SessionFactory used to generate new Session instances.  The default instance
 is a SimpleSessionFactory.
SessionFactory used to generate new Session instances.public void setSessionFactory(SessionFactory sessionFactory)
SessionFactory used to generate new Session instances.  The default instance
 is a SimpleSessionFactory.
sessionFactory - the SessionFactory used to generate new Session instances.public boolean isDeleteInvalidSessions()
true if sessions should be automatically deleted after they are discovered to be invalid,
 false if invalid sessions will be manually deleted by some process external to Shiro's control.  The
 default is true to ensure no orphans exist in the underlying data store.
 false ONLY if you have some other process that you manage yourself
 that periodically deletes invalid sessions from the backing data store over time, such as via a Quartz or Cron
 job.  If you do not do this, the invalid sessions will become 'orphans' and fill up the data store over time.
 
 This property is provided because some systems need the ability to perform querying/reporting against sessions in
 the data store, even after they have stopped or expired.  Setting this attribute to false will allow
 such querying, but with the caveat that the application developer/configurer deletes the sessions themselves by
 some other means (cron, quartz, etc).
true if sessions should be automatically deleted after they are discovered to be invalid,
         false if invalid sessions will be manually deleted by some process external to Shiro's control.public void setDeleteInvalidSessions(boolean deleteInvalidSessions)
true to ensure no orphans will exist in the underlying data store.
 false if you are manually going to delete sessions yourself by some process
 (quartz, cron, etc) external to Shiro's control.  See the
 isDeleteInvalidSessions() JavaDoc for more.
deleteInvalidSessions - whether or not sessions should be automatically deleted after they are discovered
                              to be invalid.public void setCacheManager(CacheManager cacheManager)
CacheManagerAware
setCacheManager in interface CacheManagerAwarecacheManager - the CacheManager instance to set on this component.protected Session doCreateSession(SessionContext context)
doCreateSession in class AbstractValidatingSessionManagerprotected Session newSessionInstance(SessionContext context)
protected void create(Session session)
this.sessionDAO.create(session);
- 
 
- 
- Parameters:
- session- the Session instance to persist to the underlying EIS.
 
protected void onStop(Session session)
onStop in class AbstractNativeSessionManagerprotected void afterStopped(Session session)
afterStopped in class AbstractNativeSessionManagerprotected void onExpiration(Session session)
onExpiration in class AbstractValidatingSessionManagerprotected void afterExpired(Session session)
afterExpired in class AbstractValidatingSessionManagerprotected void onChange(Session session)
onChange in class AbstractNativeSessionManager
protected Session retrieveSession(SessionKey sessionKey)
                           throws UnknownSessionException
AbstractValidatingSessionManager
retrieveSession in class AbstractValidatingSessionManagersessionKey - the session key to use to look up the target session.
sessionId.
UnknownSessionException - if there is no session identified by sessionId.protected Serializable getSessionId(SessionKey sessionKey)
protected Session retrieveSessionFromDataSource(Serializable sessionId)
                                         throws UnknownSessionException
UnknownSessionExceptionprotected void delete(Session session)
protected Collection<Session> getActiveSessions()
getActiveSessions in class AbstractValidatingSessionManager| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||