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 2007-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 configuration is
029 * changed.
030 *
031 * @param <T>
032 *          The type of configuration that this listener should be
033 *          notified about.
034 */
035public interface ConfigurationChangeListener<T extends Configuration> {
036
037  /**
038   * Indicates whether the proposed change to the configuration is
039   * acceptable to this change listener.
040   *
041   * @param configuration
042   *          The new configuration containing the changes.
043   * @param unacceptableReasons
044   *          A list that can be used to hold messages about why the
045   *          provided configuration 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(T configuration,
050      List<LocalizableMessage> unacceptableReasons);
051
052  /**
053   * Applies the configuration changes to this change listener.
054   *
055   * @param configuration
056   *          The new configuration containing the changes.
057   * @return Returns information about the result of changing the
058   *         configuration.
059   */
060  ConfigChangeResult applyConfigurationChange(T configuration);
061}