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