You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/01/21 17:46:44 UTC

svn commit: r1061896 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/ core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/ core/src/main/java/org/apache/directory/server/core/a...

Author: elecharny
Date: Fri Jan 21 16:46:43 2011
New Revision: 1061896

URL: http://svn.apache.org/viewvc?rev=1061896&view=rev
Log:
o Added some commented traces in InterceptorChain (we have to transform them to logs)
o Added some test for DIRSERVER-1605
o Removed some useless code
o Moved a check for a null entry in lookup in the defaultPartitionNexus code

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.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/schema/SchemaInterceptor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Fri Jan 21 16:46:43 2011
@@ -952,7 +952,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.compare( next.nextInterceptor, compareContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", compareRequest" );
+                        boolean result = interceptor.compare( next.nextInterceptor, compareContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", compareRequest" );
+                        
+                        return result;
                     }
                     catch ( LdapException le )
                     {
@@ -973,7 +977,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.getRootDSE( next.nextInterceptor, getRootDseContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", getRootDSERequest" );
+                        Entry rootDSE = interceptor.getRootDSE( next.nextInterceptor, getRootDseContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", getRootDSERequest" );
+                        
+                        return rootDSE;
                     }
                     catch ( LdapException le )
                     {
@@ -994,7 +1002,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", deleteRequest" );
                         interceptor.delete( next.nextInterceptor, deleteContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", deleteRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1014,7 +1024,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", addRequest" );
                         interceptor.add( next.nextInterceptor, addContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", addRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1034,7 +1046,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", modifyRequest" );
                         interceptor.modify( next.nextInterceptor, modifyContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", modifyRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1054,7 +1068,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.list( next.nextInterceptor, listContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", listRequest" );
+                        EntryFilteringCursor cursor = interceptor.list( next.nextInterceptor, listContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", listRequest" );
+                        
+                        return cursor;
                     }
                     catch ( LdapException le )
                     {
@@ -1075,7 +1093,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.search( next.nextInterceptor, searchContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", searchRequest" );
+                        EntryFilteringCursor cursor =  interceptor.search( next.nextInterceptor, searchContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", searchRequest" );
+                        
+                        return cursor;
                     }
                     catch ( LdapException le )
                     {
@@ -1096,7 +1118,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.lookup( next.nextInterceptor, lookupContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", lookupRequest" );
+                        Entry entry = interceptor.lookup( next.nextInterceptor, lookupContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", lookupRequest" );
+                        
+                        return entry;
                     }
                     catch ( LdapException le )
                     {
@@ -1117,7 +1143,11 @@ public class InterceptorChain
 
                     try
                     {
-                        return interceptor.hasEntry( next.nextInterceptor, hasEntryContext );
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", hasEntryRequest" );
+                        boolean hasEntry = interceptor.hasEntry( next.nextInterceptor, hasEntryContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", hasEntryRequest" );
+                        
+                        return hasEntry;
                     }
                     catch ( LdapException le )
                     {
@@ -1138,7 +1168,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", renameRequest" );
                         interceptor.rename( next.nextInterceptor, renameContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", renameRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1158,7 +1190,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", moveRequest" );
                         interceptor.move( next.nextInterceptor, moveContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", moveRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1178,7 +1212,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", moveAndRenameRequest" );
                         interceptor.moveAndRename( next.nextInterceptor, moveAndRenameContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", moveAndRenameRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1198,7 +1234,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", bindRequest" );
                         interceptor.bind( next.nextInterceptor, bindContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", bindRequest" );
                     }
                     catch ( LdapException le )
                     {
@@ -1218,7 +1256,9 @@ public class InterceptorChain
 
                     try
                     {
+                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", unbindRequest" );
                         interceptor.unbind( next.nextInterceptor, unbindContext );
+                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", unbindRequest" );
                     }
                     catch ( LdapException le )
                     {

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Fri Jan 21 16:46:43 2011
@@ -171,6 +171,25 @@ public class LookupIT extends AbstractLd
 
 
     /**
+     * Test a lookup( DN ) operation on the subschema subentry
+     */
+    @Test
+    public void testLookupSubSchemaSubEntry() throws Exception
+    {
+        Entry entry = connection.lookup( "cn=schema", "+" );
+
+        assertNotNull( entry );
+
+        // We should have 2 attributes
+        assertEquals( 2, entry.size() );
+
+        // Check that all the user attributes are present
+        assertEquals( "schema", entry.get( "cn" ).getString() );
+        assertTrue( entry.contains( "objectClass", "top", "subschema", "subentry", "apacheSubschema" ) );
+    }
+
+
+    /**
      * Test a lookup( DN ) operation with a list of attributes
      */
     @Test

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Fri Jan 21 16:46:43 2011
@@ -1188,7 +1188,7 @@ public class AdministrativePointIntercep
      */
     public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
-        LOG.debug( "Entering into the Administrative Interceptor, addRequest" );
+        LOG.debug( ">>> Entering into the Administrative Interceptor, addRequest" );
         Entry entry = addContext.getEntry();
         DN dn = entry.getDn();
 
@@ -1243,6 +1243,7 @@ public class AdministrativePointIntercep
      */
     public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws LdapException
     {
+        LOG.debug( ">>> Entering into the Administrative Interceptor, delRequest" );
         Entry entry = deleteContext.getEntry();
         DN dn = entry.getDn();
 
@@ -1304,6 +1305,7 @@ public class AdministrativePointIntercep
      */
     public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
     {
+        LOG.debug( ">>> Entering into the Administrative Interceptor, modifyRequest" );
         // We have to check that the modification is acceptable
         List<Modification> modifications = modifyContext.getModItems();
         DN dn = modifyContext.getDn();
@@ -1432,6 +1434,7 @@ public class AdministrativePointIntercep
      */
     public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
     {
+        LOG.debug( ">>> Entering into the Administrative Interceptor, moveRequest" );
         Entry entry = moveContext.getOriginalEntry();
 
         // Check if we are moving an Administrative Point
@@ -1460,6 +1463,7 @@ public class AdministrativePointIntercep
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
         throws LdapException
     {
+        LOG.debug( ">>> Entering into the Administrative Interceptor, moveAndRenameRequest" );
         Entry entry = moveAndRenameContext.getOriginalEntry();
 
         // Check if we are moving and renaming an Administrative Point
@@ -1487,6 +1491,7 @@ public class AdministrativePointIntercep
      */
     public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
     {
+        LOG.debug( ">>> Entering into the Administrative Interceptor, renameRequest" );
         Entry entry = renameContext.getEntry();
 
         // Check if we are renaming an Administrative Point

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Fri Jan 21 16:46:43 2011
@@ -470,6 +470,7 @@ public class AuthenticationInterceptor e
 
         checkAuthenticated( lookupContext );
         checkPwdReset( lookupContext );
+        
         return next.lookup( lookupContext );
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Fri Jan 21 16:46:43 2011
@@ -378,7 +378,7 @@ public class DefaultAuthorizationInterce
         CoreSession session = lookupContext.getSession();
         Entry entry = nextInterceptor.lookup( lookupContext );
 
-        if ( session.getDirectoryService().isAccessControlEnabled() || ( entry == null ) )
+        if ( session.getDirectoryService().isAccessControlEnabled() )
         {
             return entry;
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Fri Jan 21 16:46:43 2011
@@ -133,11 +133,6 @@ public class CollectiveAttributeIntercep
     {
         Entry result = nextInterceptor.lookup( lookupContext );
 
-        if ( result == null )
-        {
-            return null;
-        }
-
         // Adding the collective attributes if any
         if ( ( lookupContext.getAttrsId() == null ) || ( lookupContext.getAttrsId().size() == 0 ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Fri Jan 21 16:46:43 2011
@@ -250,19 +250,14 @@ public class ExceptionInterceptor extend
 
         if ( dn.equals( subschemSubentryDn ) )
         {
-            return nexus.getRootDSE( null );
+            Entry serverEntry = directoryService.getSchemaService().getSubschemaEntry( lookupContext.getAttrsIdArray() );
+            serverEntry.setDn( dn );
+
+            return serverEntry;
         }
 
         Entry result = nextInterceptor.lookup( lookupContext );
 
-        if ( result == null )
-        {
-            LdapNoSuchObjectException e = new LdapNoSuchObjectException( "Attempt to lookup non-existant entry: "
-                + dn.getName() );
-
-            throw e;
-        }
-
         return result;
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Fri Jan 21 16:46:43 2011
@@ -380,11 +380,6 @@ public class OperationalAttributeInterce
     {
         Entry result = nextInterceptor.lookup( lookupContext );
 
-        if ( result == null )
-        {
-            return null;
-        }
-
         if ( lookupContext.getAttrsId() == null )
         {
             filterOperationalAttributes( result );

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?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- 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 Fri Jan 21 16:46:43 2011
@@ -633,7 +633,17 @@ public class DefaultPartitionNexus exten
         }
 
         Partition backend = getPartition( dn );
-        return backend.lookup( lookupContext );
+        ClonedServerEntry entry =  backend.lookup( lookupContext );
+        
+        if ( entry == null )
+        {
+            LdapNoSuchObjectException e = new LdapNoSuchObjectException( "Attempt to lookup non-existant entry: "
+                + dn.getName() );
+
+            throw e;
+        }
+
+        return entry;
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1061896&r1=1061895&r2=1061896&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Fri Jan 21 16:46:43 2011
@@ -744,11 +744,6 @@ public class SchemaInterceptor extends B
     {
         Entry result = nextInterceptor.lookup( lookupContext );
 
-        if ( result == null )
-        {
-            return null;
-        }
-
         filterBinaryAttributes( result );
 
         return result;