Package xal.tools.correlator
Class SourceAgent<T>
java.lang.Object
xal.tools.correlator.SourceAgent<T>
- Direct Known Subclasses:
ChannelAgent
Generator manages a single channel. It performs any setup, monitors the
channel and it manages a circular buffer of bin agents that gather correlated
events.
- Author:
- tap
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SourceAgent
(MessageCenter messageCenter, String name, RecordFilter<T> recordFilter, CorrelationTester<T> tester) Creates new ChannelAgent -
Method Summary
Modifier and TypeMethodDescriptionvoid
binTimespanChanged
(Correlator<?, T, ?> sender, double newTimespan) void
correlationFilterChanged
(Correlator<?, T, ?> sender, CorrelationFilter<T> newFilter) Implement StateNotice interface to listen for change of statename()
Name of the managed sourceprotected final void
This method is used to advertise a new event record received by the event handler of the SourceAgent subclass.void
reset()
clear memory of all eventsvoid
setBinTimespan
(double timespan) Set the timespan to each binprotected abstract void
setupEventHandler
(RecordFilter<T> recordFilter) Subclasses implement this method to handle the monitoring of its sources in a way specific to the particular SourceAgent subclass.protected void
shutdown()
shutdown this channel agent and remove itselfvoid
sourceAdded
(Correlator<?, T, ?> sender, String name, int newCount) void
sourceRemoved
(Correlator<?, T, ?> sender, String name, int newCount) abstract boolean
Start monitoring the channelabstract void
Stop monitoring the channelvoid
willStartMonitoring
(Correlator<?, T, ?> sender) void
willStopMonitoring
(Correlator<?, T, ?> sender)
-
Field Details
-
name
unique name of this source agent -
binUpdateProxy
proxy to forward bin update events to registered listeners
-
-
Constructor Details
-
SourceAgent
protected SourceAgent(MessageCenter messageCenter, String name, RecordFilter<T> recordFilter, CorrelationTester<T> tester) Creates new ChannelAgent
-
-
Method Details
-
setupEventHandler
Subclasses implement this method to handle the monitoring of its sources in a way specific to the particular SourceAgent subclass. When an event is captured and it passes the filter test, this method should call postEvent().- Parameters:
recordFilter
- filter for records to accept or reject- See Also:
-
reset
public void reset()clear memory of all events -
setBinTimespan
public void setBinTimespan(double timespan) Set the timespan to each bin- Parameters:
timespan
- for each bin
-
postEvent
This method is used to advertise a new event record received by the event handler of the SourceAgent subclass. When an event record has passed the the filter test it should be posted via this method so that other stakeholders (i.e. the bin agents) can handle the event properly.- Parameters:
eventRecord
- for which the event was postedtimestamp
- for which the event was posted
-
name
Name of the managed source- Returns:
- name of the managed source
-
startMonitor
public abstract boolean startMonitor()Start monitoring the channel- Returns:
- true upon success and false upon failure
-
stopMonitor
public abstract void stopMonitor()Stop monitoring the channel -
shutdown
protected void shutdown()shutdown this channel agent and remove itself -
sourceAdded
-
sourceRemoved
-
binTimespanChanged
-
willStopMonitoring
-
willStartMonitoring
-
correlationFilterChanged
Implement StateNotice interface to listen for change of state
-