BaseDnRegistry.java revision 3215
2593N/A * The contents of this file are subject to the terms of the 2593N/A * Common Development and Distribution License, Version 1.0 only 2593N/A * (the "License"). You may not use this file except in compliance 2593N/A * You can obtain a copy of the license at 2593N/A * See the License for the specific language governing permissions 2593N/A * and limitations under the License. 2593N/A * When distributing Covered Code, include this CDDL HEADER in each 2593N/A * file and include the License file at 2593N/A * add the following below this CDDL HEADER, with the fields enclosed 2593N/A * by brackets "[]" replaced with your own identifying information: 2593N/A * Portions Copyright [yyyy] [name of copyright owner] 3215N/A * Copyright 2007-2008 Sun Microsystems, Inc. 2593N/A * Registry for maintaining the set of registered base DN's, assocated 2593N/A * backends and naming context information. 2593N/A // The set of base DNs registered with the server. 2593N/A // The set of private naming contexts registered with the server. 2593N/A // The set of public naming contexts registered with the server. 2593N/A // Indicates whether or not this base DN registry is in test mode. 2593N/A // A registry instance that is in test mode will not modify backend 2593N/A // objects referred to in the above maps. 2593N/A * Registers a base DN with this registry. 2593N/A * @param baseDN to register 2593N/A * @param backend with which the base DN is assocated 2593N/A * @param isPrivate indicates whether or not this base DN is private 2593N/A * @return list of error messages generated by registering the base DN 2593N/A * that should be logged if the changes to this registry are 2593N/A * @throws DirectoryException if the base DN cannot be registered 2593N/A // Check to see if the base DN is already registered with the server. 2593N/A // Check to see if the backend is already registered with the server for 2593N/A // any other base DN(s). The new base DN must not have any hierarchical 2593N/A // relationship with any other base Dns for the same backend. 2593N/A // Check to see if the new base DN is subordinate to any other base DN 2593N/A // already defined. If it is, then any other base DN(s) for the same 2593N/A // backend must also be subordinate to the same base DN. 2593N/A // Check to see if the new base DN should be the superior base DN for any 2593N/A // other base DN(s) already defined. 2593N/A // If we've gotten here, then the new base DN is acceptable. If we should 2593N/A // actually apply the changes then do so now. 2593N/A // Check to see if any of the registered backends already contain an 2593N/A // entry with the DN specified as the base DN. This could happen if 2593N/A // we're creating a new subordinate backend in an existing directory 2593N/A // (e.g., moving the "ou=People,dc=example,dc=com" branch to its own 2593N/A // backend when that data already exists under the "dc=example,dc=com" 2593N/A // backend). This condition shouldn't prevent the new base DN from 2593N/A // being registered, but it's definitely important enough that we let 2593N/A // the administrator know about it and remind them that the existing 2593N/A // backend will need to be reinitialized. 2593N/A * Deregisters a base DN with this registry. 2593N/A * @param baseDN to deregister 2593N/A * @return list of error messages generated by deregistering the base DN 2593N/A * that should be logged if the changes to this registry are 2593N/A * @throws DirectoryException if the base DN could not be deregistered 2593N/A // Make sure that the Directory Server actually contains a backend with 2593N/A // Check to see if the backend has a parent backend, and whether it has 2593N/A // any subordinates with base DNs that are below the base DN to remove. 2593N/A // See if there are any other base DNs registered within the same backend. 2593N/A // If we've gotten here, then it's OK to make the changes. 2593N/A // Get rid of the references to this base DN in the mapping tree 2593N/A // If there were any subordinate backends, then all of their base DNs 2593N/A // will now be promoted to naming contexts. 2593N/A // If there are no other base DNs for the associated backend, then 2593N/A // remove this backend as a subordinate of the parent backend. 2593N/A // If there are any subordinate backends, then they need to be made 2593N/A // subordinate to the parent backend. Also, we should log a warning 2593N/A // message indicating that there may be inconsistent search results 2593N/A // because some of the structural entries will be missing. 3168N/A // Suppress this warning message on server shutdown. 2593N/A * Creates a default instance. 2593N/A * Returns a copy of this registry. 2593N/A * @return copy of this registry 2593N/A * Creates a parameterized instance. 2593N/A * @param publicNamingContexts map 2593N/A * @param privateNamingContexts map 2593N/A * @param testOnly indicates whether this registry will be used for testing; 2593N/A * when <code>true</code> this registry will not modify backends 2593N/A * Gets the mapping of registered base DNs to their associated backend. 2593N/A * @return mapping from base DN to backend 2593N/A * Gets the mapping of registered public naming contexts to their 2593N/A * @return mapping from naming context to backend 2593N/A * Gets the mapping of registered private naming contexts to their 2593N/A * @return mapping from naming context to backend 2593N/A * Indicates whether the specified DN is contained in this registry as 2593N/A * @param dn The DN for which to make the determination. 2593N/A * @return {@code true} if the specified DN is a naming context in this 2593N/A * registry, or {@code false} if it is not. 2593N/A * Clear and nullify this registry's internal state.