uk.org.ogsadai.sessions.impl
Class TransientSessionManager

java.lang.Object
  |
  +--uk.org.ogsadai.sessions.impl.TransientSessionManager
All Implemented Interfaces:
SessionManager

public class TransientSessionManager
extends java.lang.Object
implements SessionManager

A thread-safe session manager that maintains a collection of sessions in memory. These sessions are transient so will not persist if the data service resource is terminated.

Author:
The OGSA-DAI Project Team
See Also:
SessionManager

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private static DAILogger LOG
           
private  SessionConfiguration mConfig
           
private  java.util.Map mSessions
           
 
Constructor Summary
TransientSessionManager(SessionConfiguration config)
          Constructs a new transient session manager with the specified configuration.
 
Method Summary
private  void addSession(InternalSession session)
          Adds the specified session to the the sessions being managed.
 Session createSessionView(SessionID sid)
          Creates a safe view of the specified session for use by a session participant.
 SessionConfiguration getSessionConfiguration()
          Gets the session configuration information for the session manager.
 boolean hasSession(SessionID sid)
          Does a session with a given ID exist?
 InternalSession lookupSession(SessionID sid)
          Looks up a session by its session identifier (SID).
 InternalSession newSession()
          Creates a new session with default settings.
 InternalSession newSession(SessionSettings settings)
          Creates a new session with the specified settings.
 void terminateSession(SessionID sid)
          Terminates the session with the specified session ID without concern of whether the session currently has participants or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
See Also:
Constant Field Values

LOG

private static final DAILogger LOG

mSessions

private final java.util.Map mSessions

mConfig

private final SessionConfiguration mConfig
Constructor Detail

TransientSessionManager

public TransientSessionManager(SessionConfiguration config)
Constructs a new transient session manager with the specified configuration.

Parameters:
config - The configuration details for the transient session manager.
Throws:
java.lang.IllegalArgumentException - If the config argument is null.
Method Detail

hasSession

public boolean hasSession(SessionID sid)
Description copied from interface: SessionManager
Does a session with a given ID exist?

Specified by:
hasSession in interface SessionManager
Parameters:
sid - Session id.
Returns:
true if the session exists, false otherwise.

newSession

public InternalSession newSession()
                           throws SessionCreationException
Description copied from interface: SessionManager
Creates a new session with default settings.

Specified by:
newSession in interface SessionManager
Returns:
a new session
Throws:
SessionCreationException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.

newSession

public InternalSession newSession(SessionSettings settings)
                           throws SessionCreationException
Description copied from interface: SessionManager
Creates a new session with the specified settings.

Specified by:
newSession in interface SessionManager
Parameters:
settings - The settings to be used for creating the new session.
Returns:
a new session
Throws:
SessionCreationException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.

lookupSession

public InternalSession lookupSession(SessionID sid)
                              throws SessionNotFoundException,
                                     SessionLookupException
Description copied from interface: SessionManager
Looks up a session by its session identifier (SID).

Specified by:
lookupSession in interface SessionManager
Parameters:
sid - The session identifier
Returns:
the InternalSession object corresponding to the given identifier.
Throws:
SessionNotFoundException - if the session does not exist.
SessionLookupException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.

createSessionView

public Session createSessionView(SessionID sid)
                          throws SessionNotFoundException,
                                 SessionLookupException,
                                 SessionViewCreationException
Description copied from interface: SessionManager
Creates a safe view of the specified session for use by a session participant.

The object returned must implement the Session interface but must not implement the InternalSession interface. This is to protect the internal session from abuse such as inadvertent modification.

Specified by:
createSessionView in interface SessionManager
Parameters:
sid - The session identifier
Returns:
the InternalSession object corresponding to the given identifier.
Throws:
SessionViewCreationException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.
SessionLookupException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.
SessionNotFoundException - if the session does not exist.

terminateSession

public void terminateSession(SessionID sid)
                      throws SessionNotFoundException,
                             SessionLookupException,
                             SessionTerminationException
Description copied from interface: SessionManager
Terminates the session with the specified session ID without concern of whether the session currently has participants or not.

An implementation of this method should invoke the cleanUp method of the session that is being killed. If the specified session does not exist, no action is taken.

Specified by:
terminateSession in interface SessionManager
Parameters:
sid - The session identifier
Throws:
SessionLookupException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.
SessionTerminationException - if a problem prevents the method from executing. The nature of this problem may depend on implementation. The processing of the associated request cannot continue afterwards, so higher-level components of OGSA-DAI will treat all such exceptions in the same way.
SessionNotFoundException - if the session does not exist.

addSession

private void addSession(InternalSession session)
Adds the specified session to the the sessions being managed.

Parameters:
session - Session to add.

getSessionConfiguration

public SessionConfiguration getSessionConfiguration()
Description copied from interface: SessionManager
Gets the session configuration information for the session manager.

Specified by:
getSessionConfiguration in interface SessionManager
Returns:
the session configuration information.