org.jwall.web.audit.io
Class ConcurrentAuditReader
java.lang.Object
org.jwall.web.audit.io.AbstractAuditEventReader
org.jwall.web.audit.io.ConcurrentAuditReader
- All Implemented Interfaces:
- Iterable<AuditEvent>, AuditEventReader
public class ConcurrentAuditReader
- extends AbstractAuditEventReader
This class read the index-file of a concurrent auditlog and
creates audit-events from the appopriate event-files, if
available.
- Author:
- Christian Bockermann <chris@jwall.org>
ConcurrentAuditReader
public ConcurrentAuditReader(File dataDir,
File indexFile,
boolean tail)
throws IOException
- This constructor creates a new concurrent audit-reader that reads from the
given index file and expects the audit data-files to exist relative to the
given data-directory.
- Parameters:
dataDir - The base directory of the data-files.indexFile - The file containing the summary-lines for all events.
- Throws:
IOException - In case any of the files cannot be read or does not exist.
ConcurrentAuditReader
public ConcurrentAuditReader(InputStream index,
File dataDir)
throws IOException
- Throws:
IOException
ConcurrentAuditReader
public ConcurrentAuditReader(File data,
File index)
throws IOException
- Throws:
IOException
ConcurrentAuditReader
public ConcurrentAuditReader(File dataDir,
boolean tail)
throws IOException
- This constructor creates a new concurrent audit-reader that
listens on the index file in the given data-directory. The
index-file is assumed to be called
index and
has to exists in the given data-directory.
- Parameters:
dataDir - The directory where all audit-data is stored.
- Throws:
Exception - In case the index file does not exists or
cannot be read.
IOException
ConcurrentAuditReader
public ConcurrentAuditReader(File dataDir)
throws IOException
- Throws:
IOException
readNext
public AuditEvent readNext()
throws IOException,
ParseException
- This method read the next event from the file-system. If there
is none available it waits and listens for another one to be
appended to the index-file.
- Specified by:
readNext in interface AuditEventReader- Specified by:
readNext in class AbstractAuditEventReader
- Returns:
- The next audit-event from or
NULL if no event is available.
- Throws:
IOException
ParseException- See Also:
AuditEventReader.readNext()
readEvent
public AuditEvent readEvent(String s)
throws IOException,
ParseException
- This method creates an audit-event instance from a file. The filename is
extracted from the given index-entry line
s and the basic
data directory that was specified at creation of this audit-reader.
- Parameters:
s - The index entry line.
- Returns:
- An audit-event.
- Throws:
IOException - In case the file cannot be read (due to non-existence
or missing rights) an exception is thrown.
ParseException
finish
public void finish()
close
public void close()
throws IOException
- Specified by:
close in interface AuditEventReader- Overrides:
close in class AbstractAuditEventReader
- Throws:
IOException- See Also:
AuditEventReader.close()
bytesRead
public long bytesRead()
- Specified by:
bytesRead in interface AuditEventReader- Overrides:
bytesRead in class AbstractAuditEventReader
- See Also:
AuditEventReader.bytesRead()
bytesAvailable
public long bytesAvailable()
- Specified by:
bytesAvailable in interface AuditEventReader- Overrides:
bytesAvailable in class AbstractAuditEventReader
- See Also:
AuditEventReader.bytesAvailable()
iterator
public Iterator<AuditEvent> iterator()
Copyright © 2012 jwall.org. All Rights Reserved.