org.opends.server.loggers
Class ErrorLogger

java.lang.Object
  extended by org.opends.server.loggers.ErrorLogger
All Implemented Interfaces:
ConfigurationAddListener<ErrorLogPublisherCfg>, ConfigurationChangeListener<ErrorLogPublisherCfg>, ConfigurationDeleteListener<ErrorLogPublisherCfg>

public class ErrorLogger
extends java.lang.Object
implements ConfigurationAddListener<ErrorLogPublisherCfg>, ConfigurationDeleteListener<ErrorLogPublisherCfg>, ConfigurationChangeListener<ErrorLogPublisherCfg>

This class defines the wrapper that will invoke all registered error loggers for each type of request received or response sent. If no error log publishers are registered, messages will be directed to standard out.


Constructor Summary
ErrorLogger()
           
 
Method Summary
static void addErrorLogPublisher(ErrorLogPublisher publisher)
          Add an error log publisher to the error logger.
 ConfigChangeResult applyConfigurationAdd(ErrorLogPublisherCfg config)
          Adds a new configuration to this add listener.
 ConfigChangeResult applyConfigurationChange(ErrorLogPublisherCfg config)
          Applies the configuration changes to this change listener.
 ConfigChangeResult applyConfigurationDelete(ErrorLogPublisherCfg config)
          Deletes an existing configuration from this delete listener.
static ErrorLogger getInstance()
          Retrieve the singleton instance of this class.
 void initializeErrorLogger(java.util.List<ErrorLogPublisherCfg> configs)
          Initializes all the error log publishers.
 boolean isConfigurationAddAcceptable(ErrorLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed addition of a new configuration is acceptable to this add listener.
 boolean isConfigurationChangeAcceptable(ErrorLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 boolean isConfigurationDeleteAcceptable(ErrorLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.
static void logError(Message message)
          Writes a message to the error log using the provided information.
static void removeAllErrorLogPublishers()
          Removes all existing error log publishers from the logger.
static boolean removeErrorLogPublisher(ErrorLogPublisher publisher)
          Remove an error log publisher from the error logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorLogger

public ErrorLogger()
Method Detail

getInstance

public static ErrorLogger getInstance()
Retrieve the singleton instance of this class.

Returns:
The singleton instance of this logger.

addErrorLogPublisher

public static void addErrorLogPublisher(ErrorLogPublisher publisher)
Add an error log publisher to the error logger.

Parameters:
publisher - The error log publisher to add.

removeErrorLogPublisher

public static boolean removeErrorLogPublisher(ErrorLogPublisher publisher)
Remove an error log publisher from the error logger.

Parameters:
publisher - The error log publisher to remove.
Returns:
True if the error log publisher is removed or false otherwise.

removeAllErrorLogPublishers

public static void removeAllErrorLogPublishers()
Removes all existing error log publishers from the logger.


initializeErrorLogger

public void initializeErrorLogger(java.util.List<ErrorLogPublisherCfg> configs)
                           throws ConfigException,
                                  InitializationException
Initializes all the error log publishers.

Parameters:
configs - The error log publisher configurations.
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.

isConfigurationAddAcceptable

public boolean isConfigurationAddAcceptable(ErrorLogPublisherCfg config,
                                            java.util.List<Message> unacceptableReasons)
Indicates whether the proposed addition of a new configuration is acceptable to this add listener.

Specified by:
isConfigurationAddAcceptable in interface ConfigurationAddListener<ErrorLogPublisherCfg>
Parameters:
config - The configuration that will be added.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed addition is acceptable, or false if it is not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(ErrorLogPublisherCfg 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<ErrorLogPublisherCfg>
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.

applyConfigurationAdd

public ConfigChangeResult applyConfigurationAdd(ErrorLogPublisherCfg config)
Adds a new configuration to this add listener.

Specified by:
applyConfigurationAdd in interface ConfigurationAddListener<ErrorLogPublisherCfg>
Parameters:
config - The configuration that will be added.
Returns:
Returns information about the result of adding the configuration.

applyConfigurationChange

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

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

isConfigurationDeleteAcceptable

public boolean isConfigurationDeleteAcceptable(ErrorLogPublisherCfg config,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.

Specified by:
isConfigurationDeleteAcceptable in interface ConfigurationDeleteListener<ErrorLogPublisherCfg>
Parameters:
config - The configuration that will be deleted.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed deletion is acceptable, or false if it is not.

applyConfigurationDelete

public ConfigChangeResult applyConfigurationDelete(ErrorLogPublisherCfg config)
Deletes an existing configuration from this delete listener.

Specified by:
applyConfigurationDelete in interface ConfigurationDeleteListener<ErrorLogPublisherCfg>
Parameters:
config - The existing configuration that will be deleted.
Returns:
Returns information about the result of deleting the configuration.

logError

public static void logError(Message message)
Writes a message to the error log using the provided information.

Parameters:
message - The message to be logged.