Package org.xwiki.observation
Interface ObservationManager
The main orchestrator for event notification. To receive events create a component implementing the
EventListener interface. Your component will be automatically registered when this Observation Manager
component is loaded. To send events to all registered listeners, call one of the notify(org.xwiki.observation.event.Event, java.lang.Object, java.lang.Object) methods.- Version:
- $Id: 6304cea2abd526eec2d75997c63500133848d7af $
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an Event to an already registered listener.voidaddListener(EventListener eventListener) Manually add a listener.default voidaddListener(EventListener eventListener, int priority) Manually add a listener.getListener(String listenerName) voidConvenience front-end where the additional data parameter isnull.voidCall the registered listeners matching the passed Event.voidremoveEvent(String listenerName, Event event) Removes an Event to an already registered listener.voidremoveListener(String listenerName) Remove a listener from the list of registered listeners.
-
Method Details
-
addListener
Manually add a listener.- Parameters:
eventListener- the listener to register
-
addListener
Manually add a listener.- Parameters:
eventListener- the listener to registerpriority- the priority of the listener- Since:
- 15.4RC1
-
removeListener
Remove a listener from the list of registered listeners. The removed listener will no longer receive events.- Parameters:
listenerName- the name of the listener to remove (must matchEventListener.getName()
-
addEvent
Adds an Event to an already registered listener.- Parameters:
listenerName- the name of the listener to which the event must be added (must matchEventListener.getName()event- the event to add to the matching listener
-
removeEvent
Removes an Event to an already registered listener.- Parameters:
listenerName- the name of the listener to which the event must be removed (must matchEventListener.getName()event- the event to remove to the matching listener
-
getListener
- Parameters:
listenerName- the name of the listener- Returns:
- the registered listener's instance or null if no listener is registered under that name
-
notify
Call the registered listeners matching the passed Event. The definition of source and data is purely up to the communicating classes.- Parameters:
event- the event to pass to the registered listenerssource- the source of the event (ornull)data- the additional data related to the event (ornull)
-
notify
Convenience front-end where the additional data parameter isnull.- Parameters:
event- the event to pass to the registered listenerssource- the source of the event (ornull)- See Also:
-