com.ibm.dse.base
Class DSENotifier
java.lang.Object
com.ibm.dse.base.DSENotifier
- All Implemented Interfaces:
- Notifier
- Direct Known Subclasses:
- DSEAction, DSENavigationController, DSEProcessor, MirrorNotifier, Service, TraceThreadInterruptedNotifier
- public class DSENotifier
- extends java.lang.Object
- implements Notifier
The DSENotifier class provides the capability to its objects to send and process event notifications.
If a class has to send event notifications, it can be defined as a subclass of Notifier or it can
implement the Notifier interface. The Notifier constructor registers the new Notifier instance to the
EventsManager so it can manage the handlers, which are registering for local or remote events, in a
transparent way for the application.
Constructor Summary |
DSENotifier()
This constructor creates a DSENotifier object.
|
DSENotifier(boolean mustRegister)
This constructor creates a DSENotifier with mustRegister. |
DSENotifier(java.lang.String aName)
This constructor creates a DSENotifier with a name.
|
DSENotifier(java.lang.String aName,
java.lang.String aTID)
This constructor creates a DSENotifier with a name.
|
Method Summary |
void |
addHandler(Handler aHandler,
java.lang.String anEventName)
Adds an aHandler to the chain of handlers for the specific instance of DSENotifier.
|
Hashtable |
getHandlersList()
Gets the handlersList attribute value. |
java.lang.String |
getName()
Gets the name attribute value. |
void |
removeHandler(Handler aHandler,
java.lang.String anEventName)
Removes aHandler from the chain of handlers for that specific DSENotifier instance if the
event it is interested in matches anEventName.
|
void |
setName(java.lang.String aName)
Sets the notifier name to aName |
void |
signalEvent(DSEEventObject anEvent)
The operation must call the dispatch method of the first handler registered for this event,
proceed according to the defined event propagation criteria, and follow the chain of handlers.
|
void |
signalEvent(java.lang.String anEventName)
Generates, by default, the event named anEventName as a specific event.
|
void |
signalEvent(java.lang.String anEventName,
Hashtable params)
Generates, by default, the event named anEventName as a specific event.
|
void |
terminate()
Provides a housekeeping process for the notifier instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
name
protected java.lang.String name
handlersList
protected Hashtable handlersList
DSENotifier
public DSENotifier()
- This constructor creates a DSENotifier object.
The constructor registers the new DSENotifier with the EventManager so it can manage
the handlers, which are registering for local or remote events, in a transparent way for
the application.
DSENotifier
public DSENotifier(java.lang.String aName)
- This constructor creates a DSENotifier with a name.
This constructor creates a DSENotifier with name aName and register this new instance
with the EventManager so it can manage the handlers, which are registering for local or remote
events, in a transparent way for the application.
DSENotifier
public DSENotifier(java.lang.String aName,
java.lang.String aTID)
- This constructor creates a DSENotifier with a name.
This constructor creates a DSENotifier with name aName for a specific operation
started in a workstation, which is identified by aTID. It registers this new instance to
the EventManager so it can manage the handlers, which are registering for local or remote
events, in a transparent way for the application.
DSENotifier
public DSENotifier(boolean mustRegister)
- This constructor creates a DSENotifier with mustRegister.
- Parameters:
mustRegister
- boolean
addHandler
public void addHandler(Handler aHandler,
java.lang.String anEventName)
throws DSEInvalidArgumentException
- Adds an aHandler to the chain of handlers for the specific instance of DSENotifier.
The handler is located in the first position of the chain so it is the first handler
to receive the event when signaled.
The handler, which is added to the chain of handlers using this operation, is registered
for the event anEventName to be signaled by the DSENotifier. If it is interested in any event signaled
by this notifier, then the event name must be set to allEvents.
This method generates a DSEInvalidArgumentException when aHandler or anEventName are null.
- Specified by:
addHandler
in interface Notifier
- Throws:
DSEInvalidArgumentException
getHandlersList
public Hashtable getHandlersList()
- Gets the handlersList attribute value.
- Specified by:
getHandlersList
in interface Notifier
getName
public java.lang.String getName()
- Gets the name attribute value.
- Specified by:
getName
in interface Notifier
removeHandler
public void removeHandler(Handler aHandler,
java.lang.String anEventName)
throws DSEInvalidArgumentException,
DSEHandlerNotFoundException
- Removes aHandler from the chain of handlers for that specific DSENotifier instance if the
event it is interested in matches anEventName.
If anEventName is allEvents all entries in the list for that specific handler are removed.
This method can generate a:
- DSEInvalidArgumentException if aHandler or anEventName are null.
- DSEHandlerNotFoundException if aHandler or anEventName are not found in the handlersList.
- Specified by:
removeHandler
in interface Notifier
- Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException
setName
public void setName(java.lang.String aName)
- Sets the notifier name to aName
- Specified by:
setName
in interface Notifier
signalEvent
public void signalEvent(DSEEventObject anEvent)
- The operation must call the dispatch method of the first handler registered for this event,
proceed according to the defined event propagation criteria, and follow the chain of handlers.
anEventName event contains, as attributes, as much information as is required to process it.
The information is held in the params hashtable. Required notifier interface implementors must
define themselves as a source of a standard Java event (that awakes all the listeners waiting for it).
The signalEvent method can then be overwritten 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 the Java development guide.
- Parameters:
anEvent
- DSEEventObject
signalEvent
public void signalEvent(java.lang.String anEventName)
throws DSEInvalidArgumentException
- Generates, by default, the event named anEventName as a specific event.
This means that the operation must call the dispatch method of the first handler
registered for this event, proceed according to the defined event propagation criteria,
and follow the chain of handlers. anEvent contains, as attributes, the name and the
source of this event. Required notifier interface implementors must define themselves
as a source of a standard Java event (that awakes all the listeners waiting for it).
The signalEvent method can then be overwritten to add the statement that fires the event
in the standard Java way. Additional methods to add and remove listeners must be implemented
as defined in the Java development guide.
This method throws a DSEInvalidArgumentException generated by the DSEEventObject constructor.
- Specified by:
signalEvent
in interface Notifier
- Parameters:
anEventName
- java.lang.String
- Throws:
DSEInvalidArgumentException
signalEvent
public void signalEvent(java.lang.String anEventName,
Hashtable params)
throws DSEInvalidArgumentException
- Generates, by default, the event named anEventName as a specific event.
The operation must call the dispatch method of the first handler registered for
this event, proceed according to the defined event propagation criteria, and follow
the chain of handlers. anEventName event contains, as attributes, as much
information as is required to process it. The information is held in the params
hashtable. Required notifier interface implementors must define themselves as a source
of a standard Java event (that awakes all the listeners waiting for it). The signalEvent
method can then be overwritten to add the statement that fires the event in the standard
Java way. Additional methods to add and remove listeners must be implemented as defined
in the Java development guide.
This method throws a DSEInvalidArgumentException generated by the DSEEventObject constructor.
- Specified by:
signalEvent
in interface Notifier
- Throws:
DSEInvalidArgumentException
terminate
public void terminate()
throws DSEException
- Provides a housekeeping process for the notifier instance. This is called either from
the application or from the context when it is destroyed or unchained. Subclasses should
overwrite this implementation to perform the actions required to release the resources
acquired by the notifier.
- Specified by:
terminate
in interface Notifier
- Throws:
DSEException
(c) Copyright IBM Corporation 1998, 2005