uk.org.ogsadai.sessions.impl
Class SimpleSessionCoordinator

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

public class SimpleSessionCoordinator
extends java.lang.Object
implements SessionCoordinator

A thread-safe SessionCoordinator that can be used for joining and releasing concurrent requests to and from their sessions.

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

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private static DAILogger LOG
           
private  SessionManager mSessionManager
           
 
Constructor Summary
SimpleSessionCoordinator(SessionManager manager)
          Creates a new session coordinator that uses the specified session manager for creating, accessing and destroying sessions.
 
Method Summary
 SessionManager getSessionManager()
          Returns a reference to the SessionManager that is being used for creating, retrieving and terminating sessions.
 void join(SessionParticipant participant)
          Joins the specified session participant to a session that matches its requirments.
 void release(SessionParticipant participant)
          Releases the specified session participant from the session to which it is joined.
 
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

mSessionManager

private final SessionManager mSessionManager
Constructor Detail

SimpleSessionCoordinator

public SimpleSessionCoordinator(SessionManager manager)
Creates a new session coordinator that uses the specified session manager for creating, accessing and destroying sessions.

Parameters:
manager - The SessionManager to use.
Throws:
IllegalArguementException - if manager is null.
Method Detail

join

public void join(SessionParticipant participant)
          throws SessionNotFoundException,
                 SessionJoinDeniedException,
                 SessionJoinException
Description copied from interface: SessionCoordinator
Joins the specified session participant to a session that matches its requirments.

A session participant encapsulates its requirements inside the SessionStrategy object returned by its createSessionStrategy method.

After this method returns the session participant will be able to interact with the session that it has joined.

Specified by:
join in interface SessionCoordinator
Parameters:
participant - The SessionParticipant.
Throws:
SessionJoinException - if there is an internal problem that occurs during the join.
SessionNotFoundException - if the session specified by the participant does not exist.
SessionJoinDeniedException - if there is an application-specific reason why the participant is not allowed to join.

release

public void release(SessionParticipant participant)
             throws SessionNotFoundException,
                    SessionReleaseException
Description copied from interface: SessionCoordinator
Releases the specified session participant from the session to which it is joined.

This should be invoked when the session participant has no further need to interact with the session.

Specified by:
release in interface SessionCoordinator
Parameters:
participant - the SessionParticipant to release
Throws:
SessionNotFoundException - if the session specified by the participant does not exist.
SessionReleaseException - if there is an internal problem that occurs during the release.

getSessionManager

public SessionManager getSessionManager()
Description copied from interface: SessionCoordinator
Returns a reference to the SessionManager that is being used for creating, retrieving and terminating sessions.

Specified by:
getSessionManager in interface SessionCoordinator
Returns:
SessionManager.