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 *      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 new server managed object is added.
039 *
040 * @param <T>
041 *          The type of server managed object that this listener
042 *          should be notified about.
043 */
044public interface ServerManagedObjectAddListener<T extends Configuration> {
045
046  /**
047   * Indicates whether the proposed addition of a new server managed
048   * object is acceptable to this add listener.
049   *
050   * @param mo
051   *          The server managed object that will be added.
052   * @param unacceptableReasons
053   *          A list that can be used to hold messages about why the
054   *          provided server managed object is not acceptable.
055   * @return Returns <code>true</code> if the proposed addition is
056   *         acceptable, or <code>false</code> if it is not.
057   */
058  boolean isConfigurationAddAcceptable(
059      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
060
061
062
063  /**
064   * Adds a new server managed object to this add listener.
065   *
066   * @param mo
067   *          The server managed object that will be added.
068   * @return Returns information about the result of adding the server
069   *         managed object.
070   */
071  ConfigChangeResult applyConfigurationAdd(
072      ServerManagedObject<? extends T> mo);
073}