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