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 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2015 ForgeRock AS.
016 */
017package org.opends.server.api;
018
019import org.opends.server.config.ConfigEntry;
020import org.forgerock.opendj.config.server.ConfigChangeResult;
021import org.forgerock.i18n.LocalizableMessageBuilder;
022
023/**
024 * This interface defines the methods that a Directory Server
025 * component should implement if it wishes to be able to receive
026 * notification of changes to a configuration entry.
027 */
028@org.opends.server.types.PublicAPI(
029     stability=org.opends.server.types.StabilityLevel.VOLATILE,
030     mayInstantiate=false,
031     mayExtend=true,
032     mayInvoke=false)
033public interface ConfigChangeListener
034{
035  /**
036   * Indicates whether the configuration entry that will result from a
037   * proposed modification is acceptable to this change listener.
038   *
039   * @param  configEntry         The configuration entry that will
040   *                             result from the requested update.
041   * @param  unacceptableReason  A buffer to which this method can
042   *                             append a human-readable message
043   *                             explaining why the proposed change is
044   *                             not acceptable.
045   *
046   * @return  {@code true} if the proposed entry contains an
047   *          acceptable configuration, or {@code false} if it does
048   *          not.
049   */
050  boolean configChangeIsAcceptable(ConfigEntry configEntry,
051                      LocalizableMessageBuilder unacceptableReason);
052
053
054
055  /**
056   * Attempts to apply a new configuration to this Directory Server
057   * component based on the provided changed entry.
058   *
059   * @param  configEntry  The configuration entry that containing the
060   *                      updated configuration for this component.
061   *
062   * @return  Information about the result of processing the
063   *          configuration change.
064   */
065  ConfigChangeResult applyConfigurationChange(
066                                 ConfigEntry configEntry);
067}
068