org.sakaiproject.service.framework.session
Interface UsageSessionService

All Known Implementing Classes:
UsageSessionServiceAdaptor

public interface UsageSessionService

UsageSessionService keeps track of usage sessions.

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

Field Summary
static String EVENT_LOGIN
          Name for the event of logging in.
static String EVENT_LOGOUT
          Name for the event of logging out.
static String SAKAI_SESSION_COOKIE
          Name for the global cookie to store the session
static String USAGE_SESSION_KEY
          Note: This must be a constant and not based on classname - it must stay the same regardless of the name of the implementing class.
 
Method Summary
 List getOpenSessions()
          Access a list of all open sessions.
 Map getOpenSessionsByServer()
          Access a list of all open sessions, grouped by server.
 UsageSession getSession()
          Access the usage session associated with the current request or thread.
 UsageSession getSession(String id)
          Access a usage session (may be other than the current one) by id.
 String getSessionId()
          Access the session id from the usage session associated with the current request or thread, or null if no session.
 int getSessionInactiveTimeout()
          Access the time (seconds) we will wait for any user generated request from a session before we consider the session inactive.
 int getSessionLostTimeout()
          Access the time (seconds) we will wait for hearing anyting from a session before we consider the session lost.
 List getSessions(List ids)
          Access a List of usage sessions by List of ids.
 List getSessions(String criteria, Object[] values)
          Access a List of usage sessions by *arbitrary criteria* for te session ids.
 SessionState getSessionState(String key)
          Access a SessionState object with the given key associated with the current usage session.
 String getSessionUserId()
          Deprecated. Use SessionManager.getCurrentSessionUserId()
 UsageSession setSessionActive(boolean auto)
          Indicate recent user activity on the current usage session - user initiated or auto.
 UsageSession startSession(String userId, String remoteAddress, String userAgent)
          Establish a usage session associated with the current request or thread.
 

Field Detail

EVENT_LOGIN

public static final String EVENT_LOGIN
Name for the event of logging in.

See Also:
Constant Field Values

EVENT_LOGOUT

public static final String EVENT_LOGOUT
Name for the event of logging out.

See Also:
Constant Field Values

SAKAI_SESSION_COOKIE

public static final String SAKAI_SESSION_COOKIE
Name for the global cookie to store the session

See Also:
Constant Field Values

USAGE_SESSION_KEY

public static final String USAGE_SESSION_KEY
Note: This must be a constant and not based on classname - it must stay the same regardless of the name of the implementing class.

See Also:
Constant Field Values
Method Detail

startSession

public UsageSession startSession(String userId,
                                 String remoteAddress,
                                 String userAgent)
Establish a usage session associated with the current request or thread.

Parameters:
userId - The user id.
remoteAddress - The IP address from the user is making a request.
userAgent - The string describing the user's browser.
Returns:
The new UsageSession, or null if one could not be created.

getSession

public UsageSession getSession()
Access the usage session associated with the current request or thread.

Returns:
The UsageSession object holding the information about this session.

getSessionUserId

public String getSessionUserId()
Deprecated. Use SessionManager.getCurrentSessionUserId()

Access the user id from the usage session associated with the current request or thread.

Returns:
The user id from the usage session associated with the current request or thread, or null if there is none.

getSessionId

public String getSessionId()
Access the session id from the usage session associated with the current request or thread, or null if no session.

Returns:
The session id from the usage session associated with the current request or thread, or null if no session.

getSessionState

public SessionState getSessionState(String key)
Access a SessionState object with the given key associated with the current usage session.

Parameters:
key - The SessionState key.
Returns:
an SessionState object with the given key.

setSessionActive

public UsageSession setSessionActive(boolean auto)
Indicate recent user activity on the current usage session - user initiated or auto. Maintains the initiated activity timeout mechanism.

Parameters:
auto - if true, activity from an automatic event, otherwise from a user initiated event.
Returns:
The current usage session (may be just closed).

getSession

public UsageSession getSession(String id)
Access a usage session (may be other than the current one) by id.

Parameters:
id - the Session id.
Returns:
The UsageSession object for this id, or null if not defined.

getSessions

public List getSessions(List ids)
Access a List of usage sessions by List of ids.

Parameters:
ids - the List (String) of Session ids.
Returns:
The List (UsageSession) of UsageSession object for these ids.

getSessions

public List getSessions(String criteria,
                        Object[] values)
Access a List of usage sessions by *arbitrary criteria* for te session ids.

Parameters:
criteria - A string with meaning known to the particular implementation of the API running.
Returns:
The List (UsageSession) of UsageSession object for these ids.

getSessionInactiveTimeout

public int getSessionInactiveTimeout()
Access the time (seconds) we will wait for any user generated request from a session before we consider the session inactive.

Returns:
the time (seconds) used for session inactivity detection.

getSessionLostTimeout

public int getSessionLostTimeout()
Access the time (seconds) we will wait for hearing anyting from a session before we consider the session lost.

Returns:
the time (seconds) used for lost session detection.

getOpenSessions

public List getOpenSessions()
Access a list of all open sessions.

Returns:
a List (UsageSession) of all open sessions, ordered by server, then by start (asc)

getOpenSessionsByServer

public Map getOpenSessionsByServer()
Access a list of all open sessions, grouped by server.

Returns:
a Map (server id -> List (UsageSession)) of all open sessions, ordered by server, then by start (asc)