org.apache.directory.server.core.partition
Class PartitionNexus

java.lang.Object
  extended by org.apache.directory.server.core.partition.PartitionNexus
All Implemented Interfaces:
Partition
Direct Known Subclasses:
DefaultPartitionNexus, PartitionNexusProxy

public abstract class PartitionNexus
extends java.lang.Object
implements Partition

A root Partition 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: 434579 $, $Date: 2006-08-24 20:19:11 -0400 (Thu, 24 Aug 2006) $
Author:
Apache Directory Project

Field Summary
static java.lang.String ADMIN_PASSWORD
          the initial admin passwd set on startup
static java.lang.String ADMIN_PRINCIPAL
          the default user principal or DN
static java.lang.String ADMIN_PRINCIPAL_NORMALIZED
          the normalized user principal or DN
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 partition suffix constant.
static java.lang.String USERS_BASE_NAME
          the base dn under which all users reside
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
PartitionNexus()
           
 
Method Summary
abstract  void addContextPartition(PartitionConfiguration config)
           
abstract  boolean compare(LdapDN name, java.lang.String oid, java.lang.Object value)
          Performs a comparison check to see if an attribute of an entry has a specified value.
static LdapDN getAdminName()
          Gets the DN for the admin user.
static LdapDN 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  LdapDN getMatchedName(LdapDN name)
          Gets the most significant Dn that exists within the server for any Dn.
abstract  Partition getPartition(LdapDN dn)
          Get's the partition corresponding to a distinguished name.
abstract  javax.naming.directory.Attributes getRootDSE()
          Get's the RootDSE entry for the DSA.
abstract  LdapDN getSuffix(LdapDN name)
          Gets the distinguished name of the suffix that would hold an entry with the supplied distinguished name parameter.
abstract  Partition getSystemPartition()
           
static LdapDN getUsersBaseName()
          Gets the DN for the base entry under which all non-admin users reside.
abstract  java.util.Iterator listSuffixes()
          Gets an iteration over the Name suffixes of the partitions managed by this PartitionNexus.
abstract  void registerSupportedExtensions(java.util.Set extensionOids)
          Adds a set of supportedExtension (OID Strings) to the RootDSE.
abstract  void removeContextPartition(LdapDN 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.directory.server.core.partition.Partition
add, bind, delete, destroy, getSuffix, getUpSuffix, hasEntry, init, isInitialized, isSuffix, list, lookup, lookup, modify, modify, modifyRn, move, move, search, sync, unbind
 

Field Detail

ADMIN_PRINCIPAL

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

See Also:
Constant Field Values

ADMIN_PRINCIPAL_NORMALIZED

public static final java.lang.String ADMIN_PRINCIPAL_NORMALIZED
the normalized 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_PASSWORD

public static final java.lang.String ADMIN_PASSWORD
the initial admin passwd set on startup

See Also:
Constant Field Values

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 partition 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

PartitionNexus

public PartitionNexus()
Method Detail

getAdminName

public static final LdapDN getAdminName()
Gets the DN for the admin user.

Returns:
the admin user DN

getGroupsBaseName

public static final LdapDN 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 LdapDN 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

compare

public abstract boolean compare(LdapDN name,
                                java.lang.String oid,
                                java.lang.Object value)
                         throws javax.naming.NamingException
Performs a comparison check to see if an attribute of an entry has a specified value.

Parameters:
name - the normalized name of the entry
oid - the attribute being compared
value - the value the attribute is compared to
Returns:
true if the entry contains an attribute with the value, false otherwise
Throws:
javax.naming.NamingException - if there is a problem accessing the entry and its values

addContextPartition

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

removeContextPartition

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

getSystemPartition

public abstract Partition getSystemPartition()

getPartition

public abstract Partition getPartition(LdapDN dn)
                                throws javax.naming.NamingException
Get's the partition corresponding to a distinguished name. This name need not be the name of the partition suffix. When used in conjunction with get suffix this can properly find the partition associated with the DN. Make sure to use the normalized DN.

Parameters:
dn - the normalized distinguished name to get a partition for
Returns:
the partition containing the entry represented by the dn
Throws:
javax.naming.NamingException - if there is no partition for the dn

getMatchedName

public abstract LdapDN getMatchedName(LdapDN name)
                               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.
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 LdapDN getSuffix(LdapDN name)
                          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.
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()
                                         throws javax.naming.NamingException
Gets an iteration over the Name suffixes of the partitions managed by this PartitionNexus.

Returns:
Iteration over ContextPartition suffix names as Names.
Throws:
javax.naming.NamingException - if there are any problems

registerSupportedExtensions

public abstract void registerSupportedExtensions(java.util.Set extensionOids)
Adds a set of supportedExtension (OID Strings) to the RootDSE.

Parameters:
extensionOids - a set of OID strings to add to the supportedExtension attribute in the RootDSE