View Javadoc

    1   /* Copyright 2004, 2005 Acegi Technology Pty Limited
    2    *
    3    * Licensed under the Apache License, Version 2.0 (the "License");
    4    * you may not use this file except in compliance with the License.
    5    * You may obtain a copy of the License at
    6    *
    7    *     http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    * Unless required by applicable law or agreed to in writing, software
    10   * distributed under the License is distributed on an "AS IS" BASIS,
    11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12   * See the License for the specific language governing permissions and
    13   * limitations under the License.
    14   */
    15
    16  package org.acegisecurity.concurrent;
    17
    18  /***
    19   * Maintains a registry of <code>SessionInformation</code> instances.
    20   *
    21   * @author Ben Alex
    22   * @version $Id: SessionRegistry.java,v 1.2 2005/11/17 00:55:56 benalex Exp $
    23   */
    24  public interface SessionRegistry {
    25      //~ Methods ================================================================
    26
    27      /***
    28       * Obtains all the known sessions for the specified principal. Sessions
    29       * that have expired or destroyed are not returned.
    30       *
    31       * @param principal to locate sessions for (should never be
    32       *        <code>null</code>)
    33       *
    34       * @return the unexpired and undestroyed sessions for this principal, or
    35       *         <code>null</code> if none were found
    36       */
    37      public SessionInformation[] getAllSessions(Object principal);
    38
    39      /***
    40       * Obtains the session information for the specified
    41       * <code>sessionId</code>. Even expired sessions are returned (although
    42       * destroyed sessions are never returned).
    43       *
    44       * @param sessionId to lookup (should never be <code>null</code>)
    45       *
    46       * @return the session information, or <code>null</code> if not found
    47       */
    48      public SessionInformation getSessionInformation(String sessionId);
    49
    50      /***
    51       * Updates the given <code>sessionId</code> so its last request time is
    52       * equal to the present date and time. Silently returns if the given
    53       * <code>sessionId</code> cannot be found or the session is marked to expire.
    54       *
    55       * @param sessionId for which to update the date and time of the last
    56       *        request (should never be <code>null</code>)
    57       */
    58      public void refreshLastRequest(String sessionId);
    59
    60      /***
    61       * Registers a new session for the specified principal. The newly
    62       * registered session will not be marked for expiration.
    63       *
    64       * @param sessionId to associate with the principal (should never be
    65       *        <code>null</code>)
    66       * @param principal to associate with the session (should never be
    67       *        <code>null</code>)
    68       *
    69       * @throws SessionAlreadyUsedException DOCUMENT ME!
    70       */
    71      public void registerNewSession(String sessionId, Object principal)
    72          throws SessionAlreadyUsedException;
    73
    74      /***
    75       * Deletes all the session information being maintained for the specified
    76       * <code>sessionId</code>. If the <code>sessionId</code> is not found, the
    77       * method gracefully returns.
    78       *
    79       * @param sessionId to delete information for (should never be
    80       *        <code>null</code>)
    81       */
    82      public void removeSessionInformation(String sessionId);
    83  }