directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1422008 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/entry/ core-api/src/main/java/org/apache/directory/server/core/api/filtering/ core-integ/src/test/java/org/apache/directory/server/core/ope...
Date Fri, 14 Dec 2012 17:57:57 GMT
Author: elecharny
Date: Fri Dec 14 17:57:52 2012
New Revision: 1422008

URL: http://svn.apache.org/viewvc?rev=1422008&view=rev
Log:
o The ServerEntryUtil.filterContents() method gets one more parameter : the SchemaManager,
so that it can be used without any DirectoryService. Beware : the opContext and Entry parameters
have also been inverted
o Fixed the code that uses it 

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
    directory/apacheds/trunk/interceptors/schema/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/api/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java?rev=1422008&r1=1422007&r2=1422008&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
Fri Dec 14 17:57:52 2012
@@ -737,7 +737,7 @@ public class ServerEntryUtils
      * @param operationContext The SearchingOperationContext
      * @throws LdapException If the filtering fails
      */
-    public static void filterContents( Entry entry, FilteringOperationContext operationContext
) throws LdapException
+    public static void filterContents( SchemaManager schemaManager, FilteringOperationContext
operationContext, Entry entry ) throws LdapException
     {
         boolean typesOnly = operationContext.isTypesOnly();
 
@@ -762,9 +762,7 @@ public class ServerEntryUtils
 
             return;
         }
-        
-        SchemaManager schemaManager = operationContext.getSession().getDirectoryService().getSchemaManager();
-        
+                
         // If the user has requested all the User attributes ('*') only, we filter the entry's
attribute to keep only
         // the USER attributes, plus the Operational attributes in the returning list 
         if ( operationContext.isAllUserAttributes() )

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java?rev=1422008&r1=1422007&r2=1422008&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
Fri Dec 14 17:57:52 2012
@@ -394,7 +394,9 @@ public class BaseEntryFilteringCursor ex
             if ( filters.isEmpty() )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, operationContext );
+                ServerEntryUtils.filterContents( 
+                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    operationContext, prefetched );
                 
                 return true;
             }
@@ -402,7 +404,9 @@ public class BaseEntryFilteringCursor ex
             if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( operationContext,
tempResult ) )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, operationContext );
+                ServerEntryUtils.filterContents( 
+                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    operationContext, prefetched );
 
                 return true;
             }
@@ -467,7 +471,9 @@ public class BaseEntryFilteringCursor ex
             if ( filters.isEmpty() )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, operationContext );
+                ServerEntryUtils.filterContents( 
+                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    operationContext, prefetched );
 
                 return true;
             }
@@ -475,7 +481,9 @@ public class BaseEntryFilteringCursor ex
             if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( operationContext,
tempResult ) )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, operationContext );
+                ServerEntryUtils.filterContents( 
+                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    operationContext, prefetched );
 
                 return true;
             }
@@ -495,7 +503,9 @@ public class BaseEntryFilteringCursor ex
              * Here the entry has been accepted by all filters.
              */
             prefetched = tempResult;
-            ServerEntryUtils.filterContents( prefetched, operationContext );
+            ServerEntryUtils.filterContents( 
+                operationContext.getSession().getDirectoryService().getSchemaManager(),
+                operationContext, prefetched );
 
             return true;
         }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java?rev=1422008&r1=1422007&r2=1422008&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
Fri Dec 14 17:57:52 2012
@@ -28,8 +28,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -57,7 +59,7 @@ import org.junit.runner.RunWith;
                 indexes =
                 {
                     @CreateIndex( attribute = "objectClass" ),
-                    @CreateIndex( attribute = "sn" ),
+                    //@CreateIndex( attribute = "sn" ),
                     @CreateIndex( attribute = "cn" )
                 } )
                 
@@ -73,14 +75,15 @@ public class AddPerfIT extends AbstractL
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
 
-        Dn dn = new Dn( "cn=test,ou=system" );
-        Entry entry = new DefaultEntry( getService().getSchemaManager(), dn );
-        entry.add( "ObjectClass", "top", "person" );
-        entry.add( "sn", "TEST" );
-        entry.add( "cn", "test" );
+        Dn dn = new Dn( "cn=test,dc=example,dc=com" );
+        Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,
+            "ObjectClass: top", 
+            "ObjectClass: person",
+            "sn: TEST",
+            "cn: test" );
 
         connection.add( entry );
-        int nbIterations = 15000;
+        int nbIterations = 1500;
 
         long t0 = System.currentTimeMillis();
         long t00 = 0L;
@@ -102,7 +105,7 @@ public class AddPerfIT extends AbstractL
             }
 
             String name = "test" + i;
-            dn = new Dn( "cn=" + name + ",ou=system" );
+            dn = new Dn( "cn=" + name + ",dc=example,dc=com" );
             entry = new DefaultEntry( getService().getSchemaManager(), dn,
                 "ObjectClass: top", 
                 "ObjectClass: person",
@@ -119,6 +122,23 @@ public class AddPerfIT extends AbstractL
 
         Long deltaWarmed = ( t1 - t00 );
         System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 5000 )
* 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+        
+        int nbFound = 0;
+        long t2 = System.currentTimeMillis();
+        EntryCursor result = connection.search( "dc=example,dc=com", "(sn=test123*)", SearchScope.SUBTREE,
"*" );
+        
+        while ( result.next() )
+        {
+            Entry res = result.get();
+            
+            System.out.println( res.getDn() );
+            nbFound++;
+        }
+        
+        result.close();
+        long t3 = System.currentTimeMillis();
+        System.out.println( "Delta search : " + ( t3 - t2 ) + " for " + nbFound + " entries");
+        
         connection.close();
     }
 }

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1422008&r1=1422007&r2=1422008&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Fri Dec 14 17:57:52 2012
@@ -921,7 +921,9 @@ public class SchemaInterceptor extends B
          */
         public boolean accept( SearchingOperationContext operationContext, Entry entry )
throws Exception
         {
-            ServerEntryUtils.filterContents( entry, operationContext );
+            ServerEntryUtils.filterContents( 
+                operationContext.getSession().getDirectoryService().getSchemaManager(),
+                operationContext, entry );
 
             return true;
         }
@@ -1164,11 +1166,13 @@ public class SchemaInterceptor extends B
      */
     public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
     {
-        Entry result = next( lookupContext );
+        Entry entry = next( lookupContext );
         
-        ServerEntryUtils.filterContents( result, lookupContext );
+        ServerEntryUtils.filterContents( 
+            lookupContext.getSession().getDirectoryService().getSchemaManager(),
+            lookupContext, entry );
 
-        return result;
+        return entry;
     }
 
 



Mime
View raw message