Package org.forgerock.audit.rotation
Interface RotatableObject
-
- All Known Implementing Classes:
RotatableWriter
public interface RotatableObjectInterface defining methods a rotatable file needs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the rotatable file.longgetBytesWritten()Retrieves the number of bytes written to the file.OffsetDateTimegetLastRotationTime()Retrieves the last time the file was rotated.voidregisterRotationHooks(RotationHooks rotationHooks)Registers hooks into the rotation process.booleanrotateIfNeeded()Checks the rotatable file for rotation then retention.
-
-
-
Method Detail
-
getBytesWritten
long getBytesWritten()
Retrieves the number of bytes written to the file.- Returns:
- The number of bytes written to the file.
-
getLastRotationTime
OffsetDateTime getLastRotationTime()
Retrieves the last time the file was rotated. If a file rotation never occurred, this value will be the time the server started.- Returns:
- The last time file rotation occurred.
-
rotateIfNeeded
boolean rotateIfNeeded() throws IOExceptionChecks the rotatable file for rotation then retention. The file is rotated if the configuredRotationPolicy's are true. The old audit files are retained/deleted according to theRetentionPolicy's configured.- Returns:
trueif rotation took place.- Throws:
IOException- If unable to rotateIfNeeded the audit file.
-
close
void close() throws IOExceptionCloses the rotatable file.- Throws:
IOException- If an exception occurs while closing.
-
registerRotationHooks
void registerRotationHooks(RotationHooks rotationHooks)
Registers hooks into the rotation process.- Parameters:
rotationHooks- TheRotationHooksinto the rotation process.
-
-