Class AbstractEventHandler
java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
- All Implemented Interfaces:
EventHandler
- Direct Known Subclasses:
AbstractActivityEventHandler,AbstractInstanceStartEventHandler,FileMarkHandler,MailFlagHandler
This class provides the basic means for an event handler, that is, providing
the attributes of an
EventHandler.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether this handler may consume events.protected final booleanWhether this handler is critical and failures should abort all event handling.protected final booleanWhether this handler needs to handle events exclusively.protected final StringThe ID of this handler (usually the plugin ID).protected final booleanWhether this event handler can be interrupted while handling an event.protected final LoggerThe logger for logging problems and various information. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical) Deprecated, for removal: This API element is subject to removal in a future version.AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible) Deprecated, for removal: This API element is subject to removal in a future version.AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible, LogService logService) Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, LogService logService) Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical) Deprecated, for removal: This API element is subject to removal in a future version.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible) Deprecated, for removal: This API element is subject to removal in a future version.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible, LogService logService) Creates a new event handler having the designated ID and the designated flags.AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, LogService logService) Creates a new event handler having the designated ID and the designated flags. -
Method Summary
Modifier and TypeMethodDescriptiongetID()Gets the ID of this event handler.booleanGets whether this event handler is consuming and therefore may change or consume an event while processing it.booleanGets whether this handler is critical and failures should abort all event handling.booleanGets whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.booleanWhether 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, waitMethods inherited from interface de.aristaflow.adept2.model.events.handler.EventHandler
handleEvent
-
Field Details
-
logger
The logger for logging problems and various information. -
id
The ID of this handler (usually the plugin ID). -
exclusive
protected final boolean exclusiveWhether this handler needs to handle events exclusively. -
consuming
protected final boolean consumingWhether this handler may consume events. -
critical
protected final boolean criticalWhether this handler is critical and failures should abort all event handling. -
interruptible
protected final boolean interruptibleWhether this event handler can be interrupted while handling an event.
-
-
Constructor Details
-
AbstractEventHandler
@Deprecated(since="16.2.0", forRemoval=true) public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical) Deprecated, for removal: This API element is subject to removal in a future version.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
@Deprecated(since="16.2.0", forRemoval=true) public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible) Deprecated, for removal: This API element is subject to removal in a future version.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
@Deprecated(since="16.2.0", forRemoval=true) public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical) Deprecated, for removal: This API element is subject to removal in a future version.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
@Deprecated(since="16.2.0", forRemoval=true) public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible) Deprecated, for removal: This API element is subject to removal in a future version.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.
-
AbstractEventHandler
public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, LogService logService) 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.logService- The log service to retrieve the logger from.
-
AbstractEventHandler
public AbstractEventHandler(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible, LogService logService) 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.logService- The log service to retrieve the logger from.
-
AbstractEventHandler
public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, LogService logService) 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.logService- The log service to retrieve the logger from.
-
AbstractEventHandler
public AbstractEventHandler(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible, LogService logService) 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.logService- The log service to retrieve the logger from.
-
-
Method Details
-
getID
Description copied from interface:EventHandlerGets 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:
getIDin 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:EventHandlerGets 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:
isExclusivein 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:EventHandlerGets 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:
isConsumingin 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:EventHandlerWhether 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:
isInterruptiblein 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.
-
AbstractEventHandler(Registry, boolean, boolean, boolean)instead.