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 2007-2008 Sun Microsystems, Inc.
025 */
026package org.forgerock.opendj.config.server;
027
028import org.forgerock.i18n.LocalizableMessage;
029import org.forgerock.opendj.config.Configuration;
030
031import java.util.List;
032
033/**
034 * This interface defines the methods that a Directory Server configurable
035 * component should implement if it wishes to be able to receive notifications
036 * when an existing configuration is deleted.
037 *
038 * @param <T>
039 *            The type of configuration that this listener should be notified
040 *            about.
041 */
042public interface ConfigurationDeleteListener<T extends Configuration> {
043
044    /**
045     * Indicates whether the proposed deletion of an existing configuration is
046     * acceptable to this delete listener.
047     *
048     * @param configuration
049     *            The configuration that will be deleted.
050     * @param unacceptableReasons
051     *            A list that can be used to hold messages about why the
052     *            provided configuration is not acceptable.
053     * @return Returns <code>true</code> if the proposed deletion is acceptable,
054     *         or <code>false</code> if it is not.
055     */
056    boolean isConfigurationDeleteAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons);
057
058    /**
059     * Deletes an existing configuration from this delete listener.
060     *
061     * @param configuration
062     *            The existing configuration that will be deleted.
063     * @return Returns information about the result of deleting the
064     *         configuration.
065     */
066    ConfigChangeResult applyConfigurationDelete(T configuration);
067}