directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1423398 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/filtering/ core-api/src/test/java/org/apache/directory/server/core/api/ core-jndi/src/main/java/org/apache/directory/server/core/jndi/ core...
Date Tue, 18 Dec 2012 10:40:29 GMT
Author: elecharny
Date: Tue Dec 18 10:40:27 2012
New Revision: 1423398

URL: http://svn.apache.org/viewvc?rev=1423398&view=rev
Log:
We now pass a SchemaManager as a parameter of the BaseEntryFilteringCursor. That alleviates
the need to have an instanciated DirectoryService when dealing with a Partition directly.

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java

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=1423398&r1=1423397&r2=1423398&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
Tue Dec 18 10:40:27 2012
@@ -37,6 +37,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.OperationAbandonedException;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,6 +66,9 @@ public class BaseEntryFilteringCursor ex
 
     /** the parameters associated with the search operation */
     private final SearchOperationContext operationContext;
+    
+    /** The SchemaManager */
+    private final SchemaManager schemaManager;
 
     /** the list of filters to be applied */
     private final List<EntryFilter> filters;
@@ -87,9 +91,9 @@ public class BaseEntryFilteringCursor ex
      * @param filter a single filter to be used
      */
     public BaseEntryFilteringCursor( Cursor<Entry> wrapped,
-        SearchOperationContext operationContext, EntryFilter filter )
+        SearchOperationContext operationContext, SchemaManager schemaManager, EntryFilter
filter )
     {
-        this( wrapped, operationContext, Collections.singletonList( filter ) );
+        this( wrapped, operationContext, schemaManager, Collections.singletonList( filter
) );
     }
 
 
@@ -102,7 +106,7 @@ public class BaseEntryFilteringCursor ex
      * @param invocation the search operation invocation creating this Cursor
      * @param filter a single filter to be used
      */
-    public BaseEntryFilteringCursor( Cursor<Entry> wrapped, SearchOperationContext
operationContext )
+    public BaseEntryFilteringCursor( Cursor<Entry> wrapped, SearchOperationContext
operationContext, SchemaManager schemaManager )
     {
         if ( IS_DEBUG )
         {
@@ -112,6 +116,7 @@ public class BaseEntryFilteringCursor ex
         this.wrapped = wrapped;
         this.operationContext = operationContext;
         this.filters = new ArrayList<EntryFilter>();
+        this.schemaManager = schemaManager;
     }
 
 
@@ -125,7 +130,9 @@ public class BaseEntryFilteringCursor ex
      * @param filters a list of filters to be used
      */
     public BaseEntryFilteringCursor( Cursor<Entry> wrapped,
-        SearchOperationContext operationContext, List<EntryFilter> filters )
+        SearchOperationContext operationContext, 
+        SchemaManager schemaManager, 
+        List<EntryFilter> filters )
     {
         if ( IS_DEBUG )
         {
@@ -136,6 +143,7 @@ public class BaseEntryFilteringCursor ex
         this.operationContext = operationContext;
         this.filters = new ArrayList<EntryFilter>();
         this.filters.addAll( filters );
+        this.schemaManager = schemaManager;
     }
 
 
@@ -395,7 +403,7 @@ public class BaseEntryFilteringCursor ex
             {
                 prefetched = tempResult;
                 ServerEntryUtils.filterContents( 
-                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    schemaManager,
                     operationContext, prefetched );
                 
                 return true;
@@ -405,7 +413,7 @@ public class BaseEntryFilteringCursor ex
             {
                 prefetched = tempResult;
                 ServerEntryUtils.filterContents( 
-                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    schemaManager,
                     operationContext, prefetched );
 
                 return true;
@@ -472,7 +480,7 @@ public class BaseEntryFilteringCursor ex
             {
                 prefetched = tempResult;
                 ServerEntryUtils.filterContents( 
-                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    schemaManager,
                     operationContext, prefetched );
 
                 return true;
@@ -482,7 +490,7 @@ public class BaseEntryFilteringCursor ex
             {
                 prefetched = tempResult;
                 ServerEntryUtils.filterContents( 
-                    operationContext.getSession().getDirectoryService().getSchemaManager(),
+                    schemaManager,
                     operationContext, prefetched );
 
                 return true;
@@ -504,7 +512,7 @@ public class BaseEntryFilteringCursor ex
              */
             prefetched = tempResult;
             ServerEntryUtils.filterContents( 
-                operationContext.getSession().getDirectoryService().getSchemaManager(),
+                schemaManager,
                 operationContext, prefetched );
 
             return true;

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
Tue Dec 18 10:40:27 2012
@@ -42,6 +42,7 @@ public class MockOperation implements Op
 {
     final int count;
     final CoreSession session;
+    final SchemaManager schemaManager;
 
 
     public MockOperation( SchemaManager schemaManager, int count ) throws Exception
@@ -50,12 +51,14 @@ public class MockOperation implements Op
         this.session = new MockCoreSession( new LdapPrincipal( schemaManager, new Dn( schemaManager
),
             AuthenticationLevel.STRONG ),
             new MockDirectoryService( count ) );
+        
+        this.schemaManager = schemaManager;
     }
 
 
     public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        return new BaseEntryFilteringCursor( new MockCursor( count ), searchContext );
+        return new BaseEntryFilteringCursor( new MockCursor( count ), searchContext, schemaManager
);
     }
 
 

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
Tue Dec 18 10:40:27 2012
@@ -114,7 +114,7 @@ public class MockOperationManager implem
     {
         MockCursor cursor = new MockCursor( count );
         cursor.setSchemaManager( searchContext.getSession().getDirectoryService().getSchemaManager()
);
-        return new BaseEntryFilteringCursor( cursor, searchContext );
+        return new BaseEntryFilteringCursor( cursor, searchContext, cursor.schemaManager
);
     }
 
 

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Tue Dec 18 10:40:27 2012
@@ -547,11 +547,12 @@ public abstract class ServerContext impl
             if ( result )
             {
                 Entry emptyEntry = new DefaultEntry( service.getSchemaManager(), Dn.EMPTY_DN
);
-                return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( emptyEntry
), searchContext );
+                return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( emptyEntry
), 
+                    searchContext, schemaManager );
             }
             else
             {
-                return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext
);
+                return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext,
schemaManager );
             }
         }
         else

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=1423398&r1=1423397&r2=1423398&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
Tue Dec 18 10:40:27 2012
@@ -593,7 +593,7 @@ public class DefaultPartitionNexus exten
         if ( ( ids == null ) || ( ids.size() == 0 ) )
         {
             Entry rootDse = getRootDse( null );
-            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDse
), searchContext );
+            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDse
), searchContext, directoryService.getSchemaManager() );
         }
 
         // -----------------------------------------------------------
@@ -622,14 +622,14 @@ public class DefaultPartitionNexus exten
         if ( noAttribute )
         {
             Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
-            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry
), searchContext );
+            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry
), searchContext, directoryService.getSchemaManager() );
         }
 
         // return everything
         if ( allUserAttributes && allOperationalAttributes )
         {
             Entry rootDse = getRootDse( null );
-            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDse
), searchContext );
+            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDse
), searchContext, directoryService.getSchemaManager() );
         }
 
         Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
@@ -654,7 +654,7 @@ public class DefaultPartitionNexus exten
             }
         }
 
-        return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry
), searchContext );
+        return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry
), searchContext, directoryService.getSchemaManager() );
     }
 
 
@@ -730,7 +730,7 @@ public class DefaultPartitionNexus exten
             else
             {
                 // Nothing to return in this case
-                return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext
);
+                return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext,
directoryService.getSchemaManager() );
             }
         }
         else if ( isOnelevelScope )

Modified: directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Tue Dec 18 10:40:27 2012
@@ -284,7 +284,7 @@ public class NormalizationInterceptor ex
         if ( filter == null )
         {
             LOG.warn( "undefined filter based on undefined attributeType not evaluted at
all.  Returning empty enumeration." );
-            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext
);
+            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext,
schemaManager );
         }
 
         // Normalize the filter
@@ -293,7 +293,7 @@ public class NormalizationInterceptor ex
         if ( filter == null )
         {
             LOG.warn( "undefined filter based on undefined attributeType not evaluted at
all.  Returning empty enumeration." );
-            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext
);
+            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext,
schemaManager );
         }
         else
         {

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=1423398&r1=1423397&r2=1423398&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
Tue Dec 18 10:40:27 2012
@@ -1299,7 +1299,7 @@ public class SchemaInterceptor extends B
                 }
                 else
                 {
-                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(),
searchContext );
+                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(),
searchContext, schemaManager );
                 }
 
                 AttributeType nodeAt = node.getAttributeType();
@@ -1313,11 +1313,11 @@ public class SchemaInterceptor extends B
                     Entry serverEntry = SchemaService.getSubschemaEntry( directoryService,
                         searchContext );
                     serverEntry.setDn( base );
-                    return new BaseEntryFilteringCursor( new SingletonCursor<Entry>(
serverEntry ), searchContext );
+                    return new BaseEntryFilteringCursor( new SingletonCursor<Entry>(
serverEntry ), searchContext, schemaManager );
                 }
                 else
                 {
-                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(),
searchContext );
+                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(),
searchContext, schemaManager );
                 }
             }
             else if ( filter instanceof PresenceNode )
@@ -1332,14 +1332,14 @@ public class SchemaInterceptor extends B
                         searchContext );
                     serverEntry.setDn( base );
                     EntryFilteringCursor cursor = new BaseEntryFilteringCursor(
-                        new SingletonCursor<Entry>( serverEntry ), searchContext );
+                        new SingletonCursor<Entry>( serverEntry ), searchContext, schemaManager
);
                     return cursor;
                 }
             }
         }
 
         // In any case not handled previously, just return an empty result
-        return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext
);
+        return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext,
schemaManager );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
Tue Dec 18 10:40:27 2012
@@ -983,7 +983,7 @@ public abstract class AbstractBTreeParti
 
             Cursor<Entry> result = new EntryCursorAdaptor( this, searchResult );
 
-            return new BaseEntryFilteringCursor( result, searchContext );
+            return new BaseEntryFilteringCursor( result, searchContext, schemaManager );
         }
         catch ( LdapException le )
         {

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java?rev=1423398&r1=1423397&r2=1423398&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
Tue Dec 18 10:40:27 2012
@@ -112,6 +112,6 @@ public class AbstractCursorTest
             new SearchOperationContext( session, Dn.ROOT_DSE, SearchScope.ONELEVEL, null,
"*", "EntryUUID" );
         
         return new BaseEntryFilteringCursor( new EntryCursorAdaptor( ( AbstractBTreePartition
) store, searchResult ),
-            operationContext );
+            operationContext, directoryService.getSchemaManager() );
     }
 }



Mime
View raw message