Interface SharingSource<T extends Event>
-
- Type Parameters:
T
- The type of events this event source creates. This is usually the same as the event of the shared source but it may also be different.
- All Superinterfaces:
EventHandler
,EventSource<T>
,Runnable
- All Known Implementing Classes:
AbstractSharingActEventSource
@ConfigurationDescription(properties=) public interface SharingSource<T extends Event> extends EventSource<T>, EventHandler
A sharing source is an event source that does not poll itself but shares another event source that unifies several sharing sources, polls for them and signals them separately. A sharing source is usually registered at aSharedPollingSource
. TheSharedPollingSource
combines polling for several sharing sources, for instance by creating an appropriate SQL statement. Combination is based on the common parts of the configuration of the sharing sources. The sharing sources are identified, usually via their process context (DataContext
). This allows for instance to determine which parts of a result set belong to which sharing source.
ASharingSource
usually never runs but waits for the event notified viaEventHandler.handleEvent(Event, boolean)
. Since it does not poll itself, the configured poll time is merely a hint for the shared source in which intervals to poll. Obviously the first polling for a sharing source may occur at an arbitrary point in time between its creation and the poll time elapsing the first time. Afterwards polling will be done regularly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.commons.configuration2.Configuration
getConfiguration()
Gets the (final) configuration of this sharing source.SerialisableDataContext
getDataContext()
Gets the data context of this sharing source.String
getSharedSourceEventType()
Gets the event type of the shared event source, that is the event type of the event source used by this sharing source.String
getSharedSourceId()
Gets the ID of the shared event source, that is the ID of the event source used by this sharing source.String
getSharedSourceType()
Gets the type of the shared event source, that is the type of the event source used by this sharing source.void
setSharedSourceId(String sourceId)
Sets the ID of the shared event source, that is the ID of the event source used by this sharing source.-
Methods inherited from interface de.aristaflow.adept2.model.events.handler.EventHandler
getID, handleEvent, isConsuming, isExclusive, isInterruptible
-
Methods inherited from interface de.aristaflow.adept2.model.events.sources.EventSource
addAll, addHandler, getEventHandler, getHierarchicalSourceName, getID, getType, removeHandler, setConfiguration
-
-
-
-
Method Detail
-
getSharedSourceEventType
String getSharedSourceEventType()
Gets the event type of the shared event source, that is the event type of the event source used by this sharing source. This may be the same event type as this sharing source.- Returns:
- The event type of the shared event source, that is the event type of the event source used by this sharing source.
-
getSharedSourceType
String getSharedSourceType()
Gets the type of the shared event source, that is the type of the event source used by this sharing source. This usually has to be different from the type of this source (EventSource.getType()
).- Returns:
- The type of the shared event source, that is the type of the event source used by this sharing source.
-
getSharedSourceId
String getSharedSourceId()
Gets the ID of the shared event source, that is the ID of the event source used by this sharing source. This will probably benull
until explicitly set by the event manager.- Returns:
- The ID of the shared event source, that is the ID of the event
source used by this sharing source or
null
in case the ID has not been set yet.
-
setSharedSourceId
void setSharedSourceId(String sourceId)
Sets the ID of the shared event source, that is the ID of the event source used by this sharing source.- Parameters:
sourceId
- The ID of the shared event source, that is the ID of the event source used by this sharing source.
-
getConfiguration
org.apache.commons.configuration2.Configuration getConfiguration()
Gets the (final) configuration of this sharing source. This is used to provide an appropriate shared source. Only sharing sources having the same configuration values (for at least parts of the configuration) may share a source. Otherwise they will get a non-shared source.- Returns:
- The (final) configuration of this sharing source which is used to determine which sharing sources may share a source.
-
getDataContext
SerialisableDataContext getDataContext()
Gets the data context of this sharing source. This provides the process context that usually identifies this sharing source uniquely in the shared source.- Returns:
- The data context of this sharing source and therefore the process context which is usually used by the shared source to identify a sharing source.
-
-