Class SourceAgent<T>

java.lang.Object
xal.tools.correlator.SourceAgent<T>
Direct Known Subclasses:
ChannelAgent

public abstract class SourceAgent<T> extends Object
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 Details

    • name

      protected String name
      unique name of this source agent
    • binUpdateProxy

      protected xal.tools.correlator.BinUpdate<T> binUpdateProxy
      proxy to forward bin update events to registered listeners
  • Constructor Details

  • Method Details

    • setupEventHandler

      protected 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. 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

      protected final void postEvent(T eventRecord, double timestamp)
      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 posted
      timestamp - for which the event was posted
    • name

      public String 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

      public void sourceAdded(Correlator<?,T,?> sender, String name, int newCount)
    • sourceRemoved

      public void sourceRemoved(Correlator<?,T,?> sender, String name, int newCount)
    • binTimespanChanged

      public void binTimespanChanged(Correlator<?,T,?> sender, double newTimespan)
    • willStopMonitoring

      public void willStopMonitoring(Correlator<?,T,?> sender)
    • willStartMonitoring

      public void willStartMonitoring(Correlator<?,T,?> sender)
    • correlationFilterChanged

      public void correlationFilterChanged(Correlator<?,T,?> sender, CorrelationFilter<T> newFilter)
      Implement StateNotice interface to listen for change of state