gov.sns.tools.correlator
Class BinAgent

java.lang.Object
  |
  +--gov.sns.tools.correlator.BinAgent
All Implemented Interfaces:
gov.sns.tools.correlator.BinUpdate, gov.sns.tools.correlator.StateNotice

public class BinAgent
extends java.lang.Object
implements gov.sns.tools.correlator.BinUpdate, gov.sns.tools.correlator.StateNotice

BinAgent is the class that gathers correlated events. It is assigned a timestamp. The agent listens for events and any event that is within the timespan of timestamp, is accepted. When the number of accepted channels equals the number of all channels monitored by the correlator, the bin agent wraps all the gathered event records into a correlation object and notifies the correlator world that it has found a correlation. The bin then resets itself.


Constructor Summary
BinAgent(MessageCenter localCenter, CorrelationTester tester)
          Creates new BinAgent
 
Method Summary
 void binTimespanChanged(Correlator sender, double newTimespan)
          Implement StateNotice interface to listen for change of state
 void correlationFilterChanged(Correlator sender, CorrelationFilter newFilter)
          Implement StateNotice interface to listen for change of state
 void newEvent(java.lang.String name, java.lang.Object record, double timestamp)
          Implement BinUpdate interface
 void registerEvents()
          Register events for this bin agent
 void reset()
          Forget all events
 void resetWithRecord(java.lang.String name, java.lang.Object record, double timestamp)
          Forget all events and set the timestamp to the supplied one.
 void setTimespan(double timespan)
          Set the maximum time span allowed among the records collected.
 void sourceAdded(Correlator sender, java.lang.String name, int newCount)
          Implement StateNotice interface to listen for change of state
 void sourceRemoved(Correlator sender, java.lang.String name, int newCount)
          Implement StateNotice interface to listen for change of state
 void willStartMonitoring(Correlator sender)
          Implement StateNotice interface to listen for change of state
 void willStopMonitoring(Correlator sender)
          Implement StateNotice interface to listen for change of state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinAgent

public BinAgent(MessageCenter localCenter,
                CorrelationTester tester)
Creates new BinAgent

Method Detail

registerEvents

public void registerEvents()
Register events for this bin agent


reset

public void reset()
Forget all events


resetWithRecord

public void resetWithRecord(java.lang.String name,
                            java.lang.Object record,
                            double timestamp)
Forget all events and set the timestamp to the supplied one. This is used when a bin is recycled.


setTimespan

public void setTimespan(double timespan)
Set the maximum time span allowed among the records collected.


newEvent

public void newEvent(java.lang.String name,
                     java.lang.Object record,
                     double timestamp)
Implement BinUpdate interface

Specified by:
newEvent in interface gov.sns.tools.correlator.BinUpdate

sourceAdded

public void sourceAdded(Correlator sender,
                        java.lang.String name,
                        int newCount)
Implement StateNotice interface to listen for change of state

Specified by:
sourceAdded in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator to which the source has been added.
name - The name identifying the new source.
newCount - The new number of sources correlated.

sourceRemoved

public void sourceRemoved(Correlator sender,
                          java.lang.String name,
                          int newCount)
Implement StateNotice interface to listen for change of state

Specified by:
sourceRemoved in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator from which the source has been removed.
name - The name identifying the new source.
newCount - The new number of sources correlated.

binTimespanChanged

public void binTimespanChanged(Correlator sender,
                               double newTimespan)
Implement StateNotice interface to listen for change of state

Specified by:
binTimespanChanged in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator whose timespan bin has changed.
newTimespan - The new timespan used by the correlator.

willStopMonitoring

public void willStopMonitoring(Correlator sender)
Implement StateNotice interface to listen for change of state

Specified by:
willStopMonitoring in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator that will stop.

willStartMonitoring

public void willStartMonitoring(Correlator sender)
Implement StateNotice interface to listen for change of state

Specified by:
willStartMonitoring in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator that will start.

correlationFilterChanged

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

Specified by:
correlationFilterChanged in interface gov.sns.tools.correlator.StateNotice
Parameters:
sender - The correlator whose correlation filter has changed.
newFilter - The new correlation filter to use.