org.apache.turbine.services.session
Class TurbineSession

java.lang.Object
  extended byorg.apache.turbine.services.session.TurbineSession

public abstract class TurbineSession
extends java.lang.Object

This is a conveience class provided to allow access to the SessionService through static methods. The SessionService should ALWAYS be accessed through this class.

Version:
$Id: TurbineSession.java 534527 2007-05-02 16:10:59Z tv $
Author:
Quinton McCombs
See Also:
SessionService

Constructor Summary
TurbineSession()
           
 
Method Summary
static void addSession(javax.servlet.http.HttpSession session)
          Adds a session to the current list.
static java.util.Collection getActiveSessions()
          Gets a list of the active sessions
static java.util.Collection getActiveUsers()
          Gets a collection of all user objects representing the users currently logged in.
static javax.servlet.http.HttpSession getSession(java.lang.String sessionId)
          Gets the HttpSession by the session identifier
static java.util.Collection getSessionsForUser(User user)
          Get a collection of all session on which the given user is logged in.
static User getUserFromSession(javax.servlet.http.HttpSession session)
          Gets the User object of the the specified HttpSession.
static boolean isUserLoggedIn(User user)
          Determines if a given user is currently logged in.
static void removeSession(javax.servlet.http.HttpSession session)
          Removes a session from the current list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbineSession

public TurbineSession()
Method Detail

getActiveSessions

public static java.util.Collection getActiveSessions()
Gets a list of the active sessions

Returns:
List of HttpSession objects

addSession

public static void addSession(javax.servlet.http.HttpSession session)
Adds a session to the current list. This method should only be called by the listener.

Parameters:
session - Session to add

removeSession

public static void removeSession(javax.servlet.http.HttpSession session)
Removes a session from the current list. This method should only be called by the listener.

Parameters:
session - Session to remove

isUserLoggedIn

public static boolean isUserLoggedIn(User user)
Determines if a given user is currently logged in. The actual implementation of the User object must implement the equals() method. By default, Torque based objects (liek TurbineUser) have an implementation of equals() that will compare the result of getPrimaryKey().

Parameters:
user - User to check for
Returns:
true if the user is logged in on one of the active sessions.

getActiveUsers

public static java.util.Collection getActiveUsers()
Gets a collection of all user objects representing the users currently logged in. This will exclude any instances of anonymous user that Turbine will use before the user actually logs on.

Returns:
collection of org.apache.turbine.om.security.User objects

getUserFromSession

public static User getUserFromSession(javax.servlet.http.HttpSession session)
Gets the User object of the the specified HttpSession.

Parameters:
session -
Returns:

getSession

public static javax.servlet.http.HttpSession getSession(java.lang.String sessionId)
Gets the HttpSession by the session identifier

Parameters:
sessionId -
Returns:

getSessionsForUser

public static java.util.Collection getSessionsForUser(User user)
Get a collection of all session on which the given user is logged in.

Parameters:
user - the user
Returns:
Collection of HtttSession objects


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.