org.opends.server.loggers
Class TextErrorLogPublisher

java.lang.Object
  extended by org.opends.server.api.ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
      extended by org.opends.server.loggers.TextErrorLogPublisher
All Implemented Interfaces:
ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>

public class TextErrorLogPublisher
extends ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
implements ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>

This class provides an implementation of an error log publisher.


Field Summary
 
Fields inherited from class org.opends.server.api.ErrorLogPublisher
defaultSeverities, definedSeverities
 
Constructor Summary
TextErrorLogPublisher()
           
 
Method Summary
 ConfigChangeResult applyConfigurationChange(FileBasedErrorLogPublisherCfg config)
          Applies the configuration changes to this change listener.
 void close()
          Close this publisher.
 DN getDN()
          Gets the DN of the configuration entry for this error log publisher.
static TextErrorLogPublisher getStartupTextErrorPublisher(TextWriter writer)
          Returns an instance of the text error log publisher that will print all messages to the provided writer.
 void initializeErrorLogPublisher(FileBasedErrorLogPublisherCfg config)
          Initializes this access publisher provider based on the information in the provided debug publisher configuration.
 boolean isConfigurationAcceptable(ErrorLogPublisherCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this error log publisher.
 boolean isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 void logError(Message message)
          Writes a message to the error log using the provided information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextErrorLogPublisher

public TextErrorLogPublisher()
Method Detail

getStartupTextErrorPublisher

public static TextErrorLogPublisher getStartupTextErrorPublisher(TextWriter writer)
Returns an instance of the text error log publisher that will print all messages to the provided writer. This is used to print the messages to the console when the server starts up.

Parameters:
writer - The text writer where the message will be written to.
Returns:
The instance of the text error log publisher that will print all messages to standard out.

initializeErrorLogPublisher

public void initializeErrorLogPublisher(FileBasedErrorLogPublisherCfg config)
                                 throws ConfigException,
                                        InitializationException
Initializes this access publisher provider based on the information in the provided debug publisher configuration.

Specified by:
initializeErrorLogPublisher in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
Parameters:
config - The error publisher configuration that contains the information to use to initialize this error publisher.
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.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(ErrorLogPublisherCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this error log publisher. It should be possible to call this method on an uninitialized error log publisher instance in order to determine whether the error log publisher would be able to use the provided configuration.

Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.

Overrides:
isConfigurationAcceptable in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
Parameters:
configuration - The error log publisher configuration for which to make the determination.
unacceptableReasons - A list that may be used to hold the reasons that the provided configuration is not acceptable.
Returns:
true if the provided configuration is acceptable for this error log publisher, or false if not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg 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<FileBasedErrorLogPublisherCfg>
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(FileBasedErrorLogPublisherCfg config)
Applies the configuration changes to this change listener.

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

close

public void close()
Close this publisher.

Specified by:
close in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>

logError

public void logError(Message message)
Writes a message to the error log using the provided information. The message's category and severity information will be used to determine whether to actually log this message.

Specified by:
logError in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
Parameters:
message - The message to be logged.

getDN

public DN getDN()
Gets the DN of the configuration entry for this error log publisher.

Specified by:
getDN in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
Returns:
The configuration entry DN.