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