public abstract class SourceAgent<RecordType>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected xal.tools.correlator.BinUpdate<RecordType> |
_binUpdateProxy
proxy to forward bin update events to registered listeners
|
protected java.lang.String |
_name
unique name of this source agent
|
Constructor and Description |
---|
SourceAgent(MessageCenter messageCenter,
java.lang.String name,
RecordFilter<RecordType> recordFilter,
CorrelationTester<RecordType> tester)
Creates new ChannelAgent
|
Modifier and Type | Method and Description |
---|---|
void |
binTimespanChanged(Correlator<?,RecordType,?> sender,
double newTimespan)
Handle the bin timespan changed event.
|
void |
correlationFilterChanged(Correlator<?,RecordType,?> sender,
CorrelationFilter<RecordType> newFilter)
Implement StateNotice interface to listen for change of state
|
java.lang.String |
name()
Name of the managed source
|
protected void |
postEvent(RecordType record,
double timestamp)
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 events
|
void |
setBinTimespan(double timespan)
Set the timespan to each bin
|
protected abstract void |
setupEventHandler(RecordFilter<RecordType> 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 itself
|
void |
sourceAdded(Correlator<?,RecordType,?> sender,
java.lang.String name,
int newCount)
Handle the source added event.
|
void |
sourceRemoved(Correlator<?,RecordType,?> sender,
java.lang.String name,
int newCount)
Handle the source removed event.
|
abstract boolean |
startMonitor()
Start monitoring the channel
|
abstract void |
stopMonitor()
Stop monitoring the channel
|
void |
willStartMonitoring(Correlator<?,RecordType,?> sender)
Handle the advance notice of the correlator starting.
|
void |
willStopMonitoring(Correlator<?,RecordType,?> sender)
Handle the advance notice of the correlator stopping.
|
protected java.lang.String _name
protected xal.tools.correlator.BinUpdate<RecordType> _binUpdateProxy
public SourceAgent(MessageCenter messageCenter, java.lang.String name, RecordFilter<RecordType> recordFilter, CorrelationTester<RecordType> tester)
protected abstract void setupEventHandler(RecordFilter<RecordType> recordFilter)
recordFilter
- filter for records to accept or rejectpostEvent(RecordType, double)
public void reset()
public void setBinTimespan(double timespan)
timespan
- for each binprotected final void postEvent(RecordType record, double timestamp)
record
- for which the event was postedtimestamp
- for which the event was postedpublic java.lang.String name()
public abstract boolean startMonitor()
public abstract void stopMonitor()
protected void shutdown()
public void sourceAdded(Correlator<?,RecordType,?> sender, java.lang.String name, int newCount)
sender
- The correlator to which the source has been added.name
- The name identifying the new source.newCount
- The new number of sources correlated.public void sourceRemoved(Correlator<?,RecordType,?> sender, java.lang.String name, int newCount)
sender
- The correlator from which the source has been removed.name
- The name identifying the new source.newCount
- The new number of sources correlated.public void binTimespanChanged(Correlator<?,RecordType,?> sender, double newTimespan)
sender
- The correlator whose timespan bin has changed.newTimespan
- The new timespan used by the correlator.public void willStopMonitoring(Correlator<?,RecordType,?> sender)
sender
- The correlator that will stop.public void willStartMonitoring(Correlator<?,RecordType,?> sender)
sender
- The correlator that will start.public void correlationFilterChanged(Correlator<?,RecordType,?> sender, CorrelationFilter<RecordType> newFilter)
sender
- The correlator whose correlation filter has changed.newFilter
- The new correlation filter to use.