Package org.forgerock.audit.rotation
Interface RotatableObject
- All Known Implementing Classes:
RotatableWriter
public interface RotatableObject
Interface defining methods a rotatable file needs.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the rotatable file.longRetrieves the number of bytes written to the file.Retrieves the last time the file was rotated.voidregisterRotationHooks(RotationHooks rotationHooks) Registers hooks into the rotation process.booleanChecks the rotatable file for rotation then retention.
-
Method Details
-
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
Checks 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
Closes the rotatable file.- Throws:
IOException- If an exception occurs while closing.
-
registerRotationHooks
Registers hooks into the rotation process.- Parameters:
rotationHooks- TheRotationHooksinto the rotation process.
-