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
ConstructorsModifierConstructorDescriptionprotectedSourceAgent(MessageCenter messageCenter, String name, RecordFilter<T> recordFilter, CorrelationTester<T> tester) Creates new ChannelAgent -
Method Summary
Modifier and TypeMethodDescriptionvoidbinTimespanChanged(Correlator<?, T, ?> sender, double newTimespan) voidcorrelationFilterChanged(Correlator<?, T, ?> sender, CorrelationFilter<T> newFilter) Implement StateNotice interface to listen for change of statename()Name of the managed sourceprotected final voidThis method is used to advertise a new event record received by the event handler of the SourceAgent subclass.voidreset()clear memory of all eventsvoidsetBinTimespan(double timespan) Set the timespan to each binprotected abstract voidsetupEventHandler(RecordFilter<T> recordFilter) Subclasses implement this method to handle the monitoring of its sources in a way specific to the particular SourceAgent subclass.protected voidshutdown()shutdown this channel agent and remove itselfvoidsourceAdded(Correlator<?, T, ?> sender, String name, int newCount) voidsourceRemoved(Correlator<?, T, ?> sender, String name, int newCount) abstract booleanStart monitoring the channelabstract voidStop monitoring the channelvoidwillStartMonitoring(Correlator<?, T, ?> sender) voidwillStopMonitoring(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
-