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 TypeMethodDescriptionvoid
close()
Closes the rotatable file.long
Retrieves the number of bytes written to the file.Retrieves the last time the file was rotated.void
registerRotationHooks
(RotationHooks rotationHooks) Registers hooks into the rotation process.boolean
Checks 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:
true
if 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
- TheRotationHooks
into the rotation process.
-