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