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