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