com.ibm.dse.base
Interface Notifier

All Known Subinterfaces:
Action, CheckReaderInterface, CICSConnectionService, CommonCommunicationsService, CSClientService, CSServerService, ITOCConnectionService, Lu0SnaSessionService, Lu62ConversationService, MQConnectionService, OTMAConnectionService, PrintService
All Known Implementing Classes:
DSENotifier

public interface Notifier

This interface provides its implementors with the capability to send and process event notifications. A class that sends event notifications must implement the Notifier interface or be a subclass of DSENotifier. The Notifier constructor registers a new Notifier instance to the EventManager. The EventManager can then manage the registering of Handlers for local or remote events in a transparent way for the application.

Each class that includes the Handler interface must implement all of these methods.


Method Summary
 void addHandler(Handler aHandler, java.lang.String anEventName)
          This method should add aHandler to the chain of Handlers for the notifier instance.
 Hashtable getHandlersList()
          Returns the handlersList attribute value.
 java.lang.String getName()
          Returns the name attribute value.
 void removeHandler(Handler aHandler, java.lang.String anEventName)
          This method must remove aHandler from the chain of that specific Class instance if the event it is interested in matches anEventName.
 void setName(java.lang.String aName)
          Sets the name attribute to aName.
 void signalEvent(java.lang.String anEventName)
          Calls the dispatch method of the first Handler registered for the event anEventName and proceeds according to the defined event propagation criteria following the chain of Handlers.
 void signalEvent(java.lang.String anEventName, Hashtable aParametersTable)
          Calls the dispatch method of the first Handler registered for the event anEventName and proceeds according to the defined event propagation criteria following the chain of Handlers.
 void terminate()
          This is a housekeeping process for Notifier instances.
 

Method Detail

addHandler

public void addHandler(Handler aHandler,
                       java.lang.String anEventName)
                throws DSEInvalidArgumentException
This method should add aHandler to the chain of Handlers for the notifier instance. If the Handler is interested in any event signaled by this Notifier, the event name should be set to "allEvents". The Handler is added to the first position of the chain so that it will be the first Handler to receive the event when signaled.

This method should generate the event handlerAddedEvent and throws a DSEInvalidArgumentException when aHandler or anEventName are null.


getHandlersList

public Hashtable getHandlersList()
Returns the handlersList attribute value.

getName

public java.lang.String getName()
Returns the name attribute value.

removeHandler

public void removeHandler(Handler aHandler,
                          java.lang.String anEventName)
                   throws DSEInvalidArgumentException,
                          DSEHandlerNotFoundException
This method must remove aHandler from the chain of that specific Class instance if the event it is interested in matches anEventName.

If anEventName is "allEvents" all entries in the list for that specific handler will be removed. This operation must generate the event handlerRemovedEvent and a DSEHandlerNotFoundException when aHandler cannot be found in the chain of handlers for this specific Class and event name. This method must generate :

  1. - a DSEInvalidArgumentException if aHandler or anEventName are null.
  2. - a DSEHandlerNotFoundException if aHandler or anEventName are not found in the handlersList.

setName

public void setName(java.lang.String aName)
Sets the name attribute to aName.

signalEvent

public void signalEvent(java.lang.String anEventName)
                 throws DSEInvalidArgumentException
Calls the dispatch method of the first Handler registered for the event anEventName and proceeds according to the defined event propagation criteria following the chain of Handlers. This method will create a DSEEventObject with name anEventName and source the Notifier that signaled the event.

Any notifier interface implementors must define themselves, if required, as a source of an standard Java event (which awakes all the listeners waiting for it). The signalEvent method should then also to add the statement that fires the event in the standard Java way. Additional methods to add and remove listeners must also be implemented as defined in Java developement guide.

This method throws a DSEInvalidArgumentException.


signalEvent

public void signalEvent(java.lang.String anEventName,
                        Hashtable aParametersTable)
                 throws DSEInvalidArgumentException
Calls the dispatch method of the first Handler registered for the event anEventName and proceeds according to the defined event propagation criteria following the chain of Handlers. This method will create a DSEEventObject with name anEventName and attributes those defined in the Hashtable aParametersTable.

Any notifier interface implementors must define themselves, if required, as a source of an standard Java event (which awakes all the listeners waiting for it). The signalEvent method should then also add the statement that fires the event in the standard Java way. Additional methods to add and remove listeners must also be implemented as defined in Java developement guide.

This method throws a DSEInvalidArgumentException.


terminate

public void terminate()
               throws DSEException
This is a housekeeping process for Notifier instances. This is called either from the application or from the context when it is destroyed or unchained. Subclasses should overwrite this implementation to perform whatever actions needed for releasing all the resources acquired by the notifier.