org.xwiki.observation
Class WrappedThreadEventListener

java.lang.Object
  extended by org.xwiki.observation.AbstractThreadEventListener
      extended by org.xwiki.observation.WrappedThreadEventListener
All Implemented Interfaces:
EventListener

public class WrappedThreadEventListener
extends AbstractThreadEventListener

Wraps a provided EventListener and filters events by only keeping those coming from the provided Thread.

Since:
3.2M3
Version:
$Id$

Constructor Summary
WrappedThreadEventListener(EventListener listener, Thread thread)
           
 
Method Summary
 List<Event> getEvents()
           
 String getName()
           
protected  void onEventInternal(Event event, Object source, Object data)
          Called when the event has been produce by the proper Thread.
 
Methods inherited from class org.xwiki.observation.AbstractThreadEventListener
onEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedThreadEventListener

public WrappedThreadEventListener(EventListener listener,
                                  Thread thread)
Parameters:
listener - the wrapped listener
thread - the thread to match to receive events
Method Detail

getEvents

public List<Event> getEvents()
Returns:
the list of events this listener is configured to receive. This listener will be automatically registered with this list of events against the ObservationManager. When an event occurs, for each matching event in this list, the EventListener.onEvent(Event, Object, Object) method will be called.

getName

public String getName()
Returns:
the listener's name. It's a free form text identifying this listener instance in a unique manner. This name is used for some operations in ObservationManager.

onEventInternal

protected void onEventInternal(Event event,
                               Object source,
                               Object data)
Description copied from class: AbstractThreadEventListener
Called when the event has been produce by the proper Thread.

Specified by:
onEventInternal in class AbstractThreadEventListener
Parameters:
event - the event triggered. Can be used to differentiate different events if your Object supports several events for example.
source - the event source i.e. the object for which the event was triggered. For example this would be the document Object if the event is a document update event.
data - some additional and optional data passed that can be acted on.


Copyright © 2004-2012 XWiki. All Rights Reserved.