org.xwiki.observation
Interface EventListener

All Known Implementing Classes:
AbstractDocumentSkinExtensionPlugin, AbstractDocumentTranslationBundle, AbstractLogEventListener, AbstractScriptCheckerListener, AbstractThreadEventListener, ActivityStreamImpl, AnnotationEventGeneratorEventListener, ApplicationManagerListener, AttachmentEventGeneratorListener, AutomaticWatchModeListener, BrokenLinkEventListener, CheckAnnotationClassEventListener, CommentEventGeneratorListener, ComponentManagerBridgeEventListener, CSRFTokenInvalidator, CssSkinExtensionPlugin, DefaultDocumentCache.Listener, DefaultDocumentTranslationBundle, DefaultJobProgress, DefaultSecurityCacheRulesInvalidator, DefaultWikiComponentBuilderEventListener, DefaultWikiComponentManagerEventListener, DistributionInitializerListener, DocumentContentAnnotationUpdateListener, DocumentModifiedEventListener, DocumentTranslationBundleInitializer, ExtensionApplicationStartedListener, ExtensionUpdaterListener, HibernateShutdownEventListener, IndexUpdater, JarExtensionJobFinishedListener, JARTranslationBundleFactoryListener, JsSkinExtensionPlugin, LegacyEventDispatcher, LegacyNotificationDispatcher, LinkCheckerEventListener, LocalEventListener, LogbackEventGenerator, LogQueueListener, NestedScriptMacroValidatorListener, ObservationContextListener, OpenOfficeManagerLifecycleListener, PermissionCheckerListener, RegisterMacrosOnImportListener, RemoteListener, RightsManagerListener, ScriptClassLoaderHandlerListener, StopCacheManagerListener, WatchListStore, WikiEventListener, WikiMacroEventListener, WikiMacroExecutionEventListener, WikiMacroInitializerListener, WikiUIExtensionComponentBuilderEventListener, WrappedThreadEventListener, XarExtensionJobFinishedListener, XARImportEventListener, XClassPropertyEventGeneratorListener, XObjectEventGeneratorListener, XWiki, XWikiCacheStore, XWikiGroupServiceImpl, XWikiMacrosMappingRenderer, XWikiPreferencesWikiTranslationBundle, XWikiStatsServiceImpl

@Role
public interface EventListener

Components wanting to receive Observation events must implement this interface.


Method Summary
 List<Event> getEvents()
           
 String getName()
           
 void onEvent(Event event, Object source, Object data)
          The ObservationManager calls this method when an event matches one of the events for which this listener is registered (see getEvents().
 

Method Detail

getName

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.

getEvents

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 onEvent(Event, Object, Object) method will be called.

onEvent

void onEvent(Event event,
             Object source,
             Object data)
The ObservationManager calls this method when an event matches one of the events for which this listener is registered (see getEvents().

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.