Class AbstractLogger<P extends LogPublisher<C>,C extends LogPublisherCfg>

java.lang.Object
org.opends.server.loggers.AbstractLogger<P,C>
Type Parameters:
P - The type of the LogPublisher corresponding to this logger
C - The type of the LogPublisherCfg corresponding to this logger
All Implemented Interfaces:
ConfigurationAddListener<C>, ConfigurationChangeListener<C>, ConfigurationDeleteListener<C>
Direct Known Subclasses:
AccessLogger, ErrorLogger, HTTPAccessLogger

public abstract class AbstractLogger<P extends LogPublisher<C>,C extends LogPublisherCfg> extends Object implements ConfigurationAddListener<C>, ConfigurationDeleteListener<C>, ConfigurationChangeListener<C>
This class defines the wrapper that will invoke all registered loggers for each type of request received or response sent. If no log publishers are registered, messages will be directed to standard out.
  • Method Details

    • getLogPublishers

      protected abstract Collection<P> getLogPublishers()
      Returns the log publishers.
      Returns:
      the collection of LogPublishers
    • addLogPublisher

      public abstract void addLogPublisher(P publisher)
      Add a log publisher to the logger.
      Parameters:
      publisher - The log publisher to add.
    • modifyLogPublisher

      public void modifyLogPublisher(P publisher, C config) throws ConfigException
      Modify an existing log publisher.
      Parameters:
      publisher - The log publisher to modify.
      config - The new configuration.
      Throws:
      ConfigException - If an error occurs.
    • removeLogPublisher

      public abstract void removeLogPublisher(P publisher)
      Remove a log publisher from the logger.
      Parameters:
      publisher - The log publisher to remove.
    • removeAllLogPublishers

      public abstract void removeAllLogPublishers()
      Removes all existing log publishers from the logger.
    • getJavaClassPropertyDefinition

      protected abstract ClassPropertyDefinition getJavaClassPropertyDefinition()
      Returns the java ClassPropertyDefinition for the current logger.
      Returns:
      the java ClassPropertyDefinition for the current logger.
    • initializeLogger

      public void initializeLogger(List<C> configs, ServerContext serverContext) throws ConfigException
      Initializes all the log publishers.
      Parameters:
      configs - The log publisher configurations.
      serverContext - The server context.
      Throws:
      ConfigException - If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.
    • isConfigurationAddAcceptable

      public boolean isConfigurationAddAcceptable(C config, List<LocalizableMessage> unacceptableReasons)
      Description copied from interface: ConfigurationAddListener
      Indicates whether the proposed addition of a new configuration is acceptable to this add listener.
      Specified by:
      isConfigurationAddAcceptable in interface ConfigurationAddListener<P extends LogPublisher<C>>
      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(C 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 interface ConfigurationChangeListener<P extends LogPublisher<C>>
      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(C config)
      Description copied from interface: ConfigurationAddListener
      Adds a new configuration to this add listener.
      Specified by:
      applyConfigurationAdd in interface ConfigurationAddListener<P extends LogPublisher<C>>
      Parameters:
      config - The configuration that will be added.
      Returns:
      Returns information about the result of adding the configuration.
    • applyConfigurationChange

      public ConfigChangeResult applyConfigurationChange(C config)
      Description copied from interface: ConfigurationChangeListener
      Applies the configuration changes to this change listener.
      Specified by:
      applyConfigurationChange in interface ConfigurationChangeListener<P extends LogPublisher<C>>
      Parameters:
      config - The new configuration containing the changes.
      Returns:
      Returns information about the result of changing the configuration.
    • isConfigurationDeleteAcceptable

      public boolean isConfigurationDeleteAcceptable(C config, List<LocalizableMessage> unacceptableReasons)
      Description copied from interface: ConfigurationDeleteListener
      Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.
      Specified by:
      isConfigurationDeleteAcceptable in interface ConfigurationDeleteListener<P extends LogPublisher<C>>
      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(C config)
      Description copied from interface: ConfigurationDeleteListener
      Deletes an existing configuration from this delete listener.
      Specified by:
      applyConfigurationDelete in interface ConfigurationDeleteListener<P extends LogPublisher<C>>
      Parameters:
      config - The existing configuration that will be deleted.
      Returns:
      Returns information about the result of deleting the configuration.