Class AbstractEventHandler

java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
All Implemented Interfaces:
EventHandler
Direct Known Subclasses:
AbstractActivityEventHandler, AbstractInstanceStartEventHandler, FileMarkHandler, 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 an EventHandler.
  • Field Details

    • 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 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

      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 interface EventHandler
      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 interface EventHandler
      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 interface EventHandler
      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 interface EventHandler
      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.