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

java.lang.Object
  extended by org.apache.directory.server.core.partition.PartitionNexus
      extended by org.apache.directory.server.core.partition.DefaultPartitionNexus
All Implemented Interfaces:
Partition

public class DefaultPartitionNexus
extends PartitionNexus

A nexus for partitions dedicated for storing entries specific to a naming context.

Version:
$Rev: 689588 $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.server.core.partition.PartitionNexus
ADMIN_PASSWORD_BYTES, ADMIN_PASSWORD_STRING, ADMIN_UID
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
DEFAULT_CACHE_SIZE, DEFAULT_PARTITION_IMPLEMENTATION, SYSTEM_PARTITION_NAME
 
Constructor Summary
DefaultPartitionNexus(ServerEntry rootDSE)
          Creates the root nexus singleton of the entire system.
 
Method Summary
 void add(AddOperationContext addContext)
          Looks up the backend corresponding to the entry first, then checks to see if the entry already exists.
 void addContextPartition(AddContextPartitionOperationContext opContext)
           
 void bind(BindOperationContext bindContext)
          Represents a bind operation issued to authenticate a client.
 boolean compare(CompareOperationContext compareContext)
          Performs a comparison check to see if an attribute of an entry has a specified value.
 void delete(DeleteOperationContext deleteContext)
          Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be deleted until this operation has been applied to their children.
 void destroy()
          Deinitialized this partition.
 int getCacheSize()
          Not supported!
 java.lang.String getId()
          Always returns the string "NEXUS".
 javax.naming.ldap.LdapContext getLdapContext()
          Gets the LdapContext associated with the calling thread.
 org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext matchedNameContext)
          Gets the most significant Dn that exists within the server for any Dn.
 Partition getPartition(org.apache.directory.shared.ldap.name.LdapDN dn)
          Gets the partition associated with a normalized dn.
 ClonedServerEntry getRootDSE(GetRootDSEOperationContext getRootDSEContext)
          Get's the RootDSE entry for the DSA.
 java.lang.String getSuffix()
          Always returns the empty String "".
 org.apache.directory.shared.ldap.name.LdapDN getSuffix(GetSuffixOperationContext getSuffixContext)
          Gets the distinguished name of the suffix that would hold an entry with the supplied distinguished name parameter.
 org.apache.directory.shared.ldap.name.LdapDN getSuffixDn()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 Partition getSystemPartition()
           
 org.apache.directory.shared.ldap.name.LdapDN getUpSuffixDn()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 boolean hasEntry(EntryOperationContext opContext)
          Fast operation to check and see if a particular entry exists.
 void init(DirectoryService directoryService)
          Initializes this partition.
 boolean isInitialized()
          Checks to see if this partition is initialized or not.
 EntryFilteringCursor list(ListOperationContext opContext)
          A specialized form of one level search used to return a minimal set of information regarding child entries under a base.
 java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext emptyContext)
          Gets an iteration over the Name suffixes of the partitions managed by this PartitionNexus.
 ClonedServerEntry lookup(java.lang.Long id)
           
 ClonedServerEntry lookup(LookupOperationContext opContext)
          Looks up an entry by distinguished/absolute name.
 void modify(ModifyOperationContext modifyContext)
          Modifies an entry by adding, removing or replacing a set of attributes.
 void move(MoveOperationContext opContext)
          Transplants a child entry, to a position in the namespace under a new parent entry.
 void moveAndRename(MoveAndRenameOperationContext opContext)
          Transplants a child entry, to a position in the namespace under a new parent entry and changes the RN of the child entry which can optionally have its old RN attributes removed.
 void registerSupportedExtensions(java.util.Set<java.lang.String> extensionOids)
          Adds a set of supportedExtension (OID Strings) to the RootDSE.
 void registerSupportedSaslMechanisms(java.util.Set<java.lang.String> supportedSaslMechanisms)
           
 void removeContextPartition(RemoveContextPartitionOperationContext removeContextPartition)
           
 void rename(RenameOperationContext opContext)
          Modifies an entry by changing its relative name.
 EntryFilteringCursor search(SearchOperationContext opContext)
          Conducts a search against this ContextPartition.
 void setCacheSize(int cacheSize)
          Not support!
 void setId(java.lang.String id)
          Not supported!
 void setSuffix(java.lang.String suffix)
          Unsupported operation on the Nexus.
 void sync()
          Flushes any changes made to this partition now.
 void unbind(UnbindOperationContext unbindContext)
          Represents an unbind operation issued by an authenticated client.
 
Methods inherited from class org.apache.directory.server.core.partition.PartitionNexus
getAdminName, getGroupsBaseName, getUsersBaseName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPartitionNexus

public DefaultPartitionNexus(ServerEntry rootDSE)
                      throws java.lang.Exception
Creates the root nexus singleton of the entire system. The root DSE has several attributes that are injected into it besides those that may already exist. As partitions are added to the system more namingContexts attributes are added to the rootDSE.

Parameters:
rootDSE - the root entry for the DSA
Throws:
javax.naming.Exception - on failure to initialize
java.lang.Exception
See Also:
Vendor Information
Method Detail

getId

public java.lang.String getId()
Always returns the string "NEXUS".

Returns:
the string "NEXUS"

setId

public void setId(java.lang.String id)
Not supported!

Parameters:
id - the unique identifier for this partition
Throws:
java.lang.UnsupportedOperationException - everytime

getSuffix

public java.lang.String getSuffix()
Always returns the empty String "".

Returns:
the empty String ""

setSuffix

public void setSuffix(java.lang.String suffix)
Unsupported operation on the Nexus.

Parameters:
suffix - the suffix string for this Partition.
Throws:
java.lang.UnsupportedOperationException - everytime

setCacheSize

public void setCacheSize(int cacheSize)
Not support!

Parameters:
cacheSize - the size of the cache

getCacheSize

public int getCacheSize()
Not supported!

Returns:
the size of the cache
Throws:
java.lang.UnsupportedOperationException - always

init

public void init(DirectoryService directoryService)
          throws java.lang.Exception
Description copied from interface: Partition
Initializes this partition.

Parameters:
directoryService - the directory core for the server.
Throws:
java.lang.Exception - if initialization fails in any way

isInitialized

public boolean isInitialized()
Description copied from interface: Partition
Checks to see if this partition is initialized or not.

Returns:
true if the partition is initialized, false otherwise

destroy

public void destroy()
Description copied from interface: Partition
Deinitialized this partition.


sync

public void sync()
          throws java.lang.Exception
Description copied from interface: Partition
Flushes any changes made to this partition now.

Throws:
java.lang.Exception - if buffers cannot be flushed to disk
See Also:
Partition.sync()

compare

public boolean compare(CompareOperationContext compareContext)
                throws java.lang.Exception
Description copied from class: PartitionNexus
Performs a comparison check to see if an attribute of an entry has a specified value.

Specified by:
compare in class PartitionNexus
Parameters:
compareContext - the context used to compare
Returns:
true if the entry contains an attribute with the value, false otherwise
Throws:
java.lang.Exception - if there is a problem accessing the entry and its values

addContextPartition

public void addContextPartition(AddContextPartitionOperationContext opContext)
                         throws java.lang.Exception
Specified by:
addContextPartition in class PartitionNexus
Throws:
java.lang.Exception

removeContextPartition

public void removeContextPartition(RemoveContextPartitionOperationContext removeContextPartition)
                            throws java.lang.Exception
Specified by:
removeContextPartition in class PartitionNexus
Throws:
java.lang.Exception

getSystemPartition

public Partition getSystemPartition()
Specified by:
getSystemPartition in class PartitionNexus

getLdapContext

public javax.naming.ldap.LdapContext getLdapContext()
Description copied from class: PartitionNexus
Gets the LdapContext associated with the calling thread.

Specified by:
getLdapContext in class PartitionNexus
Returns:
The LdapContext associated with the thread of execution or null if no context is associated with the calling thread.
See Also:
PartitionNexus.getLdapContext()

getMatchedName

public org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext matchedNameContext)
                                                            throws java.lang.Exception
Description copied from class: PartitionNexus
Gets the most significant Dn that exists within the server for any Dn.

Specified by:
getMatchedName in class PartitionNexus
Parameters:
matchedNameContext - the context containing the 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:
java.lang.Exception - if there are any problems
See Also:
PartitionNexus.getMatchedName( GetMatchedNameOperationContext )

getSuffixDn

public org.apache.directory.shared.ldap.name.LdapDN getSuffixDn()
Description copied from interface: Partition
Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.

Returns:
Name representing the distinguished/absolute name of this ContextPartitions root context.

getUpSuffixDn

public org.apache.directory.shared.ldap.name.LdapDN getUpSuffixDn()
Description copied from interface: Partition
Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.

Returns:
Name representing the distinguished/absolute name of this ContextPartitions root context.

getSuffix

public org.apache.directory.shared.ldap.name.LdapDN getSuffix(GetSuffixOperationContext getSuffixContext)
                                                       throws java.lang.Exception
Description copied from class: PartitionNexus
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.

Specified by:
getSuffix in class PartitionNexus
Parameters:
getSuffixContext - the Context containing 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:
java.lang.Exception - if there are any problems
See Also:
PartitionNexus.getSuffix( GetSuffixOperationContext )

listSuffixes

public java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext emptyContext)
                                                  throws java.lang.Exception
Description copied from class: PartitionNexus
Gets an iteration over the Name suffixes of the partitions managed by this PartitionNexus.

Specified by:
listSuffixes in class PartitionNexus
Returns:
Iteration over ContextPartition suffix names as Names.
Throws:
java.lang.Exception - if there are any problems
See Also:
PartitionNexus.listSuffixes( ListSuffixOperationContext )

getRootDSE

public ClonedServerEntry getRootDSE(GetRootDSEOperationContext getRootDSEContext)
Description copied from class: PartitionNexus
Get's the RootDSE entry for the DSA.

Specified by:
getRootDSE in class PartitionNexus
Returns:
the attributes of the RootDSE

bind

public void bind(BindOperationContext bindContext)
          throws java.lang.Exception
Description copied from interface: Partition
Represents a bind operation issued to authenticate a client. Partitions need not support this operation. This operation is here to enable those interested in implementing virtual directories with ApacheDS.

Parameters:
bindContext - the bind context, containing all the needed informations to bind
Throws:
java.lang.Exception - if something goes wrong

unbind

public void unbind(UnbindOperationContext unbindContext)
            throws java.lang.Exception
Description copied from interface: Partition
Represents an unbind operation issued by an authenticated client. Partitions need not support this operation. This operation is here to enable those interested in implementing virtual directories with ApacheDS.

Parameters:
unbindContext - the context used to unbind
Throws:
java.lang.Exception - if something goes wrong

delete

public void delete(DeleteOperationContext deleteContext)
            throws java.lang.Exception
Description copied from interface: Partition
Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be deleted until this operation has been applied to their children.

Parameters:
deleteContext - the context of the entry to delete from this ContextPartition.
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.delete(DeleteOperationContext)

add

public void add(AddOperationContext addContext)
         throws java.lang.Exception
Looks up the backend corresponding to the entry first, then checks to see if the entry already exists. If so an exception is thrown. If not the add operation against the backend proceeds. This check is performed here so backend implementors do not have to worry about performing these kinds of checks.

Parameters:
addContext - the context used to add and entry to this ContextPartition
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.add( AddOperationContext )

modify

public void modify(ModifyOperationContext modifyContext)
            throws java.lang.Exception
Description copied from interface: Partition
Modifies an entry by adding, removing or replacing a set of attributes.

Parameters:
modifyContext - The contetx containin the modification operation to perform on the entry which is one of constants specified by the DirContext interface: ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE.
Throws:
java.lang.Exception - if there are any problems
See Also:
DirContext, DirContext.ADD_ATTRIBUTE, DirContext.REMOVE_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE

list

public EntryFilteringCursor list(ListOperationContext opContext)
                          throws java.lang.Exception
Description copied from interface: Partition
A specialized form of one level search used to return a minimal set of information regarding child entries under a base. Convenience method used to optimize operations rather than conducting a full search with retrieval.

Parameters:
opContext - the context containing the distinguished/absolute name for the search/listing
Returns:
a NamingEnumeration containing objects of type ServerSearchResult
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.list(ListOperationContext)

search

public EntryFilteringCursor search(SearchOperationContext opContext)
                            throws java.lang.Exception
Description copied from interface: Partition
Conducts a search against this ContextPartition. Namespace specific parameters for search are contained within the environment using namespace specific keys into the hash. For example in the LDAP namespace a ContextPartition implementation may look for search Controls using a namespace specific or implementation specific key for the set of LDAP Controls.

Parameters:
opContext - The context containing the information used by the operation
Returns:
a NamingEnumeration containing objects of type
Throws:
java.lang.Exception - if there are any problems

lookup

public ClonedServerEntry lookup(LookupOperationContext opContext)
                         throws java.lang.Exception
Description copied from interface: Partition
Looks up an entry by distinguished/absolute name. This is a simplified version of the search operation used to point read an entry used for convenience. Depending on the context parameters, we my look for a simple entry, or for a restricted set of attributes for this entry

Parameters:
opContext - The context containing the parameters
Returns:
an Attributes object representing the entry
Throws:
java.lang.Exception - if there are any problems

hasEntry

public boolean hasEntry(EntryOperationContext opContext)
                 throws java.lang.Exception
Description copied from interface: Partition
Fast operation to check and see if a particular entry exists.

Parameters:
opContext - The context used to pass informations
Returns:
true if the entry exists, false if it does not
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.hasEntry(EntryOperationContext)

rename

public void rename(RenameOperationContext opContext)
            throws java.lang.Exception
Description copied from interface: Partition
Modifies an entry by changing its relative name. Optionally attributes associated with the old relative name can be removed from the entry. This makes sense only in certain namespaces like LDAP and will be ignored if it is irrelavent.

Parameters:
opContext - the modify DN context
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.rename(RenameOperationContext)

move

public void move(MoveOperationContext opContext)
          throws java.lang.Exception
Description copied from interface: Partition
Transplants a child entry, to a position in the namespace under a new parent entry.

Parameters:
opContext - The context containing the DNs to move
Throws:
java.lang.Exception - if there are any problems
See Also:
Partition.move(MoveOperationContext)

moveAndRename

public void moveAndRename(MoveAndRenameOperationContext opContext)
                   throws java.lang.Exception
Description copied from interface: Partition
Transplants a child entry, to a position in the namespace under a new parent entry and changes the RN of the child entry which can optionally have its old RN attributes removed. The removal of old RN attributes may not make sense in all namespaces. If the concept is undefined in a namespace this parameters is ignored. An example of a namespace where this parameter is significant is the LDAP namespace.

Parameters:
opContext - The context contain all the information about the modifyDN operation
Throws:
java.lang.Exception - if there are any problems

getPartition

public Partition getPartition(org.apache.directory.shared.ldap.name.LdapDN dn)
                       throws java.lang.Exception
Gets the partition associated with a normalized dn.

Specified by:
getPartition in class PartitionNexus
Parameters:
dn - the normalized distinguished name to resolve to a partition
Returns:
the backend partition associated with the normalized dn
Throws:
java.lang.Exception - if the name cannot be resolved to a partition

registerSupportedExtensions

public void registerSupportedExtensions(java.util.Set<java.lang.String> extensionOids)
                                 throws java.lang.Exception
Description copied from class: PartitionNexus
Adds a set of supportedExtension (OID Strings) to the RootDSE.

Specified by:
registerSupportedExtensions in class PartitionNexus
Parameters:
extensionOids - a set of OID strings to add to the supportedExtension attribute in the RootDSE
Throws:
java.lang.Exception

registerSupportedSaslMechanisms

public void registerSupportedSaslMechanisms(java.util.Set<java.lang.String> supportedSaslMechanisms)
                                     throws java.lang.Exception
Specified by:
registerSupportedSaslMechanisms in class PartitionNexus
Throws:
java.lang.Exception

lookup

public ClonedServerEntry lookup(java.lang.Long id)
                         throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.