Class AbstractEvent

java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
All Implemented Interfaces:
Event
Direct Known Subclasses:
FileEventImpl, MailEventImpl, MemoryResultSetEventImpl, ResultSetEventImpl

public class AbstractEvent extends Object implements Event
An abstract event providing the type handling and ID handling as well as the creation date. Additionally this class creates unique IDs for each created event based on the type. That is the ID is unique with respect to the event type, source type, source ID and event manager.
Author:
Ulrich Kreher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final long
    The time (in milliseconds, see System.currentTimeMillis()) this result set has been created.
    protected final String
    The type of this event.
    protected final long
    The ID of this event.
    protected static final ObjectCounting<de.aristaflow.adept2.core.eventmanager.common.EventTypeIndex>
    A counter for the IDs for all produced events based on the type of event.
    protected final URI[]
    The URIs of the service (event manager) creating this event.
    protected final String
    The ID of the source of this event.
    protected final String
    The type of the source of this event.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractEvent(URI[] managerURI, String eventType, String sourceType, String sourceID)
    Creates a new event having the designated attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Gets the time (in milliseconds) this event has been created.
    URI[]
    Gets the URI of the event manager of the event source that produced this event.
    Gets the type of this event.
    long
    Gets the ID for this event that is set consecutively for all events of the same type produced by the same event source.
    Gets the ID of the source of this event.
    Gets the type of the source of this event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ID_COUNT

      protected static final ObjectCounting<de.aristaflow.adept2.core.eventmanager.common.EventTypeIndex> ID_COUNT
      A counter for the IDs for all produced events based on the type of event.
    • id

      protected final long id
      The ID of this event.
    • managerURI

      protected final URI[] managerURI
      The URIs of the service (event manager) creating this event.
    • eventType

      protected final String eventType
      The type of this event.
    • sourceType

      protected final String sourceType
      The type of the source of this event.
    • sourceID

      protected final String sourceID
      The ID of the source of this event.
    • creationTime

      protected final long creationTime
      The time (in milliseconds, see System.currentTimeMillis()) this result set has been created.
  • Constructor Details

    • AbstractEvent

      public AbstractEvent(URI[] managerURI, String eventType, String sourceType, String sourceID)
      Creates a new event having the designated attributes.
      Parameters:
      managerURI - The URIs of the service (event manager) creating the event.
      eventType - The type of the event.
      sourceType - The type of the source of this event.
      sourceID - The ID of the source of this event.
  • Method Details

    • getID

      public long getID()
      Description copied from interface: Event
      Gets the ID for this event that is set consecutively for all events of the same type produced by the same event source.
      Specified by:
      getID in interface Event
      Returns:
      The ID for this event.
    • getEventManager

      public URI[] getEventManager()
      Description copied from interface: Event
      Gets the URI of the event manager of the event source that produced this event.
      Specified by:
      getEventManager in interface Event
      Returns:
      The URI of the event manager of the event source that produced this event.
    • getEventType

      public String getEventType()
      Description copied from interface: Event
      Gets the type of this event.
      Specified by:
      getEventType in interface Event
      Returns:
      The type of this event.
    • getSourceType

      public String getSourceType()
      Description copied from interface: Event
      Gets the type of the source of this event.
      Specified by:
      getSourceType in interface Event
      Returns:
      The type of the source of of this event.
    • getSourceID

      public String getSourceID()
      Description copied from interface: Event
      Gets the ID of the source of this event.
      Specified by:
      getSourceID in interface Event
      Returns:
      The ID of the source of of this event.
    • getCreationTime

      public long getCreationTime()
      Description copied from interface: Event
      Gets the time (in milliseconds) this event has been created.
      Specified by:
      getCreationTime in interface Event
      Returns:
      The time (in milliseconds) this event has been created.
      See Also: