Package org.forgerock.audit.retention
Class SizeBasedRetentionPolicy
- java.lang.Object
-
- org.forgerock.audit.retention.SizeBasedRetentionPolicy
-
- All Implemented Interfaces:
RetentionPolicy
public class SizeBasedRetentionPolicy extends Object implements RetentionPolicy
Created a size based file retention policy. This policy stores a set number of archived files.
-
-
Constructor Summary
Constructors Constructor Description SizeBasedRetentionPolicy(int maxNumberOfFiles)
Constructs a SizeBasedRetentionPolicy with a given maximum number of archived files.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<File>
deleteFiles(boolean hasRotated, FileNamingPolicy fileNamingPolicy)
Returns all files that should be deleted according to the policy.
-
-
-
Constructor Detail
-
SizeBasedRetentionPolicy
public SizeBasedRetentionPolicy(int maxNumberOfFiles)
Constructs a SizeBasedRetentionPolicy with a given maximum number of archived files. A negative value disables pruning of old archive files.- Parameters:
maxNumberOfFiles
- The maximum number of archive files to keep. A negative value will disable pruning old archive files.
-
-
Method Detail
-
deleteFiles
public List<File> deleteFiles(boolean hasRotated, FileNamingPolicy fileNamingPolicy)
Description copied from interface:RetentionPolicy
Returns all files that should be deleted according to the policy.- Specified by:
deleteFiles
in interfaceRetentionPolicy
- Parameters:
hasRotated
-true
if one of the rotation policies rotated the file at last call.fileNamingPolicy
- The naming policy used generate the log file names.- Returns:
- Not-null, An array of files that should be deleted according to the policy.
-
-