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 if entries below a
035 * configuration entry are removed.
036 */
037public interface ConfigDeleteListener {
038    /**
039     * Indicates whether it is acceptable to remove the provided configuration
040     * entry.
041     *
042     * @param configEntry
043     *            The configuration entry that will be removed from the
044     *            configuration.
045     * @param unacceptableReason
046     *            A buffer to which this method can append a human-readable
047     *            message explaining why the proposed delete is not acceptable.
048     * @return {@code true} if the proposed entry may be removed from the
049     *         configuration, or {@code false} if not.
050     */
051    boolean configDeleteIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason);
052
053    /**
054     * Attempts to apply a new configuration based on the provided deleted
055     * entry.
056     *
057     * @param configEntry
058     *            The new configuration entry that has been deleted.
059     * @return Information about the result of processing the configuration
060     *         change.
061     */
062    ConfigChangeResult applyConfigurationDelete(Entry configEntry);
063}