org.opends.server.loggers
Class SizeBasedRotationPolicy

java.lang.Object
  extended by org.opends.server.loggers.SizeBasedRotationPolicy
All Implemented Interfaces:
ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>, RotationPolicy<SizeLimitLogRotationPolicyCfg>

public class SizeBasedRotationPolicy
extends java.lang.Object
implements RotationPolicy<SizeLimitLogRotationPolicyCfg>, ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>

This class implements a rotation policy based on the size of the file.


Constructor Summary
SizeBasedRotationPolicy()
           
 
Method Summary
 ConfigChangeResult applyConfigurationChange(SizeLimitLogRotationPolicyCfg config)
          Applies the configuration changes to this change listener.
 void initializeLogRotationPolicy(SizeLimitLogRotationPolicyCfg config)
          Initializes this log rotation policy based on the information in the provided rotation policy configuration.
 boolean isConfigurationChangeAcceptable(SizeLimitLogRotationPolicyCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 boolean rotateFile(MultifileTextWriter writer)
          This method indicates if the log file should be rotated or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeBasedRotationPolicy

public SizeBasedRotationPolicy()
Method Detail

initializeLogRotationPolicy

public void initializeLogRotationPolicy(SizeLimitLogRotationPolicyCfg config)
                                 throws ConfigException,
                                        InitializationException
Initializes this log rotation policy based on the information in the provided rotation policy configuration.

Specified by:
initializeLogRotationPolicy in interface RotationPolicy<SizeLimitLogRotationPolicyCfg>
Parameters:
config - The rotation policy configuration that contains the information to use to initialize this policy.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(SizeLimitLogRotationPolicyCfg config,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>
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, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(SizeLimitLogRotationPolicyCfg config)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>
Parameters:
config - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.

rotateFile

public boolean rotateFile(MultifileTextWriter writer)
This method indicates if the log file should be rotated or not.

Specified by:
rotateFile in interface RotationPolicy<SizeLimitLogRotationPolicyCfg>
Parameters:
writer - The multi file text writer writing the log file.
Returns:
true if the file needs to be rotated, false otherwise.