org.xwiki.observation
Interface ObservationManager


@Role
public 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: 40db38571369ba5f40a1fcd1ff696226540769e7 $

Method Summary
 void addEvent(String listenerName, Event event)
          Adds an Event to an already registered listener.
 void addListener(EventListener eventListener)
          Manually add a listener.
 EventListener getListener(String listenerName)
           
 void notify(Event event, Object source)
          Convenience front-end where the additional data parameter is null.
 void notify(Event event, Object source, Object data)
          Call the registered listeners matching the passed Event.
 void removeEvent(String listenerName, Event event)
          Removes an Event to an already registered listener.
 void removeListener(String listenerName)
          Remove a listener from the list of registered listeners.
 

Method Detail

addListener

void addListener(EventListener eventListener)
Manually add a listener.

Parameters:
eventListener - the listener to register

removeListener

void removeListener(String listenerName)
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 match EventListener.getName()

addEvent

void addEvent(String listenerName,
              Event event)
Adds an Event to an already registered listener.

Parameters:
listenerName - the name of the listener to which the event must be added (must match EventListener.getName()
event - the event to add to the matching listener

removeEvent

void removeEvent(String listenerName,
                 Event event)
Removes an Event to an already registered listener.

Parameters:
listenerName - the name of the listener to which the event must be removed (must match EventListener.getName()
event - the event to remove to the matching listener

getListener

EventListener getListener(String listenerName)
Parameters:
listenerName - the name of the listener
Returns:
the registered listener's instance or null if no listener is registered under that name

notify

void notify(Event event,
            Object source,
            Object data)
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 listeners
source - the source of the event (or null)
data - the additional data related to the event (or null)

notify

void notify(Event event,
            Object source)
Convenience front-end where the additional data parameter is null.

Parameters:
event - the event to pass to the registered listeners
source - the source of the event (or null)
See Also:
notify(org.xwiki.observation.event.Event, Object, Object)


Copyright © 2004–2014 XWiki. All rights reserved.