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 *      Portions Copyright 2014-2015 ForgeRock AS
026 */
027package org.opends.server.api;
028
029import org.opends.server.config.ConfigEntry;
030import org.forgerock.opendj.config.server.ConfigChangeResult;
031import org.forgerock.i18n.LocalizableMessageBuilder;
032
033/**
034 * This interface defines the methods that a Directory Server
035 * component should implement if it wishes to be able to receive
036 * notification if entries below a configuration entry are removed.
037 */
038@org.opends.server.types.PublicAPI(
039     stability=org.opends.server.types.StabilityLevel.VOLATILE,
040     mayInstantiate=false,
041     mayExtend=true,
042     mayInvoke=false)
043public interface ConfigDeleteListener
044{
045  /**
046   * Indicates whether it is acceptable to remove the provided
047   * configuration entry.
048   *
049   * @param  configEntry         The configuration entry that will be
050   *                             removed from the configuration.
051   * @param  unacceptableReason  A buffer to which this method can
052   *                             append a human-readable message
053   *                             explaining why the proposed delete is
054   *                             not acceptable.
055   *
056   * @return  {@code true} if the proposed entry may be removed from
057   *          the configuration, or {@code false} if not.
058   */
059  boolean configDeleteIsAcceptable(ConfigEntry configEntry,
060                      LocalizableMessageBuilder unacceptableReason);
061
062
063
064  /**
065   * Attempts to apply a new configuration based on the provided
066   * deleted entry.
067   *
068   * @param  configEntry  The new configuration entry that has been
069   *                      deleted.
070   *
071   * @return  Information about the result of processing the
072   *          configuration change.
073   */
074  ConfigChangeResult applyConfigurationDelete(ConfigEntry configEntry);
075}
076