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-2016 ForgeRock AS.
016 */
017
018package org.forgerock.opendj.config;
019
020import org.forgerock.opendj.config.client.ConcurrentModificationException;
021import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException;
022import org.forgerock.opendj.config.client.OperationRejectedException;
023import org.forgerock.opendj.ldap.LdapException;
024
025/** A common base interface for all managed object configuration clients. */
026public interface ConfigurationClient {
027
028    /**
029     * Get the configuration definition associated with this configuration.
030     *
031     * @return Returns the configuration definition associated with this
032     *         configuration.
033     */
034    ManagedObjectDefinition<? extends ConfigurationClient, ? extends Configuration> definition();
035
036    /**
037     * Get a property provider view of this configuration.
038     *
039     * @return Returns a property provider view of this configuration.
040     */
041    PropertyProvider properties();
042
043    /**
044     * If this is a new configuration this method will attempt to add it to the
045     * server, otherwise it will commit any changes made to this configuration.
046     *
047     * @throws ManagedObjectAlreadyExistsException
048     *             If this is a new configuration but it could not be added to
049     *             the server because it already exists.
050     * @throws MissingMandatoryPropertiesException
051     *             If this configuration contains some mandatory properties
052     *             which have been left undefined.
053     * @throws ConcurrentModificationException
054     *             If this is a new configuration which is being added to the
055     *             server but its parent has been removed by another client, or
056     *             if this configuration is being modified but it has been
057     *             removed from the server by another client.
058     * @throws OperationRejectedException
059     *             If the server refuses to add or modify this configuration due
060     *             to some server-side constraint which cannot be satisfied.
061     * @throws LdapException
062     *             If any other error occurs.
063     */
064    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
065        ConcurrentModificationException, OperationRejectedException, LdapException;
066
067}