mandala.rami.impl
Class CallbackListeners

java.lang.Object
  extended bymandala.rami.impl.CallbackListeners
All Implemented Interfaces:
Callback, java.io.Serializable

public class CallbackListeners
extends java.lang.Object
implements Callback, java.io.Serializable

This implementation of the Callback interface provides event driven progamming style.

It dispatches the result of the asynchronous method invocation into two categories : normal end of the method i.e when it returns void or a value and abrupt end of the method i.e when an exception occured. In the first case, each Callback registered has result listeners is notified sequentially. In the other case, each Callback registered has exception handler is notified sequentially.

Warning, when the asynchronous method invocation terminates, nothing is done if no listeners has been registered into the categorie the result is really (either a valid result or an exception).

Version:
1.0
Author:
eipi
See Also:
Callback, Serialized Form

Constructor Summary
CallbackListeners()
           
 
Method Summary
 void addExceptionListener(Callback exceptionListener)
          Adds the specified Callback to the exception listeners list.
 void addResultListener(Callback resultListener)
          Adds the specified Callback to the result listeners list.
 void done(InvocationInfo invocationInfo, MethodResult methodResult)
          This method is called once an asynchronous method invocation had been considered terminated.
 java.util.Enumeration getExceptionListeners()
          Returns the list of exception listeners.
 java.util.Enumeration getResultListeners()
          Returns the list of result listeners.
 void removeExceptionListener(Callback exceptionListener)
          Removes the specified Callback from the exception listeners list.
 void removeResultListener(Callback resultListener)
          Removes the specified Callback from the result listeners list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallbackListeners

public CallbackListeners()
Method Detail

addResultListener

public void addResultListener(Callback resultListener)

Adds the specified Callback to the result listeners list.

The specified resultListener will be notified when an asynchronous method invocation terminates correctly.

Parameters:
resultListener - the result listener
See Also:
Callback

removeResultListener

public void removeResultListener(Callback resultListener)

Removes the specified Callback from the result listeners list.

The specified resultListener will no longer be notified when an asynchronous method invocation terminates correctly.

Parameters:
resultListener - the result listener
See Also:
Callback

addExceptionListener

public void addExceptionListener(Callback exceptionListener)

Adds the specified Callback to the exception listeners list.

The specified exceptionListener will be notified when an asynchronous method invocation terminates incorrectly i.e if it has thrown an exception.

Parameters:
exceptionListener - the exception listener
See Also:
Callback

removeExceptionListener

public void removeExceptionListener(Callback exceptionListener)

Removes the specified Callback from the exception listeners list.

The specified exceptionListener will no longer be notified so it is no longer notified when an asynchronous method invocation has terminated incorrectly i.e if it has thrown an exception.

Parameters:
exceptionListener - the exception listener
See Also:
Callback

done

public void done(InvocationInfo invocationInfo,
                 MethodResult methodResult)
Description copied from interface: Callback

This method is called once an asynchronous method invocation had been considered terminated.

Specified by:
done in interface Callback
Parameters:
invocationInfo - the invocationInfo object representing informations on the asychronous method invocation.
methodResult - the MethodResult object representing the result of the asychronous method invocation.
See Also:
InvocationInfo, MethodResult

getResultListeners

public java.util.Enumeration getResultListeners()

Returns the list of result listeners.

Returns:
an enumeration of the list of the result listeners

getExceptionListeners

public java.util.Enumeration getExceptionListeners()

Returns the list of exception listeners.

Returns:
an enumeration of the list of the exception listeners

toString

public java.lang.String toString()


Mandala help mailing list