org.apache.turbine.services.session

## Class TurbineSession

- java.lang.Object
- - org.apache.turbine.services.session.TurbineSession

-     public abstract class TurbineSession
      extends 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 1706239 2015-10-01 13:18:35Z tv $
  Author:
    Quinton McCombs
  See Also:
    `SessionService`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TurbineSession()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addSession(HttpSession session)` Adds a session to the current list.
    `static Collection<HttpSession>` | `getActiveSessions()` Gets a list of the active sessions
    `static Collection<User>` | `getActiveUsers()` Gets a collection of all user objects representing the users currently logged in.
    `static HttpSession` | `getSession(String sessionId)` Gets the HttpSession by the session identifier
    `static Collection<HttpSession>` | `getSessionsForUser(User user)` Get a collection of all session on which the given user is logged in.
    `static User` | `getUserFromSession(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(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 Collection<HttpSession> getActiveSessions()

      Gets a list of the active sessions
      Returns:
        List of HttpSession objects

    - #### addSession

          public static void addSession(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(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 Collection<User> 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(HttpSession session)

      Gets the User object of the the specified HttpSession.
      Parameters:
        `session` -
      Returns:
        the user from the session

    - #### getSession

          public static HttpSession getSession(String sessionId)

      Gets the HttpSession by the session identifier
      Parameters:
        `sessionId` - the id of the session
      Returns:
        the session for the given id

    - #### getSessionsForUser

          public static Collection<HttpSession> 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-2015 The Apache Software Foundation. All Rights Reserved.