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
,DebugLogger
,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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addLogPublisher(P publisher)
Add a log publisher to the logger.ConfigChangeResult
applyConfigurationAdd(C config)
Adds a new configuration to this add listener.ConfigChangeResult
applyConfigurationChange(C config)
Applies the configuration changes to this change listener.ConfigChangeResult
applyConfigurationDelete(C config)
Deletes an existing configuration from this delete listener.protected abstract ClassPropertyDefinition
getJavaClassPropertyDefinition()
Returns the javaClassPropertyDefinition
for the current logger.protected abstract Collection<P>
getLogPublishers()
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.abstract void
removeAllLogPublishers()
Removes all existing log publishers from the logger.abstract void
removeLogPublisher(P publisher)
Remove a log publisher from the logger.
-
-
-
Method Detail
-
getLogPublishers
protected abstract Collection<P> getLogPublishers()
Returns the log publishers.- Returns:
- the collection of
LogPublisher
s
-
addLogPublisher
public abstract void addLogPublisher(P publisher)
Add a log publisher to the logger.- Parameters:
publisher
- The log publisher to add.
-
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 javaClassPropertyDefinition
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 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
public ConfigChangeResult applyConfigurationAdd(C config)
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
public ConfigChangeResult applyConfigurationChange(C config)
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
public ConfigChangeResult applyConfigurationDelete(C config)
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.
-
-