T - The type of events this event source creates.public interface EventSource<T extends Event>
extends java.lang.Runnable
Runnable.run()-method that checks and waits for the event, creates it and
calls the registered event handler. | Modifier and Type | Method and Description |
|---|---|
void |
addAll(java.util.List<EventHandler> handler)
Adds the designated event handler in the designated order to the list of
the handler that are already registered.
|
void |
addHandler(EventHandler handler,
int index)
Adds the designated handler at the designated position (0-based) to the
list of registered handler.
|
java.util.List<EventHandler> |
getEventHandler()
Gets the event handler that have been registered for this event source.
|
java.lang.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.
|
java.lang.String |
getID()
Gets the ID of this source.
|
java.lang.String |
getType()
Gets the type of this source.
|
EventHandler |
removeHandler(java.lang.String handlerID)
Removes the handler with the designated ID from the list and returns it.
|
void |
setConfiguration(Configuration conf,
java.lang.String id)
Sets the (additional) configuration of this event source and its ID.
|
java.lang.String getType()
java.lang.String getID()
set this ID is arbitrary
and may even be null.java.lang.String getHierarchicalSourceName()
void setConfiguration(Configuration conf, java.lang.String id) throws ConfigurationException
Runnable.run().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.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.java.util.List<EventHandler> getEventHandler()
void addHandler(EventHandler handler, int index)
handler - The handler which to add.index - The index (0-based) at which to add the handler in the list.void addAll(java.util.List<EventHandler> handler)
handler - The handler to register in the designated order. They are
added at the end of the list of handler that are already
registered.EventHandler removeHandler(java.lang.String handlerID)
null
will be returned.handlerID - The ID of the handler which to remove.null in case no handler with
the designated ID has been registered.