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

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

public class PartitionNexusProxy
extends PartitionNexus

A decorator that wraps other PartitionNexus to enable InterceptorChain and InvocationStack support. All Invocations made to this nexus is automatically pushed to InvocationStack of the current thread, and popped when the operation ends. All invocations are filtered by InterceptorChain.

Version:
$Rev: 669073 $, $Date: 2008-06-18 05:49:58 +0200 (Mi, 18 Jun 2008) $
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
PartitionNexusProxy(DirectoryService service)
          Creates a new instance.
 
Method Summary
 void add(AddOperationContext opContext)
          Adds an entry to this ContextPartition.
 void add(AddOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void addContextPartition(AddContextPartitionOperationContext opContext)
           
 void addContextPartition(AddContextPartitionOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void bind(BindOperationContext opContext)
          Represents a bind operation issued to authenticate a client.
 void bind(BindOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
          TODO : check if we can find another way to protect ourselves from recursion.
 void close()
           
 boolean compare(CompareOperationContext opContext)
          Performs a comparison check to see if an attribute of an entry has a specified value.
 boolean compare(CompareOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void delete(DeleteOperationContext opContext)
          Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be deleted until this operation has been applied to their children.
 void delete(DeleteOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void destroy()
          Deinitialized this partition.
 int getCacheSize()
          Gets the entry cache size for this partition.
 ClonedServerEntry getContextEntry()
           
 java.lang.String getId()
          Gets the unique identifier for this partition.
 javax.naming.ldap.LdapContext getLdapContext()
          Gets the LdapContext associated with the calling thread.
 org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext opContext)
          Gets the most significant Dn that exists within the server for any Dn.
 org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 Partition getPartition(org.apache.directory.shared.ldap.name.LdapDN dn)
          Get's the partition corresponding to a distinguished name.
 ClonedServerEntry getRootDSE(GetRootDSEOperationContext opContext)
          Get's the RootDSE entry for the DSA.
 ClonedServerEntry getRootDSE(GetRootDSEOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 java.lang.String getSuffix()
          Gets the non-normalized suffix for this Partition as a string.
 org.apache.directory.shared.ldap.name.LdapDN getSuffix(GetSuffixOperationContext opContext)
          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 getSuffix(GetSuffixOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 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.
 boolean hasEntry(EntryOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void init(DirectoryService core)
          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.
 EntryFilteringCursor list(ListOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext opContext)
          Gets an iteration over the Name suffixes of the partitions managed by this PartitionNexus.
 java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 ClonedServerEntry lookup(java.lang.Long id)
           
 ClonedServerEntry lookup(LookupOperationContext opContext)
          Looks up an entry by distinguished/absolute name.
 ClonedServerEntry lookup(LookupOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void modify(ModifyOperationContext opContext)
          Modifies an entry by adding, removing or replacing a set of attributes.
 void modify(ModifyOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void move(MoveOperationContext opContext)
          Transplants a child entry, to a position in the namespace under a new parent entry.
 void move(MoveOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 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 moveAndRename(MoveAndRenameOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 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 opContext)
           
 void removeContextPartition(RemoveContextPartitionOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void rename(RenameOperationContext opContext)
          Modifies an entry by changing its relative name.
 void rename(RenameOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 EntryFilteringCursor search(SearchOperationContext opContext)
          Conducts a search against this ContextPartition.
 EntryFilteringCursor search(SearchOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 void setCacheSize(int cacheSize)
          Used to specify the entry cache size for a Partition.
 void setContextEntry(ServerEntry contextEntry)
           
 void setId(java.lang.String id)
          Sets the unique identifier for this partition.
 void setSuffix(java.lang.String suffix)
          Sets the non-normalized suffix for this Partition as a string.
 void sync()
          Flushes any changes made to this partition now.
 void unbind(UnbindOperationContext opContext)
          Represents an unbind operation issued by an authenticated client.
 void unbind(UnbindOperationContext opContext, java.util.Collection<java.lang.String> byPassed)
           
 
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

PartitionNexusProxy

public PartitionNexusProxy(DirectoryService service)
                    throws java.lang.Exception
Creates a new instance.

Parameters:
caller - a JNDI Context object that will call this proxy
service - a JNDI service
Throws:
java.lang.Exception
Method Detail

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.

getId

public java.lang.String getId()
Description copied from interface: Partition
Gets the unique identifier for this partition.

Returns:
the unique identifier for this partition

setId

public void setId(java.lang.String id)
Description copied from interface: Partition
Sets the unique identifier for this partition.

Parameters:
id - the unique identifier for this partition

getContextEntry

public ClonedServerEntry getContextEntry()

setContextEntry

public void setContextEntry(ServerEntry contextEntry)

getSuffix

public java.lang.String getSuffix()
Description copied from interface: Partition
Gets the non-normalized suffix for this Partition as a string.

Returns:
the suffix string for this Partition.

setSuffix

public void setSuffix(java.lang.String suffix)
Description copied from interface: Partition
Sets the non-normalized suffix for this Partition as a string.

Parameters:
suffix - the suffix string for this Partition.

setCacheSize

public void setCacheSize(int cacheSize)
Description copied from interface: Partition
Used to specify the entry cache size for a Partition. Various Partition implementations may interpret this value in different ways: i.e. total cache size limit verses the number of entries to cache.

Parameters:
cacheSize - the size of the cache

getCacheSize

public int getCacheSize()
Description copied from interface: Partition
Gets the entry cache size for this partition.

Returns:
the size of the cache

init

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

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

destroy

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


getSystemPartition

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

getPartition

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

Specified by:
getPartition in class PartitionNexus
Parameters:
dn - the normalized distinguished name to get a partition for
Returns:
the partition containing the entry represented by the dn
Throws:
java.lang.Exception - if there is no partition for the dn

getSuffixDn

public org.apache.directory.shared.ldap.name.LdapDN getSuffixDn()
                                                         throws java.lang.Exception
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.
Throws:
java.lang.Exception - if access or suffix parsing fails

getUpSuffixDn

public org.apache.directory.shared.ldap.name.LdapDN getUpSuffixDn()
                                                           throws java.lang.Exception
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.
Throws:
java.lang.Exception - if access or suffix parsing fails

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

close

public void close()
           throws java.lang.Exception
Throws:
java.lang.Exception

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

getMatchedName

public org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext opContext)
                                                            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:
opContext - 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

getMatchedName

public org.apache.directory.shared.ldap.name.LdapDN getMatchedName(GetMatchedNameOperationContext opContext,
                                                                   java.util.Collection<java.lang.String> byPassed)
                                                            throws java.lang.Exception
Throws:
java.lang.Exception

getSuffix

public org.apache.directory.shared.ldap.name.LdapDN getSuffix(GetSuffixOperationContext opContext)
                                                       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:
opContext - 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

getSuffix

public org.apache.directory.shared.ldap.name.LdapDN getSuffix(GetSuffixOperationContext opContext,
                                                              java.util.Collection<java.lang.String> byPassed)
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

listSuffixes

public java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext opContext)
                                                  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

listSuffixes

public java.util.Iterator<java.lang.String> listSuffixes(ListSuffixOperationContext opContext,
                                                         java.util.Collection<java.lang.String> byPassed)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

compare

public boolean compare(CompareOperationContext opContext)
                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:
opContext - 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

compare

public boolean compare(CompareOperationContext opContext,
                       java.util.Collection<java.lang.String> byPassed)
                throws java.lang.Exception
Throws:
java.lang.Exception

delete

public void delete(DeleteOperationContext opContext)
            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:
opContext - the context of the entry to delete from this ContextPartition.
Throws:
java.lang.Exception - if there are any problems

delete

public void delete(DeleteOperationContext opContext,
                   java.util.Collection<java.lang.String> byPassed)
            throws java.lang.Exception
Throws:
java.lang.Exception

add

public void add(AddOperationContext opContext)
         throws java.lang.Exception
Description copied from interface: Partition
Adds an entry to this ContextPartition.

Parameters:
opContext - the context used to add and entry to this ContextPartition
Throws:
java.lang.Exception - if there are any problems

add

public void add(AddOperationContext opContext,
                java.util.Collection<java.lang.String> byPassed)
         throws java.lang.Exception
Throws:
java.lang.Exception

modify

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

Parameters:
opContext - 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

modify

public void modify(ModifyOperationContext opContext,
                   java.util.Collection<java.lang.String> byPassed)
            throws java.lang.Exception
Throws:
java.lang.Exception

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

list

public EntryFilteringCursor list(ListOperationContext opContext,
                                 java.util.Collection<java.lang.String> byPassed)
                          throws java.lang.Exception
Throws:
java.lang.Exception

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

search

public EntryFilteringCursor search(SearchOperationContext opContext,
                                   java.util.Collection<java.lang.String> byPassed)
                            throws java.lang.Exception
Throws:
java.lang.Exception

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

lookup

public ClonedServerEntry lookup(LookupOperationContext opContext,
                                java.util.Collection<java.lang.String> byPassed)
                         throws java.lang.Exception
Throws:
java.lang.Exception

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

hasEntry

public boolean hasEntry(EntryOperationContext opContext,
                        java.util.Collection<java.lang.String> byPassed)
                 throws java.lang.Exception
Throws:
java.lang.Exception

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

rename

public void rename(RenameOperationContext opContext,
                   java.util.Collection<java.lang.String> byPassed)
            throws java.lang.Exception
Throws:
java.lang.Exception

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

move

public void move(MoveOperationContext opContext,
                 java.util.Collection<java.lang.String> byPassed)
          throws java.lang.Exception
Throws:
java.lang.Exception

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

moveAndRename

public void moveAndRename(MoveAndRenameOperationContext opContext,
                          java.util.Collection<java.lang.String> byPassed)
                   throws java.lang.Exception
Throws:
java.lang.Exception

bind

public void bind(BindOperationContext opContext,
                 java.util.Collection<java.lang.String> byPassed)
          throws java.lang.Exception
TODO : check if we can find another way to protect ourselves from recursion.

Parameters:
opContext - The operation context
byPassed - bypass instructions to skip interceptors
Throws:
java.lang.Exception - if bind fails

unbind

public void unbind(UnbindOperationContext opContext,
                   java.util.Collection<java.lang.String> byPassed)
            throws java.lang.Exception
Throws:
java.lang.Exception

bind

public void bind(BindOperationContext opContext)
          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:
opContext - the bind context, containing all the needed informations to bind
Throws:
java.lang.Exception - if something goes wrong

unbind

public void unbind(UnbindOperationContext opContext)
            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:
opContext - the context used to unbind
Throws:
java.lang.Exception - if something goes wrong

getRootDSE

public ClonedServerEntry getRootDSE(GetRootDSEOperationContext opContext)
                             throws java.lang.Exception
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
Throws:
java.lang.Exception

getRootDSE

public ClonedServerEntry getRootDSE(GetRootDSEOperationContext opContext,
                                    java.util.Collection<java.lang.String> byPassed)
                             throws java.lang.Exception
Throws:
java.lang.Exception

addContextPartition

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

addContextPartition

public void addContextPartition(AddContextPartitionOperationContext opContext,
                                java.util.Collection<java.lang.String> byPassed)
                         throws java.lang.Exception
Throws:
java.lang.Exception

removeContextPartition

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

removeContextPartition

public void removeContextPartition(RemoveContextPartitionOperationContext opContext,
                                   java.util.Collection<java.lang.String> byPassed)
                            throws java.lang.Exception
Throws:
java.lang.Exception

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.