Class AbstractEventHandler
- java.lang.Object
-
- de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
-
- All Implemented Interfaces:
EventHandler
- Direct Known Subclasses:
AbstractActivityEventHandler
,FileMarkHandler
,InstanceStartEventHandler
,InstanceStartEventHandler
,MailFlagHandler
public abstract class AbstractEventHandler extends Object implements EventHandler
This class provides the basic means for an event handler, that is, providing the attributes of anEventHandler
.- Author:
- Ulrich Kreher
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
consuming
Whether this handler may consume events.protected boolean
critical
Whether this handler is critical and failures should abort all event handling.protected boolean
exclusive
Whether this handler needs to handle events exclusively.protected String
id
The ID of this handler (usually the plugin ID).protected boolean
interruptible
Whether this event handler can be interrupted while handling an event.protected Logger
logger
The logger for logging problems and various information.
-
Constructor Summary
Constructors Constructor Description AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical)
Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical)
Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
Creates a new event handler having the designated ID and the designated flags.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getID()
Gets the ID of this event handler.boolean
isConsuming()
Gets whether this event handler is consuming and therefore may change or consume an event while processing it.boolean
isCritical()
Gets whether this handler is critical and failures should abort all event handling.boolean
isExclusive()
Gets whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.boolean
isInterruptible()
Whether this event handler can be interrupted while handling an event.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.events.handler.EventHandler
handleEvent
-
-
-
-
Field Detail
-
logger
protected final Logger logger
The logger for logging problems and various information.
-
id
protected final String id
The ID of this handler (usually the plugin ID).
-
exclusive
protected final boolean exclusive
Whether this handler needs to handle events exclusively.
-
consuming
protected final boolean consuming
Whether this handler may consume events.
-
critical
protected final boolean critical
Whether this handler is critical and failures should abort all event handling.
-
interruptible
protected final boolean interruptible
Whether this event handler can be interrupted while handling an event.
-
-
Constructor Detail
-
AbstractEventHandler
public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical)
Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.- Parameters:
id
- The ID of this handler (usually the plugin ID).exclusive
- Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.consuming
- Whether this handler may consume events. If the handler is consuming, it is also exclusive.critical
- Whether this handler is critical. If the handler is critical, it will also be exclusive.
-
AbstractEventHandler
public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.- Parameters:
id
- The ID of this handler (usually the plugin ID).exclusive
- Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.consuming
- Whether this handler may consume events. If the handler is consuming, it is also exclusive.critical
- Whether this handler is critical. If the handler is critical, it will also be exclusive.interruptible
- Whether this event handler can be interrupted while handling an event.
-
AbstractEventHandler
public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical)
Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.- Parameters:
registry
- The registry to get the ID of this handler (the simple name of the plugin instance).exclusive
- Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.consuming
- Whether this handler may consume events. If the handler is consuming, it is also exclusive.critical
- Whether this handler is critical. If the handler is critical, it will also be exclusive.
-
AbstractEventHandler
public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.- Parameters:
registry
- The registry to get the ID of this handler (the simple name of the plugin instance).exclusive
- Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.consuming
- Whether this handler may consume events. If the handler is consuming, it is also exclusive.critical
- Whether this handler is critical. If the handler is critical, it will also be exclusive.interruptible
- Whether this event handler can be interrupted while handling an event.
-
-
Method Detail
-
getID
public String getID()
Description copied from interface:EventHandler
Gets the ID of this event handler. This uniquely identifies the handler with respect to the corresponding event manager. If the event handler is loaded as plugin of the event manager, the ID should correspond to the simple plugin instance name.- Specified by:
getID
in interfaceEventHandler
- Returns:
- The ID of this event handler which uniquely identifies the handler with respect to the corresponding event manager.
-
isExclusive
public boolean isExclusive()
Description copied from interface:EventHandler
Gets whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.
In case of a consuming handler, exclusive handling is always implicitly presumed.- Specified by:
isExclusive
in interfaceEventHandler
- Returns:
- Whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.
-
isConsuming
public boolean isConsuming()
Description copied from interface:EventHandler
Gets whether this event handler is consuming and therefore may change or consume an event while processing it. This does not indicate that all events will be consumed when handled.
A consuming handler is always exclusive.- Specified by:
isConsuming
in interfaceEventHandler
- Returns:
- Whether this event handler is consuming and thus may change or consume an event while processing it.
-
isInterruptible
public boolean isInterruptible()
Description copied from interface:EventHandler
Whether this event handler can be interrupted while handling an event. If so, it must expect an interrupt any time. If not, it has to be aware that the event may have been cancelled while handling.
This must not change at any time.- Specified by:
isInterruptible
in interfaceEventHandler
- Returns:
- Whether this event handler can be interrupted while handling an event.
-
isCritical
public boolean isCritical()
Gets whether this handler is critical and failures should abort all event handling.- Returns:
- Whether this handler is critical and failures should abort all event handling.
-
-