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 new configuration is added.
029 *
030 * @param <T>
031 *          The type of configuration that this listener should be
032 *          notified about.
033 */
034public interface ConfigurationAddListener<T extends Configuration> {
035
036  /**
037   * Indicates whether the proposed addition of a new configuration is
038   * acceptable to this add listener.
039   *
040   * @param configuration
041   *          The configuration that will be added.
042   * @param unacceptableReasons
043   *          A list that can be used to hold messages about why the
044   *          provided configuration is not acceptable.
045   * @return Returns <code>true</code> if the proposed addition is
046   *         acceptable, or <code>false</code> if it is not.
047   */
048  boolean isConfigurationAddAcceptable(T configuration,
049      List<LocalizableMessage> unacceptableReasons);
050
051
052
053  /**
054   * Adds a new configuration to this add listener.
055   *
056   * @param configuration
057   *          The configuration that will be added.
058   * @return Returns information about the result of adding the
059   *         configuration.
060   */
061  ConfigChangeResult applyConfigurationAdd(T configuration);
062}