Package org.opends.server.loggers
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 loggerC
- 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 Summary
Modifier and TypeMethodDescriptionabstract void
addLogPublisher
(P publisher) Add a log publisher to the logger.applyConfigurationAdd
(C config) Adds a new configuration to this add listener.applyConfigurationChange
(C config) Applies the configuration changes to this change listener.applyConfigurationDelete
(C config) Deletes an existing configuration from this delete listener.protected abstract ClassPropertyDefinition
Returns the javaClassPropertyDefinition
for the current logger.protected abstract Collection<P>
Returns the log publishers.void
initializeLogger
(List<C> configs, ServerContext serverContext) Initializes all the log publishers.boolean
isConfigurationAddAcceptable
(C config, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed addition of a new configuration is acceptable to this add listener.boolean
isConfigurationChangeAcceptable
(C config, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.boolean
isConfigurationDeleteAcceptable
(C config, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.void
modifyLogPublisher
(P publisher, C config) Modify an existing log publisher.abstract void
Removes all existing log publishers from the logger.abstract void
removeLogPublisher
(P publisher) Remove a log publisher from the logger.
-
Method Details
-
getLogPublishers
Returns the log publishers.- Returns:
- the collection of
LogPublisher
s
-
addLogPublisher
Add a log publisher to the logger.- Parameters:
publisher
- The log publisher to add.
-
modifyLogPublisher
Modify an existing log publisher.- Parameters:
publisher
- The log publisher to modify.config
- The new configuration.- Throws:
ConfigException
- If an error occurs.
-
removeLogPublisher
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
Returns the javaClassPropertyDefinition
for the current logger.- Returns:
- the java
ClassPropertyDefinition
for the current logger.
-
initializeLogger
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
Description copied from interface:ConfigurationAddListener
Indicates whether the proposed addition of a new configuration is acceptable to this add listener.- Specified by:
isConfigurationAddAcceptable
in interfaceConfigurationAddListener<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, orfalse
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 interfaceConfigurationChangeListener<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, orfalse
if it is not.
-
applyConfigurationAdd
Description copied from interface:ConfigurationAddListener
Adds a new configuration to this add listener.- Specified by:
applyConfigurationAdd
in interfaceConfigurationAddListener<P extends LogPublisher<C>>
- Parameters:
config
- The configuration that will be added.- Returns:
- Returns information about the result of adding the configuration.
-
applyConfigurationChange
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<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 interfaceConfigurationDeleteListener<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, orfalse
if it is not.
-
applyConfigurationDelete
Description copied from interface:ConfigurationDeleteListener
Deletes an existing configuration from this delete listener.- Specified by:
applyConfigurationDelete
in interfaceConfigurationDeleteListener<P extends LogPublisher<C>>
- Parameters:
config
- The existing configuration that will be deleted.- Returns:
- Returns information about the result of deleting the configuration.
-