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.forgerock.opendj.server.config.client; 027 028 029 030import java.util.Collection; 031import java.util.SortedSet; 032import org.forgerock.opendj.config.client.ConcurrentModificationException; 033import org.forgerock.opendj.config.client.IllegalManagedObjectNameException; 034import org.forgerock.opendj.config.client.ManagedObjectDecodingException; 035import org.forgerock.opendj.config.client.OperationRejectedException; 036import org.forgerock.opendj.config.ConfigurationClient; 037import org.forgerock.opendj.config.DefinitionDecodingException; 038import org.forgerock.opendj.config.ManagedObjectDefinition; 039import org.forgerock.opendj.config.ManagedObjectNotFoundException; 040import org.forgerock.opendj.config.PropertyException; 041import org.forgerock.opendj.ldap.LdapException; 042import org.forgerock.opendj.server.config.meta.RootDNCfgDefn.DefaultRootPrivilegeName; 043import org.forgerock.opendj.server.config.server.RootDNCfg; 044import org.forgerock.opendj.server.config.server.RootDNUserCfg; 045 046 047 048/** 049 * A client-side interface for reading and modifying Root DN settings. 050 * <p> 051 * The Root DN configuration contains all the Root DN Users defined in 052 * the directory server. In addition, it also defines the default set 053 * of privileges that Root DN Users automatically inherit. 054 */ 055public interface RootDNCfgClient extends ConfigurationClient { 056 057 /** 058 * Get the configuration definition associated with this Root DN. 059 * 060 * @return Returns the configuration definition associated with this Root DN. 061 */ 062 ManagedObjectDefinition<? extends RootDNCfgClient, ? extends RootDNCfg> definition(); 063 064 065 066 /** 067 * Gets the "default-root-privilege-name" property. 068 * <p> 069 * Specifies the names of the privileges that root users will be 070 * granted by default. 071 * 072 * @return Returns the values of the "default-root-privilege-name" property. 073 */ 074 SortedSet<DefaultRootPrivilegeName> getDefaultRootPrivilegeName(); 075 076 077 078 /** 079 * Sets the "default-root-privilege-name" property. 080 * <p> 081 * Specifies the names of the privileges that root users will be 082 * granted by default. 083 * 084 * @param values The values of the "default-root-privilege-name" property. 085 * @throws PropertyException 086 * If one or more of the new values are invalid. 087 */ 088 void setDefaultRootPrivilegeName(Collection<DefaultRootPrivilegeName> values) throws PropertyException; 089 090 091 092 /** 093 * Lists the Root DN Users. 094 * 095 * @return Returns an array containing the names of the Root DN 096 * Users. 097 * @throws ConcurrentModificationException 098 * If this Root DN has been removed from the server by 099 * another client. 100 * @throws LdapException 101 * If any other error occurs. 102 */ 103 String[] listRootDNUsers() throws ConcurrentModificationException, 104 LdapException; 105 106 107 108 /** 109 * Gets the named Root DN User. 110 * 111 * @param name 112 * The name of the Root DN User to retrieve. 113 * @return Returns the named Root DN User. 114 * @throws DefinitionDecodingException 115 * If the named Root DN User was found but its type could 116 * not be determined. 117 * @throws ManagedObjectDecodingException 118 * If the named Root DN User was found but one or more of 119 * its properties could not be decoded. 120 * @throws ManagedObjectNotFoundException 121 * If the named Root DN User was not found on the server. 122 * @throws ConcurrentModificationException 123 * If this Root DN has been removed from the server by 124 * another client. 125 * @throws LdapException 126 * If any other error occurs. 127 */ 128 RootDNUserCfgClient getRootDNUser(String name) 129 throws DefinitionDecodingException, ManagedObjectDecodingException, 130 ManagedObjectNotFoundException, ConcurrentModificationException, 131 LdapException; 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 LdapException 177 * If any other error occurs. 178 */ 179 void removeRootDNUser(String name) 180 throws ManagedObjectNotFoundException, OperationRejectedException, 181 ConcurrentModificationException, LdapException; 182 183}