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 2013/08/21 08:17:36 UTC

svn commit: r1516093 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/partition/ core-shared/src/main/java/org/apache/directory/server/core/shared/partition/ protocol-ldap/src/main/java/org/apache/directory/se...

Author: elecharny
Date: Wed Aug 21 06:17:36 2013
New Revision: 1516093

URL: http://svn.apache.org/r1516093
Log:
o Avoided a clone of the rootDSE when we need to get back a single value from it
o Added a method in the PartitionNexus interface to grab a single value from the rootDSE 
o Improved control that a searchRequest is done on the subscheaSubentry, by avoiding the parsing of the associated DN for every request

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java?rev=1516093&r1=1516092&r2=1516093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java Wed Aug 21 06:17:36 2013
@@ -23,8 +23,10 @@ package org.apache.directory.server.core
 import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
@@ -58,6 +60,15 @@ public interface PartitionNexus extends 
 
 
     /**
+     * Get's the RootDSE value associated with an AttributeType
+     * 
+     * @param attributeType The attribute type for which we want a value
+     * @return the values associated with the given attributeType
+     */
+    Value<?> getRootDseValue( AttributeType attributeType );
+
+
+    /**
      * Add a partition to the server.
      * 
      * @param Partition The Partition to add

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1516093&r1=1516092&r2=1516093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Wed Aug 21 06:17:36 2013
@@ -813,6 +813,17 @@ public class DefaultPartitionNexus exten
     /**
      * {@inheritDoc}
      */
+    public Value<?> getRootDseValue( AttributeType attributeType )
+    {
+        Value<?> value = rootDse.get( attributeType ).get();
+
+        return value.clone();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public synchronized void addContextPartition( Partition partition ) throws LdapException
     {
         // Turn on default indices

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java?rev=1516093&r1=1516092&r2=1516093&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java Wed Aug 21 06:17:36 2013
@@ -100,6 +100,9 @@ public class SearchRequestHandler extend
     /** cached to save redundant lookups into registries */
     private AttributeType OBJECT_CLASS_AT;
 
+    /** cached to save redundant lookups into registries */
+    private AttributeType SUBSCHEMA_SUBENTRY_AT;
+
     /** The replication handler */
     protected ReplicationRequestHandler replicationReqHandler;
 
@@ -1434,8 +1437,15 @@ public class SearchRequestHandler extend
 
         DirectoryService ds = session.getCoreSession().getDirectoryService();
         PartitionNexus nexus = ds.getPartitionNexus();
-        Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        Dn subschemaSubentryDn = new Dn( ds.getSchemaManager(), subschemaSubentry.getString() );
+
+        if ( SUBSCHEMA_SUBENTRY_AT == null )
+        {
+            SUBSCHEMA_SUBENTRY_AT = session.getCoreSession().getDirectoryService().getSchemaManager().getAttributeType(
+                SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
+        }
+
+        Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
+        Dn subschemaSubentryDn = ds.getDnFactory().create( subschemaSubentry.getString() );
         String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
 
         return subschemaSubentryDnNorm.equals( baseNormForm );