Interface EventSource<T extends Event>

    • Method Detail

      • getType

        String getType()
        Gets the type of this source. This is usually the simple instance name of the plugin, if the event source has been loaded as plugin.
        Returns:
        The type of this source.
      • getID

        String getID()
        Gets the ID of this source. Until separately set this ID is arbitrary and may even be null.
        Returns:
        The ID of this source.
      • getHierarchicalSourceName

        String getHierarchicalSourceName()
        Gets the hierarchical name of this source, that is the event type, the source type and the source ID for usage in log messages and alike.
        Returns:
        The hierarchical name of this source, that is the event type, the source type and the source ID.
      • setConfiguration

        void setConfiguration​(org.apache.commons.configuration2.Configuration conf,
                              String id)
                       throws ConfigurationException
        Sets the (additional) configuration of this event source and its ID. The configuration is additional with respect to the configuration provided by the plugin load mechanism, if the event source is loaded as plugin.
        It is ensured that this method will be called before Runnable.run().
        Parameters:
        conf - The configuration of this event source. This adheres (and overwrites) the configuration provided by the plugin loading, if this event source has been loaded as plugin. Whether this is allowed to be null depends on the implementation of the event source.
        id - The ID of this event source. This must not be null nor the empty string.
        Throws:
        ConfigurationException - If there are problems with the designated configuration (configuration is null although this is not allowed, a required configuration value is missing, ...), a ConfigurationException will be thrown.
      • getEventHandler

        List<EventHandler> getEventHandler()
        Gets the event handler that have been registered for this event source. These handler are notified about an event in the designated order.
        Returns:
        The event handler that have been registered for this event source.
      • addHandler

        void addHandler​(EventHandler handler,
                        int index)
        Adds the designated handler at the designated position (0-based) to the list of registered handler. It is not checked, whether the handler is already registered.
        Parameters:
        handler - The handler which to add.
        index - The index (0-based) at which to add the handler in the list.
      • addAll

        void addAll​(List<EventHandler> handler)
        Adds the designated event handler in the designated order to the list of the handler that are already registered. It is not checked whether a handler is already registered (and neither whether a handler is several times in the designated list.
        Parameters:
        handler - The handler to register in the designated order. They are added at the end of the list of handler that are already registered.
      • removeHandler

        EventHandler removeHandler​(String handlerID)
        Removes the handler with the designated ID from the list and returns it. If there is no handler registered with the designated ID, null will be returned.
        Parameters:
        handlerID - The ID of the handler which to remove.
        Returns:
        The removed handler or null in case no handler with the designated ID has been registered.