public class ConcurrentAuditWriter extends Object implements AuditEventWriter
| Modifier and Type | Field and Description |
|---|---|
static SimpleDateFormat |
DATE_FORMAT |
static SimpleDateFormat |
DIR_FORMAT |
| Constructor and Description |
|---|
ConcurrentAuditWriter(File baseDir)
Create a new audit-writer that writes events into sub-directories below the given
directory
base according to their date. |
ConcurrentAuditWriter(File baseDir,
File indexFile)
This constructor creates a new instance of the class that writes all events to
files within the given directory
baseDir. |
| Modifier and Type | Method and Description |
|---|---|
static String |
createSummary(AuditEvent evt)
This method creates a summary-string from the given audit-event.
|
File |
getDirectoryFor(Date date)
This method creates the file-name for the given date and also creates the
file itself and the corresponding subdirectories.
|
File |
getFileFor(AuditEvent evt) |
File |
write(AuditEvent evt)
This method writes the given audit-event
evt to a file, whose name is
deducted from the creation time of the event. |
void |
writeEvent(AuditEvent evt) |
public static final SimpleDateFormat DIR_FORMAT
public static final SimpleDateFormat DATE_FORMAT
public ConcurrentAuditWriter(File baseDir, File indexFile) throws IOException
baseDir. In addition to that, the
writer creates summary-entries in an index-file denoted by indexFile.baseDir - The directory where to store the event-data files.indexFile - The file to which the index-entries are appended.IOException - In case an IO-error occurs (file-permissions, etc.)public ConcurrentAuditWriter(File baseDir) throws IOException
base according to their date. The index-file is assumed to
be the file index within that directory.baseDir - The base directory where the audit-data files are stored.Exception - In case base is not a directory or cannot be created or
is not writable.IOExceptionpublic File write(AuditEvent evt) throws IOException
evt to a file, whose name is
deducted from the creation time of the event. The file is created relative to the
base-directory given at construction-time of this writer-instance.
Additionally a summary-entry will be created that is appended to the index-file.evt - The AuditEvent-instance to be written to disk.IOExceptionpublic File getFileFor(AuditEvent evt) throws IOException
IOExceptionpublic void writeEvent(AuditEvent evt) throws IOException
writeEvent in interface AuditEventWriterIOExceptionpublic File getDirectoryFor(Date date) throws IOException
date - The date of an event.IOException - In case the file or any of the subdirectories cannot be created.public static String createSummary(AuditEvent evt)
evt - The event to create the summary from.Copyright © 2013 jwall.org. All Rights Reserved.