uk.org.ogsadai.sessions
Class SessionEventDispatcher

java.lang.Object
  |
  +--uk.org.ogsadai.sessions.SessionEventDispatcher
All Implemented Interfaces:
SessionListener

public class SessionEventDispatcher
extends java.lang.Object
implements SessionListener

A thread-safe class for dispatching session events to a collection of session listeners. This class implements the SessionListener interface for the sake of consistency. Each time one of the methods of this interface is invoked, the corresponding event will be dispatched to each of the registered listeners.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.util.Collection mListeners
          The session listeners that are attached to this session.
 
Constructor Summary
SessionEventDispatcher()
           
 
Method Summary
 void addSessionListener(SessionListener listener)
          Registers a session listener which will be notified of subsequent session events.
 void sessionCleanedUp(SessionEvent event)
          Handles the "session cleaned-up" event by invoking the sessionCleanedUp() method on each session listener.
 void sessionJoined(SessionEvent event)
          Handles the "session joined" event by invoking the sessionJoined() method on each session listener.
 void sessionLeft(SessionEvent event)
          Handles the "session left" event by invoking the sessionLeft() method on each session listener.
 
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
Copyright statement

See Also:
Constant Field Values

mListeners

private final java.util.Collection mListeners
The session listeners that are attached to this session.

Constructor Detail

SessionEventDispatcher

public SessionEventDispatcher()
Method Detail

sessionJoined

public void sessionJoined(SessionEvent event)
Handles the "session joined" event by invoking the sessionJoined() method on each session listener.

Specified by:
sessionJoined in interface SessionListener
Parameters:
event - The session event.

sessionLeft

public void sessionLeft(SessionEvent event)
Handles the "session left" event by invoking the sessionLeft() method on each session listener.

Specified by:
sessionLeft in interface SessionListener
Parameters:
event - The session event.

sessionCleanedUp

public void sessionCleanedUp(SessionEvent event)
Handles the "session cleaned-up" event by invoking the sessionCleanedUp() method on each session listener.

Specified by:
sessionCleanedUp in interface SessionListener
Parameters:
event - The session event.

addSessionListener

public void addSessionListener(SessionListener listener)
Registers a session listener which will be notified of subsequent session events.

Parameters:
listener - The SessionListener to register.
Throws:
java.lang.IllegalArgumentException - if listener is null.