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