| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| SessionRegistry |
|
| 1.0;1 |
| 1 | /* Copyright 2004, 2005, 2006 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 1784 2007-02-24 21:00:24Z luke_t $ |
|
| 23 | */ |
|
| 24 | public interface SessionRegistry { |
|
| 25 | //~ Methods ======================================================================================================== |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Obtains all the known principals in the <code>SessionRegistry</code>. |
|
| 29 | * |
|
| 30 | * @return each of the unique principals, which can then be presented to {@link #getAllSessions(Object, boolean)}. |
|
| 31 | */ |
|
| 32 | Object[] getAllPrincipals(); |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Obtains all the known sessions for the specified principal. Sessions that have been destroyed are not |
|
| 36 | * returned. Sessions that have expired may be returned, depending on the passed argument. |
|
| 37 | * |
|
| 38 | * @param principal to locate sessions for (should never be <code>null</code>) |
|
| 39 | * @param includeExpiredSessions if <code>true</code>, the returned sessions will also include those that have |
|
| 40 | * expired for the principal |
|
| 41 | * |
|
| 42 | * @return the matching sessions for this principal, or <code>null</code> if none were found |
|
| 43 | */ |
|
| 44 | SessionInformation[] getAllSessions(Object principal, boolean includeExpiredSessions); |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Obtains the session information for the specified <code>sessionId</code>. Even expired sessions are |
|
| 48 | * returned (although destroyed sessions are never returned). |
|
| 49 | * |
|
| 50 | * @param sessionId to lookup (should never be <code>null</code>) |
|
| 51 | * |
|
| 52 | * @return the session information, or <code>null</code> if not found |
|
| 53 | */ |
|
| 54 | SessionInformation getSessionInformation(String sessionId); |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Updates the given <code>sessionId</code> so its last request time is equal to the present date and time. |
|
| 58 | * Silently returns if the given <code>sessionId</code> cannot be found or the session is marked to expire. |
|
| 59 | * |
|
| 60 | * @param sessionId for which to update the date and time of the last request (should never be <code>null</code>) |
|
| 61 | */ |
|
| 62 | void refreshLastRequest(String sessionId); |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Registers a new session for the specified principal. The newly registered session will not be marked for |
|
| 66 | * expiration. |
|
| 67 | * |
|
| 68 | * @param sessionId to associate with the principal (should never be <code>null</code>) |
|
| 69 | * @param principal to associate with the session (should never be <code>null</code>) |
|
| 70 | * |
|
| 71 | * @throws SessionAlreadyUsedException DOCUMENT ME! |
|
| 72 | */ |
|
| 73 | void registerNewSession(String sessionId, Object principal) |
|
| 74 | throws SessionAlreadyUsedException; |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Deletes all the session information being maintained for the specified <code>sessionId</code>. If the |
|
| 78 | * <code>sessionId</code> is not found, the method gracefully returns. |
|
| 79 | * |
|
| 80 | * @param sessionId to delete information for (should never be <code>null</code>) |
|
| 81 | */ |
|
| 82 | void removeSessionInformation(String sessionId); |
|
| 83 | } |