001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008-2009 Sun Microsystems, Inc. 015 * Portions Copyright 2011-2016 ForgeRock AS. 016 */ 017package org.opends.server.loggers; 018 019import java.io.Closeable; 020import java.util.List; 021 022import org.forgerock.i18n.LocalizableMessage; 023import org.forgerock.opendj.server.config.server.LogPublisherCfg; 024import org.forgerock.opendj.config.server.ConfigException; 025import org.opends.server.core.ServerContext; 026import org.forgerock.opendj.ldap.DN; 027import org.opends.server.types.InitializationException; 028 029/** 030 * This class defines the set of methods and structures that must be implemented 031 * for a Directory Server log publisher. 032 * 033 * @param <T> 034 * The type of log publisher configuration handled by this log 035 * publisher implementation. 036 */ 037@org.opends.server.types.PublicAPI( 038 stability = org.opends.server.types.StabilityLevel.VOLATILE, 039 mayInstantiate = false, 040 mayExtend = true, 041 mayInvoke = false) 042public interface LogPublisher<T extends LogPublisherCfg> extends Closeable 043{ 044 045 /** 046 * Initializes this publisher provider based on the information in the 047 * provided debug publisher configuration. 048 * 049 * @param config 050 * The publisher configuration that contains the information to use 051 * to initialize this publisher. 052 * @param serverContext 053 * The server context. 054 * @throws ConfigException 055 * If an unrecoverable problem arises in the process of performing 056 * the initialization as a result of the server configuration. 057 * @throws InitializationException 058 * If a problem occurs during initialization that is not related to 059 * the server configuration. 060 */ 061 void initializeLogPublisher(T config, ServerContext serverContext) throws ConfigException, 062 InitializationException; 063 064 065 066 /** 067 * Indicates whether the provided configuration is acceptable for this log 068 * publisher. It should be possible to call this method on an uninitialized 069 * log publisher instance in order to determine whether the log publisher 070 * would be able to use the provided configuration. 071 * <BR><BR> 072 * Note that implementations which use a subclass of the provided 073 * configuration class will likely need to cast the configuration to the 074 * appropriate subclass type. 075 * 076 * @param configuration 077 * The log publisher configuration for which to make the 078 * determination. 079 * @param unacceptableReasons 080 * A list that may be used to hold the reasons that the provided 081 * configuration is not acceptable. 082 * @return {@code true} if the provided configuration is acceptable for this 083 * log publisher, or {@code false} if not. 084 */ 085 boolean isConfigurationAcceptable(T configuration, 086 List<LocalizableMessage> unacceptableReasons); 087 088 089 090 /** 091 * Close this publisher. 092 */ 093 @Override 094 void close(); 095 096 097 098 /** 099 * Gets the DN of the configuration entry for this log publisher. 100 * 101 * @return The configuration entry DN. 102 */ 103 DN getDN(); 104 105}