directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r525116 - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/authn/ main/java/org/apache/directory/server/core/interceptor/ main/java/org/apache/directory/server/core/interceptor/context/ main/java/org/apache/...
Date Tue, 03 Apr 2007 09:39:49 GMT
Author: elecharny
Date: Tue Apr  3 02:39:47 2007
New Revision: 525116

URL: http://svn.apache.org/viewvc?view=rev&rev=525116
Log:
Modified the unbind operation, using an unbindServiceContext through all the interceptors

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindServiceContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
Tue Apr  3 02:39:47 2007
@@ -461,7 +461,9 @@
     throws NamingException
     {   
         BindServiceContext bindCtx = (BindServiceContext)bindContext;
-        LdapDN normBindDn = bindCtx.getNormalizedBindDn();
+        
+        // The DN is always normalized here
+        LdapDN normBindDn = bindCtx.getBindDn();
         String bindUpDn = bindCtx.getBindDn().getUpName();
         
         if ( IS_DEBUG )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
Tue Apr  3 02:39:47 2007
@@ -228,8 +228,8 @@
     }
 
 
-    public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
+    public void unbind( NextInterceptor next, ServiceContext unbindContext ) throws NamingException
     {
-        next.unbind( bindDn );
+        next.unbind( unbindContext );
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
Tue Apr  3 02:39:47 2007
@@ -240,13 +240,13 @@
         throws NamingException;
 
     /**
-     * Filters {@link Partition#bind(org.apache.directory.shared.ldap.name.LdapDN,byte[],java.util.List,String)}
call.
+     * Filters {@link Partition#bind(ServiceContext)} call.
      */
     void bind( NextInterceptor next, ServiceContext bindContext )
         throws NamingException;
 
     /**
-     * Filters {@link Partition#unbind(org.apache.directory.shared.ldap.name.LdapDN)} call.
+     * Filters {@link Partition#unbind(ServiceContext)} call.
      */
-    void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException;
+    void unbind( NextInterceptor next, ServiceContext unbindContext ) throws NamingException;
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Tue Apr  3 02:39:47 2007
@@ -209,9 +209,9 @@
         }
 
 
-        public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
+        public void unbind( NextInterceptor next, ServiceContext unbindContext ) throws NamingException
         {
-            nexus.unbind( bindDn );
+            nexus.unbind( unbindContext );
         }
     };
 
@@ -741,14 +741,15 @@
     }
 
 
-    public void unbind( LdapDN bindDn ) throws NamingException
+    public void unbind( ServiceContext unbindContext ) throws NamingException
     {
         Entry node = getStartingEntry();
         Interceptor head = node.configuration.getInterceptor();
         NextInterceptor next = node.nextInterceptor;
+        
         try
         {
-            head.unbind( next, bindDn );
+            head.unbind( next, unbindContext );
         }
         catch ( NamingException ne )
         {
@@ -1444,14 +1445,14 @@
                 }
 
 
-                public void unbind( LdapDN bindDn ) throws NamingException
+                public void unbind( ServiceContext unbindContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.unbind( next.nextInterceptor, bindDn );
+                        interceptor.unbind( next.nextInterceptor, unbindContext );
                     }
                     catch ( NamingException ne )
                     {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
Tue Apr  3 02:39:47 2007
@@ -173,7 +173,7 @@
     void bind( ServiceContext bindContext ) 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, ServiceContext))}
      */
-    void unbind( LdapDN bindDn ) throws NamingException;
+    void unbind( ServiceContext unbindContext ) throws NamingException;
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindServiceContext.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindServiceContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindServiceContext.java
Tue Apr  3 02:39:47 2007
@@ -32,32 +32,39 @@
  */
 public class BindServiceContext implements ServiceContext
 {
+    /** The principal DN */
     private LdapDN bindDn;
-    private LdapDN normalizedBindDn;
+
+    /** The list of supported mechanisms */
     private List<String> mechanisms;
+    
+    /** The password */
     private byte[] credentials;
+    
+    /** The SASL identifier */
     private String saslAuthId;
     
+    /**
+     * @return The Principal's DN
+     */
     public LdapDN getBindDn()
     {
         return bindDn;
     }
     
+    /**
+     * Set the principal's DN.
+     *
+     * @param bindDn The principal's DN
+     */
     public void setBindDn( LdapDN bindDn )
     {
         this.bindDn = bindDn;
     }
 
-    public LdapDN getNormalizedBindDn()
-    {
-        return normalizedBindDn;
-    }
-
-    public void setNormalizedBindDn( LdapDN normalizedBindDn )
-    {
-        this.normalizedBindDn = normalizedBindDn;
-    }
-
+    /**
+     * @return The list of supported mechanisms
+     */
     public List<String> getMechanisms()
     {
         return mechanisms;
@@ -68,6 +75,9 @@
         this.mechanisms = mechanisms;
     }
 
+    /**
+     * @return The principal password
+     */
     public byte[] getCredentials()
     {
         return credentials;
@@ -78,6 +88,9 @@
         this.credentials = credentials;
     }
 
+    /**
+     * @return The SASL authentication ID
+     */
     public String getSaslAuthId()
     {
         return saslAuthId;
@@ -87,5 +100,4 @@
     {
         this.saslAuthId = saslAuthId;
     }
-    
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
Tue Apr  3 02:39:47 2007
@@ -405,9 +405,8 @@
     
     public void bind( NextInterceptor next, ServiceContext ctx )  throws NamingException
     {
-        BindServiceContext bindContext = (BindServiceContext)ctx;
-        bindContext.setNormalizedBindDn( LdapDN.normalize( bindContext.getBindDn(), attrNormalizers
) );
-        next.bind( bindContext );
+        LdapDN.normalize( ((BindServiceContext)ctx).getBindDn(), attrNormalizers );
+        next.bind( ctx );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Tue Apr  3 02:39:47 2007
@@ -46,6 +46,7 @@
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.BindServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
+import org.apache.directory.server.core.interceptor.context.UnbindServiceContext;
 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.schema.registries.AttributeTypeRegistry;
@@ -663,14 +664,14 @@
     // ------------------------------------------------------------------------
     public void bind( ServiceContext bindContext ) throws NamingException
     {
-        Partition partition = getBackend( ((BindServiceContext)bindContext).getNormalizedBindDn()
);
+        Partition partition = getBackend( ((BindServiceContext)bindContext).getBindDn() );
         partition.bind( bindContext );
     }
 
-    public void unbind( LdapDN bindDn ) throws NamingException
+    public void unbind( ServiceContext unbindContext ) throws NamingException
     {
-        Partition partition = getBackend( bindDn );
-        partition.unbind( bindDn );
+        Partition partition = getBackend( ((UnbindServiceContext)unbindContext).getUnbindDn()
);
+        partition.unbind( unbindContext );
     }
 
 
@@ -987,6 +988,7 @@
     private Partition getBackend( LdapDN dn ) throws NamingException
     {
         LdapDN clonedDn = ( LdapDN ) dn.clone();
+        
         while ( clonedDn.size() > 0 )
         {
             if ( partitions.containsKey( clonedDn.toString() ) )
@@ -996,6 +998,7 @@
 
             clonedDn.remove( clonedDn.size() - 1 );
         }
+        
         throw new LdapNameNotFoundException( dn.getUpName() );
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
Tue Apr  3 02:39:47 2007
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.partition;
 
 
-import java.util.List;
 import java.util.Map;
 
 import javax.naming.Context;
@@ -300,8 +299,8 @@
      * 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 unbindContext the context used to unbind
      * @throws NamingException if something goes wrong
      */
-    void unbind( LdapDN bindDn ) throws NamingException;
+    void unbind( ServiceContext unbindContext ) throws NamingException;
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
Tue Apr  3 02:39:47 2007
@@ -691,16 +691,16 @@
         }
     }
 
-    public void unbind( LdapDN bindDn, Collection bypass ) throws NamingException
+    public void unbind( ServiceContext unbindContext, Collection bypass ) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
         Object[] args = new Object[]
-            { bindDn };
+            { unbindContext };
         stack.push( new Invocation( this, caller, "unbind", args, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().unbind( bindDn );
+            this.configuration.getInterceptorChain().unbind( unbindContext );
         }
         finally
         {
@@ -715,9 +715,9 @@
     }
 
 
-    public void unbind( LdapDN bindDn ) throws NamingException
+    public void unbind( ServiceContext unbindContext ) throws NamingException
     {
-        unbind( bindDn, null );
+        unbind( unbindContext, null );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Tue Apr  3 02:39:47 2007
@@ -421,7 +421,7 @@
     }
 
 
-    public final void unbind( LdapDN bindDn ) throws NamingException
+    public final void unbind( ServiceContext unbindContext ) throws NamingException
     {
     }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=525116&r1=525115&r2=525116
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Tue Apr  3 02:39:47 2007
@@ -21,13 +21,13 @@
 
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import junit.framework.TestCase;
 
@@ -65,7 +65,7 @@
         { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2"
),
             new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
     private InterceptorChain chain;
-    private List interceptors = new ArrayList( interceptorArray.length );
+    private List<Interceptor> interceptors = new ArrayList<Interceptor>( interceptorArray.length
);
 
 
     protected void setUp() throws Exception
@@ -151,7 +151,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "0" );
         bypass.add( "1" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -185,7 +185,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "0" );
         bypass.add( "4" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -215,7 +215,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "1" );
         bypass.add( "3" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -441,10 +441,10 @@
         }
 
 
-        public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
+        public void unbind( NextInterceptor next, ServiceContext unbindContext ) throws NamingException
         {
             interceptors.add( this );
-            next.unbind( bindDn );
+            next.unbind( unbindContext );
         }
     }
 



Mime
View raw message