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 */
016package org.opends.server.admin.std.client;
017
018
019
020import java.util.Collection;
021import java.util.SortedSet;
022import org.opends.server.admin.client.AuthorizationException;
023import org.opends.server.admin.client.CommunicationException;
024import org.opends.server.admin.client.ConcurrentModificationException;
025import org.opends.server.admin.client.IllegalManagedObjectNameException;
026import org.opends.server.admin.client.ManagedObjectDecodingException;
027import org.opends.server.admin.client.OperationRejectedException;
028import org.opends.server.admin.ConfigurationClient;
029import org.opends.server.admin.DefinitionDecodingException;
030import org.opends.server.admin.ManagedObjectDefinition;
031import org.opends.server.admin.ManagedObjectNotFoundException;
032import org.opends.server.admin.PropertyException;
033import org.opends.server.admin.std.meta.RootDNCfgDefn.DefaultRootPrivilegeName;
034import org.opends.server.admin.std.server.RootDNCfg;
035import org.opends.server.admin.std.server.RootDNUserCfg;
036
037
038
039/**
040 * A client-side interface for reading and modifying Root DN settings.
041 * <p>
042 * The Root DN configuration contains all the Root DN Users defined in
043 * the directory server. In addition, it also defines the default set
044 * of privileges that Root DN Users automatically inherit.
045 */
046public interface RootDNCfgClient extends ConfigurationClient {
047
048  /**
049   * Get the configuration definition associated with this Root DN.
050   *
051   * @return Returns the configuration definition associated with this Root DN.
052   */
053  ManagedObjectDefinition<? extends RootDNCfgClient, ? extends RootDNCfg> definition();
054
055
056
057  /**
058   * Gets the "default-root-privilege-name" property.
059   * <p>
060   * Specifies the names of the privileges that root users will be
061   * granted by default.
062   *
063   * @return Returns the values of the "default-root-privilege-name" property.
064   */
065  SortedSet<DefaultRootPrivilegeName> getDefaultRootPrivilegeName();
066
067
068
069  /**
070   * Sets the "default-root-privilege-name" property.
071   * <p>
072   * Specifies the names of the privileges that root users will be
073   * granted by default.
074   *
075   * @param values The values of the "default-root-privilege-name" property.
076   * @throws PropertyException
077   *           If one or more of the new values are invalid.
078   */
079  void setDefaultRootPrivilegeName(Collection<DefaultRootPrivilegeName> values) throws PropertyException;
080
081
082
083  /**
084   * Lists the Root DN Users.
085   *
086   * @return Returns an array containing the names of the Root DN
087   *         Users.
088   * @throws ConcurrentModificationException
089   *           If this Root DN has been removed from the server by
090   *           another client.
091   * @throws AuthorizationException
092   *           If the server refuses to list the Root DN Users because
093   *           the client does not have the correct privileges.
094   * @throws CommunicationException
095   *           If the client cannot contact the server due to an
096   *           underlying communication problem.
097   */
098  String[] listRootDNUsers() throws ConcurrentModificationException,
099      AuthorizationException, CommunicationException;
100
101
102
103  /**
104   * Gets the named Root DN User.
105   *
106   * @param name
107   *           The name of the Root DN User to retrieve.
108   * @return Returns the named Root DN User.
109   * @throws DefinitionDecodingException
110   *           If the named Root DN User was found but its type could
111   *           not be determined.
112   * @throws ManagedObjectDecodingException
113   *           If the named Root DN User was found but one or more of
114   *           its properties could not be decoded.
115   * @throws ManagedObjectNotFoundException
116   *           If the named Root DN User was not found on the server.
117   * @throws ConcurrentModificationException
118   *           If this Root DN has been removed from the server by
119   *           another client.
120   * @throws AuthorizationException
121   *           If the server refuses to retrieve the named Root DN
122   *           User because the client does not have the correct
123   *           privileges.
124   * @throws CommunicationException
125   *           If the client cannot contact the server due to an
126   *           underlying communication problem.
127   */
128  RootDNUserCfgClient getRootDNUser(String name)
129      throws DefinitionDecodingException, ManagedObjectDecodingException,
130      ManagedObjectNotFoundException, ConcurrentModificationException,
131      AuthorizationException, CommunicationException;
132
133
134
135  /**
136   * Creates a new Root DN User. The new Root DN User will initially
137   * not contain any property values (including mandatory properties).
138   * Once the Root DN User has been configured it can be added to the
139   * server using the {@link #commit()} method.
140   *
141   * @param <C>
142   *          The type of the Root DN User being created.
143   * @param d
144   *          The definition of the Root DN User to be created.
145   * @param name
146   *          The name of the new Root DN User.
147   * @param exceptions
148   *          An optional collection in which to place any {@link
149   *          PropertyException}s that occurred whilst attempting to
150   *          determine the default values of the Root DN User. This
151   *          argument can be <code>null<code>.
152   * @return Returns a new Root DN User configuration instance.
153   * @throws IllegalManagedObjectNameException
154   *          If the name of the new Root DN User is invalid.
155   */
156  <C extends RootDNUserCfgClient> C createRootDNUser(
157      ManagedObjectDefinition<C, ? extends RootDNUserCfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
158
159
160
161  /**
162   * Removes the named Root DN User.
163   *
164   * @param name
165   *          The name of the Root DN User to remove.
166   * @throws ManagedObjectNotFoundException
167   *           If the Root DN User does not exist.
168   * @throws OperationRejectedException
169   *           If the server refuses to remove the Root DN User due to
170   *           some server-side constraint which cannot be satisfied
171   *           (for example, if it is referenced by another managed
172   *           object).
173   * @throws ConcurrentModificationException
174   *           If this Root DN has been removed from the server by
175   *           another client.
176   * @throws AuthorizationException
177   *           If the server refuses to remove the Root DN User
178   *           because the client does not have the correct privileges.
179   * @throws CommunicationException
180   *           If the client cannot contact the server due to an
181   *           underlying communication problem.
182   */
183  void removeRootDNUser(String name)
184      throws ManagedObjectNotFoundException, OperationRejectedException,
185      ConcurrentModificationException, AuthorizationException,
186      CommunicationException;
187
188}