org.apache.ldap.server.partition
Class ContextPartitionNexus

java.lang.Object
  extended byorg.apache.ldap.server.partition.ContextPartitionNexus
All Implemented Interfaces:
ContextPartition
Direct Known Subclasses:
DefaultContextPartitionNexus

public abstract class ContextPartitionNexus
extends java.lang.Object
implements ContextPartition

A root ContextPartition that contains all other partitions, and routes all operations to the child partition that matches to its base suffixes. It also provides some extended operations such as accessing rootDSE and listing base suffixes.

Version:
$Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
Author:
Apache Directory Project

Field Summary
static java.lang.String ADMIN_PRINCIPAL
          the default user principal or DN
static byte[] ADMIN_PW
          the initial admin passwd set on startup
static java.lang.String ADMIN_UID
          the admin super user uid
static java.lang.String GROUPS_BASE_NAME
          the base dn under which all groups reside
static java.lang.String SYSTEM_PARTITION_SUFFIX
          System backend suffix constant.
static java.lang.String USERS_BASE_NAME
          the base dn under which all users reside
 
Fields inherited from interface org.apache.ldap.server.partition.ContextPartition
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
ContextPartitionNexus()
           
 
Method Summary
abstract  void addContextPartition(ContextPartitionConfiguration config)
           
static javax.naming.Name getAdminName()
          Gets the DN for the admin user.
static javax.naming.Name getGroupsBaseName()
          Gets the DN for the base entry under which all groups reside.
abstract  javax.naming.ldap.LdapContext getLdapContext()
          Gets the LdapContext associated with the calling thread.
abstract  javax.naming.Name getMatchedName(javax.naming.Name name, boolean normalized)
          Gets the most significant Dn that exists within the server for any Dn.
abstract  javax.naming.directory.Attributes getRootDSE()
          Get's the RootDSE entry for the DSA.
abstract  javax.naming.Name getSuffix(javax.naming.Name name, boolean normalized)
          Gets the distinguished name of the suffix that would hold an entry with the supplied distinguished name parameter.
abstract  ContextPartition getSystemPartition()
           
static javax.naming.Name getUsersBaseName()
          Gets the DN for the base entry under which all non-admin users reside.
abstract  java.util.Iterator listSuffixes(boolean normalized)
          Gets an iteration over the Name suffixes of the Backends managed by this ContextPartitionNexus.
abstract  void removeContextPartition(javax.naming.Name suffix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ldap.server.partition.ContextPartition
add, delete, destroy, getSuffix, hasEntry, init, isInitialized, isSuffix, list, lookup, lookup, modify, modify, modifyRn, move, move, search, sync
 

Field Detail

ADMIN_PRINCIPAL

public static final java.lang.String ADMIN_PRINCIPAL
the default user principal or DN

See Also:
Constant Field Values

ADMIN_UID

public static final java.lang.String ADMIN_UID
the admin super user uid

See Also:
Constant Field Values

ADMIN_PW

public static final byte[] ADMIN_PW
the initial admin passwd set on startup


USERS_BASE_NAME

public static final java.lang.String USERS_BASE_NAME
the base dn under which all users reside

See Also:
Constant Field Values

GROUPS_BASE_NAME

public static final java.lang.String GROUPS_BASE_NAME
the base dn under which all groups reside

See Also:
Constant Field Values

SYSTEM_PARTITION_SUFFIX

public static final java.lang.String SYSTEM_PARTITION_SUFFIX
System backend suffix constant. Should be kept down to a single Dn name component or the default constructor will have to parse it instead of building the name. Note that what ever the SUFFIX equals it should be both the normalized and the user provided form.

See Also:
Constant Field Values
Constructor Detail

ContextPartitionNexus

public ContextPartitionNexus()
Method Detail

getAdminName

public static final javax.naming.Name getAdminName()
Gets the DN for the admin user.

Returns:
the admin user DN

getGroupsBaseName

public static final javax.naming.Name getGroupsBaseName()
Gets the DN for the base entry under which all groups reside. A new Name instance is created and returned every time.

Returns:
the groups base DN

getUsersBaseName

public static final javax.naming.Name getUsersBaseName()
Gets the DN for the base entry under which all non-admin users reside. A new Name instance is created and returned every time.

Returns:
the users base DN

getLdapContext

public abstract javax.naming.ldap.LdapContext getLdapContext()
Gets the LdapContext associated with the calling thread.

Returns:
The LdapContext associated with the thread of execution or null if no context is associated with the calling thread.

getRootDSE

public abstract javax.naming.directory.Attributes getRootDSE()
                                                      throws javax.naming.NamingException
Get's the RootDSE entry for the DSA.

Returns:
the attributes of the RootDSE
Throws:
javax.naming.NamingException

addContextPartition

public abstract void addContextPartition(ContextPartitionConfiguration config)
                                  throws javax.naming.NamingException
Throws:
javax.naming.NamingException

removeContextPartition

public abstract void removeContextPartition(javax.naming.Name suffix)
                                     throws javax.naming.NamingException
Throws:
javax.naming.NamingException

getSystemPartition

public abstract ContextPartition getSystemPartition()

getMatchedName

public abstract javax.naming.Name getMatchedName(javax.naming.Name name,
                                                 boolean normalized)
                                          throws javax.naming.NamingException
Gets the most significant Dn that exists within the server for any Dn.

Parameters:
name - the normalized distinguished name to use for matching.
normalized - boolean if true cause the return of a normalized Dn, if false it returns the original user provided distinguished name for the matched portion of the Dn as it was provided on entry creation.
Returns:
a distinguished name representing the matching portion of dn, as originally provided by the user on creation of the matched entry or the empty string distinguished name if no match was found.
Throws:
javax.naming.NamingException - if there are any problems

getSuffix

public abstract javax.naming.Name getSuffix(javax.naming.Name name,
                                            boolean normalized)
                                     throws javax.naming.NamingException
Gets the distinguished name of the suffix that would hold an entry with the supplied distinguished name parameter. If the DN argument does not fall under a partition suffix then the empty string Dn is returned.

Parameters:
name - the normalized distinguished name to use for finding a suffix.
normalized - if true causes the return of a normalized Dn, but if false it returns the original user provided distinguished name for the suffix Dn as it was provided on suffix entry creation.
Returns:
the suffix portion of dn, or the valid empty string Dn if no naming context was found for dn.
Throws:
javax.naming.NamingException - if there are any problems

listSuffixes

public abstract java.util.Iterator listSuffixes(boolean normalized)
                                         throws javax.naming.NamingException
Gets an iteration over the Name suffixes of the Backends managed by this ContextPartitionNexus.

Parameters:
normalized - if true the returned Iterator contains normalized Dn but, if false, it returns the original user provided distinguished names in the Iterator.
Returns:
Iteration over ContextPartition suffix names as Names.
Throws:
javax.naming.NamingException - if there are any problems


Copyright © 2002-2005 . All Rights Reserved.