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