uk.org.ogsadai.service.resource
Class ResourceEventDispatcher

java.lang.Object
  |
  +--uk.org.ogsadai.service.resource.ResourceEventDispatcher
All Implemented Interfaces:
ResourceListener

public class ResourceEventDispatcher
extends java.lang.Object
implements ResourceListener

A thread-safe class for dispatching events from data service resources to data resource accessors. If a data resource accessor implements the ResourceListener interface then it can be notified of data service resource events e.g. session creation and termination. This class implements the ResourceListener interface for the sake of consistency. Each time one of the methods of this interface is invoked, the corresponding event will be dispatched to all listeners.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.util.Collection mListeners
          The listeners that are attached to this dispatcher.
 
Constructor Summary
ResourceEventDispatcher()
           
 
Method Summary
 void addListener(ResourceListener listener)
          Registers listener which will be notified of subsequent resource events.
 void sessionCreated(ResourceEvent event)
          Handles the "session created" event by invoking the sessionCreated method of all the listeners.
 void sessionTerminated(ResourceEvent event)
          Handles the "session terminated" event by invoking the sessionTerminated method of all the listeners.
 
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 listeners that are attached to this dispatcher.

Constructor Detail

ResourceEventDispatcher

public ResourceEventDispatcher()
Method Detail

sessionCreated

public void sessionCreated(ResourceEvent event)
Handles the "session created" event by invoking the sessionCreated method of all the listeners.

Specified by:
sessionCreated in interface ResourceListener
Parameters:
event - the session event

sessionTerminated

public void sessionTerminated(ResourceEvent event)
Handles the "session terminated" event by invoking the sessionTerminated method of all the listeners.

Specified by:
sessionTerminated in interface ResourceListener
Parameters:
event - the session event

addListener

public void addListener(ResourceListener listener)
Registers listener which will be notified of subsequent resource events.

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