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