uk.org.ogsadai.sessions
Interface SessionManager

All Known Implementing Classes:
TransientSessionManager

public interface SessionManager

The interface for the creation, retrieval and termination of sessions.

This interface is used by the engine and SessionStrategy implementations for managing sessions.

Note that no references to actual Session objects are passed as arguments to these methods. This is to avoid complicating the implementation of Session and SessionManagemer objects. Such complexities would otherwise arise in dealing with requests to perform operations on sessions that have already expired. Instead the session in question is always identified either by its SessionID (SID) or a SessionSettings object.

Author:
The OGSA-DAI Project Team

Method Summary
 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.
 

Method Detail

hasSession

public boolean hasSession(SessionID sid)
                   throws SessionLookupException
Does a session with a given ID exist?

Parameters:
sid - Session id.
Returns:
true if the session exists, false otherwise.
Throws:
java.lang.IllegalArgumentException - if sid is null.
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.

newSession

public InternalSession newSession()
                           throws SessionCreationException
Creates a new session with default settings.

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
Creates a new session with the specified settings.

Parameters:
settings - The settings to be used for creating the new session.
Returns:
a new session
Throws:
java.lang.IllegalArgumentException - if settings is null.
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
Looks up a session by its session identifier (SID).

Parameters:
sid - The session identifier
Returns:
the InternalSession object corresponding to the given identifier.
Throws:
java.lang.IllegalArgumentException - if sid is null.
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
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.

Parameters:
sid - The session identifier
Returns:
the InternalSession object corresponding to the given identifier.
Throws:
java.lang.IllegalArgumentException - if sid is null.
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.
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.

terminateSession

public void terminateSession(SessionID sid)
                      throws SessionNotFoundException,
                             SessionLookupException,
                             SessionTerminationException
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.

Parameters:
sid - The session identifier
Throws:
java.lang.IllegalArgumentException - if sid is null.
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.
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.

getSessionConfiguration

public SessionConfiguration getSessionConfiguration()
Gets the session configuration information for the session manager.

Returns:
the session configuration information.