Package org.opends.server.loggers
Class FreeDiskSpaceRetentionPolicy
java.lang.Object
org.opends.server.loggers.FreeDiskSpaceRetentionPolicy
- All Implemented Interfaces:
ConfigurationChangeListener<FreeDiskSpaceLogRetentionPolicyCfg>
,RetentionPolicy<FreeDiskSpaceLogRetentionPolicyCfg>
public final class FreeDiskSpaceRetentionPolicy
extends Object
implements RetentionPolicy<FreeDiskSpaceLogRetentionPolicyCfg>, ConfigurationChangeListener<FreeDiskSpaceLogRetentionPolicyCfg>
This class implements a retention policy based on the free disk space available expressed as a percentage.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionApplies the configuration changes to this change listener.Path[]
deleteFiles
(org.opends.server.loggers.FileNamingPolicy fileNamingPolicy) Returns all files that should be deleted according to the policy.void
Initializes this log retention policy based on the information in the provided retention policy configuration.boolean
isConfigurationChangeAcceptable
(FreeDiskSpaceLogRetentionPolicyCfg config, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.toString()
-
Constructor Details
-
FreeDiskSpaceRetentionPolicy
public FreeDiskSpaceRetentionPolicy()
-
-
Method Details
-
initializeLogRetentionPolicy
Description copied from interface:RetentionPolicy
Initializes this log retention policy based on the information in the provided retention policy configuration.- Specified by:
initializeLogRetentionPolicy
in interfaceRetentionPolicy<FreeDiskSpaceLogRetentionPolicyCfg>
- Parameters:
config
- The retention policy configuration that contains the information to use to initialize this policy.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FreeDiskSpaceLogRetentionPolicyCfg config, List<LocalizableMessage> unacceptableReasons) Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<FreeDiskSpaceLogRetentionPolicyCfg>
- Parameters:
config
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
applyConfigurationChange
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<FreeDiskSpaceLogRetentionPolicyCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
deleteFiles
public Path[] deleteFiles(org.opends.server.loggers.FileNamingPolicy fileNamingPolicy) throws IOException Description copied from interface:RetentionPolicy
Returns all files that should be deleted according to the policy.- Specified by:
deleteFiles
in interfaceRetentionPolicy<FreeDiskSpaceLogRetentionPolicyCfg>
- Parameters:
fileNamingPolicy
- The naming policy used generate the log file names.- Returns:
- An array of files that should be deleted according to the policy or
null
if an error occurred while obtaining the file list. - Throws:
IOException
- If an error occurs while obtaining a list of files to delete.
-
toString
-