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 a its associated server managed object
029 * is changed.
030 *
031 * @param <T>
032 *          The type of server managed object that this listener
033 *          should be notified about.
034 */
035public interface ServerManagedObjectChangeListener<T extends Configuration> {
036
037  /**
038   * Indicates whether the proposed change to the server managed
039   * object is acceptable to this change listener.
040   *
041   * @param mo
042   *          The new server managed object containing the changes.
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 change is
047   *         acceptable, or <code>false</code> if it is not.
048   */
049  boolean isConfigurationChangeAcceptable(
050      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
051
052
053
054  /**
055   * Applies the server managed object changes to this change
056   * listener.
057   *
058   * @param mo
059   *          The new server managed object containing the changes.
060   * @return Returns information about the result of changing the
061   *         server managed object.
062   */
063  ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends T> mo);
064}