network.detectors
Class FileConsistencyEventDetector

java.lang.Object
  |
  +--network.detectors.EventDetector
        |
        +--network.detectors.FileConsistencyEventDetector
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class FileConsistencyEventDetector
extends EventDetector
implements java.io.Serializable

This detector hashes all files in /usr/bin and recalculates the hashes periodically. If a file's hash does not match its previous hash, a FileConsistencyEvent is generated.

See Also:
Serialized Form

Field Summary
(package private)  java.lang.String checkFile
           
(package private)  java.lang.String[] defaultLocalTriggeringEvents
           
(package private)  byte[] prevHash
           
(package private)  java.lang.String previousValue
           
 
Fields inherited from class network.detectors.EventDetector
agentURN, attempts, cred, dbModule, eventIDGenerator, eventTable, host, localTriggeringEvents, printRunningThreadsFlag, remoteTriggeringEvents, reportTable
 
Constructor Summary
(package private) FileConsistencyEventDetector(ConfigObject configObj)
          The default constructor.
 
Method Summary
 java.util.Vector generateEvent(network.events.Event triggeredEvent)
          This method will generate a FileConsistencyEvent if the previous hash of a file does not match the current hash.
 java.lang.String getGeneratingEventClassName()
          Returns the fully-qualified classname of the event that this detector may generate.
protected  byte[] serialize(java.lang.Object X)
          Serializes an Object into a byte array.
 
Methods inherited from class network.detectors.EventDetector
getAlarmLevel, getAlertLevel, getLocalTriggeringEventClassNames, getRemoteTriggeringEventClassNames, getSynchronizer, InitializeFields, modifyDetector, populatePatterns, printRunningThreads, run, setAgentURN, setAlarmLevel, setAlertLevel, setDB, setEventIDGenerator, setEventTable, setLocalTriggeringEvents, setRemoteTriggeringEvents, setReportTable, stopDetector, switchOffPrintRunningThreads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultLocalTriggeringEvents

java.lang.String[] defaultLocalTriggeringEvents

previousValue

java.lang.String previousValue

prevHash

byte[] prevHash

checkFile

java.lang.String checkFile
Constructor Detail

FileConsistencyEventDetector

FileConsistencyEventDetector(ConfigObject configObj)
The default constructor. Sets up triggering dependencies.

Method Detail

getGeneratingEventClassName

public java.lang.String getGeneratingEventClassName()
Returns the fully-qualified classname of the event that this detector may generate.

Specified by:
getGeneratingEventClassName in class EventDetector
Returns:
the fully-qualified classname of the event that this detector may generate.

serialize

protected byte[] serialize(java.lang.Object X)
Serializes an Object into a byte array.

Parameters:
X - the Object to serialize.
Returns:
serialized byte array representing the original object.

generateEvent

public java.util.Vector generateEvent(network.events.Event triggeredEvent)
This method will generate a FileConsistencyEvent if the previous hash of a file does not match the current hash.

Specified by:
generateEvent in class EventDetector
Parameters:
triggeredEvent - the event that triggered the detector.
Returns:
a vector of FileConsistencyEvents.