Package org.wildfly.security.audit
Class FileAuditEndpoint.Builder
- java.lang.Object
-
- org.wildfly.security.audit.FileAuditEndpoint.Builder
-
- Direct Known Subclasses:
PeriodicRotatingFileAuditEndpoint.Builder
,SizeRotatingFileAuditEndpoint.Builder
- Enclosing class:
- FileAuditEndpoint
public static class FileAuditEndpoint.Builder extends Object
A builder for file audit endpoints.
-
-
Field Summary
Fields Modifier and Type Field Description private Clock
clock
private Supplier<DateTimeFormatter>
dateTimeFormatterSupplier
private boolean
flushOnAccept
private boolean
flushSet
private Path
location
private boolean
syncOnAccept
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuditEndpoint
build()
Construct a new file audit endpoint.(package private) FileAuditEndpoint.Builder
setClock(Clock clock)
Sets theClock
instance the resultingFileAuditEndpoint
should use to query the current time.FileAuditEndpoint.Builder
setDateTimeFormatterSupplier(Supplier<DateTimeFormatter> dateTimeFormatterSupplier)
Set the supplier to obtain theDateTimeFormatter
for dates.FileAuditEndpoint.Builder
setFlushOnAccept(boolean flushOnAccept)
Sets if the output should be flushed on each event accepted.FileAuditEndpoint.Builder
setLocation(Path location)
Set the location to write the audit events to.FileAuditEndpoint.Builder
setSyncOnAccept(boolean syncOnAccept)
Sets if the system output buffers should be forced to be synchronized on each event accepted.
-
-
-
Field Detail
-
clock
private Clock clock
-
dateTimeFormatterSupplier
private Supplier<DateTimeFormatter> dateTimeFormatterSupplier
-
location
private Path location
-
syncOnAccept
private boolean syncOnAccept
-
flushOnAccept
private boolean flushOnAccept
-
flushSet
private boolean flushSet
-
-
Method Detail
-
setDateTimeFormatterSupplier
public FileAuditEndpoint.Builder setDateTimeFormatterSupplier(Supplier<DateTimeFormatter> dateTimeFormatterSupplier)
Set the supplier to obtain theDateTimeFormatter
for dates. The supplied formatter has to have a time zone configured.- Parameters:
dateTimeFormatterSupplier
- the supplier to obtain theDateTimeFormatter
- Returns:
- this builder.
-
setLocation
public FileAuditEndpoint.Builder setLocation(Path location)
Set the location to write the audit events to.- Parameters:
location
- the location to write the audit events to.- Returns:
- this builder.
-
setFlushOnAccept
public FileAuditEndpoint.Builder setFlushOnAccept(boolean flushOnAccept)
Sets if the output should be flushed on each event accepted. If not set, flushing is done when output buffers synchronization is set.- Parameters:
flushOnAccept
- should the output be flushed on each event accepted.- Returns:
- this builder.
- Since:
- 1.3.0
-
setSyncOnAccept
public FileAuditEndpoint.Builder setSyncOnAccept(boolean syncOnAccept)
Sets if the system output buffers should be forced to be synchronized on each event accepted. Enabled by default. Output flushing can be set independently usingsetFlushOnAccept(boolean)
but defaults to this value.- Parameters:
syncOnAccept
- should the system output buffers be forced to be synchronized on each event accepted.- Returns:
- this builder.
-
setClock
FileAuditEndpoint.Builder setClock(Clock clock)
Sets theClock
instance the resultingFileAuditEndpoint
should use to query the current time. For testing purposes only, therefore package visible.- Parameters:
clock
- the clock to query the current time- Returns:
- this builder
-
build
public AuditEndpoint build() throws IOException
Construct a new file audit endpoint.- Returns:
- the built file audit endpoint.
- Throws:
IOException
-
-