org.sakaiproject.component.kernel.session
Class SessionComponent

java.lang.Object
  extended byorg.sakaiproject.component.kernel.session.SessionComponent
All Implemented Interfaces:
SessionManager

public class SessionComponent
extends Object
implements SessionManager

Standard implementation of the Sakai SessionManager.

Version:
$Revision: 2451 $
Author:
University of Michigan, Sakai Software Development Team

Nested Class Summary
protected  class SessionComponent.Maintenance
          Maintenance
 class SessionComponent.MyLittleSession
          Entity: ToolSession, ContextSession (and even HttpSession)
 class SessionComponent.MySession
          Entity: Session Also is an HttpSession
 class SessionComponent.MySessionBindingEvent
          Entity: SessionBindingEvent
 
Field Summary
protected static String CURRENT_SESSION
          Key in the ThreadLocalManager for binding our current session.
protected static String CURRENT_TOOL_SESSION
          Key in the ThreadLocalManager for binding our current tool session.
protected  int m_checkEvery
          Configuration: how often to check for inactive sessions (seconds).
protected  int m_defaultInactiveInterval
          Configuration: default inactive period for sessions (seconds).
protected  IdManager m_idManager
          Dependency: the id manager.
protected  SessionComponent.Maintenance m_maintenance
          The maintenance.
protected  Map m_sessions
          The sessions - keyed by session id.
protected  ThreadLocalManager m_threadLocalManager
          Dependency: the current manager.
 
Constructor Summary
SessionComponent()
           
 
Method Summary
 void destroy()
          Final cleanup.
 Session getCurrentSession()
          Access the session associated with the current request or processing thread.
 String getCurrentSessionUserId()
          Access the current session's user id, or return null if there is no current session.
 ToolSession getCurrentToolSession()
          Access the tool session associated with the current request or processing thread.
 Session getSession(String sessionId)
          Access the known session with this id.
 void init()
          Final initialization, once all dependencies are set.
 void setCheckEvery(String value)
          Configuration: set how often to check for inactive sessions (seconds).
 void setCurrentSession(Session s)
          Set this session as the current one for this request processing or thread.
 void setCurrentToolSession(ToolSession s)
          Set this session as the current tool session for this request processing or thread.
 void setIdManager(IdManager manager)
          Dependency - set the id manager.
 void setInactiveInterval(String value)
          Configuration - set the default inactive period for sessions.
 void setThreadLocalManager(ThreadLocalManager manager)
          Dependency - set the current manager.
 Session startSession()
          Start a new session.
 Session startSession(String id)
          Start a new session, using this session id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_sessions

protected Map m_sessions
The sessions - keyed by session id.


m_maintenance

protected SessionComponent.Maintenance m_maintenance
The maintenance.


CURRENT_SESSION

protected static final String CURRENT_SESSION
Key in the ThreadLocalManager for binding our current session.

See Also:
Constant Field Values

CURRENT_TOOL_SESSION

protected static final String CURRENT_TOOL_SESSION
Key in the ThreadLocalManager for binding our current tool session.

See Also:
Constant Field Values

m_threadLocalManager

protected ThreadLocalManager m_threadLocalManager
Dependency: the current manager.


m_idManager

protected IdManager m_idManager
Dependency: the id manager.


m_defaultInactiveInterval

protected int m_defaultInactiveInterval
Configuration: default inactive period for sessions (seconds).


m_checkEvery

protected int m_checkEvery
Configuration: how often to check for inactive sessions (seconds).

Constructor Detail

SessionComponent

public SessionComponent()
Method Detail

setThreadLocalManager

public void setThreadLocalManager(ThreadLocalManager manager)
Dependency - set the current manager.


setIdManager

public void setIdManager(IdManager manager)
Dependency - set the id manager.


setInactiveInterval

public void setInactiveInterval(String value)
Configuration - set the default inactive period for sessions.

Parameters:
value - The default inactive period for sessions.

setCheckEvery

public void setCheckEvery(String value)
Configuration: set how often to check for inactive sessions (seconds).

Parameters:
value - The how often to check for inactive sessions (seconds) value.

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Final cleanup.


getSession

public Session getSession(String sessionId)
Description copied from interface: SessionManager
Access the known session with this id.

Specified by:
getSession in interface SessionManager
Returns:
The Session object that has this id, or null if the id is not known.

startSession

public Session startSession()
Description copied from interface: SessionManager
Start a new session.

Specified by:
startSession in interface SessionManager
Returns:
The new UsageSession.

startSession

public Session startSession(String id)
Description copied from interface: SessionManager
Start a new session, using this session id.

Specified by:
startSession in interface SessionManager
Parameters:
id - The session Id to use.
Returns:
The new UsageSession.

getCurrentSession

public Session getCurrentSession()
Description copied from interface: SessionManager
Access the session associated with the current request or processing thread.

Specified by:
getCurrentSession in interface SessionManager
Returns:
The session associatd with the current request or processing thread.

getCurrentSessionUserId

public String getCurrentSessionUserId()
Description copied from interface: SessionManager
Access the current session's user id, or return null if there is no current session.

Specified by:
getCurrentSessionUserId in interface SessionManager
Returns:
The current session's user id, or null if there is no current session or it has no user id.

getCurrentToolSession

public ToolSession getCurrentToolSession()
Description copied from interface: SessionManager
Access the tool session associated with the current request or processing thread.

Specified by:
getCurrentToolSession in interface SessionManager
Returns:
The tool session associatd with the current request or processing thread.

setCurrentSession

public void setCurrentSession(Session s)
Description copied from interface: SessionManager
Set this session as the current one for this request processing or thread.

Specified by:
setCurrentSession in interface SessionManager
Parameters:
s - The session to set as the current session.

setCurrentToolSession

public void setCurrentToolSession(ToolSession s)
Description copied from interface: SessionManager
Set this session as the current tool session for this request processing or thread.

Specified by:
setCurrentToolSession in interface SessionManager
Parameters:
s - The session to set as the current tool session.