directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r541123 [8/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/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Wed May 23 17:26:40 2007
@@ -31,18 +31,16 @@
 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.configuration.MutableInterceptorConfiguration;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 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.core.partition.PartitionNexusProxy;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -78,140 +76,120 @@
         }
 
 
-        public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
+        public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return nexus.compare( name, oid, value );
+            return nexus.compare( opContext );
         }
 
 
-        public Attributes getRootDSE( NextInterceptor next ) throws NamingException
+        public Attributes getRootDSE( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return nexus.getRootDSE();
+            return nexus.getRootDSE( opContext );
         }
 
 
-        public LdapDN getMatchedName ( NextInterceptor next, LdapDN dn ) throws NamingException
+        public LdapDN getMatchedName( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return ( LdapDN ) nexus.getMatchedName( dn ).clone();
+            return ( LdapDN ) nexus.getMatchedName( opContext ).clone();
         }
 
 
-        public LdapDN getSuffix ( NextInterceptor next, LdapDN dn ) throws NamingException
+        public LdapDN getSuffix( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return ( LdapDN ) nexus.getSuffix( dn ).clone();
+            return ( LdapDN ) nexus.getSuffix( opContext ).clone();
         }
 
 
-        public Iterator listSuffixes ( NextInterceptor next ) throws NamingException
+        public Iterator listSuffixes( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return nexus.listSuffixes();
+            return nexus.listSuffixes( opContext );
         }
 
 
-        public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+        public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.delete( name );
+            nexus.delete( opContext );
         }
 
 
-        public void add(NextInterceptor next, LdapDN normName, Attributes entry) throws NamingException
+        public void add( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.add( normName, entry );
+            nexus.add( opContext );
         }
 
 
-        public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+        public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.modify( name, modOp, mods );
+            nexus.modify( opContext );
         }
 
 
-        public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+        public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.modify( name, mods );
+            return nexus.list( opContext );
         }
 
 
-        public NamingEnumeration list( NextInterceptor next, LdapDN base ) throws NamingException
+        public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return nexus.list( base );
+            return nexus.search( opContext );
         }
 
 
-        public NamingEnumeration search( NextInterceptor next, LdapDN base, Map env, ExprNode filter,
-            SearchControls searchCtls ) throws NamingException
+        public Attributes lookup( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return nexus.search( base, env, filter, searchCtls );
+            return ( Attributes ) nexus.lookup( opContext ).clone();
         }
 
 
-        public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
+        public boolean hasEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            return ( Attributes ) nexus.lookup( name ).clone();
+            return nexus.hasEntry( opContext );
         }
 
 
-        public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
-        {
-            return ( Attributes ) nexus.lookup( dn, attrIds ).clone();
-        }
-
-
-        public boolean hasEntry( NextInterceptor next, LdapDN name ) throws NamingException
-        {
-            return nexus.hasEntry( name );
-        }
-
-
-        public boolean isSuffix( NextInterceptor next, LdapDN name ) throws NamingException
-        {
-            return nexus.isSuffix( name );
-        }
-
-
-        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn )
+        public void rename( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
-            nexus.modifyRn( name, newRn, deleteOldRn );
+            nexus.rename( opContext );
         }
 
 
-        public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException
+        public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.move( oriChildName, newParentName );
+            nexus.move( opContext );
         }
 
 
-        public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn )
+        public void moveAndRename( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
-            nexus.move( oriChildName, newParentName, newRn, deleteOldRn );
+            nexus.moveAndRename( opContext );
         }
 
 
-        public void addContextPartition( NextInterceptor next, PartitionConfiguration cfg )
+        public void addContextPartition( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
-            nexus.addContextPartition( cfg );
+            nexus.addContextPartition( opContext );
         }
 
 
-        public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+        public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.removeContextPartition( suffix );
+            nexus.removeContextPartition( 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
         {
-            nexus.bind( bindDn, credentials, mechanisms, saslAuthId );
+            nexus.bind( opContext );
         }
 
 
-        public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
+        public void unbind( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
-            nexus.unbind( bindDn );
+            nexus.unbind( opContext );
         }
     };
 
@@ -534,14 +512,15 @@
     }
 
 
-    public Attributes getRootDSE() throws NamingException
+    public Attributes getRootDSE( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.getRootDSE( next );
+            return head.getRootDSE( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -555,14 +534,15 @@
     }
 
 
-    public LdapDN getMatchedName( LdapDN name ) throws NamingException
+    public LdapDN getMatchedName( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+
         try
         {
-            return head.getMatchedName( next, name );
+            return head.getMatchedName( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -576,14 +556,15 @@
     }
 
 
-    public LdapDN getSuffix ( LdapDN name ) throws NamingException
+    public LdapDN getSuffix( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.getSuffix( next, name );
+            return head.getSuffix( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -597,14 +578,15 @@
     }
 
 
-    public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
+    public boolean compare( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.compare( next, name, oid, value );
+            return head.compare( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -618,14 +600,15 @@
     }
 
 
-    public Iterator listSuffixes() throws NamingException
+    public Iterator listSuffixes( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.listSuffixes( next );
+            return head.listSuffixes( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -639,14 +622,15 @@
     }
 
 
-    public void addContextPartition( PartitionConfiguration cfg ) throws NamingException
+    public void addContextPartition( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.addContextPartition( next, cfg );
+            head.addContextPartition( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -660,14 +644,15 @@
     }
 
 
-    public void removeContextPartition( LdapDN suffix ) throws NamingException
+    public void removeContextPartition( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.removeContextPartition( next, suffix );
+            head.removeContextPartition( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -681,14 +666,15 @@
     }
 
 
-    public void delete( LdapDN name ) throws NamingException
+    public void delete( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.delete( next, name );
+            head.delete( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -701,14 +687,15 @@
     }
 
 
-    public void add( LdapDN normName, Attributes entry ) throws NamingException
+    public void add( OperationContext opContext ) throws NamingException
     {
         Entry node = getStartingEntry();
         Interceptor head = node.configuration.getInterceptor();
         NextInterceptor next = node.nextInterceptor;
+        
         try
         {
-            head.add( next, normName, entry );
+            head.add( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -721,14 +708,15 @@
     }
 
 
-    public void bind( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId ) throws NamingException
+    public void bind( OperationContext opContext ) throws NamingException
     {
         Entry node = getStartingEntry();
         Interceptor head = node.configuration.getInterceptor();
         NextInterceptor next = node.nextInterceptor;
+        
         try
         {
-            head.bind( next, bindDn, credentials, mechanisms, saslAuthId );
+            head.bind( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -741,14 +729,15 @@
     }
 
 
-    public void unbind( LdapDN bindDn ) throws NamingException
+    public void unbind( OperationContext opContext ) throws NamingException
     {
         Entry node = getStartingEntry();
         Interceptor head = node.configuration.getInterceptor();
         NextInterceptor next = node.nextInterceptor;
+        
         try
         {
-            head.unbind( next, bindDn );
+            head.unbind( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -761,14 +750,15 @@
     }
 
 
-    public void modify( LdapDN name, int modOp, Attributes mods ) throws NamingException
+    public void modify( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.modify( next, name, modOp, mods );
+            head.modify( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -781,11 +771,12 @@
     }
 
 
-    public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+    /*public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
             head.modify( next, name, mods );
@@ -798,17 +789,18 @@
         {
             throwInterceptorException( head, e );
         }
-    }
+    }*/
 
 
-    public NamingEnumeration list( LdapDN base ) throws NamingException
+    public NamingEnumeration list( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.list( next, base );
+            return head.list( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -822,57 +814,16 @@
     }
 
 
-    public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
+    public NamingEnumeration<SearchResult> search( OperationContext opContext )
         throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.search( next, base, env, filter, searchCtls );
-        }
-        catch ( NamingException ne )
-        {
-            throw ne;
-        }
-        catch ( Throwable e )
-        {
-            throwInterceptorException( head, e );
-            throw new InternalError(); // Should be unreachable
-        }
-    }
-
-
-    public Attributes lookup( LdapDN name ) throws NamingException
-    {
-        Entry entry = getStartingEntry();
-        Interceptor head = entry.configuration.getInterceptor();
-        NextInterceptor next = entry.nextInterceptor;
-        try
-        {
-            return head.lookup( next, name );
-        }
-        catch ( NamingException ne )
-        {
-            throw ne;
-        }
-        catch ( Throwable e )
-        {
-            throwInterceptorException( head, e );
-            throw new InternalError(); // Should be unreachable
-        }
-    }
-
-
-    public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
-    {
-        Entry entry = getStartingEntry();
-        Interceptor head = entry.configuration.getInterceptor();
-        NextInterceptor next = entry.nextInterceptor;
-        try
-        {
-            return head.lookup( next, dn, attrIds );
+            return head.search( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -886,14 +837,15 @@
     }
 
 
-    public boolean hasEntry( LdapDN name ) throws NamingException
+    public Attributes lookup( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.hasEntry( next, name );
+            return head.lookup( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -907,14 +859,15 @@
     }
 
 
-    public boolean isSuffix( LdapDN name ) throws NamingException
+    public boolean hasEntry( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            return head.isSuffix( next, name );
+            return head.hasEntry( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -928,14 +881,15 @@
     }
 
 
-    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void rename( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.modifyRn( next, name, newRn, deleteOldRn );
+            head.rename( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -948,14 +902,15 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName ) throws NamingException
+    public void move( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.move( next, oriChildName, newParentName );
+            head.move( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -968,14 +923,15 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void moveAndRename( OperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
+        
         try
         {
-            head.move( next, oriChildName, newParentName, newRn, deleteOldRn );
+            head.moveAndRename( next, opContext );
         }
         catch ( NamingException ne )
         {
@@ -1051,14 +1007,14 @@
                 }
 
 
-                public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
+                public boolean compare( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.compare( next.nextInterceptor, name, oid, value );
+                        return interceptor.compare( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1072,14 +1028,14 @@
                 }
 
 
-                public Attributes getRootDSE() throws NamingException
+                public Attributes getRootDSE( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.getRootDSE( next.nextInterceptor );
+                        return interceptor.getRootDSE( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1093,14 +1049,14 @@
                 }
 
 
-                public LdapDN getMatchedName ( LdapDN dn ) throws NamingException
+                public LdapDN getMatchedName( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.getMatchedName( next.nextInterceptor, dn );
+                        return interceptor.getMatchedName( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1114,14 +1070,14 @@
                 }
 
 
-                public LdapDN getSuffix ( LdapDN dn ) throws NamingException
+                public LdapDN getSuffix( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.getSuffix( next.nextInterceptor, dn );
+                        return interceptor.getSuffix( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1135,14 +1091,14 @@
                 }
 
 
-                public Iterator listSuffixes () throws NamingException
+                public Iterator listSuffixes( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.listSuffixes( next.nextInterceptor );
+                        return interceptor.listSuffixes( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1156,14 +1112,14 @@
                 }
 
 
-                public void delete( LdapDN name ) throws NamingException
+                public void delete( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.delete( next.nextInterceptor, name );
+                        interceptor.delete( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1176,14 +1132,14 @@
                 }
 
 
-                public void add( LdapDN normName, Attributes entry ) throws NamingException
+                public void add( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.add( next.nextInterceptor, normName, entry );
+                        interceptor.add( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1196,14 +1152,14 @@
                 }
 
 
-                public void modify( LdapDN name, int modOp, Attributes mods ) throws NamingException
+                public void modify( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.modify( next.nextInterceptor, name, modOp, mods );
+                        interceptor.modify( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1215,35 +1171,15 @@
                     }
                 }
 
-
-                public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+                
+                public NamingEnumeration list( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.modify( next.nextInterceptor, name, mods );
-                    }
-                    catch ( NamingException ne )
-                    {
-                        throw ne;
-                    }
-                    catch ( Throwable e )
-                    {
-                        throwInterceptorException( interceptor, e );
-                    }
-                }
-
-
-                public NamingEnumeration list( LdapDN base ) throws NamingException
-                {
-                    Entry next = getNextEntry();
-                    Interceptor interceptor = next.configuration.getInterceptor();
-
-                    try
-                    {
-                        return interceptor.list( next.nextInterceptor, base );
+                        return interceptor.list( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1257,7 +1193,7 @@
                 }
 
 
-                public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
+                public NamingEnumeration<SearchResult> search( OperationContext opContext )
                     throws NamingException
                 {
                     Entry next = getNextEntry();
@@ -1265,7 +1201,7 @@
 
                     try
                     {
-                        return interceptor.search( next.nextInterceptor, base, env, filter, searchCtls );
+                        return interceptor.search( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1279,14 +1215,14 @@
                 }
 
 
-                public Attributes lookup( LdapDN name ) throws NamingException
+                public Attributes lookup( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.lookup( next.nextInterceptor, name );
+                        return interceptor.lookup( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1300,14 +1236,14 @@
                 }
 
 
-                public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
+                public boolean hasEntry( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.lookup( next.nextInterceptor, dn, attrIds );
+                        return interceptor.hasEntry( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1321,14 +1257,14 @@
                 }
 
 
-                public boolean hasEntry( LdapDN name ) throws NamingException
+                public void rename( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.hasEntry( next.nextInterceptor, name );
+                        interceptor.rename( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1337,19 +1273,18 @@
                     catch ( Throwable e )
                     {
                         throwInterceptorException( interceptor, e );
-                        throw new InternalError(); // Should be unreachable
                     }
                 }
 
 
-                public boolean isSuffix( LdapDN name ) throws NamingException
+                public void move( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        return interceptor.isSuffix( next.nextInterceptor, name );
+                        interceptor.move( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1358,52 +1293,11 @@
                     catch ( Throwable e )
                     {
                         throwInterceptorException( interceptor, e );
-                        throw new InternalError(); // Should be unreachable
                     }
                 }
 
 
-                public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
-                {
-                    Entry next = getNextEntry();
-                    Interceptor interceptor = next.configuration.getInterceptor();
-
-                    try
-                    {
-                        interceptor.modifyRn( next.nextInterceptor, name, newRn, deleteOldRn );
-                    }
-                    catch ( NamingException ne )
-                    {
-                        throw ne;
-                    }
-                    catch ( Throwable e )
-                    {
-                        throwInterceptorException( interceptor, e );
-                    }
-                }
-
-
-                public void move( LdapDN oriChildName, LdapDN newParentName ) throws NamingException
-                {
-                    Entry next = getNextEntry();
-                    Interceptor interceptor = next.configuration.getInterceptor();
-
-                    try
-                    {
-                        interceptor.move( next.nextInterceptor, oriChildName, newParentName );
-                    }
-                    catch ( NamingException ne )
-                    {
-                        throw ne;
-                    }
-                    catch ( Throwable e )
-                    {
-                        throwInterceptorException( interceptor, e );
-                    }
-                }
-
-
-                public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn )
+                public void moveAndRename( OperationContext opContext )
                     throws NamingException
                 {
                     Entry next = getNextEntry();
@@ -1411,7 +1305,7 @@
 
                     try
                     {
-                        interceptor.move( next.nextInterceptor, oriChildName, newParentName, newRn, deleteOldRn );
+                        interceptor.moveAndRename( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1424,15 +1318,14 @@
                 }
 
 
-                public void bind( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId )
-                    throws NamingException
+                public void bind( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
-
+    
                     try
                     {
-                        interceptor.bind( next.nextInterceptor, bindDn, credentials, mechanisms, saslAuthId );
+                        interceptor.bind( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1445,14 +1338,14 @@
                 }
 
 
-                public void unbind( LdapDN bindDn ) throws NamingException
+                public void unbind( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.unbind( next.nextInterceptor, bindDn );
+                        interceptor.unbind( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1465,14 +1358,14 @@
                 }
 
 
-                public void addContextPartition( PartitionConfiguration cfg ) throws NamingException
+                public void addContextPartition( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.addContextPartition( next.nextInterceptor, cfg );
+                        interceptor.addContextPartition( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {
@@ -1486,14 +1379,14 @@
                 }
 
 
-                public void removeContextPartition( LdapDN suffix ) throws NamingException
+                public void removeContextPartition( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.removeContextPartition( next.nextInterceptor, suffix );
+                        interceptor.removeContextPartition( next.nextInterceptor, opContext );
                     }
                     catch ( NamingException ne )
                     {

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java Wed May 23 17:26:40 2007
@@ -21,21 +21,16 @@
 
 
 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.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-
 /**
  * Represents the next {@link Interceptor} in the interceptor chain.
  *
@@ -47,134 +42,114 @@
 public interface NextInterceptor
 {
     /**
-     * Calls the next interceptor's {@link Interceptor#compare(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String,Object)}.
-     */
-    boolean compare( LdapDN name, String oid, Object value ) throws NamingException;
-
-
-    /**
-     * Calls the next interceptor's {@link Interceptor#getRootDSE(NextInterceptor)}.
+     * Calls the next interceptor's {@link Interceptor#compare( NextInterceptor, OperationContext )}.
      */
-    Attributes getRootDSE() throws NamingException;
+    boolean compare( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#getMatchedName(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#getRootDSE( NextInterceptor, OperationContext )}.
      */
-    LdapDN getMatchedName ( LdapDN name ) throws NamingException;
+    Attributes getRootDSE( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#getSuffix(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#getMatchedName( NextInterceptor, OperationContext )}.
      */
-    LdapDN getSuffix ( LdapDN name ) throws NamingException;
+    LdapDN getMatchedName( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#listSuffixes(NextInterceptor)}.
+     * Calls the next interceptor's {@link Interceptor#getSuffix( NextInterceptor, OperationContext )}.
      */
-    Iterator listSuffixes () throws NamingException;
+    LdapDN getSuffix( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link PartitionNexus#addContextPartition(PartitionConfiguration)}.
+     * Calls the next interceptor's {@link Interceptor#listSuffixes( NextInterceptor, OperationContext )}.
      */
-    void addContextPartition( PartitionConfiguration cfg ) throws NamingException;
+    Iterator listSuffixes( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link PartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link PartitionNexus#addContextPartition( nextInterceptor, OperationContext )}.
      */
-    void removeContextPartition( LdapDN suffix ) throws NamingException;
+    void addContextPartition( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link PartitionNexus#removeContextPartition( NextInterceptor, OperationContext )}.
      */
-    void delete( LdapDN name ) throws NamingException;
+    void removeContextPartition( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#add(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes)}.
+     * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, OperationContext )}.
      */
-    void add(LdapDN normName, Attributes entry) throws NamingException;
+    void delete( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes)}.
+     * Calls the next interceptor's {@link Interceptor#add( NextInterceptor, OperationContext )}.
      */
-    void modify( LdapDN name, int modOp, Attributes attributes ) throws NamingException;
+    void add( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])}.
+     * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, OperationContext )}.
      */
-    void modify( LdapDN name, ModificationItemImpl[] items ) throws NamingException;
-
+    void modify( OperationContext opContext ) throws NamingException;
 
     /**
-     * Calls the next interceptor's {@link Interceptor#list(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, OperationContext )}.
      */
-    NamingEnumeration list( LdapDN baseName ) throws NamingException;
+    NamingEnumeration list( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#search(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls)}.
+     * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, OperationContext opContext )}.
      */
-    NamingEnumeration search( LdapDN baseName, Map environment, ExprNode filter, SearchControls searchControls )
+    NamingEnumeration<SearchResult> search( OperationContext opContext )
         throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, OperationContext )}.
      */
-    Attributes lookup( LdapDN name ) throws NamingException;
+    Attributes lookup( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String[])}.
+     * Calls the next interceptor's {@link Interceptor#hasEntry( NextInterceptor, OperationContext )}.
      */
-    Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
+    boolean hasEntry( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#hasEntry(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#rename( NextInterceptor, OperationContext )}.
      */
-    boolean hasEntry( LdapDN name ) throws NamingException;
+    void rename( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#isSuffix(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#move( NextInterceptor, OperationContext )}.
      */
-    boolean isSuffix( LdapDN name ) throws NamingException;
+    void move( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modifyRn(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}.
+     * Calls the next interceptor's {@link Interceptor#moveAndRename( NextInterceptor, OperationContext )}.
      */
-    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void moveAndRename( OperationContext opContext ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link Interceptor#bind( NextInterceptor, OperationContext )}
      */
-    void move( LdapDN oldName, LdapDN newParentName ) throws NamingException;
-
-
-    /**
-     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}.
-     */
-    void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
-
-
-    /**
-     * Calls the next interceptor's {@link Interceptor#bind(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,byte[],java.util.List,String)}
-     */
-    void bind( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId ) throws NamingException;
-
+    void bind( OperationContext opContext ) throws NamingException;
 
     /**
-     * Calls the next interceptor's {@link Interceptor#unbind(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}
+     * Calls the next interceptor's {@link Interceptor#unbind( NextInterceptor, OperationContext )}
      */
-    void unbind( LdapDN bindDn ) throws NamingException;
+    void unbind( OperationContext opContext ) throws NamingException;
 }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java Wed May 23 17:26:40 2007
@@ -21,6 +21,7 @@
 
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.Map;
@@ -45,8 +46,11 @@
     // I didn't use ThreadLocal to release contexts explicitly.
     // It seems like JDK 1.5 supports explicit release by introducing
     // <tt>ThreadLocal.remove()</tt>, but we're still targetting 1.4.
-    private static final Map stacks = new IdentityHashMap();
+    private static final Map<Thread, InvocationStack> stacks = 
+        Collections.synchronizedMap( new IdentityHashMap<Thread, InvocationStack>() );
 
+    private final Thread thread;
+    private final List<Invocation> stack = new ArrayList<Invocation>();
 
     /**
      * Returns the invocation stack of current thread.
@@ -55,26 +59,19 @@
     {
         Thread currentThread = Thread.currentThread();
         InvocationStack ctx;
-        synchronized ( stacks )
+        ctx = stacks.get( currentThread );
+
+        if ( ctx == null )
         {
-            ctx = ( InvocationStack ) stacks.get( currentThread );
-            if ( ctx == null )
-            {
-                ctx = new InvocationStack();
-            }
+            ctx = new InvocationStack( currentThread );
         }
+
         return ctx;
     }
 
-    private final Thread thread;
-    private final List stack = new ArrayList();
-
-
-    private InvocationStack()
+    private InvocationStack( Thread currentThread )
     {
-        Thread currentThread = Thread.currentThread();
-        this.thread = currentThread;
-        // This operation is already synchronized from getInstance()
+        thread = currentThread;
         stacks.put( currentThread, this );
     }
 
@@ -86,7 +83,7 @@
     public Invocation[] toArray()
     {
         Invocation[] result = new Invocation[stack.size()];
-        result = ( Invocation[] ) stack.toArray( result );
+        result = stack.toArray( result );
         return result;
     }
 
@@ -96,7 +93,7 @@
      */
     public Invocation peek()
     {
-        return ( Invocation ) this.stack.get( 0 );
+        return stack.get( 0 );
     }
 
 
@@ -105,7 +102,7 @@
      */
     public boolean isEmpty()
     {
-        return this.stack.isEmpty();
+        return stack.isEmpty();
     }
 
 
@@ -114,7 +111,7 @@
      */
     public void push( Invocation invocation )
     {
-        this.stack.add( 0, invocation );
+        stack.add( 0, invocation );
     }
 
 
@@ -124,13 +121,11 @@
      */
     public Invocation pop()
     {
-        Invocation invocation = ( Invocation ) this.stack.remove( 0 );
-        if ( this.stack.size() == 0 )
+        Invocation invocation = stack.remove( 0 );
+        
+        if ( stack.size() == 0 )
         {
-            synchronized ( stacks )
-            {
-                stacks.remove( thread );
-            }
+            stacks.remove( thread );
         }
 
         return invocation;

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java Wed May 23 17:26:40 2007
@@ -36,6 +36,8 @@
 import org.apache.directory.server.core.configuration.ShutdownConfiguration;
 import org.apache.directory.server.core.configuration.StartupConfiguration;
 import org.apache.directory.server.core.configuration.SyncConfiguration;
+import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -71,6 +73,8 @@
  */
 public abstract class AbstractContextFactory implements InitialContextFactory, DirectoryServiceListener
 {
+    //TM private static long cumul = 0L;
+    //TM private static long count = 0;
     // ------------------------------------------------------------------------
     // Members
     // ------------------------------------------------------------------------
@@ -85,6 +89,7 @@
 
     public final synchronized Context getInitialContext( Hashtable env ) throws NamingException
     {
+        //TM long t0 = System.nanoTime();
         Configuration cfg = Configuration.toConfiguration( env );
         env = ( Hashtable ) env.clone();
         
@@ -119,23 +124,36 @@
         }
         else if ( cfg instanceof AddPartitionConfiguration )
         {
-            new PartitionNexusProxy( 
-                service.getJndiContext( principalDn, principal, credential, authentication, "" ),
-                service ).addContextPartition( ( ( AddPartitionConfiguration ) cfg )
-                .getDirectoryPartitionConfiguration() );
+            AddContextPartitionOperationContext ctxPartition = 
+                new AddContextPartitionOperationContext( ( ( AddPartitionConfiguration ) cfg ).getDirectoryPartitionConfiguration() );
+            
+            Context ctx = service.getJndiContext( principalDn, principal, credential, authentication, "" ); 
+            
+            new PartitionNexusProxy( ctx, service ).addContextPartition( ctxPartition );
         }
         else if ( cfg instanceof RemovePartitionConfiguration )
         {
             Context ctx = service.getJndiContext( principalDn, principal, credential, authentication, "" );
             PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, service );
-            proxy.removeContextPartition( ( ( RemovePartitionConfiguration ) cfg ).getSuffix() );
+            proxy.removeContextPartition( 
+                new RemoveContextPartitionOperationContext( ( ( RemovePartitionConfiguration ) cfg ).getSuffix() ) );
         }
         else if ( service == null )
         {
             throw new NamingException( "Unknown configuration: " + cfg );
         }
 
-        return service.getJndiContext( principalDn, principal, credential, authentication, providerUrl );
+        Context context = service.getJndiContext( principalDn, principal, credential, authentication, providerUrl );
+        //TM long t1 = System.nanoTime();
+        //TM cumul += (t1 - t0)/1000;
+        //TM count++;
+        
+        //TM if ( count % 1000 == 0)
+        //TM {
+        //TM     System.out.println( "getInitialContext cost : " + (cumul/count) );
+        //TM }
+        
+        return context;
     }
 
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java Wed May 23 17:26:40 2007
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.jndi;
 
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 
 import java.io.ByteArrayInputStream;
@@ -48,12 +49,8 @@
     // Attribute Id Constants Used By The Java LDAP BootstrapSchema
     // ------------------------------------------------------------------------
 
-    /** objectClass attribute for top */
-    public static final String TOP_ATTR = "top";
     /** the javaObject attribute */
     public static final String JOBJECT_ATTR = "javaObject";
-    /** the objectClass attribute */
-    public static final String OBJECTCLASS_ATTR = "objectClass";
     /** the javaContainer attribute */
     public static final String JCONTAINER_ATTR = "javaContainer";
     /** the javaSerializedObject attribute */
@@ -173,8 +170,8 @@
          * objectClass: javaContainer
          * objectClass: javaSerializedObject
          */
-        Attribute objectClass = new AttributeImpl( "objectClass" );
-        objectClass.add( TOP_ATTR );
+        Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
+        objectClass.add( SchemaConstants.TOP_OC );
         objectClass.add( JOBJECT_ATTR );
         objectClass.add( JCONTAINER_ATTR );
         objectClass.add( JSERIALIZEDOBJ_ATTR );

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed May 23 17:26:40 2007
@@ -49,8 +49,20 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.authn.AuthenticationService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+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.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
@@ -70,7 +82,7 @@
 public abstract class ServerContext implements EventContext
 {
     /** property key used for deleting the old RDN on a rename */
-    public static final String DELETE_OLD_RDN_PROP = "java.naming.ldap.deleteRDN";
+    public static final String DELETE_OLD_RDN_PROP = JndiPropertyConstants.JNDI_LDAP_DELETE_RDN;
 
     /** The directory service which owns this context **/
     private final DirectoryService service;
@@ -121,20 +133,20 @@
         this.env.putAll( env );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( this.env );
         dn = props.getProviderDn();
+        
+        BindOperationContext bindContext = new BindOperationContext();
+        bindContext.setDn( props.getBindDn() );
+        bindContext.setCredentials( props.getCredentials() );
+        bindContext.setMechanisms( props.getAuthenticationMechanisms() );
+        bindContext.setSaslAuthId( props.getSaslAuthId() );
 
         // need to issue a bind operation here
-        this.nexusProxy.bind( props.getBindDn(), props.getCredentials(), props.getAuthenticationMechanisms(), props
-            .getSaslAuthId() );
+        this.nexusProxy.bind( bindContext ); 
 
-        if ( ! nexusProxy.hasEntry( dn ) )
+        if ( ! nexusProxy.hasEntry( new EntryOperationContext( dn ) ) )
         {
             throw new NameNotFoundException( dn + " does not exist" );
         }
-
-        if ( dn.size() == 0 )
-        {
-            return;
-        }
     }
 
 
@@ -251,7 +263,7 @@
      */
     public String getNameInNamespace() throws NamingException
     {
-        return dn.toString();
+        return dn.getUpName();
     }
 
 
@@ -301,8 +313,8 @@
         LdapDN target = buildTarget( name );
         injectRdnAttributeValues( target, attributes );
         
-        attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR, JavaLdapSupport.JCONTAINER_ATTR );
-        attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR, JavaLdapSupport.TOP_ATTR );
+        attributes.put( SchemaConstants.OBJECT_CLASS_AT, JavaLdapSupport.JCONTAINER_ATTR );
+        attributes.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC );
 
         /*
          * Add the new context to the server which as a side effect adds 
@@ -311,7 +323,7 @@
          * we need to copy over the controls as well to propagate the complete 
          * environment besides whats in the hashtable for env.
          */
-        nexusProxy.add(target, attributes );
+        nexusProxy.add( new AddOperationContext( target, attributes ) );
         return new ServerLdapContext( service, principal, target );
     }
 
@@ -331,12 +343,13 @@
     public void destroySubcontext( Name name ) throws NamingException
     {
         LdapDN target = buildTarget( name );
+        
         if ( target.size() == 0 )
         {
             throw new LdapNoPermissionException( "can't delete the rootDSE" );
         }
 
-        nexusProxy.delete( target );
+        nexusProxy.delete( new DeleteOperationContext( target ) );
     }
 
 
@@ -380,7 +393,7 @@
         if ( outAttrs != null )
         {
             LdapDN target = buildTarget( name );
-            nexusProxy.add( target, outAttrs );
+            nexusProxy.add( new AddOperationContext( target, outAttrs ) );
             return;
         }
 
@@ -415,7 +428,7 @@
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( attributes, obj );
-            nexusProxy.add( target, attributes );
+            nexusProxy.add( new AddOperationContext( target, attributes ) );
         }
         else if ( obj instanceof DirContext )
         {
@@ -432,7 +445,7 @@
 
             LdapDN target = buildTarget( name );
             injectRdnAttributeValues( target, attributes );
-            nexusProxy.add( target, attributes );
+            nexusProxy.add( new AddOperationContext( target, attributes ) );
         }
         else
         {
@@ -457,6 +470,7 @@
     {
         LdapDN oldDn = buildTarget( oldName );
         LdapDN newDn = buildTarget( newName );
+        
         if ( oldDn.size() == 0 )
         {
             throw new LdapNoPermissionException( "can't rename the rootDSE" );
@@ -479,9 +493,9 @@
         if ( null != env.get( DELETE_OLD_RDN_PROP ) )
         {
             String delOldRdnStr = ( String ) env.get( DELETE_OLD_RDN_PROP );
-            delOldRdn = !delOldRdnStr.equals( "false" );
-            delOldRdn = delOldRdn || delOldRdnStr.equals( "no" );
-            delOldRdn = delOldRdn || delOldRdnStr.equals( "0" );
+            delOldRdn = !delOldRdnStr.equalsIgnoreCase( "false" ) && 
+                            !delOldRdnStr.equalsIgnoreCase( "no" ) && 
+                            !delOldRdnStr.equals( "0" );
         }
 
         /*
@@ -492,21 +506,22 @@
          * a move operation.  Furthermore if the RDN in the move operation 
          * changes it is both an RDN change and a move operation.
          */
-        if ( oldName.size() == newName.size() && oldBase.equals( newBase ) )
+        if ( ( oldName.size() == newName.size() ) && oldBase.equals( newBase ) )
         {
-            nexusProxy.modifyRn( oldDn, newRdn, delOldRdn );
+            nexusProxy.rename( new RenameOperationContext( oldDn, newRdn, delOldRdn ) );
         }
         else
         {
-            LdapDN parent = ( LdapDN ) newDn.clone();
-            parent.remove( newDn.size() - 1 );
+            LdapDN target = ( LdapDN ) newDn.clone();
+            target.remove( newDn.size() - 1 );
+            
             if ( newRdn.equalsIgnoreCase( oldRdn ) )
             {
-                nexusProxy.move( oldDn, parent );
+                nexusProxy.move( new MoveOperationContext( oldDn, target ) );
             }
             else
             {
-                nexusProxy.move( oldDn, parent, newRdn, delOldRdn );
+                nexusProxy.moveAndRename( new MoveAndRenameOperationContext( oldDn, target, newRdn, delOldRdn ) );
             }
         }
     }
@@ -527,10 +542,12 @@
     public void rebind( Name name, Object obj ) throws NamingException
     {
         LdapDN target = buildTarget( name );
-        if ( nexusProxy.hasEntry( target ) )
+        
+        if ( nexusProxy.hasEntry( new EntryOperationContext( target ) ) )
         {
-            nexusProxy.delete( target );
+            nexusProxy.delete( new DeleteOperationContext( target ) );
         }
+        
         bind( name, obj );
     }
 
@@ -549,7 +566,7 @@
      */
     public void unbind( Name name ) throws NamingException
     {
-        nexusProxy.delete( buildTarget( name ) );
+        nexusProxy.delete( new DeleteOperationContext( buildTarget( name ) ) );
     }
 
 
@@ -576,7 +593,17 @@
     {
         Object obj;
         LdapDN target = buildTarget( name );
-        Attributes attributes = nexusProxy.lookup( target );
+        
+        Attributes attributes = null;
+        
+        if ( name.size() == 0 )
+        {
+        	attributes = nexusProxy.getRootDSE( new LookupOperationContext( target ) );
+        }
+        else
+        {
+        	attributes = nexusProxy.lookup( new LookupOperationContext( target ) );
+        }
 
         try
         {
@@ -690,7 +717,7 @@
      */
     public NamingEnumeration list( Name name ) throws NamingException
     {
-        return nexusProxy.list( buildTarget( name ) );
+        return nexusProxy.list( new ListOperationContext( buildTarget( name ) ) );
     }
 
 
@@ -710,10 +737,10 @@
     {
         // Conduct a special one level search at base for all objects
         LdapDN base = buildTarget( name );
-        PresenceNode filter = new PresenceNode( "objectClass" );
+        PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
         SearchControls ctls = new SearchControls();
         ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        return nexusProxy.search( base, getEnvironment(), filter, ctls );
+        return nexusProxy.search( new SearchOperationContext( base, getEnvironment(), filter, ctls ) );
     }
 
 
@@ -784,7 +811,7 @@
 
     public void addNamingListener( Name name, int scope, NamingListener namingListener ) throws NamingException
     {
-        ExprNode filter = new PresenceNode( "objectClass" );
+        ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( scope );
         ( ( PartitionNexusProxy ) this.nexusProxy ).addNamingListener( this, buildTarget( name ), filter,
@@ -841,7 +868,7 @@
         LdapDN target = ( LdapDN ) dn.clone();
 
         // Add to left hand side of cloned DN the relative name arg
-        target.addAll( target.size(), relativeName );
+        target.addAllNormalized( target.size(), relativeName );
         return target;
     }
 }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Wed May 23 17:26:40 2007
@@ -44,7 +44,14 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+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.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -116,7 +123,9 @@
      */
     public Attributes getAttributes( Name name ) throws NamingException
     {
-        return getNexusProxy().lookup( buildTarget( name ) );
+        LookupOperationContext lookupContext = new LookupOperationContext( buildTarget( name ) );
+
+        return getNexusProxy().lookup( lookupContext );
     }
 
 
@@ -136,7 +145,9 @@
      */
     public Attributes getAttributes( Name name, String[] attrIds ) throws NamingException
     {
-        return getNexusProxy().lookup( buildTarget( name ), attrIds );
+        LookupOperationContext lookupContext = new LookupOperationContext( buildTarget( name ), attrIds );
+        
+        return getNexusProxy().lookup( lookupContext );
     }
 
 
@@ -149,14 +160,34 @@
         modifyAttributes( new LdapDN( name ), modOp, attrs );
     }
 
-
     /**
-     * @see javax.naming.directory.DirContext#modifyAttributes(
-     * javax.naming.Name,int, javax.naming.directory.Attributes)
+     * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
+     *      int, javax.naming.directory.Attributes)
      */
     public void modifyAttributes( Name name, int modOp, Attributes attrs ) throws NamingException
     {
-        getNexusProxy().modify( buildTarget( name ), modOp, attrs );
+        ModificationItemImpl[] modItems = null;
+        
+        if ( attrs != null )
+        {
+            modItems = new ModificationItemImpl[attrs.size()];
+            NamingEnumeration e = attrs.getAll();
+            int i = 0;
+            
+            while ( e.hasMore() )
+            {
+                modItems[i++] = new ModificationItemImpl( modOp, ( Attribute ) e.next() ) ;
+            }
+        }
+
+    	if ( name instanceof LdapDN )
+    	{
+    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( name ), modItems ) );
+    	}
+    	else
+    	{
+    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), modItems ) );
+    	}
     }
 
     /**
@@ -199,7 +230,7 @@
             newMods[i] = new ModificationItemImpl( mods[i] );
         }
         
-        getNexusProxy().modify( buildTarget( name ), newMods );
+        getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), newMods ) );
     }
 
 
@@ -209,7 +240,7 @@
      */
     public void modifyAttributes( Name name, ModificationItemImpl[] mods ) throws NamingException
     {
-        getNexusProxy().modify( buildTarget( name ), mods );
+        getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), mods ) );
     }
 
 
@@ -247,7 +278,7 @@
         {
             Attributes clone = ( Attributes ) attrs.clone();
             LdapDN target = buildTarget( name );
-            getNexusProxy().add( target, clone );
+            getNexusProxy().add( new AddOperationContext( target, clone ) );
             return;
         }
 
@@ -267,7 +298,7 @@
                     attributes.put( ( Attribute ) list.next() );
                 }
             }
-            getNexusProxy().add( target, attributes );
+            getNexusProxy().add( new AddOperationContext( target, attributes ) );
             return;
         }
 
@@ -299,7 +330,7 @@
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( attributes, obj );
-            getNexusProxy().add( target, attributes );
+            getNexusProxy().add( new AddOperationContext( target, attributes ) );
         }
         else if ( obj instanceof DirContext )
         {
@@ -314,7 +345,7 @@
                 }
             }
             LdapDN target = buildTarget( name );
-            getNexusProxy().add( target, attributes );
+            getNexusProxy().add( new AddOperationContext( target, attributes ) );
         }
         else
         {
@@ -340,9 +371,9 @@
     public void rebind( Name name, Object obj, Attributes attrs ) throws NamingException
     {
         LdapDN target = buildTarget( name );
-        if ( getNexusProxy().hasEntry( target ) )
+        if ( getNexusProxy().hasEntry( new EntryOperationContext( target ) ) )
         {
-            getNexusProxy().delete( target );
+            getNexusProxy().delete( new DeleteOperationContext( target ) );
         }
         bind( name, obj, attrs );
     }
@@ -373,6 +404,7 @@
         Rdn rdn = target.getRdn( target.size() - 1 );
         
         Attributes attributes = ( Attributes ) attrs.clone();
+        
         if ( rdn.size() == 1 )
         {
             String rdnAttribute = rdn.getUpType();
@@ -407,7 +439,7 @@
         }
 
         // Add the new context to the server which as a side effect adds
-        getNexusProxy().add( target, attributes );
+        getNexusProxy().add( new AddOperationContext( target, attributes ) );
 
         // Initialize the new context
         return new ServerLdapContext( getService(), getPrincipal(), target );
@@ -504,8 +536,9 @@
         // If matchingAttributes is null/empty use a match for everything filter
         if ( null == matchingAttributes || matchingAttributes.size() <= 0 )
         {
-            PresenceNode filter = new PresenceNode( "objectClass" );
-            return getNexusProxy().search( target, getEnvironment(), filter, ctls );
+            PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
+            return getNexusProxy().search( 
+                new SearchOperationContext( target, getEnvironment(), filter, ctls ) );
         }
 
         // Handle simple filter expressions without multiple terms
@@ -529,7 +562,8 @@
                     node = new SimpleNode( attr.getID(), ( String ) value, AssertionEnum.EQUALITY );
                 }
 
-                return getNexusProxy().search( target, getEnvironment(), node, ctls );
+                return getNexusProxy().search( 
+                    new SearchOperationContext( target, getEnvironment(), node, ctls ) );
             }
         }
         
@@ -575,7 +609,8 @@
             }
         }
 
-        return getNexusProxy().search( target, getEnvironment(), filter, ctls );
+        return getNexusProxy().search( 
+            new SearchOperationContext( target, getEnvironment(), filter, ctls ) );
     }
 
 
@@ -602,12 +637,9 @@
      */
     public NamingEnumeration search( Name name, ExprNode filter, SearchControls cons ) throws NamingException
     {
-        /*Name newName = new LdapDN( name.toString() );
-         newName = LdapDN.oidToName( newName, DnOidContainer.getOids() );
-         Name target = buildTarget( ((LdapDN)newName).toLdapName() );*/
-
         LdapDN target = buildTarget( name );
-        return getNexusProxy().search( target, getEnvironment(), filter, cons );
+        return getNexusProxy().search( 
+            new SearchOperationContext( target, getEnvironment(), filter, cons ) );
     }
 
 
@@ -638,7 +670,8 @@
             throw ne;
         }
 
-        return getNexusProxy().search( target, getEnvironment(), filterNode, cons );
+        return getNexusProxy().search( 
+            new SearchOperationContext( target, getEnvironment(), filterNode, cons ) );
     }
 
 
@@ -726,7 +759,7 @@
     // EventDirContext implementations
     // ------------------------------------------------------------------------
 
-    FilterParserImpl filterParser = new FilterParserImpl();
+    private static final FilterParserImpl filterParser = new FilterParserImpl();
 
 
     public void addNamingListener( Name name, String filterStr, SearchControls searchControls,

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Wed May 23 17:26:40 2007
@@ -31,6 +31,8 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.core.referral.ReferralService;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -49,6 +51,9 @@
     private Control[] responseControls = EMPTY_CONTROLS;
     private Control[] connectControls = EMPTY_CONTROLS;
 
+    /** A reference to the RTeferralService interceptor */
+    private transient ReferralService refService = null; 
+    
 
     /**
      * Creates an instance of an ServerLdapContext.
@@ -60,6 +65,7 @@
     public ServerLdapContext( DirectoryService service, Hashtable env ) throws NamingException
     {
         super( service, env );
+        refService = (( ReferralService )service.getConfiguration().getInterceptorChain().get( ReferralService.NAME ) );        
     }
 
 
@@ -73,6 +79,7 @@
     ServerLdapContext( DirectoryService service, LdapPrincipal principal, LdapDN dn ) throws NamingException
     {
         super( service, principal, dn );
+        refService = (( ReferralService )service.getConfiguration().getInterceptorChain().get( ReferralService.NAME ) );        
     }
 
 
@@ -163,7 +170,7 @@
      */
     public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
     {
-        return super.getNexusProxy().compare( name, oid, value );
+        return super.getNexusProxy().compare( new CompareOperationContext( name, oid, value ) );
     }
 
 
@@ -178,22 +185,32 @@
     public void ldapUnbind() throws NamingException
     {
         String bindDn = ( String ) getEnvironment().get( Context.SECURITY_PRINCIPAL );
-        super.getNexusProxy().unbind( new LdapDN( bindDn ) );
+        
+        super.getNexusProxy().unbind( new UnbindOperationContext( new LdapDN( bindDn ) ) );
     }
 
 
-    private transient ReferralService refService;
+    /**
+     * Check if a Name is a referral
+     * @param name The Name to check
+     * @return <code>true</code> if the Name is a referral.
+     * @throws NamingException If the Name is incorrect
+     */
     public boolean isReferral( String name ) throws NamingException
     {
-        if ( refService == null )
-        {
-            refService = ( ReferralService ) getService().getConfiguration().getInterceptorChain().get(
-                ReferralService.NAME );
-        }
-
         return refService.isReferral( name );
     }
 
+    /**
+     * Check if a Name is a referral
+     * @param name The Name to check
+     * @return <code>true</code> if the Name is a referral.
+     * @throws NamingException If the Name is incorrect
+     */
+    public boolean isReferral( LdapDN name ) throws NamingException
+    {
+        return refService.isReferral( name );
+    }
 
     public ServerContext getRootContext() throws NamingException
     {



Mime
View raw message