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 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 server managed object is deleted.
037 *
038 * @param <T>
039 *            The type of server managed object that this listener should be
040 *            notified about.
041 */
042public interface ServerManagedObjectDeleteListener<T extends Configuration> {
043
044    /**
045     * Indicates whether the proposed deletion of an existing server managed
046     * object is acceptable to this delete listener.
047     *
048     * @param mo
049     *            The server managed object that will be deleted.
050     * @param unacceptableReasons
051     *            A list that can be used to hold messages about why the
052     *            provided server managed object 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(ServerManagedObject<? extends T> mo,
057            List<LocalizableMessage> unacceptableReasons);
058
059    /**
060     * Deletes an existing server managed object from this delete listener.
061     *
062     * @param mo
063     *            The existing server managed object that will be deleted.
064     * @return Returns information about the result of deleting the server
065     *         managed object.
066     */
067    ConfigChangeResult applyConfigurationDelete(ServerManagedObject<? extends T> mo);
068}