|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.api.EventNotifier
public class EventNotifier
This class implements event broadcasting for the use of the Server API. Events are dispatched to registered event listeners. When a listener is being registered, event filters are specified, so that the listener receives only events of interest. Events are filtered based on their type and their id.
An atomic filter is a string, that does not contain whitespaces, newlines, commas and semi-colons. If an atomic filter ends with '*', it matches all texts, whose prefix is the same as the filter up to the '*' symbol. For example a "di.al.*" filter matches both "di.al.start" and "di.al.stop". A composite filter is a string that contains atomic filters, separated by whitespaces. (Note that an atomic filter is a valid composite filter.) A composite filter matches a piece of text, if any of its atomic filters matches the text. An empty string is considered to be a match-none filter. null is considered a match-all filter.
Two modes of operation are supported - synchronous and asynchronous. In synchronous mode, the 'broadcastEvent' method completes only after all matching listeners have handled the event. In asynchronous mode, there is no such guarantee.
Field Summary | |
---|---|
static String |
MATCH_ALL_FILTER
A filter that matches all events. |
static String |
MATCH_NONE_FILTER
A filter that matches no events. |
Constructor Summary | |
---|---|
EventNotifier(boolean sync,
String suppressedEventTypesStr)
Create a new notifier object with an empty set of event listeners. |
Method Summary | |
---|---|
void |
addEventListener(DIEventListener listener,
String typeFiltersStr,
String idFilter)
Register a new event listener accompanied with event filters. |
void |
broadcastEvent(DIEvent event)
Broadcast an event to all registered listeners, whose filters match the event. |
boolean |
removeEventListener(DIEventListener listener)
Unregisters an event listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MATCH_ALL_FILTER
public static final String MATCH_NONE_FILTER
Constructor Detail |
---|
public EventNotifier(boolean sync, String suppressedEventTypesStr)
sync
- whether the notifier will operate in synchronous modesuppressedEventTypesStr
- a list of filters for event types that will be suppressed by
the notifier; suppressed events will not be propagated by the
notifier events will not be propagated to listenersMethod Detail |
---|
public void addEventListener(DIEventListener listener, String typeFiltersStr, String idFilter) throws DIException
listener
- an event listenertypeFiltersStr
- a composite filter that matches event typeidFilter
- an atomic filter that matches event id
DIException
- if the listener is nullpublic boolean removeEventListener(DIEventListener listener)
listener
- an event listener
public void broadcastEvent(DIEvent event)
event
- an event
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |