uk.org.ogsadai.activity.event
Class CompositeActivityListener

java.lang.Object
  extended by uk.org.ogsadai.activity.event.CompositeActivityListener
All Implemented Interfaces:
ActivityListener

public class CompositeActivityListener
extends java.lang.Object
implements ActivityListener

A thread-safe composite activity listener that allows child listeners to be registered and de-registered. Whenever an event is received, it is forwarded to all registered child listeners. No guarantees are given about the order in which child listeners will receive forwarded events. All methods are synchronized and an event is forwarded to the registered child listeners using the same thread that invoked the event method.

Author:
The OGSA-DAI Project Team

Constructor Summary
CompositeActivityListener()
           
 
Method Summary
 void addActivityListener(ActivityListener listener)
          Register a new child activity listener.
 void completed(Activity source)
          Invoked when the processing of an activity has completed
 void error(Activity source, DAIException cause)
          Invoked when an error occurs while processing an activity
 java.util.Collection getActivityListeners()
          Gets an immutable collection of the registered activity listeners.
 void otherEvent(Activity source, EventDetails details)
          Invoked when an event that is not covered by the other event methods takes place within an activity.
 void pending(Activity source)
          Invoked when activity has been constructed and is pending for processing.
 void processing(Activity source)
          Invoked when the processing of an activity is about to commence.
 void removeActivityListener(ActivityListener listener)
          De-registers a child activity listener.
 void terminated(Activity source)
          Invoked when an activity's processing is terminated.
 void warning(Activity source, Warning warning)
          Invoked when an activity issues a warning during processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeActivityListener

public CompositeActivityListener()
Method Detail

addActivityListener

public void addActivityListener(ActivityListener listener)
Register a new child activity listener. If the listener has already been registered then no action takes place.

Parameters:
listener - activity listener to register

removeActivityListener

public void removeActivityListener(ActivityListener listener)
De-registers a child activity listener. If the specified listener is not currently registered, then no action takes place.

Parameters:
listener - activity listener to de-register

getActivityListeners

public java.util.Collection getActivityListeners()
Gets an immutable collection of the registered activity listeners.

Returns:
an immutable collection of ActivityListener objects

pending

public void pending(Activity source)
Description copied from interface: ActivityListener
Invoked when activity has been constructed and is pending for processing.

Specified by:
pending in interface ActivityListener
Parameters:
source - the activity that sourced the event

processing

public void processing(Activity source)
Description copied from interface: ActivityListener
Invoked when the processing of an activity is about to commence.

Specified by:
processing in interface ActivityListener
Parameters:
source - the activity that sourced the event

terminated

public void terminated(Activity source)
Description copied from interface: ActivityListener
Invoked when an activity's processing is terminated.

Specified by:
terminated in interface ActivityListener
Parameters:
source - the activity that sourced the event

completed

public void completed(Activity source)
Description copied from interface: ActivityListener
Invoked when the processing of an activity has completed

Specified by:
completed in interface ActivityListener
Parameters:
source - the activity that sourced the event

error

public void error(Activity source,
                  DAIException cause)
Description copied from interface: ActivityListener
Invoked when an error occurs while processing an activity

Specified by:
error in interface ActivityListener
Parameters:
source - the activity that sourced the event
cause - the cause of the error

otherEvent

public void otherEvent(Activity source,
                       EventDetails details)
Description copied from interface: ActivityListener
Invoked when an event that is not covered by the other event methods takes place within an activity. The nature of the event depends on the activity that sourced it. This allows specialised activities to source their own specific events.

Specified by:
otherEvent in interface ActivityListener
Parameters:
source - the activity that sourced the event
details - details about the event

warning

public void warning(Activity source,
                    Warning warning)
Description copied from interface: ActivityListener
Invoked when an activity issues a warning during processing.

Specified by:
warning in interface ActivityListener
Parameters:
source - the activity that sourced the event
warning - details about the warning