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 08:59:21 UTC

svn commit: r1061668 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java

Author: elecharny
Date: Fri Jan 21 07:59:21 2011
New Revision: 1061668

URL: http://svn.apache.org/viewvc?rev=1061668&view=rev
Log:
For internal lookups done in eagerlyPopulatFields, call the nexusPartition directly.

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.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=1061668&r1=1061667&r2=1061668&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 07:59:21 2011
@@ -51,7 +51,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
@@ -558,8 +557,6 @@ public class InterceptorChain
      *
      * @param opContext the operation context to populate with cached fields
      */
-    // This will suppress PMD.EmptyCatchBlock warnings in this method
-    @SuppressWarnings("PMD.EmptyCatchBlock")
     private void eagerlyPopulateFields( OperationContext opContext ) throws LdapException
     {
         // If the entry field is not set for ops other than add for example
@@ -571,20 +568,13 @@ public class InterceptorChain
             // We have to use the admin session here, otherwise we may have
             // trouble reading the entry due to insufficient access rights
             CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
-
-            Entry foundEntry = adminSession
-                .lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES_ARRAY );
+            
+            LookupOperationContext lookupContext = new LookupOperationContext( adminSession, opContext.getDn() );
+            ClonedServerEntry foundEntry = opContext.getSession().getDirectoryService().getPartitionNexus().lookup( lookupContext );
 
             if ( foundEntry != null )
             {
-                if ( foundEntry instanceof DefaultEntry )
-                {
-                    opContext.setEntry( new ClonedServerEntry( foundEntry ) );
-                }
-                else
-                {
-                    opContext.setEntry( ( ClonedServerEntry ) foundEntry );
-                }
+                opContext.setEntry( foundEntry );
             }
             else
             {

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=1061668&r1=1061667&r2=1061668&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 07:59:21 2011
@@ -146,6 +146,10 @@ public class DefaultPartitionNexus exten
     final List<Modification> mods = new ArrayList<Modification>( 2 );
 
     private String lastSyncedCtxCsn = null;
+    
+    /** The cn=schema DN */
+    private DN subschemSubentryDn;
+
 
 
     /**
@@ -221,6 +225,9 @@ public class DefaultPartitionNexus exten
         DN adminDn = directoryService.getDNFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
         adminDn.normalize( schemaManager );
 
+        Value<?> attr = rootDSE.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+        subschemSubentryDn = directoryService.getDNFactory().create( attr.getString() );
+
         initializeSystemPartition( directoryService );
 
         List<Partition> initializedPartitions = new ArrayList<Partition>();
@@ -595,6 +602,11 @@ public class DefaultPartitionNexus exten
     {
         DN dn = lookupContext.getDn();
 
+        if ( dn.equals( subschemSubentryDn ) )
+        {
+            return new ClonedServerEntry( rootDSE.clone() );
+        }
+
         // This is for the case we do a lookup on the rootDSE
         if ( dn.size() == 0 )
         {