directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r541123 [9/25] - in /directory/apacheds/branches/apacheds-sasl-branch: ./ benchmarks/ bootstrap-extract/ bootstrap-extract/src/ bootstrap-extract/src/main/ bootstrap-extract/src/main/java/ bootstrap-extract/src/main/java/org/ bootstrap-extr...
Date Thu, 24 May 2007 00:27:07 GMT
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Wed May 23 17:26:40 2007
@@ -21,24 +21,26 @@
 
 
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
-
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -47,14 +49,13 @@
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
-
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -69,15 +70,25 @@
 {
     /** logger used by this class */
     private static final Logger log = LoggerFactory.getLogger( NormalizationService.class );
+    
+    /** The service name */
+    public static final String NAME = "normalizationService";
 
     /** a filter node value normalizer and undefined node remover */
     private NormalizingVisitor normVisitor;
+    
     /** an expanding filter that makes expressions more specific */
     private ExpandingVisitor expVisitor;
+    
     /** the attributeType registry used for normalization and determining if some filter nodes are undefined */
     private AttributeTypeRegistry attributeRegistry;
+    
+    /** The association between attributeTypes and their normalizers */
+    private Map<String, OidNormalizer> attrNormalizers; 
 
-
+    /**
+     * Initialize the registries, normalizers. 
+     */
     public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
     {
         OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry();
@@ -85,77 +96,74 @@
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
         normVisitor = new NormalizingVisitor( ncn, oidRegistry );
         expVisitor = new ExpandingVisitor( attributeRegistry );
+        attrNormalizers = attributeRegistry.getNormalizerMapping();
     }
 
-
+    /**
+     * The destroy method does nothing
+     */
     public void destroy()
     {
     }
 
-
     // ------------------------------------------------------------------------
     // Normalize all Name based arguments for ContextPartition interface operations
     // ------------------------------------------------------------------------
 
-    public void add(NextInterceptor nextInterceptor, LdapDN name, Attributes attrs)
+    public void add(NextInterceptor nextInterceptor, OperationContext opContext)
         throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        nextInterceptor.add( normalized, attrs );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        nextInterceptor.add( opContext );
     }
 
 
-    public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public void delete( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        nextInterceptor.delete( normalized );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        nextInterceptor.delete( opContext );
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+    public void modify( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        nextInterceptor.modify( normalized, modOp, attrs );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        nextInterceptor.modify( opContext );
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        nextInterceptor.modify( normalized, items );
-    }
-
-
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean deleteOldRn )
+    public void rename( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        nextInterceptor.modifyRn( normalized, newRn, deleteOldRn );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        nextInterceptor.rename( opContext );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName ) throws NamingException
+    public void move( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        newParentName.normalize( attributeRegistry.getNormalizerMapping());
-        nextInterceptor.move( normalized, newParentName );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        ((MoveOperationContext)opContext).getParent().normalize( attrNormalizers);
+        nextInterceptor.move( opContext );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName, String newRn, boolean deleteOldRn )
+    public void moveAndRename( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        newParentName.normalize( attributeRegistry.getNormalizerMapping());
-        nextInterceptor.move( normalized, newParentName, newRn, deleteOldRn );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        LdapDN.normalize( ((MoveAndRenameOperationContext)opContext).getParent(), attrNormalizers);
+        nextInterceptor.moveAndRename( opContext );
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN base, Map env, ExprNode filter,
-        SearchControls searchCtls ) throws NamingException
+    public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        base.normalize( attributeRegistry.getNormalizerMapping());
+        LdapDN base = opContext.getDn();
+        ExprNode filter = ((SearchOperationContext)opContext).getFilter();
+        
+        base.normalize( attrNormalizers);
 
         if ( filter.isLeaf() )
         {
@@ -328,42 +336,29 @@
             }
         }
         
-        return nextInterceptor.search( base, env, filter, searchCtls );
+        ((SearchOperationContext)opContext).setFilter( filter );
+        return nextInterceptor.search( opContext );
     }
 
 
-    public boolean hasEntry( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public boolean hasEntry( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.hasEntry( name );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        return nextInterceptor.hasEntry( opContext );
     }
 
 
-    public boolean isSuffix( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.isSuffix( name );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        return nextInterceptor.list( opContext );
     }
 
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN base ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        base = LdapDN.normalize( base, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.list( base );
-    }
-
-
-    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
-    {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.lookup( name );
-    }
-
-
-    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
-    {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.lookup( name, attrIds );
+        LdapDN.normalize( ((LookupOperationContext)opContext).getDn(), attrNormalizers );
+        return nextInterceptor.lookup( opContext );
     }
 
 
@@ -371,44 +366,43 @@
     // Normalize all Name based arguments for other interface operations
     // ------------------------------------------------------------------------
 
-    public LdapDN getMatchedName ( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public LdapDN getMatchedName ( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.getMatchedName( name );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        return nextInterceptor.getMatchedName( opContext );
     }
 
 
-    public LdapDN getSuffix ( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public LdapDN getSuffix ( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return nextInterceptor.getSuffix( name );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        return nextInterceptor.getSuffix( opContext );
     }
 
 
-    public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
+    public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        name = LdapDN.normalize( name, attributeRegistry.getNormalizerMapping() );
-        return next.compare( name, oid, value );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        return next.compare( opContext );
     }
     
     
-    public void bind( NextInterceptor next, LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId ) 
-        throws NamingException
+    public void bind( NextInterceptor next, OperationContext opContext )  throws NamingException
     {
-        bindDn = LdapDN.normalize( bindDn, attributeRegistry.getNormalizerMapping() );
-        next.bind( bindDn, credentials, mechanisms, saslAuthId );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        next.bind( opContext );
     }
 
 
-    public void addContextPartition( NextInterceptor next, PartitionConfiguration cfg ) throws NamingException
+    public void addContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        next.addContextPartition( cfg );
+        next.addContextPartition( opContext );
     }
 
 
-    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        suffix = LdapDN.normalize( suffix, attributeRegistry.getNormalizerMapping() );
-        next.removeContextPartition( suffix );
+        LdapDN.normalize( opContext.getDn(), attrNormalizers );
+        next.removeContextPartition( opContext );
     }
 }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java Wed May 23 17:26:40 2007
@@ -58,8 +58,10 @@
 {
     /** logger used by this class */
     private final static Logger log = LoggerFactory.getLogger( NormalizingVisitor.class );
+    
     /** the name component normalizer used by this visitor */
     private final NameComponentNormalizer ncn;
+    
     /** the oid registry used to resolve OIDs for attributeType ids */
     private final OidRegistry registry;
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Wed May 23 17:26:40 2007
@@ -22,10 +22,9 @@
 
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
+import java.util.List;
 import java.util.Set;
 
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -35,7 +34,6 @@
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
@@ -43,21 +41,29 @@
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.directory.shared.ldap.util.DateUtils;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.DateUtils;
 
 
 /**
@@ -71,6 +77,9 @@
  */
 public class OperationalAttributeService extends BaseInterceptor
 {
+    /** The service name */
+    public static final String NAME = "operationalAttributeService";
+
     private final SearchResultFilter DENORMALIZING_SEARCH_FILTER = new SearchResultFilter()
     {
         public boolean accept( Invocation invocation, SearchResult result, SearchControls controls ) 
@@ -131,7 +140,7 @@
         isDenormalizeOpAttrsEnabled = factoryCfg.getStartupConfiguration().isDenormalizeOpAttrsEnabled();
 
         // stuff for dealing with subentries (garbage for now)
-        String subschemaSubentry = ( String ) nexus.getRootDSE().get( "subschemaSubentry" ).get();
+        String subschemaSubentry = ( String ) nexus.getRootDSE( null ).get( "subschemaSubentry" ).get();
         subschemaSubentryDn = new LdapDN( subschemaSubentry );
         subschemaSubentryDn.normalize( factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
     }
@@ -145,179 +154,173 @@
     /**
      * Adds extra operational attributes to the entry before it is added.
      */
-    public void add(NextInterceptor nextInterceptor, LdapDN normName, Attributes entry)
+    public void add(NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
         String principal = getPrincipal().getName();
+        Attributes entry = ((AddOperationContext)opContext).getEntry();
 
-        Attribute attribute = new AttributeImpl( "creatorsName" );
+        Attribute attribute = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT );
         attribute.add( principal );
         entry.put( attribute );
 
-        attribute = new AttributeImpl( "createTimestamp" );
+        attribute = new AttributeImpl( SchemaConstants.CREATE_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         entry.put( attribute );
 
-        nextInterceptor.add(normName, entry );
+        nextInterceptor.add( opContext );
     }
-
-
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+    
+    public void modify( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        nextInterceptor.modify( name, modOp, attrs );
+        nextInterceptor.modify( opContext );
 
-        if ( name.getNormName().equals( subschemaSubentryDn.getNormName() ) ) 
+        if ( opContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName() ) ) 
         {
             return;
         }
         
         // add operational attributes after call in case the operation fails
         Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( "modifiersName" );
+        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
         attributes.put( attribute );
 
-        attribute = new AttributeImpl( "modifyTimestamp" );
+        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
-
-        nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
-    }
-
-
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        nextInterceptor.modify( name, items );
-
-        if ( name.getNormName().equals( subschemaSubentryDn.getNormName() ) ) 
-        {
-            return;
-        }
         
-        // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( "modifiersName" );
-        attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
-
-        attribute = new AttributeImpl( "modifyTimestamp" );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
 
-        nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
+        ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(), items );
+        nexus.modify( newModify );
     }
 
 
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean deleteOldRn )
+    public void rename( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        nextInterceptor.modifyRn( name, newRn, deleteOldRn );
+        nextInterceptor.rename( opContext );
 
         // add operational attributes after call in case the operation fails
         Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( "modifiersName" );
+        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
         attributes.put( attribute );
 
-        attribute = new AttributeImpl( "modifyTimestamp" );
+        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        LdapDN newDn = ( LdapDN ) name.clone();
-        newDn.remove( name.size() - 1 );
-        newDn.add( newRn );
+        LdapDN newDn = ( LdapDN ) opContext.getDn().clone();
+        newDn.remove( opContext.getDn().size() - 1 );
+        newDn.add( ((RenameOperationContext)opContext).getNewRdn() );
         newDn.normalize( registry.getNormalizerMapping() );
-        nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes );
+        
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+        ModifyOperationContext newModify = new ModifyOperationContext( newDn, items );
+        
+        nexus.modify( newModify );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName ) throws NamingException
+    public void move( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        nextInterceptor.move( name, newParentName );
+        nextInterceptor.move( opContext );
 
         // add operational attributes after call in case the operation fails
         Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( "modifiersName" );
+        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
         attributes.put( attribute );
 
-        attribute = new AttributeImpl( "modifyTimestamp" );
+        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+
+        ModifyOperationContext newModify = 
+            new ModifyOperationContext( ((MoveOperationContext)opContext).getParent(), items );
+        
+        nexus.modify( newModify );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName, String newRn, boolean deleteOldRn )
+    public void moveAndRename( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        nextInterceptor.move( name, newParentName, newRn, deleteOldRn );
+        nextInterceptor.moveAndRename( opContext );
 
         // add operational attributes after call in case the operation fails
         Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( "modifiersName" );
+        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
         attributes.put( attribute );
 
-        attribute = new AttributeImpl( "modifyTimestamp" );
+        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+        ModifyOperationContext newModify = 
+            new ModifyOperationContext( 
+        		((MoveAndRenameOperationContext)opContext).getParent(), items );
+        nexus.modify( newModify );
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        Attributes result = nextInterceptor.lookup( name );
+        Attributes result = nextInterceptor.lookup( opContext );
+        
         if ( result == null )
         {
             return null;
         }
-        filter( result );
-        return result;
-    }
-
 
-    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
-    {
-        Attributes result = nextInterceptor.lookup( name, attrIds );
-        if ( result == null )
+        if ( ((LookupOperationContext)opContext).getAttrsId() == null )
         {
-            return null;
+            filter( result );
         }
-
-        filter( name, result, attrIds );
+        else
+        {
+            filter( opContext, result );
+        }
+        
         return result;
     }
 
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN base ) throws NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
-        NamingEnumeration e = nextInterceptor.list( base );
+        NamingEnumeration e = nextInterceptor.list( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
-        return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, SEARCH_FILTER );
+        return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, SEARCH_FILTER, "List Operational Filter" );
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN base, Map env, ExprNode filter,
-                                     SearchControls searchCtls ) throws NamingException
+    public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, OperationContext opContext ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
-        NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );
+        NamingEnumeration e = nextInterceptor.search( opContext );
+        SearchControls searchCtls = ((SearchOperationContext)opContext).getSearchControls();
+        
         if ( searchCtls.getReturningAttributes() != null )
         {
             if ( isDenormalizeOpAttrsEnabled )
             {
-                return new SearchResultFilteringEnumeration( e, searchCtls, invocation, DENORMALIZING_SEARCH_FILTER );
+                return new SearchResultFilteringEnumeration( e, searchCtls, invocation, DENORMALIZING_SEARCH_FILTER, "Search Operational Filter denormalized" );
             }
                 
             return e;
         }
 
-        return new SearchResultFilteringEnumeration( e, searchCtls, invocation, SEARCH_FILTER );
+        return new SearchResultFilteringEnumeration( e, searchCtls, invocation, SEARCH_FILTER , "Search Operational Filter");
     }
 
 
@@ -352,18 +355,21 @@
     }
 
 
-    private void filter( Name dn, Attributes entry, String[] ids ) throws NamingException
+    private void filter( OperationContext lookupContext, Attributes entry ) throws NamingException
     {
+        LdapDN dn = ((LookupOperationContext)lookupContext).getDn();
+        List<String> ids = ((LookupOperationContext)lookupContext).getAttrsId();
+        
         // still need to protect against returning op attrs when ids is null
         if ( ids == null )
         {
-            OperationalAttributeService.this.filter( entry );
+            filter( entry );
             return;
         }
 
         if ( dn.size() == 0 )
         {
-            Set<String> idsSet = new HashSet<String>( ids.length );
+            Set<String> idsSet = new HashSet<String>( ids.size() );
 
             for ( String id:ids  )
             {
@@ -395,7 +401,7 @@
     {
         if ( isDenormalizeOpAttrsEnabled )
         {
-            AttributeType type = registry.lookup( SystemSchemaConstants.CREATORS_NAME_AT );
+            AttributeType type = registry.lookup( SchemaConstants.CREATORS_NAME_AT );
             Attribute attr = AttributeUtils.getAttribute( entry, type );
 
             if ( attr != null )
@@ -407,7 +413,7 @@
             }
             
             type = null;
-            type = registry.lookup( SystemSchemaConstants.MODIFIERS_NAME_AT );
+            type = registry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
             attr = null;
             attr = AttributeUtils.getAttribute( entry, type );
             
@@ -453,7 +459,9 @@
             }
             else if ( rdn.size() == 1 )
             {
-                newDn.add( new Rdn( registry.lookup( rdn.getNormType() ).getName(), (String)rdn.getAtav().getValue() ) );
+            	String name = registry.lookup( rdn.getNormType() ).getName();
+            	String value = (String)rdn.getAtav().getValue(); 
+                newDn.add( new Rdn( name, name, value, value ) );
                 continue;
             }
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Wed May 23 17:26:40 2007
@@ -20,22 +20,19 @@
 package org.apache.directory.server.core.partition;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-
 /**
  * A {@link Partition} that helps users to implement their own partition.
  * Most methods are implemented by default.  Please look at the description of
@@ -177,12 +174,6 @@
     }
 
 
-    public final boolean isSuffix( LdapDN name ) throws NamingException
-    {
-        return getSuffix().equals( name );
-    }
-
-
     /**
      * This method does nothing by default.
      */
@@ -192,15 +183,15 @@
 
 
     /**
-     * This method calls {@link Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN)} and return <tt>true</tt>
+     * This method calls {@link Partition#lookup(OperationContext)} and return <tt>true</tt>
      * if it returns an entry by default.  Please override this method if
      * there is more effective way for your implementation.
      */
-    public boolean hasEntry( LdapDN name ) throws NamingException
+    public boolean hasEntry( OperationContext entryContext ) throws NamingException
     {
         try
         {
-            return lookup( name ) != null;
+            return lookup( new LookupOperationContext( entryContext.getDn() ) ) != null;
         }
         catch ( NameNotFoundException e )
         {
@@ -214,46 +205,24 @@
      * with null <tt>attributeIds</tt> by default.  Please override
      * this method if there is more effective way for your implementation.
      */
-    public Attributes lookup( LdapDN name ) throws NamingException
+    public Attributes lookup( OperationContext lookupContext ) throws NamingException
     {
-        return lookup( name, null );
-    }
-
-
-    /**
-     * This method forwards the request to
-     * {@link Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItemImpl[])} after
-     * translating parameters to {@link ModificationItemImpl}<tt>[]</tt> by default.
-     * Please override this method if there is more effactive way for your
-     * implementation.
-     */
-    public void modify( LdapDN name, int modOp, Attributes mods ) throws NamingException
-    {
-        List<ModificationItemImpl> items = new ArrayList<ModificationItemImpl>( mods.size() );
-        NamingEnumeration e = mods.getAll();
-        while ( e.hasMore() )
-        {
-            items.add( new ModificationItemImpl( modOp, ( Attribute ) e.next() ) );
-        }
-
-        ModificationItemImpl[] itemsArray = new ModificationItemImpl[items.size()];
-        itemsArray = items.toArray( itemsArray );
-        modify( name, itemsArray );
+        return null;
     }
 
 
     /**
-     * This method calls {@link Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)} and
-     * {@link Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)} subsequently
+     * This method calls {@link Partition#move(OperationContext)} and
+     * {@link Partition#rename(OperationContext)} subsequently
      * by default.  Please override this method if there is more effactive
      * way for your implementation.
      */
-    public void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void move( LdapDN oldName, LdapDN newParentName, String newRdn, boolean deleteOldRn ) throws NamingException
     {
         LdapDN newName = ( LdapDN ) newParentName.clone();
-        newName.add( newRn );
-        move( oldName, newParentName );
-        modifyRn( newName, newRn, deleteOldRn );
+        newName.add( newRdn );
+        replace( new MoveOperationContext( oldName, newParentName ) );
+        rename( new RenameOperationContext( newName, newRdn, deleteOldRn ) );
     }
 
 
@@ -261,7 +230,7 @@
      * This method throws {@link OperationNotSupportedException} by default.
      * Please override this method to implement move operation.
      */
-    public void move( LdapDN oldName, LdapDN newParentName ) throws NamingException
+    public void replace( OperationContext replaceContext ) throws NamingException
     {
         throw new OperationNotSupportedException( "Moving an entry to other parent entry is not supported." );
     }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Wed May 23 17:26:40 2007
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -44,6 +45,13 @@
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.ldap.constants.SupportedSASLMechanisms;
@@ -51,6 +59,7 @@
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.MultiException;
 import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
@@ -60,11 +69,12 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
+import org.apache.directory.shared.ldap.message.ServerSearchResult;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
@@ -113,6 +123,99 @@
 
     /** the backends keyed by normalized suffix strings */
     private Map<String, Partition> partitions = new HashMap<String, Partition>();
+    
+    private PartitionStructure partitionList = new PartitionContainer();
+    
+    private interface PartitionStructure
+    {
+        boolean isPartition();
+        public PartitionStructure addPartitionHandler( String name, PartitionStructure children );
+    }
+    
+    private class PartitionContainer implements PartitionStructure
+    {
+        private Map<String, PartitionStructure> children;
+        
+        private PartitionContainer()
+        {
+            children = new HashMap<String, PartitionStructure>();
+        }
+        
+        public boolean isPartition()
+        {
+            return false;
+        }
+        
+        public PartitionStructure addPartitionHandler( String name, PartitionStructure child )
+        {
+            children.put( name, child );
+            return this;
+        }
+        
+        public String toString()
+        {
+            StringBuilder sb = new StringBuilder();
+            
+            sb.append( "Partition container :\n" );
+            
+            for ( PartitionStructure child:children.values() )
+            {
+                sb.append( '{' ).append( child.toString() ).append( "} " );
+            }
+            
+            return sb.toString();
+        }
+    }
+    
+    private class PartitionHandler implements PartitionStructure
+    {
+        private Partition partition;
+        
+        private PartitionHandler( Partition partition )
+        {
+            this.partition = partition;
+        }
+
+        public boolean isPartition()
+        {
+            return true;
+        }
+
+        public PartitionStructure addPartitionHandler( String name, PartitionStructure partition )
+        {
+            return this;
+        }
+        
+        public Partition getpartition()
+        {
+            return partition;
+        }
+
+        public String toString()
+        {
+            try
+            {
+                return partition.getSuffix().getUpName();
+            }
+            catch ( NamingException ne )
+            {
+                return "Unkown partition";
+            }
+        }
+}
+    
+    private PartitionStructure buildPartitionStructure( PartitionStructure current, LdapDN dn, int index, Partition partition )
+    {
+        if ( index == dn.size() - 1 )
+        {
+            return current.addPartitionHandler( dn.getRdn( index ).toString(), new PartitionHandler( partition ) );
+        }
+        else
+        {
+            return current.addPartitionHandler( dn.getRdn( index ).toString(), 
+                buildPartitionStructure( new PartitionContainer(), dn, index + 1, partition ) );
+        }
+    }
 
     /** the read only rootDSE attributes */
     private final Attributes rootDSE;
@@ -163,10 +266,10 @@
         attr.add( SubentriesControl.CONTROL_OID );
         attr.add( ManageDsaITControl.CONTROL_OID );
 
-        attr = new AttributeImpl( "objectClass" );
+        attr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
         rootDSE.put( attr );
-        attr.add( "top" );
-        attr.add( "extensibleObject" );
+        attr.add( SchemaConstants.TOP_OC );
+        attr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
 
         attr = new AttributeImpl( NAMINGCTXS_ATTR );
         rootDSE.put( attr );
@@ -213,7 +316,7 @@
             while ( i.hasNext() )
             {
                 PartitionConfiguration c = ( PartitionConfiguration ) i.next();
-                addContextPartition( c );
+                addContextPartition( new AddContextPartitionOperationContext( c ) );
                 initializedPartitionCfgs.add( 0, c );
             }
             initialized = true;
@@ -261,17 +364,17 @@
             // ---------------------------------------------------------------
             
             Attributes systemEntry = systemCfg.getContextEntry();
-            Attribute objectClassAttr = systemEntry.get( "objectClass" );
+            Attribute objectClassAttr = systemEntry.get( SchemaConstants.OBJECT_CLASS_AT );
             if ( objectClassAttr == null )
             {
-                objectClassAttr = new AttributeImpl(  "objectClass" );
+                objectClassAttr = new AttributeImpl(  SchemaConstants.OBJECT_CLASS_AT );
                 systemEntry.put( objectClassAttr );
             }
-            objectClassAttr.add( "top" );
-            objectClassAttr.add( "organizationalUnit" );
-            objectClassAttr.add( "extensibleObject" );
-            systemEntry.put( "creatorsName", PartitionNexus.ADMIN_PRINCIPAL );
-            systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() );
+            objectClassAttr.add( SchemaConstants.TOP_OC );
+            objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
+            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, PartitionNexus.ADMIN_PRINCIPAL );
+            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
             systemEntry.put( NamespaceTools.getRdnAttribute( PartitionNexus.SYSTEM_PARTITION_SUFFIX ),
                 NamespaceTools.getRdnValue( PartitionNexus.SYSTEM_PARTITION_SUFFIX ) );
             systemCfg.setContextEntry( systemEntry );
@@ -330,12 +433,12 @@
                 indices.add( Oid.UPDN );
             }
             
-            if ( ! indexOids.contains( registry.getOid( "objectClass" ) ) )
+            if ( ! indexOids.contains( registry.getOid( SchemaConstants.OBJECT_CLASS_AT ) ) )
             {
                 log.warn( "CAUTION: You have not included objectClass as an indexed attribute" +
                         "in the system partition configuration.  This will lead to poor " +
                         "performance.  The server is automatically adding this index for you." );
-                indices.add( "objectClass" );
+                indices.add( SchemaConstants.OBJECT_CLASS_AT );
             }
         }
         else
@@ -357,18 +460,18 @@
             indexedSystemAttrs.add( Oid.ONEALIAS );
             indexedSystemAttrs.add( Oid.SUBALIAS );
             indexedSystemAttrs.add( Oid.UPDN );
-            indexedSystemAttrs.add( "objectClass" );
+            indexedSystemAttrs.add( SchemaConstants.OBJECT_CLASS_AT );
             systemCfg.setIndexedAttributes( indexedSystemAttrs );
     
             // Add context entry for system partition
             Attributes systemEntry = new AttributesImpl();
-            Attribute objectClassAttr = new AttributeImpl( "objectClass" );
-            objectClassAttr.add( "top" );
-            objectClassAttr.add( "organizationalUnit" );
-            objectClassAttr.add( "extensibleObject" );
+            Attribute objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
+            objectClassAttr.add( SchemaConstants.TOP_OC );
+            objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
             systemEntry.put( objectClassAttr );
-            systemEntry.put( "creatorsName", PartitionNexus.ADMIN_PRINCIPAL );
-            systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() );
+            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, PartitionNexus.ADMIN_PRINCIPAL );
+            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
             systemEntry.put( NamespaceTools.getRdnAttribute( PartitionNexus.SYSTEM_PARTITION_SUFFIX ),
                 NamespaceTools.getRdnValue( PartitionNexus.SYSTEM_PARTITION_SUFFIX ) );
             systemCfg.setContextEntry( systemEntry );
@@ -378,14 +481,18 @@
         system.init( factoryCfg, systemCfg );
         systemCfg.setContextPartition( system );
         String key = system.getSuffix().toString();
+        
         if ( partitions.containsKey( key ) )
         {
             throw new ConfigurationException( "Duplicate partition suffix: " + key );
         }
+        
         partitions.put( key, system );
+        
+        buildPartitionStructure( partitionList, system.getSuffix(), 0, system );
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( system.getUpSuffix().toString() );
+        namingContexts.add( system.getUpSuffix().getUpName() );
 
         return systemCfg;
     }
@@ -411,9 +518,10 @@
         while ( suffixes.hasNext() )
         {
             String suffix = suffixes.next();
+            
             try
             {
-                removeContextPartition( new LdapDN( suffix ) );
+                removeContextPartition( new RemoveContextPartitionOperationContext( new LdapDN( suffix ) ) );
             }
             catch ( NamingException e )
             {
@@ -432,6 +540,7 @@
     {
         MultiException error = null;
         Iterator list = this.partitions.values().iterator();
+        
         while ( list.hasNext() )
         {
             Partition partition = ( Partition ) list.next();
@@ -466,19 +575,22 @@
     // ContextPartitionNexus Method Implementations
     // ------------------------------------------------------------------------
 
-    public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
+    public boolean compare( OperationContext compareContext ) throws NamingException
     {
-        Partition partition = getBackend( name );
+        Partition partition = getBackend( compareContext.getDn() );
         AttributeTypeRegistry registry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+        
+        CompareOperationContext ctx = (CompareOperationContext)compareContext;
 
         // complain if we do not recognize the attribute being compared
-        if ( !registry.hasAttributeType( oid ) )
+        if ( !registry.hasAttributeType( ctx.getOid() ) )
         {
-            throw new LdapInvalidAttributeIdentifierException( oid + " not found within the attributeType registry" );
+            throw new LdapInvalidAttributeIdentifierException( ctx.getOid() + " not found within the attributeType registry" );
         }
 
-        AttributeType attrType = registry.lookup( oid );
-        Attribute attr = partition.lookup( name ).get( attrType.getName() );
+        AttributeType attrType = registry.lookup( ctx.getOid() );
+        
+        Attribute attr = partition.lookup( new LookupOperationContext( ctx.getDn() ) ).get( attrType.getName() );
 
         // complain if the attribute being compared does not exist in the entry
         if ( attr == null )
@@ -487,7 +599,7 @@
         }
 
         // see first if simple match without normalization succeeds
-        if ( attr.contains( value ) )
+        if ( attr.contains( ctx.getValue() ) )
         {
             return true;
         }
@@ -500,11 +612,12 @@
          * through all values looking for a match.
          */
         Normalizer normalizer = attrType.getEquality().getNormalizer();
-        Object reqVal = normalizer.normalize( value );
+        Object reqVal = normalizer.normalize( ctx.getValue() );
 
         for ( int ii = 0; ii < attr.size(); ii++ )
         {
             Object attrValObj = normalizer.normalize( attr.get( ii ) );
+            
             if ( attrValObj instanceof String )
             {
                 String attrVal = ( String ) attrValObj;
@@ -531,12 +644,14 @@
     }
 
 
-    public synchronized void addContextPartition( PartitionConfiguration config ) throws NamingException
+    public synchronized void addContextPartition( OperationContext addContextPartitionContext ) throws NamingException
     {
+        PartitionConfiguration config = ((AddContextPartitionOperationContext)addContextPartitionContext).getCfg();
         Partition partition = config.getContextPartition();
 
         // Turn on default indices
         String key = config.getSuffix();
+        
         if ( partitions.containsKey( key ) )
         {
             throw new ConfigurationException( "Duplicate partition suffix: " + key );
@@ -548,23 +663,26 @@
         }
         
         partitions.put( partition.getSuffix().toString(), partition );
+        
+        buildPartitionStructure( partitionList, partition.getSuffix(), 0, partition );
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( partition.getUpSuffix().toString() );
+        namingContexts.add( partition.getUpSuffix().getUpName() );
     }
 
 
-    public synchronized void removeContextPartition( LdapDN suffix ) throws NamingException
+    public synchronized void removeContextPartition( OperationContext removeContextPartition ) throws NamingException
     {
-        String key = suffix.toString();
-        Partition partition = ( Partition ) partitions.get( key );
+        String key = removeContextPartition.getDn().getNormName();
+        Partition partition = partitions.get( key );
+        
         if ( partition == null )
         {
             throw new NameNotFoundException( "No partition with suffix: " + key );
         }
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.remove( partition.getUpSuffix().toString() );
+        namingContexts.remove( partition.getUpSuffix().getUpName() );
         partitions.remove( key );
 
         partition.sync();
@@ -588,14 +706,15 @@
 
 
     /**
-     * @see PartitionNexus#getMatchedName(org.apache.directory.shared.ldap.name.LdapDN)
+     * @see PartitionNexus#getMatchedName( OperationContext )
      */
-    public LdapDN getMatchedName ( LdapDN dn ) throws NamingException
+    public LdapDN getMatchedName ( OperationContext getMatchedNameContext ) throws NamingException
     {
-        dn = ( LdapDN ) dn.clone();
+        LdapDN dn = ( LdapDN ) getMatchedNameContext.getDn().clone();
+        
         while ( dn.size() > 0 )
         {
-            if ( hasEntry( dn ) )
+            if ( hasEntry( new EntryOperationContext( dn ) ) )
             {
                 return dn;
             }
@@ -619,25 +738,25 @@
 
 
     /**
-     * @see PartitionNexus#getSuffix(org.apache.directory.shared.ldap.name.LdapDN)
+     * @see PartitionNexus#getSuffix( OperationContext )
      */
-    public LdapDN getSuffix ( LdapDN dn ) throws NamingException
+    public LdapDN getSuffix ( OperationContext getSuffixContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
+        Partition backend = getBackend( getSuffixContext.getDn() );
         return backend.getSuffix();
     }
 
 
     /**
-     * @see PartitionNexus#listSuffixes()
+     * @see PartitionNexus#listSuffixes( OperationContext )
      */
-    public Iterator listSuffixes () throws NamingException
+    public Iterator listSuffixes ( OperationContext emptyContext ) throws NamingException
     {
         return Collections.unmodifiableSet( partitions.keySet() ).iterator();
     }
 
 
-    public Attributes getRootDSE()
+    public Attributes getRootDSE( OperationContext getRootDSEContext )
     {
         return rootDSE;
     }
@@ -658,7 +777,7 @@
     private void unregister( Partition partition ) throws NamingException
     {
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.remove( partition.getSuffix().toString() );
+        namingContexts.remove( partition.getSuffix().getUpName() );
         partitions.remove( partition.getSuffix().toString() );
     }
 
@@ -666,28 +785,26 @@
     // ------------------------------------------------------------------------
     // DirectoryPartition Interface Method Implementations
     // ------------------------------------------------------------------------
-
-    public void bind( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId ) throws NamingException
+    public void bind( OperationContext bindContext ) throws NamingException
     {
-        Partition partition = getBackend( bindDn );
-        partition.bind( bindDn, credentials, mechanisms, saslAuthId );
+        Partition partition = getBackend( bindContext.getDn() );
+        partition.bind( bindContext );
     }
 
-
-    public void unbind( LdapDN bindDn ) throws NamingException
+    public void unbind( OperationContext unbindContext ) throws NamingException
     {
-        Partition partition = getBackend( bindDn );
-        partition.unbind( bindDn );
+        Partition partition = getBackend( unbindContext.getDn() );
+        partition.unbind( unbindContext );
     }
 
 
     /**
      * @see Partition#delete(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public void delete( LdapDN dn ) throws NamingException
+    public void delete( OperationContext deleteContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
-        backend.delete( dn );
+        Partition backend = getBackend( deleteContext.getDn() );
+        backend.delete( deleteContext );
     }
 
 
@@ -698,58 +815,64 @@
      * here so backend implementors do not have to worry about performing these
      * kinds of checks.
      *
-     * @see Partition#add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes)
+     * @see Partition#add( OperationContext )
      */
-    public void add( LdapDN dn, Attributes entry ) throws NamingException
+    public void add( OperationContext addContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
-        backend.add( dn, entry );
+        Partition backend = getBackend( addContext.getDn() );
+        backend.add( addContext );
     }
 
 
     /**
      * @see Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes)
      */
-    public void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException
+    public void modify( OperationContext modifyContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
-        backend.modify( dn, modOp, mods );
+        Partition backend = getBackend( modifyContext.getDn() );
+        backend.modify( modifyContext );
     }
 
 
     /**
+<<<<<<< .mine
+=======
      * @see Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])
      */
-    public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
+    /*public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
     {
         Partition backend = getBackend( dn );
         backend.modify( dn, mods );
-    }
+    }*/
 
 
     /**
+>>>>>>> .r530934
      * @see Partition#list(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public NamingEnumeration list( LdapDN base ) throws NamingException
+    public NamingEnumeration list( OperationContext opContext ) throws NamingException
     {
-        Partition backend = getBackend( base );
-        return backend.list( base );
+        Partition backend = getBackend( opContext.getDn() );
+        return backend.list( opContext );
     }
 
 
     /**
      * @see Partition#search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls)
      */
-    public NamingEnumeration<SearchResult> search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
+    public NamingEnumeration<SearchResult> search( OperationContext opContext )
         throws NamingException
     {
-
+        LdapDN base = opContext.getDn();
+        SearchControls searchCtls = ((SearchOperationContext)opContext).getSearchControls();
+        ExprNode filter = ((SearchOperationContext)opContext).getFilter();
+        
         if ( base.size() == 0 )
         {
             boolean isObjectScope = searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE;
             
             // test for (objectClass=*)
-            boolean isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equalsIgnoreCase( "2.5.4.0" );
+            boolean isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equals( SchemaConstants.OBJECT_CLASS_AT_OID );
 
             /*
              * if basedn is "", filter is "(objectclass=*)" and scope is object
@@ -765,7 +888,7 @@
                 // -----------------------------------------------------------
                 if ( ids == null || ids.length == 0 )
                 {
-                    SearchResult result = new SearchResult( "", null, ( Attributes ) getRootDSE().clone(), false );
+                    SearchResult result = new ServerSearchResult( "", null, ( Attributes ) getRootDSE( null ).clone(), false );
                     return new SingletonEnumeration( result );
                 }
                 
@@ -809,21 +932,21 @@
                 // return nothing
                 if ( containsOneDotOne )
                 {
-                    SearchResult result = new SearchResult( "", null, new AttributesImpl(), false );
+                    SearchResult result = new ServerSearchResult( "", null, new AttributesImpl(), false );
                     return new SingletonEnumeration( result );
                 }
                 
                 // return everything
                 if ( containsAsterisk && containsPlus )
                 {
-                    SearchResult result = new SearchResult( "", null, ( Attributes ) getRootDSE().clone(), false );
+                    SearchResult result = new ServerSearchResult( "", null, ( Attributes ) getRootDSE( null ).clone(), false );
                     return new SingletonEnumeration( result );
                 }
                 
                 Attributes attrs = new AttributesImpl();
                 if ( containsAsterisk )
                 {
-                    for ( NamingEnumeration ii = getRootDSE().getAll(); ii.hasMore(); /**/ )
+                    for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ )
                     {
                         // add all user attribute
                         Attribute attr = ( Attribute ) ii.next();
@@ -841,7 +964,7 @@
                 }
                 else if ( containsPlus )
                 {
-                    for ( NamingEnumeration ii = getRootDSE().getAll(); ii.hasMore(); /**/ )
+                    for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ )
                     {
                         // add all operational attributes
                         Attribute attr = ( Attribute ) ii.next();
@@ -859,7 +982,7 @@
                 }
                 else
                 {
-                    for ( NamingEnumeration ii = getRootDSE().getAll(); ii.hasMore(); /**/ )
+                    for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ )
                     {
                       // add user attributes specifically asked for
                         Attribute attr = ( Attribute ) ii.next();
@@ -871,7 +994,7 @@
                     }
                 }
 
-                SearchResult result = new SearchResult( "", null, attrs, false );
+                SearchResult result = new ServerSearchResult( "", null, attrs, false );
                 return new SingletonEnumeration( result );
             }
 
@@ -879,53 +1002,62 @@
         }
 
         Partition backend = getBackend( base );
-        return backend.search( base, env, filter, searchCtls );
-    }
-
-
-    /**
-     * @see Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN)
-     */
-    public Attributes lookup( LdapDN dn ) throws NamingException
-    {
-        if ( dn.size() == 0 )
-        {
-            return ( Attributes ) rootDSE.clone();
-        }
-
-        Partition backend = getBackend( dn );
-        return backend.lookup( dn );
+        return backend.search( opContext );
     }
 
 
     /**
      * @see Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[])
      */
-    public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
+    public Attributes lookup( OperationContext opContext ) throws NamingException
     {
+        LookupOperationContext ctx = (LookupOperationContext)opContext;
+        LdapDN dn = ctx.getDn();
+        
         if ( dn.size() == 0 )
         {
             Attributes retval = new AttributesImpl();
             NamingEnumeration list = rootDSE.getIDs();
-            while ( list.hasMore() )
+     
+            if ( ctx.getAttrsId() != null )
             {
-                String id = ( String ) list.next();
-                Attribute attr = rootDSE.get( id );
-                retval.put( ( Attribute ) attr.clone() );
+                while ( list.hasMore() )
+                {
+                    String id = ( String ) list.next();
+                    
+                    if ( ctx.getAttrsId().contains( id ) )
+                    {
+                        Attribute attr = rootDSE.get( id );
+                        retval.put( ( Attribute ) attr.clone() );
+                    }
+                }
             }
+            else
+            {
+                while ( list.hasMore() )
+                {
+                    String id = ( String ) list.next();
+                    
+                    Attribute attr = rootDSE.get( id );
+                    retval.put( ( Attribute ) attr.clone() );
+                }
+            }
+            
             return retval;
         }
 
         Partition backend = getBackend( dn );
-        return backend.lookup( dn, attrIds );
+        return backend.lookup( ctx );
     }
 
 
     /**
-     * @see Partition#hasEntry(org.apache.directory.shared.ldap.name.LdapDN)
+     * @see Partition#hasEntry(OperationContext)
      */
-    public boolean hasEntry( LdapDN dn ) throws NamingException
+    public boolean hasEntry( OperationContext opContext ) throws NamingException
     {
+        LdapDN dn = opContext.getDn();
+        
         if ( IS_DEBUG )
         {
             log.debug( "Check if DN '" + dn + "' exists." );
@@ -937,46 +1069,37 @@
         }
 
         Partition backend = getBackend( dn );
-        return backend.hasEntry( dn );
+        return backend.hasEntry( opContext );
     }
 
 
     /**
-     * @see Partition#isSuffix(org.apache.directory.shared.ldap.name.LdapDN)
+     * @see Partition#rename(OperationContext)
      */
-    public boolean isSuffix( LdapDN dn )
+    public void rename( OperationContext opContext ) throws NamingException
     {
-        return partitions.containsKey( dn.toString() );
+        Partition backend = getBackend( opContext.getDn() );
+        backend.rename( opContext );
     }
 
 
     /**
-     * @see Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)
+     * @see Partition#move(OperationContext)
      */
-    public void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void move( OperationContext opContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
-        backend.modifyRn( dn, newRdn, deleteOldRdn );
+        Partition backend = getBackend( opContext.getDn() );
+        backend.move( opContext );
     }
 
 
     /**
-     * @see Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)
+     * @see Partition#moveAndRename( OperationContext )
      */
-    public void move( LdapDN oriChildName, LdapDN newParentName ) throws NamingException
+    public void moveAndRename( OperationContext opContext ) throws NamingException
     {
-        Partition backend = getBackend( oriChildName );
-        backend.move( oriChildName, newParentName );
-    }
-
-
-    /**
-     * @see Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)
-     */
-    public void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean deleteOldRdn ) throws NamingException
-    {
-        Partition backend = getBackend( oldChildDn );
-        backend.move( oldChildDn, newParentDn, newRdn, deleteOldRdn );
+        Partition backend = getBackend( opContext.getDn() );
+        backend.moveAndRename( opContext );
     }
 
 
@@ -994,15 +1117,17 @@
     private Partition getBackend( LdapDN dn ) throws NamingException
     {
         LdapDN clonedDn = ( LdapDN ) dn.clone();
+        
         while ( clonedDn.size() > 0 )
         {
             if ( partitions.containsKey( clonedDn.toString() ) )
             {
-                return ( Partition ) partitions.get( clonedDn.toString() );
+                return partitions.get( clonedDn.toString() );
             }
 
             clonedDn.remove( clonedDn.size() - 1 );
         }
+        
         throw new LdapNameNotFoundException( dn.getUpName() );
     }
 
@@ -1023,7 +1148,7 @@
         }
         for ( Iterator oids = extensionOids.iterator(); oids.hasNext(); )
         {
-            supportedExtension.add( ( String ) oids.next() );
+            supportedExtension.add( oids.next() );
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Wed May 23 17:26:40 2007
@@ -20,20 +20,15 @@
 package org.apache.directory.server.core.partition;
 
 
-import java.util.List;
-import java.util.Map;
-
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -106,52 +101,37 @@
      * Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be 
      * deleted until this operation has been applied to their children.
      *
-     * @param name the normalized distinguished/absolute name of the entry to
+     * @param opContext the context of the entry to
      * delete from this ContextPartition.
      * @throws NamingException if there are any problems
      */
-    void delete( LdapDN name ) throws NamingException;
+    void delete( OperationContext opContext ) throws NamingException;
 
 
     /**
      * Adds an entry to this ContextPartition.
      *
-     * @param name
-     * @param entry the entry to add to this ContextPartition
+     * @param opContext the context used  to add and entry to this ContextPartition
      * @throws NamingException if there are any problems
      */
-    void add( LdapDN name, Attributes entry ) throws NamingException;
+    void add( OperationContext opContext ) throws NamingException;
 
 
     /**
      * Modifies an entry by adding, removing or replacing a set of attributes.
      *
-     * @param name the normalized distinguished/absolute name of the entry to
-     * modify
-     * @param modOp the modification operation to perform on the entry which
-     * is one of constants specified by the DirContext interface:
+     * @param opContext The contetx containin the modification operation 
+     * to perform on the entry which is one of constants specified by the 
+     * DirContext interface:
      * <code>ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE</code>.
-     * @param attributes the attributes and their values used to affect the
-     * modification with.
+     * 
      * @throws NamingException if there are any problems
      * @see javax.naming.directory.DirContext
      * @see javax.naming.directory.DirContext#ADD_ATTRIBUTE
      * @see javax.naming.directory.DirContext#REMOVE_ATTRIBUTE
      * @see javax.naming.directory.DirContext#REPLACE_ATTRIBUTE
      */
-    void modify( LdapDN name, int modOp, Attributes attributes ) throws NamingException;
-
-
-    /**
-     * Modifies an entry by using a combination of adds, removes or replace 
-     * operations using a set of ModificationItems.
-     *
-     * @param name the normalized distinguished/absolute name of the entry to modify
-     * @param items the ModificationItems used to affect the modification with
-     * @throws NamingException if there are any problems
-     * @see javax.naming.directory.ModificationItem
-     */
-    void modify( LdapDN name, ModificationItemImpl[] items ) throws NamingException;
+    void modify( OperationContext opContext ) throws NamingException;
 
 
     /**
@@ -160,11 +140,11 @@
      * used to optimize operations rather than conducting a full search with 
      * retrieval.
      *
-     * @param baseName the base distinguished/absolute name for the search/listing
+     * @param opContext the context containing the distinguished/absolute name for the search/listing
      * @return a NamingEnumeration containing objects of type {@link SearchResult}
      * @throws NamingException if there are any problems
      */
-    NamingEnumeration list( LdapDN baseName ) throws NamingException;
+    NamingEnumeration list( OperationContext opContext ) throws NamingException;
 
 
     /**
@@ -175,16 +155,13 @@
      * namespace specific or implementation specific key for the set of LDAP
      * Controls.
      *
-     * @param baseName the normalized distinguished/absolute name of the search base
-     * @param environment the environment under which operation occurs
-     * @param filter the root node of the filter expression tree
-     * @param searchControls the search controls
+     * @param opContext The context containing the information used by the operation
      * @throws NamingException if there are any problems
      * @return a NamingEnumeration containing objects of type 
      * <a href="http://java.sun.com/j2se/1.4.2/docs/api/
      * javax/naming/directory/SearchResult.html">SearchResult</a>.
      */
-    NamingEnumeration<SearchResult> search( LdapDN baseName, Map environment, ExprNode filter, SearchControls searchControls )
+    NamingEnumeration<SearchResult> search( OperationContext opContext )
         throws NamingException;
 
 
@@ -192,48 +169,24 @@
      * 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
      *
-     * @param name the normalized distinguished name of the object to lookup
-     * @return an Attributes object representing the entry
-     * @throws NamingException if there are any problems
-     */
-    Attributes lookup( LdapDN name ) throws NamingException;
-
-
-    /**
-     * 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 with a set of attributes to return.  If the attributes is
-     * null or empty, the returned entry will contain all attributes.
-     *
-     * @param name the normalized distinguished name of the object to lookup
-     * @param attrIds the set of attributes to return
+     * @param lookupContext The context containing the parameters
      * @return an Attributes object representing the entry
      * @throws NamingException if there are any problems
      */
-    Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
-
+    Attributes lookup( OperationContext lookupContext ) throws NamingException;
 
     /**
      * Fast operation to check and see if a particular entry exists.
      *
-     * @param name the normalized distinguished/absolute name of the object to
-     * check for existance
+     * @param opContext The context used to pass informations
      * @return true if the entry exists, false if it does not
      * @throws NamingException if there are any problems
      */
-    boolean hasEntry( LdapDN name ) throws NamingException;
-
-
-    /**
-     * Checks to see if name is a context suffix.
-     *
-     * @param name the normalized distinguished/absolute name of the context
-     * @return true if the name is a context suffix, false if it is not.
-     * @throws NamingException if there are any problems
-     */
-    boolean isSuffix( LdapDN name ) throws NamingException;
-
+    boolean hasEntry( OperationContext opContext ) throws NamingException;
 
     /**
      * Modifies an entry by changing its relative name. Optionally attributes
@@ -241,27 +194,20 @@
      * This makes sense only in certain namespaces like LDAP and will be ignored
      * if it is irrelavent.
      *
-     * @param name the normalized distinguished/absolute name of the entry to
-     * modify the RN of.
-     * @param newRn the new RN of the entry specified by name
-     * @param deleteOldRn boolean flag which removes the old RN attribute
-     * from the entry if set to true, and has no affect if set to false
+     * @param opContext the modify DN context
      * @throws NamingException if there are any problems
      */
-    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void rename( OperationContext opContext ) throws NamingException;
 
 
     /**
      * Transplants a child entry, to a position in the namespace under a new
      * parent entry.
      *
-     * @param oldName the normalized distinguished/absolute name of the
-     * original child name representing the child entry to move
-     * @param newParentName the normalized distinguished/absolute name of the
-     * new parent to move the target entry to
+     * @param opContext The context containing the DNs to move
      * @throws NamingException if there are any problems
      */
-    void move( LdapDN oldName, LdapDN newParentName ) throws NamingException;
+    void move( OperationContext opContext ) throws NamingException;
 
 
     /**
@@ -272,16 +218,11 @@
      * namespace this parameters is ignored.  An example of a namespace where
      * this parameter is significant is the LDAP namespace.
      *
-     * @param oldName the normalized distinguished/absolute name of the
-     * original child name representing the child entry to move
-     * @param newParentName the normalized distinguished/absolute name of the
-     * new parent to move the targeted entry to
-     * @param newRn the new RN of the entry
-     * @param deleteOldRn boolean flag which removes the old RN attribute
-     * from the entry if set to true, and has no affect if set to false
+     * @param opContext The context contain all the information about
+     * the modifyDN operation
      * @throws NamingException if there are any problems
      */
-    void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
+    void moveAndRename( OperationContext opContext ) throws NamingException;
 
 
     /**
@@ -289,23 +230,18 @@
      * need not support this operation.  This operation is here to enable those
      * interested in implementing virtual directories with ApacheDS.
      * 
-     * @param bindDn the normalized dn of the principal
-     * @param credentials the credentials of the principal
-     * @param mechanisms the mechanisms requested by the JNDI caller or a single
-     * mechanism representing the SASL bind mechanism used by a networked client (Strings)
-     * @param saslAuthId the SASL authentication (may be null)
+     * @param opContext the bind context, containing all the needed informations to bind
      * @throws NamingException if something goes wrong
      */
-    void bind( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId ) throws NamingException;
-
+    void bind( OperationContext opContext ) throws NamingException;
 
     /**
      * 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.
      * 
-     * @param bindDn the normalized dn of the principal attempting to unbind
+     * @param opContext the context used to unbind
      * @throws NamingException if something goes wrong
      */
-    void unbind( LdapDN bindDn ) throws NamingException;
+    void unbind( OperationContext opContext ) throws NamingException;
 }



Mime
View raw message