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 */
026package org.forgerock.opendj.config.server.spi;
027
028import org.forgerock.i18n.LocalizableMessageBuilder;
029import org.forgerock.opendj.config.server.ConfigChangeResult;
030import org.forgerock.opendj.ldap.Entry;
031
032/**
033 * This interface defines the methods that a Directory Server component should
034 * implement if it wishes to be able to receive notification of changes to a
035 * configuration entry.
036 */
037public interface ConfigChangeListener {
038    /**
039     * Indicates whether the configuration entry that will result from a
040     * proposed modification is acceptable to this change listener.
041     *
042     * @param configEntry
043     *            The configuration entry that will result from the requested
044     *            update.
045     * @param unacceptableReason
046     *            A buffer to which this method can append a human-readable
047     *            message explaining why the proposed change is not acceptable.
048     * @return {@code true} if the proposed entry contains an acceptable
049     *         configuration, or {@code false} if it does not.
050     */
051    boolean configChangeIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason);
052
053    /**
054     * Attempts to apply a new configuration to this Directory Server component
055     * based on the provided changed entry.
056     *
057     * @param configEntry
058     *            The configuration entry that containing the updated
059     *            configuration for this component.
060     * @return Information about the result of processing the configuration
061     *         change.
062     */
063    ConfigChangeResult applyConfigurationChange(Entry configEntry);
064}