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