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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddLogPublisher(P publisher)Add a log publisher to the logger.ConfigChangeResultapplyConfigurationAdd(C config)Adds a new configuration to this add listener.ConfigChangeResultapplyConfigurationChange(C config)Applies the configuration changes to this change listener.ConfigChangeResultapplyConfigurationDelete(C config)Deletes an existing configuration from this delete listener.protected abstract ClassPropertyDefinitiongetJavaClassPropertyDefinition()Returns the javaClassPropertyDefinitionfor the current logger.protected abstract Collection<P>getLogPublishers()Returns the log publishers.voidinitializeLogger(List<C> configs, ServerContext serverContext)Initializes all the log publishers.booleanisConfigurationAddAcceptable(C config, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed addition of a new configuration is acceptable to this add listener.booleanisConfigurationChangeAcceptable(C config, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.booleanisConfigurationDeleteAcceptable(C config, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.voidmodifyLogPublisher(P publisher, C config)Modify an existing log publisher.abstract voidremoveAllLogPublishers()Removes all existing log publishers from the logger.abstract voidremoveLogPublisher(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
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 javaClassPropertyDefinitionfor the current logger.- Returns:
- the java
ClassPropertyDefinitionfor 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:ConfigurationAddListenerIndicates whether the proposed addition of a new configuration is acceptable to this add listener.- Specified by:
isConfigurationAddAcceptablein 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
trueif the proposed addition is acceptable, orfalseif it is not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(C config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationAdd
public ConfigChangeResult applyConfigurationAdd(C config)
Description copied from interface:ConfigurationAddListenerAdds a new configuration to this add listener.- Specified by:
applyConfigurationAddin 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:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein 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:ConfigurationDeleteListenerIndicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.- Specified by:
isConfigurationDeleteAcceptablein 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
trueif the proposed deletion is acceptable, orfalseif it is not.
-
applyConfigurationDelete
public ConfigChangeResult applyConfigurationDelete(C config)
Description copied from interface:ConfigurationDeleteListenerDeletes an existing configuration from this delete listener.- Specified by:
applyConfigurationDeletein interfaceConfigurationDeleteListener<P extends LogPublisher<C>>- Parameters:
config- The existing configuration that will be deleted.- Returns:
- Returns information about the result of deleting the configuration.
-
-