| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.AccessLogPublisherCfg; |
| | | import org.opends.server.admin.std.server.FileBasedAccessLogPublisherCfg; |
| | | import org.opends.server.admin.std.server.FileBasedAuditLogPublisherCfg; |
| | | import org.opends.server.api.AccessLogPublisher; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | * the directory server. |
| | | */ |
| | | public class TextAuditLogPublisher extends |
| | | AccessLogPublisher<FileBasedAccessLogPublisherCfg> implements |
| | | ConfigurationChangeListener<FileBasedAccessLogPublisherCfg> |
| | | AccessLogPublisher<FileBasedAuditLogPublisherCfg> implements |
| | | ConfigurationChangeListener<FileBasedAuditLogPublisherCfg> |
| | | { |
| | | |
| | | private boolean suppressInternalOperations = true; |
| | |
| | | |
| | | private TextWriter writer; |
| | | |
| | | private FileBasedAccessLogPublisherCfg currentConfig; |
| | | private FileBasedAuditLogPublisherCfg currentConfig; |
| | | |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedAccessLogPublisherCfg config) |
| | | FileBasedAuditLogPublisherCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | |
| | | public void close() |
| | | { |
| | | writer.shutdown(); |
| | | currentConfig.removeFileBasedAccessChangeListener(this); |
| | | currentConfig.removeFileBasedAuditChangeListener(this); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Override() |
| | | public void initializeAccessLogPublisher( |
| | | FileBasedAccessLogPublisherCfg config) |
| | | FileBasedAuditLogPublisherCfg config) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | File logFile = getFileForPath(config.getLogFile()); |
| | |
| | | |
| | | currentConfig = config; |
| | | |
| | | config.addFileBasedAccessChangeListener(this); |
| | | config.addFileBasedAuditChangeListener(this); |
| | | } |
| | | |
| | | |
| | |
| | | public boolean isConfigurationAcceptable(AccessLogPublisherCfg configuration, |
| | | List<Message> unacceptableReasons) |
| | | { |
| | | FileBasedAccessLogPublisherCfg config = |
| | | (FileBasedAccessLogPublisherCfg) configuration; |
| | | FileBasedAuditLogPublisherCfg config = |
| | | (FileBasedAuditLogPublisherCfg) configuration; |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FileBasedAccessLogPublisherCfg config, List<Message> unacceptableReasons) |
| | | FileBasedAuditLogPublisherCfg config, List<Message> unacceptableReasons) |
| | | { |
| | | // Make sure the permission is valid. |
| | | try |