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