public abstract class Correlator<SourceType,RecordType,SourceAgentType extends SourceAgent<RecordType>>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected double |
_binTimespan |
protected CorrelationTester<RecordType> |
correlationTester |
protected MessageCenter |
localCenter |
Constructor and Description |
---|
Correlator(double aBinTimespan)
Creates new Correlator
|
Correlator(double aBinTimespan,
CorrelationFilter<RecordType> aFilter)
Correlator constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(CorrelationNotice<RecordType> listener)
Register the listener as a receiver of Correlation notices from this correlator.
|
protected void |
addSource(SourceType source,
java.lang.String sourceName)
Add a source to monitor.
|
protected void |
addSource(SourceType source,
java.lang.String sourceName,
RecordFilter<RecordType> recordFilter)
Add a source to monitor.
|
double |
binTimespan()
Maximum time span allowed for events to be considered correlated
|
void |
dispose()
Dispose of the correlator and its overhead
|
Correlation<RecordType> |
fetchCorrelationWithTimeout(double aTimeout)
fetchCorrelationWithTimeout() is a convenience method that allows the user a simple way to fetch a correlation without handling
events and implementing a listener. |
java.util.Collection<java.lang.String> |
getNamesOfSources()
Get all the names of all the sources managed by this correlator
|
protected java.util.Collection<SourceAgentType> |
getSourceAgents()
Get all of the channel agents managed by this correlator
|
boolean |
hasSource(java.lang.String sourceName)
See if we already manage this channel
|
boolean |
isRunning()
Determine if the correlator is running
|
void |
monitorWithTimeout(double timeout)
Monitor and post the best partial correlation if the timeout is
exceeded.
|
protected abstract SourceAgentType |
newSourceAgent(SourceType source,
java.lang.String sourceName,
RecordFilter<RecordType> recordFilter) |
int |
numSources()
Number of channels being managed
|
void |
pulseMonitorWithTimeout(double timeout)
Monitor until the timeout or until a complete correlation is found
|
protected void |
registerEvents()
Register for notices.
|
void |
removeAllSources()
Stop managing all registered sources
|
void |
removeListener(CorrelationNotice<RecordType> listener)
Unregister the listener as a receiver of Correlation notices from this correlator.
|
void |
removeSource(java.lang.String sourceName)
Stop managing the specified source.
|
void |
setBinTimespan(double timespan)
Set the maximum time span allowed for events to be considered correlated
|
void |
setCorrelationFilter(CorrelationFilter<RecordType> newFilter)
Set the correlation filter to the one specified.
|
void |
startMonitoring()
Start monitoring the managed sources.
|
void |
stopMonitoring()
Stop monitoring the managed sources.
|
protected MessageCenter localCenter
protected double _binTimespan
protected CorrelationTester<RecordType> correlationTester
public Correlator(double aBinTimespan)
public Correlator(double aBinTimespan, CorrelationFilter<RecordType> aFilter)
protected void registerEvents()
public void addListener(CorrelationNotice<RecordType> listener)
listener
- to register for receiving eventspublic void removeListener(CorrelationNotice<RecordType> listener)
listener
- to remove from receiving eventspublic double binTimespan()
public void setBinTimespan(double timespan)
timespan
- of the binspublic void setCorrelationFilter(CorrelationFilter<RecordType> newFilter)
newFilter
- The correlation filter to use.protected java.util.Collection<SourceAgentType> getSourceAgents()
public java.util.Collection<java.lang.String> getNamesOfSources()
public int numSources()
public boolean hasSource(java.lang.String sourceName)
sourceName
- name of source to testprotected void addSource(SourceType source, java.lang.String sourceName)
source
- to addsourceName
- name of source to addprotected void addSource(SourceType source, java.lang.String sourceName, RecordFilter<RecordType> recordFilter)
source
- to addsourceName
- name of source to addrecordFilter
- filter for the sourceprotected abstract SourceAgentType newSourceAgent(SourceType source, java.lang.String sourceName, RecordFilter<RecordType> recordFilter)
public void removeSource(java.lang.String sourceName)
sourceName
- name of source to removepublic void removeAllSources()
public void pulseMonitorWithTimeout(double timeout)
timeout
- time to wait in secondspublic void monitorWithTimeout(double timeout)
timeout
- time to wait in secondspublic void startMonitoring()
public void stopMonitoring()
public boolean isRunning()
public void dispose()
public Correlation<RecordType> fetchCorrelationWithTimeout(double aTimeout)
fetchCorrelationWithTimeout()
is a convenience method that allows the user a simple way to fetch a correlation without handling
events and implementing a listener. The method spawns a fetch and blocks until a correlation is retrieved or the timeout has expired.
The resulting correlation is returned. If no correlation was found within the timeout, null is returned.aTimeout
- timeout for fetching a correlation