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 2007-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2014-2015 ForgeRock AS
026 */
027package org.opends.server.admin.server;
028
029import java.util.List;
030
031import org.forgerock.i18n.LocalizableMessage;
032import org.forgerock.opendj.config.server.ConfigChangeResult;
033import org.opends.server.admin.Configuration;
034
035/**
036 * This interface defines the methods that a Directory Server
037 * configurable component should implement if it wishes to be able to
038 * receive notifications when a its associated configuration is
039 * changed.
040 *
041 * @param <T>
042 *          The type of configuration that this listener should be
043 *          notified about.
044 */
045public interface ConfigurationChangeListener<T extends Configuration> {
046
047  /**
048   * Indicates whether the proposed change to the configuration is
049   * acceptable to this change listener.
050   *
051   * @param configuration
052   *          The new configuration containing the changes.
053   * @param unacceptableReasons
054   *          A list that can be used to hold messages about why the
055   *          provided configuration is not acceptable.
056   * @return Returns <code>true</code> if the proposed change is
057   *         acceptable, or <code>false</code> if it is not.
058   */
059  boolean isConfigurationChangeAcceptable(T configuration,
060      List<LocalizableMessage> unacceptableReasons);
061
062  /**
063   * Applies the configuration changes to this change listener.
064   *
065   * @param configuration
066   *          The new configuration containing the changes.
067   * @return Returns information about the result of changing the
068   *         configuration.
069   */
070  ConfigChangeResult applyConfigurationChange(T configuration);
071}