directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r659365 [2/2] - in /directory/apacheds/branches/bigbang: core/src/main/java/org/apache/directory/server/core/authz/support/ core/src/main/java/org/apache/directory/server/core/filtering/ core/src/main/java/org/apache/directory/server/core/n...
Date Fri, 23 May 2008 02:16:36 GMT
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
Thu May 22 19:16:32 2008
@@ -24,14 +24,14 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerModification;
-import org.apache.directory.server.core.entry.ServerSearchResult;
-import org.apache.directory.server.core.enumeration.SearchResultFilter;
+import org.apache.directory.server.core.filtering.EntryFilter;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -42,6 +42,7 @@
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -154,7 +155,7 @@
 
         // prepare to find all subentries in all namingContexts
         Iterator<String> suffixes = this.nexus.listSuffixes( null );
-        ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue(
+        ExprNode filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT,
new ClientStringValue(
             SchemaConstants.SUBENTRY_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -168,7 +169,7 @@
             //suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
             suffix.normalize( atRegistry.getNormalizerMapping() );
 
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 suffix, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -236,51 +237,45 @@
     // Methods/Code dealing with Subentry Visibility
     // -----------------------------------------------------------------------
 
-    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext
opContext )
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext
opContext )
         throws Exception
     {
-        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
+        EntryFilteringCursor cursor = nextInterceptor.list( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
 
         if ( !isSubentryVisible( invocation ) )
         {
-            // TODO FixMe
-            //return new SearchResultFilteringEnumeration( result, new SearchControls(),
invocation,
-            //    new HideSubentriesFilter(), "List Subentry filter" );
+            cursor.addEntryFilter( new HideSubentriesFilter() );
         }
 
-        return result;
+        return cursor;
     }
 
 
-    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor,
-        SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext
opContext ) 
+        throws Exception
     {
-        Cursor<ServerEntry> result = nextInterceptor.search( opContext );
+        EntryFilteringCursor cursor = nextInterceptor.search( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
         SearchControls searchCtls = opContext.getSearchControls();
 
         // object scope searches by default return subentries
         if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
         {
-            return result;
+            return cursor;
         }
 
         // for subtree and one level scope we filter
         if ( !isSubentryVisible( invocation ) )
         {
-            // TODO FixMe
-            //return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideSubentriesFilter(),
-            //    "Search Subentry filter hide subentries" );
-            return null;
+            cursor.addEntryFilter( new HideSubentriesFilter() );
         }
         else
         {
-            // TODO FixMe
-            //return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideEntriesFilter(),
-            //    "Search Subentry filter hide entries" );
-            return null;
+            cursor.addEntryFilter( new HideEntriesFilter() );
         }
+
+        return cursor;
     }
 
 
@@ -485,7 +480,7 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -619,7 +614,7 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -660,7 +655,7 @@
         ExprNode filter = new PresenceNode( "administrativeRole" );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> aps = nexus.search( new SearchOperationContext( registries,
name,
+        EntryFilteringCursor aps = nexus.search( new SearchOperationContext( registries,
name,
             AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
         if ( aps.next() )
@@ -778,7 +773,7 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -855,7 +850,7 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -929,7 +924,7 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -1063,7 +1058,7 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
+            EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( registries,
                 oldBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
             while ( subentries.next() )
@@ -1359,12 +1354,12 @@
     /**
      * SearchResultFilter used to filter out subentries based on objectClass values.
      */
-    public class HideSubentriesFilter implements SearchResultFilter
+    public class HideSubentriesFilter implements EntryFilter
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls
controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry
)
             throws Exception
         {
-            String dn = result.getDn().getNormName();
+            String dn = entry.getDn().getNormName();
 
             // see if we can get a match without normalization
             if ( subentryCache.hasSubentry( dn ) )
@@ -1373,28 +1368,17 @@
             }
 
             // see if we can use objectclass if present
-            EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT
);
+            EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
 
             if ( objectClasses != null )
             {
                 return !objectClasses.contains( SchemaConstants.SUBENTRY_OC );
             }
 
-            if ( !result.isRelative() )
-            {
-                LdapDN ndn = new LdapDN( dn );
-                ndn.normalize( atRegistry.getNormalizerMapping() );
-                String normalizedDn = ndn.toString();
-                return !subentryCache.hasSubentry( normalizedDn );
-            }
-
-            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
-            name.normalize( atRegistry.getNormalizerMapping() );
-
-            LdapDN rest = result.getDn();
-            rest.normalize( atRegistry.getNormalizerMapping() );
-            name.addAll( rest );
-            return !subentryCache.hasSubentry( name.toString() );
+            LdapDN ndn = new LdapDN( dn );
+            ndn.normalize( atRegistry.getNormalizerMapping() );
+            String normalizedDn = ndn.toString();
+            return !subentryCache.hasSubentry( normalizedDn );
         }
     }
 
@@ -1402,12 +1386,12 @@
      * SearchResultFilter used to filter out normal entries but shows subentries based on

      * objectClass values.
      */
-    public class HideEntriesFilter implements SearchResultFilter
+    public class HideEntriesFilter implements EntryFilter
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls
controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry
)
             throws Exception
         {
-            String dn = result.getDn().getNormName();
+            String dn = entry.getDn().getNormName();
 
             // see if we can get a match without normalization
             if ( subentryCache.hasSubentry( dn ) )
@@ -1416,27 +1400,16 @@
             }
 
             // see if we can use objectclass if present
-            EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT
);
+            EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
 
             if ( objectClasses != null )
             {
                 return objectClasses.contains( SchemaConstants.SUBENTRY_OC );
             }
 
-            if ( !result.isRelative() )
-            {
-                LdapDN ndn = new LdapDN( dn );
-                ndn.normalize( atRegistry.getNormalizerMapping() );
-                return subentryCache.hasSubentry( ndn.toNormName() );
-            }
-
-            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
-            name.normalize( atRegistry.getNormalizerMapping() );
-
-            LdapDN rest = result.getDn();
-            rest.normalize( atRegistry.getNormalizerMapping() );
-            name.addAll( rest );
-            return subentryCache.hasSubentry( name.toNormName() );
+            LdapDN ndn = new LdapDN( dn );
+            ndn.normalize( atRegistry.getNormalizerMapping() );
+            return subentryCache.hasSubentry( ndn.toNormName() );
         }
     }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
Thu May 22 19:16:32 2008
@@ -17,13 +17,14 @@
  *  under the License. 
  *  
  */
-
 package org.apache.directory.server.core.trigger;
 
+
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -111,16 +112,16 @@
         {
             String suffix = suffixes.next();
             LdapDN baseDn = new LdapDN( suffix );
-            ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, 
+            ExprNode filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT,

                     new ClientStringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC
) );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-            Cursor<ServerEntry> results = 
+            EntryFilteringCursor results = 
                 nexus.search( new SearchOperationContext( registries, baseDn, AliasDerefMode.DEREF_ALWAYS,
filter, ctls ) );
             
             while ( results.next() )
             {
-                ServerEntry resultEntry = results.get();
+                ClonedServerEntry resultEntry = results.get();
                 LdapDN subentryDn = resultEntry.getDn();
                 EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
                 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Thu May 22 19:16:32 2008
@@ -28,6 +28,7 @@
 import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
@@ -179,16 +180,16 @@
         }
 
 
-        public Cursor<ServerEntry> search( SearchOperationContext opContext )
+        public EntryFilteringCursor search( SearchOperationContext opContext )
             throws NamingException
         {
-            return new BogusCursor( count );
+            return new EntryFilteringCursor( new BogusCursor( count ), opContext );
         }
 
 
-        public Cursor<ServerEntry> search( SearchOperationContext opContext, Collection
bypass ) throws NamingException
+        public EntryFilteringCursor search( SearchOperationContext opContext, Collection<String>
bypass ) throws NamingException
         {
-            return new BogusCursor( count );
+            return new EntryFilteringCursor( new BogusCursor( count ), opContext );
         }
     }
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
Thu May 22 19:16:32 2008
@@ -21,8 +21,8 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
-import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -83,7 +83,7 @@
     }
 
 
-    public ServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext
) throws Exception
+    public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext
opContext ) throws Exception
     {
         test.interceptors.add( this );
         return next.getRootDSE( opContext );
@@ -104,7 +104,7 @@
     }
 
 
-    public Iterator listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext
) throws Exception
+    public Iterator<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext
opContext ) throws Exception
     {
         test.interceptors.add( this );
         return next.listSuffixes( opContext );
@@ -155,21 +155,21 @@
     }
 
 
-    public Cursor<ServerEntry> list( NextInterceptor next, ListOperationContext opContext
) throws Exception
+    public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext
) throws Exception
     {
         test.interceptors.add( this );
         return next.list( opContext );
     }
 
 
-    public Cursor<ServerEntry> search( NextInterceptor next, SearchOperationContext
opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext
) throws Exception
     {
         test.interceptors.add( this );
         return next.search( opContext );
     }
 
 
-    public ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws
Exception
+    public ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext
) throws Exception
     {
         test.interceptors.add( this );
         return next.lookup( opContext );

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
Thu May 22 19:16:32 2008
@@ -21,12 +21,10 @@
 
 
 import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
 
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerSearchResult;
-import org.apache.directory.server.core.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.invocation.Invocation;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilter;
+import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 
 
@@ -59,12 +57,11 @@
      * A {@link SearchResultFilter} that filters out the entries whose
      * {@link #ENTRY_DELETED} attribute is <tt>TRUE</tt>.
      */
-    public static final SearchResultFilter DELETED_ENTRIES_FILTER = new SearchResultFilter()
+    public static final EntryFilter DELETED_ENTRIES_FILTER = new EntryFilter()
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls
controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry
)
             throws NamingException
         {
-            ServerEntry entry = result.getServerEntry();
             EntryAttribute deleted = entry.get( ENTRY_DELETED );
             Object value = deleted == null ? null : deleted.get();
             return ( value == null || !"TRUE".equalsIgnoreCase( value.toString() ) );

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
Thu May 22 19:16:32 2008
@@ -25,9 +25,10 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
 import org.apache.directory.mitosis.store.ReplicationStore;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
@@ -93,17 +94,17 @@
     private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, Registries
registries )
         throws Exception
     {
-        Cursor<ServerEntry> ne = nexus.list( new ListOperationContext( registries,
normalizedName ) );
+        EntryFilteringCursor cursor = nexus.list( new ListOperationContext( registries, normalizedName
) );
         
-        if ( !ne.available() )
+        if ( !cursor.available() )
         {
             nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
             return;
         }
 
-        while ( ne.next() )
+        while ( cursor.next() )
         {
-            ServerEntry sr = ne.get();
+            ClonedServerEntry sr = cursor.get();
             LdapDN dn = sr.getDn();
             dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
             recursiveDelete( nexus, dn, registries );

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Thu May 22 19:16:32 2008
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.operation;
 
+
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.Constants;
@@ -26,10 +27,10 @@
 import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -270,13 +271,13 @@
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
         
-        Cursor<ServerEntry> e = nexus.search( 
+        EntryFilteringCursor cursor = nexus.search( 
             new SearchOperationContext( registries, oldName, AliasDerefMode.DEREF_ALWAYS,
                     new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
 
-        while ( e.next() )
+        while ( cursor.next() )
         {
-            ServerEntry entry = e.get();
+            ServerEntry entry = cursor.get();
 
             // Get the name of the old entry
             LdapDN oldEntryName = entry.getDn();

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
Thu May 22 19:16:32 2008
@@ -33,8 +33,9 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -344,16 +345,16 @@
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
         ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
 
-        Cursor<ServerEntry> e = nexus.search(
+        EntryFilteringCursor cursor = nexus.search(
             new SearchOperationContext( registries, contextName, AliasDerefMode.DEREF_ALWAYS,
filter, ctrl ) );
 
         List<LdapDN> names = new ArrayList<LdapDN>();
         
         try
         {
-            while ( e.next() )
+            while ( cursor.next() )
             {
-            	ServerEntry entry = e.get();
+            	ServerEntry entry = cursor.get();
                 LdapDN name = entry.getDn();
                 
                 if ( name.size() > contextName.size() )
@@ -364,7 +365,7 @@
         }
         finally
         {
-            e.close();
+            cursor.close();
         }
 
         for ( LdapDN name : names )
@@ -457,7 +458,7 @@
     }
 
 
-    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext
) throws Exception
+    public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext
lookupContext ) throws Exception
     {
         if ( lookupContext.getAttrsId() != null )
         {
@@ -485,30 +486,28 @@
             }
         }
 
-        ServerEntry result = nextInterceptor.lookup( lookupContext );
-        ensureNotDeleted( lookupContext.getDn(), result );
-        return result;
+        ClonedServerEntry entry = nextInterceptor.lookup( lookupContext );
+        ensureNotDeleted( lookupContext.getDn(), entry );
+        return entry;
     }
 
 
     @Override
-    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext
opContext ) throws Exception
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext
opContext ) throws Exception
     {
-    	Cursor<ServerEntry> result = nextInterceptor.search(
+    	EntryFilteringCursor cursor = nextInterceptor.search(
 	            new SearchOperationContext(
 	                registries, opContext.getDn(), opContext.getAliasDerefMode(),
 	                new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ),
 	                new SearchControls() ) );
 
-        // TODO FixMe
-    	//return new SearchResultFilteringEnumeration( result, new SearchControls(), InvocationStack.getInstance().peek(),
-        //    Constants.DELETED_ENTRIES_FILTER, "List replication filter" );
-    	return null;
+    	cursor.addEntryFilter( Constants.DELETED_ENTRIES_FILTER );
+    	return cursor;
     }
 
 
     @Override
-    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext
opContext ) 
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext
opContext ) 
         throws Exception
     {
         SearchControls searchControls = opContext.getSearchControls();
@@ -522,12 +521,10 @@
             searchControls.setReturningAttributes( newAttrIds );
         }
 
-    	Cursor<ServerEntry> result = nextInterceptor.search(
-            new SearchOperationContext( registries, opContext.getDn(), opContext.getAliasDerefMode(),
opContext.getFilter(), searchControls ) );
-        // TODO FixMe
-    	// return new SearchResultFilteringEnumeration( result, searchControls, InvocationStack.getInstance().peek(),
-        //    Constants.DELETED_ENTRIES_FILTER, "Search Replication filter" );
-    	return null;
+    	EntryFilteringCursor cursor = nextInterceptor.search( new SearchOperationContext( registries,

+    	    opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(), searchControls
) );
+    	cursor.addEntryFilter( Constants.DELETED_ENTRIES_FILTER );
+    	return cursor;
     }
 
 

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
Thu May 22 19:16:32 2008
@@ -42,8 +42,8 @@
 import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -378,15 +378,15 @@
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> e = ctx.getDirectoryService().getPartitionNexus().search(
+        EntryFilteringCursor cursor = ctx.getDirectoryService().getPartitionNexus().search(
             new SearchOperationContext( ctx.getDirectoryService().getRegistries(), contextName,
                 AliasDerefMode.DEREF_ALWAYS, new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID
), ctrl ) );
 
         try
         {
-            while ( e.next() )
+            while ( cursor.next() )
             {
-                ServerEntry entry = e.get();
+                ServerEntry entry = cursor.get();
 
                 // Skip entries without entryCSN attribute.
                 EntryAttribute entryCSNAttr = entry.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN
);
@@ -430,7 +430,7 @@
         }
         finally
         {
-            e.close();
+            cursor.close();
         }
     }
 



Mime
View raw message