org.jwall.web.audit.io
Class ModSecurityAuditReader

java.lang.Object
  extended by org.jwall.web.audit.io.ModSecurityAuditReader
All Implemented Interfaces:
AuditEventReader

public class ModSecurityAuditReader
extends java.lang.Object
implements AuditEventReader

This class implements a reader for AuditEvent-objects read from a file produced by mod_security prior version 2.0.

Author:
Christian Bockermann <chris@jwall.org>

Constructor Summary
ModSecurityAuditReader(java.io.File f)
          This creates a new instance of this class that reads events from the given file.
ModSecurityAuditReader(java.io.File f, boolean tail)
          This creates a new instance of this class that reads events from the given file.
ModSecurityAuditReader(java.io.File f, java.lang.String uriPrefix)
          This creates a new instance of this class that reads events from the given file and returns only events whose REQUEST_URI starts with the given prefix.
ModSecurityAuditReader(java.io.InputStream in, java.lang.String prefix)
          Creates an instance of this class which reads events from the given input-stream.
 
Method Summary
 long bytesAvailable()
           
 long bytesRead()
           
 void close()
           
 AuditEvent readNext()
          This method reads another event from the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModSecurityAuditReader

public ModSecurityAuditReader(java.io.InputStream in,
                              java.lang.String prefix)
Creates an instance of this class which reads events from the given input-stream.

Parameters:
in - The input-stream to read from.
prefix - Will cause this instance to return only events whose REQUEST_URI starts with prefix.

ModSecurityAuditReader

public ModSecurityAuditReader(java.io.File f,
                              java.lang.String uriPrefix)
                       throws java.io.IOException
This creates a new instance of this class that reads events from the given file and returns only events whose REQUEST_URI starts with the given prefix.

Parameters:
f - The file to read from
uriPrefix - A prefix string that filters events which do not contain this string as prefix in their REQUEST_URI.
Throws:
java.io.IOException - In case reading failed.

ModSecurityAuditReader

public ModSecurityAuditReader(java.io.File f)
                       throws java.io.IOException
This creates a new instance of this class that reads events from the given file.

Parameters:
f -
Throws:
java.io.IOException

ModSecurityAuditReader

public ModSecurityAuditReader(java.io.File f,
                              boolean tail)
                       throws java.io.IOException
This creates a new instance of this class that reads events from the given file.

Parameters:
f -
Throws:
java.io.IOException
Method Detail

readNext

public AuditEvent readNext()
                    throws java.io.IOException,
                           ParseException
This method reads another event from the stream.

Specified by:
readNext in interface AuditEventReader
Returns:
The event that was read.
Throws:
java.io.IOException
ParseException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface AuditEventReader
Throws:
java.io.IOException

bytesAvailable

public long bytesAvailable()
Specified by:
bytesAvailable in interface AuditEventReader

bytesRead

public long bytesRead()
Specified by:
bytesRead in interface AuditEventReader