deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.security.session
Class MemoryBasedSessionManager

java.lang.Object
  extended by org.deegree.security.session.MemoryBasedSessionManager
All Implemented Interfaces:
SessionManager

public class MemoryBasedSessionManager
extends java.lang.Object
implements SessionManager

This exception shall be thrown when a session(ID) will be used that has been expired.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Andreas Poth , last edited by: $Author: mschneider $

Method Summary
 void addSession(Session session)
          adds a session to the session managment. the session will be stored within two lists. one addresses the session with its ID the other with its user name.
 void clearExpired()
          removes all sessions that are expired from the session management
static Session createSession()
          creates a session for an anonymous user that never expires
static Session createSession(int duration)
          creates a session for an anonymous user that expires after the passed duration after the last access to it.
static Session createSession(java.lang.String user)
          creates a session that never expires for a named user who will be authentificated through his name and password.
static Session createSession(java.lang.String user, int duration)
          creates a session for a named user who will be authentificated through his name and password.
static MemoryBasedSessionManager getInstance()
          realizes Singelton pattern
returns an instance of the SessionManager.
 Session getSessionByID(java.lang.String id)
          returns the session identified by its ID.
 Session getSessionByUser(java.lang.String user)
          returns the session assigned to the passed user.
 Session removeSessionByID(java.lang.String id)
          removes a session identified by its ID from the session managment. the removed session will be returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MemoryBasedSessionManager getInstance()
realizes Singelton pattern
returns an instance of the SessionManager. Before this method can be invoked

Returns:
single instance of SessionManager in a JVM

createSession

public static Session createSession(java.lang.String user)
creates a session that never expires for a named user who will be authentificated through his name and password. If the user doesn't exists or the passwoed is invalid for an existing user an exception will be thrown.

Parameters:
user - user name
Returns:
the session

createSession

public static Session createSession(java.lang.String user,
                                    int duration)
creates a session for a named user who will be authentificated through his name and password. The session expires after the passed duration after the last access to it. If the user doesn't exists or the passwoed is invalid for an existing user an exception will be thrown.

Parameters:
user - user name
duration -
Returns:
the session

createSession

public static Session createSession()
creates a session for an anonymous user that never expires

Returns:
the session

createSession

public static Session createSession(int duration)
creates a session for an anonymous user that expires after the passed duration after the last access to it.

Parameters:
duration -
Returns:
the session

getSessionByID

public Session getSessionByID(java.lang.String id)
                       throws SessionStatusException
returns the session identified by its ID. If no session with the passed ID is known null will be returned. If the requested session isn't alive anymore it will be removed from the session manager

Specified by:
getSessionByID in interface SessionManager
Parameters:
id -
Returns:
the session identified by its ID. If no session with the passed ID is known null will be returned.
Throws:
SessionStatusException

getSessionByUser

public Session getSessionByUser(java.lang.String user)
                         throws SessionStatusException
returns the session assigned to the passed user. If no session is assigend to the passed user null will be returned. If the requested session isn't alive anymore it will be removed from the session manager

Specified by:
getSessionByUser in interface SessionManager
Parameters:
user -
Returns:
the session assigned to the passed user. If no session is assigend to the passed user null will be returned.
Throws:
SessionStatusException

addSession

public void addSession(Session session)
                throws SessionStatusException
adds a session to the session managment. the session will be stored within two lists. one addresses the session with its ID the other with its user name. If the session is anonymous it just will be stored in the first list.

Specified by:
addSession in interface SessionManager
Parameters:
session -
Throws:
SessionStatusException

removeSessionByID

public Session removeSessionByID(java.lang.String id)
removes a session identified by its ID from the session managment. the removed session will be returned.

Specified by:
removeSessionByID in interface SessionManager
Parameters:
id -
Returns:
the session

clearExpired

public void clearExpired()
removes all sessions that are expired from the session management

Specified by:
clearExpired in interface SessionManager

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org