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