Package org.forgerock.audit.rotation
Interface RotatableObject
-
- All Known Implementing Classes:
RotatableWriter
public interface RotatableObject
Interface defining methods a rotatable file needs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the rotatable file.long
getBytesWritten()
Retrieves the number of bytes written to the file.OffsetDateTime
getLastRotationTime()
Retrieves the last time the file was rotated.void
registerRotationHooks(RotationHooks rotationHooks)
Registers hooks into the rotation process.boolean
rotateIfNeeded()
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 IOException
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
void close() throws IOException
Closes the rotatable file.- Throws:
IOException
- If an exception occurs while closing.
-
registerRotationHooks
void registerRotationHooks(RotationHooks rotationHooks)
Registers hooks into the rotation process.- Parameters:
rotationHooks
- TheRotationHooks
into the rotation process.
-
-