Class EventListenerExample
- java.lang.Object
-
- org.dspace.servicemanager.example.EventListenerExample
-
- All Implemented Interfaces:
EventListener
public final class EventListenerExample extends Object implements EventListener
A sample EventListener which writes a string form of each received Event to the DSpace log.- Version:
- $Revision$
- Author:
- Mark Diggory (mdiggory at atmire.com)
-
-
Constructor Summary
Constructors Constructor Description EventListenerExample()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getEventNamePrefixes()
This defines the events that you want to know about by event name.String
getResourcePrefix()
This defines the events that you want to know about by event resource (reference).void
receiveEvent(Event event)
Called when an event occurs which passes through the filters created byEventListener.getEventNamePrefixes()
andEventListener.getResourcePrefix()
.
-
-
-
Method Detail
-
getEventNamePrefixes
public String[] getEventNamePrefixes()
Description copied from interface:EventListener
This defines the events that you want to know about by event name.EventListener.receiveEvent(Event)
will be called whenever an event occurs which has a name that begins with any of the strings this method returns. Simply return an empty array if you do not want to match events this way.Note: Can be used with
EventListener.getResourcePrefix()
.- Specified by:
getEventNamePrefixes
in interfaceEventListener
- Returns:
- null
-
getResourcePrefix
public String getResourcePrefix()
Description copied from interface:EventListener
This defines the events that you want to know about by event resource (reference).EventListener.receiveEvent(Event)
will be called whenever an event occurs which has a resource that begins with the string this method returns. Simply return an empty string to match no events this way.Note: Can be used with
EventListener.getEventNamePrefixes()
.- Specified by:
getResourcePrefix
in interfaceEventListener
- Returns:
- null
-
receiveEvent
public void receiveEvent(Event event)
Description copied from interface:EventListener
Called when an event occurs which passes through the filters created byEventListener.getEventNamePrefixes()
andEventListener.getResourcePrefix()
.- Specified by:
receiveEvent
in interfaceEventListener
- Parameters:
event
- includes all the information related to the event that occurred
-
-