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 new entries
035 * added below a configuration entry.
036 */
037public interface ConfigAddListener {
038    /**
039     * Indicates whether the configuration entry that will result from a
040     * proposed add is acceptable to this add listener.
041     *
042     * @param configEntry
043     *            The configuration entry that will result from the requested
044     *            add.
045     * @param unacceptableReason
046     *            A buffer to which this method can append a human-readable
047     *            message explaining why the proposed entry 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 configAddIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason);
052
053    /**
054     * Attempts to apply a new configuration based on the provided added entry.
055     *
056     * @param configEntry
057     *            The new configuration entry that contains the configuration to
058     *            apply.
059     * @return Information about the result of processing the configuration
060     *         change.
061     */
062    ConfigChangeResult applyConfigurationAdd(Entry configEntry);
063}