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 new entries
025 * added below a configuration entry.
026 */
027public interface ConfigAddListener {
028    /**
029     * Indicates whether the configuration entry that will result from a
030     * proposed add is acceptable to this add listener.
031     *
032     * @param configEntry
033     *            The configuration entry that will result from the requested
034     *            add.
035     * @param unacceptableReason
036     *            A buffer to which this method can append a human-readable
037     *            message explaining why the proposed entry 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 configAddIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason);
042
043    /**
044     * Attempts to apply a new configuration based on the provided added entry.
045     *
046     * @param configEntry
047     *            The new configuration entry that contains the configuration to
048     *            apply.
049     * @return Information about the result of processing the configuration
050     *         change.
051     */
052    ConfigChangeResult applyConfigurationAdd(Entry configEntry);
053}