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