directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r659365 [1/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
Author: akarasulu
Date: Thu May 22 19:16:32 2008
New Revision: 659365

URL: http://svn.apache.org/viewvc?rev=659365&view=rev
Log:
removing SearchResultFilter and SearchResultFilterEnumeration and replacing with EntryFilter and EntryFilteringCursor

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/EntryFilteringCursor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java Thu May 22 19:16:32 2008
@@ -23,9 +23,9 @@
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.event.EventInterceptor;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.normalization.NormalizationInterceptor;
 import org.apache.directory.server.core.operational.OperationalAttributeInterceptor;
@@ -155,7 +155,7 @@
     private int getImmSubCount( Registries registries, PartitionNexusProxy proxy, LdapDN entryName ) throws Exception
     {
         int cnt = 0;
-        Cursor<ServerEntry> results = null;
+        EntryFilteringCursor results = null;
         
         try
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/EntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/EntryFilteringCursor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/EntryFilteringCursor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/EntryFilteringCursor.java Thu May 22 19:16:32 2008
@@ -346,7 +346,16 @@
         outer: while ( wrapped.next() )
         {
             boolean accepted = true;
-            tempResult = new ClonedServerEntry( wrapped.get() );
+            
+            ServerEntry tempEntry = wrapped.get();
+            if ( tempEntry instanceof ClonedServerEntry )
+            {
+                tempResult = ( ClonedServerEntry ) tempEntry;
+            }
+            else
+            {
+                tempResult = new ClonedServerEntry( tempEntry );
+            }
             
             /*
              * O P T I M I Z A T I O N

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Thu May 22 19:16:32 2008
@@ -21,9 +21,10 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.EmptyCursor;
+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.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
@@ -159,7 +160,7 @@
     }
 
 
-    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
         ExprNode filter = opContext.getFilter();
         opContext.getDn().normalize( attrNormalizers );
@@ -168,7 +169,7 @@
         if ( result == null )
         {
             LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
-            return new EmptyCursor<ServerEntry>();
+            return new EntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
         }
         else
         {
@@ -187,7 +188,7 @@
     }
 
 
-    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
         return nextInterceptor.list( opContext );
@@ -213,7 +214,8 @@
         return normalizedAttrIds;
     }
 
-    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
+    
+    public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
         
@@ -231,6 +233,7 @@
     // Normalize all Name based arguments for other interface operations
     // ------------------------------------------------------------------------
 
+    
     public LdapDN getMatchedName ( NextInterceptor nextInterceptor, GetMatchedNameOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Thu May 22 19:16:32 2008
@@ -19,23 +19,23 @@
  */
 package org.apache.directory.server.core.operational;
 
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.lang.NotImplementedException;
 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.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -47,8 +47,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.invocation.Invocation;
-import org.apache.directory.server.core.invocation.InvocationStack;
+import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -64,7 +63,7 @@
 import org.apache.directory.shared.ldap.util.DateUtils;
 
 import javax.naming.directory.SearchControls;
-
+ 
 
 /**
  * An {@link Interceptor} that adds or modifies the default attributes
@@ -79,37 +78,30 @@
  */
 public class OperationalAttributeInterceptor extends BaseInterceptor
 {
-    private final SearchResultFilter DENORMALIZING_SEARCH_FILTER = new SearchResultFilter()
+    private final EntryFilter DENORMALIZING_SEARCH_FILTER = new EntryFilter()
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls ) 
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry serverEntry ) 
             throws Exception
         {
-            ServerEntry serverEntry = result.getServerEntry(); 
-            
-            if ( controls.getReturningAttributes() == null )
+            if ( operation.getSearchControls().getReturningAttributes() == null )
             {
                 return true;
             }
             
-            boolean denormalized = filterDenormalized( serverEntry );
-            
-            result.setServerEntry( serverEntry );
-            
-            return denormalized;
+            return filterDenormalized( serverEntry );
         }
     };
 
     /**
      * the database search result filter to register with filter service
      */
-    private final SearchResultFilter SEARCH_FILTER = new SearchResultFilter()
+    private final EntryFilter SEARCH_FILTER = new EntryFilter()
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry )
             throws Exception
         {
-            ServerEntry serverEntry = result.getServerEntry(); 
-            
-            return controls.getReturningAttributes() != null || filterOperationalAttributes( serverEntry );
+            return operation.getSearchControls().getReturningAttributes() != null 
+                || filterOperationalAttributes( entry );
         }
     };
 
@@ -274,9 +266,9 @@
     }
 
 
-    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
+    public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
     {
-        ServerEntry result = nextInterceptor.lookup( opContext );
+        ClonedServerEntry result = nextInterceptor.lookup( opContext );
         
         if ( result == null )
         {
@@ -296,38 +288,31 @@
     }
 
 
-    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
-        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
-        Invocation invocation = InvocationStack.getInstance().peek();
-        
-//        return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, SEARCH_FILTER, "List Operational Filter" );
-        // TODO not implemented
-        throw new NotImplementedException();
+        EntryFilteringCursor cursor = nextInterceptor.list( opContext );
+        cursor.addEntryFilter( SEARCH_FILTER );
+        return cursor;
     }
 
 
-    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
-        Invocation invocation = InvocationStack.getInstance().peek();
-        Cursor<ServerEntry> result = nextInterceptor.search( opContext );
+        EntryFilteringCursor cursor = nextInterceptor.search( opContext );
         SearchControls searchCtls = opContext.getSearchControls();
         
         if ( searchCtls.getReturningAttributes() != null )
         {
             if ( service.isDenormalizeOpAttrsEnabled() )
             {
-//                return new SearchResultFilteringEnumeration( result, searchCtls, invocation, DENORMALIZING_SEARCH_FILTER, "Search Operational Filter denormalized" );
-                // TODO not implemented
-                throw new NotImplementedException();
+                cursor.addEntryFilter( DENORMALIZING_SEARCH_FILTER );
             }
                 
-            return result;
+            return cursor;
         }
 
-//        return new SearchResultFilteringEnumeration( result, searchCtls, invocation, SEARCH_FILTER , "Search Operational Filter");
-        // TODO Not implemented
-        throw new NotImplementedException();
+        cursor.addEntryFilter( SEARCH_FILTER );
+        return cursor;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Thu May 22 19:16:32 2008
@@ -40,13 +40,12 @@
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
 import org.apache.directory.server.core.changelog.ChangeLogInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
-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.ServerSearchResult;
-import org.apache.directory.server.core.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
+import org.apache.directory.server.core.filtering.EntryFilter;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -66,6 +65,7 @@
 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 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.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
@@ -242,7 +242,7 @@
     }
 
 
-    public ServerEntry getContextEntry()
+    public ClonedServerEntry getContextEntry()
     {
         throw new UnsupportedOperationException( "Not supported by PartitionNexusProxy" );
     }
@@ -483,14 +483,13 @@
     }
 
 
-    public Cursor<ServerEntry> list( ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
     {
         return list( opContext, null );
     }
 
 
-    public Cursor<ServerEntry> list( ListOperationContext opContext, Collection<String> bypass )
-            throws Exception
+    public EntryFilteringCursor list( ListOperationContext opContext, Collection<String> bypass ) throws Exception
     {
         ensureStarted();
         opContext.push( new Invocation( this, caller, "list", bypass ) );
@@ -506,41 +505,37 @@
     }
 
 
-    public Cursor<ServerEntry> search( SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
     {
-        Cursor<ServerEntry> ne = search( opContext, null );
-
-        if ( ne instanceof SearchResultFilteringEnumeration )
-        {
-            SearchResultFilteringEnumeration results = ( SearchResultFilteringEnumeration ) ne;
-            SearchControls searchCtls = opContext.getSearchControls();
+        EntryFilteringCursor cursor = search( opContext, null );
+        final SearchControls searchCtls = opContext.getSearchControls();
 
             if ( searchCtls.getTimeLimit() + searchCtls.getCountLimit() > 0 )
             {
                 // this will be the last filter added so other filters before it must
                 // have passed/approved of the entry to be returned back to the client
                 // so the candidate we have is going to be returned for sure
-                results.addResultFilter( new SearchResultFilter()
+                cursor.addEntryFilter( new EntryFilter()
                 {
                     final long startTime = System.currentTimeMillis();
                     int count = 1; // with prefetch we've missed one which is ok since 1 is the minimum
 
 
-                    public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+                    public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry )
                             throws Exception
                     {
-                        if ( controls.getTimeLimit() > 0 )
+                        if ( searchCtls.getTimeLimit() > 0 )
                         {
                             long runtime = System.currentTimeMillis() - startTime;
-                            if ( runtime > controls.getTimeLimit() )
+                            if ( runtime > searchCtls.getTimeLimit() )
                             {
                                 throw new LdapTimeLimitExceededException();
                             }
                         }
 
-                        if ( controls.getCountLimit() > 0 )
+                        if ( searchCtls.getCountLimit() > 0 )
                         {
-                            if ( count > controls.getCountLimit() )
+                            if ( count > searchCtls.getCountLimit() )
                             {
                                 throw new LdapSizeLimitExceededException();
                             }
@@ -551,13 +546,12 @@
                     }
                 } );
             }
-        }
 
-        return ne;
+        return cursor;
     }
 
 
-    public Cursor<ServerEntry> search( SearchOperationContext opContext, Collection<String> bypass )
+    public EntryFilteringCursor search( SearchOperationContext opContext, Collection<String> bypass )
             throws Exception
     {
         ensureStarted();
@@ -574,7 +568,7 @@
     }
 
 
-    public ServerEntry lookup( LookupOperationContext opContext ) throws Exception
+    public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
     {
         if ( opContext.getDn().size() == 0 )
         {
@@ -590,7 +584,7 @@
                     }
                 }
 
-                return ROOT_DSE_NO_OPERATIONNAL;
+                return new ClonedServerEntry( ROOT_DSE_NO_OPERATIONNAL );
             } 
             else if ( ( attrs.size() == 1 ) && ( attrs.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) ) )
             {
@@ -602,7 +596,7 @@
                     }
                 }
 
-                return ROOT_DSE_ALL;
+                return new ClonedServerEntry( ROOT_DSE_ALL );
             }
 
         }
@@ -611,7 +605,7 @@
     }
 
 
-    public ServerEntry lookup( LookupOperationContext opContext, Collection<String> bypass ) throws Exception
+    public ClonedServerEntry lookup( LookupOperationContext opContext, Collection<String> bypass ) throws Exception
     {
         ensureStarted();
         opContext.push( new Invocation( this, caller, "lookup", bypass ) );
@@ -766,7 +760,7 @@
     }
 
 
-    public ServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
+    public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
     {
         if ( opContext.getDn().size() == 0 )
         {
@@ -778,14 +772,14 @@
                 }
             }
 
-            return ROOT_DSE_ALL;
+            return new ClonedServerEntry( ROOT_DSE_ALL );
         }
 
         return getRootDSE( opContext, null );
     }
 
 
-    public ServerEntry getRootDSE( GetRootDSEOperationContext opContext, Collection<String> bypass )
+    public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext, Collection<String> bypass )
             throws Exception
     {
         ensureStarted();
@@ -901,7 +895,7 @@
     }
 
 
-    public ServerEntry lookup( Long id ) throws Exception
+    public ClonedServerEntry lookup( Long id ) throws Exception
     {
         // TODO not implemented until we can lookup partition using the 
         // partition id component of the 64 bit identifier

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Thu May 22 19:16:32 2008
@@ -20,8 +20,9 @@
 package org.apache.directory.server.core.partition.impl.btree;
 
 
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+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.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
@@ -34,15 +35,14 @@
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.gui.PartitionViewer;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.xdbm.*;
 import org.apache.directory.server.xdbm.search.Optimizer;
 import org.apache.directory.server.xdbm.search.SearchEngine;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 import javax.naming.directory.SearchControls;
 import java.util.Collections;
@@ -137,11 +137,11 @@
      *
      * @return the root suffix entry for this BTreePartition
      */
-    public ServerEntry getContextEntry()
+    public ClonedServerEntry getContextEntry()
     {
         if ( contextEntry != null )
         {
-            return ( ServerEntry ) contextEntry.clone();
+            return new ClonedServerEntry( contextEntry );
         }
         else
         {
@@ -262,13 +262,14 @@
     public abstract void modify( ModifyOperationContext opContext ) throws Exception;
 
 
-    public Cursor<ServerEntry> list( ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
     {
-        return new ServerEntryCursorAdaptor( this, list( getEntryId( opContext.getDn().getNormName() ) ) );
+        return new EntryFilteringCursor( new ServerEntryCursorAdaptor( this, 
+            list( getEntryId( opContext.getDn().getNormName() ) ) ), opContext );
     }
 
 
-    public Cursor<ServerEntry> search( SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
     {
         SearchControls searchCtls = opContext.getSearchControls();
         IndexCursor<Long,ServerEntry> underlying;
@@ -279,32 +280,28 @@
             opContext.getFilter(), 
             searchCtls );
 
-        return new ServerEntryCursorAdaptor( this, underlying );
+        return new EntryFilteringCursor( new ServerEntryCursorAdaptor( this, underlying ), opContext );
     }
 
 
-    public ServerEntry lookup( LookupOperationContext opContext ) throws Exception
+    public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
     {
-        ServerEntry entry = lookup( getEntryId( opContext.getDn().getNormName() ) );
+        ClonedServerEntry entry = lookup( getEntryId( opContext.getDn().getNormName() ) );
 
         if ( ( opContext.getAttrsId() == null ) || ( opContext.getAttrsId().size() == 0 ) )
         {
             return entry;
         }
 
-        ServerEntry retval = new DefaultServerEntry( opContext.getRegistries(), opContext.getDn() );
-
-        for ( String attrId:opContext.getAttrsId() )
+        for ( AttributeType attributeType : entry.getAttributeTypes() )
         {
-            EntryAttribute attr = entry.get( attrId );
-
-            if ( attr != null )
+            if ( ! opContext.getAttrsId().contains( attributeType.getOid() ) )
             {
-                retval.put( attr );
+                entry.removeAttributes( attributeType );
             }
         }
 
-        return retval;
+        return entry;
     }
 
 
@@ -530,7 +527,7 @@
     public abstract String getEntryUpdn( String dn ) throws Exception;
 
 
-    public abstract ServerEntry lookup( Long id ) throws Exception;
+    public abstract ClonedServerEntry lookup( Long id ) throws Exception;
 
 
     public abstract void delete( Long id ) throws Exception;
@@ -557,9 +554,6 @@
     public abstract Iterator<String> getSystemIndices();
 
 
-    public abstract ServerEntry getIndices( Long id ) throws Exception;
-
-
     /**
      * Gets the count of the total number of entries in the database.
      *

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java Thu May 22 19:16:32 2008
@@ -31,7 +31,7 @@
 
 
 /**
- * TODO ServerEntryCursorAdaptor.
+ * Adapts index cursors to return just ServerEntry objects.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -49,8 +49,8 @@
     }
     
     
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#after(java.lang.Object)
+    /* 
+     * @see Cursor#after(java.lang.Object)
      */
     public void after( ServerEntry element ) throws Exception
     {
@@ -58,8 +58,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#afterLast()
+    /* 
+     * @see Cursor#afterLast()
      */
     public void afterLast() throws Exception
     {
@@ -67,8 +67,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#available()
+    /* 
+     * @see Cursor#available()
      */
     public boolean available()
     {
@@ -76,8 +76,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#before(java.lang.Object)
+    /* 
+     * @see Cursor#before(java.lang.Object)
      */
     public void before( ServerEntry element ) throws Exception
     {
@@ -85,8 +85,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#beforeFirst()
+    /* 
+     * @see Cursor#beforeFirst()
      */
     public void beforeFirst() throws Exception
     {
@@ -94,8 +94,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#close()
+    /* 
+     * @see Cursor#close()
      */
     public void close() throws Exception
     {
@@ -103,8 +103,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#first()
+    /* 
+     * @see Cursor#first()
      */
     public boolean first() throws Exception
     {
@@ -112,8 +112,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#get()
+    /* 
+     * @see Cursor#get()
      */
     public ServerEntry get() throws Exception
     {
@@ -128,8 +128,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#isClosed()
+    /* 
+     * @see Cursor#isClosed()
      */
     public boolean isClosed() throws Exception
     {
@@ -137,8 +137,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#isElementReused()
+    /* 
+     * @see Cursor#isElementReused()
      */
     public boolean isElementReused()
     {
@@ -146,8 +146,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#last()
+    /* 
+     * @see Cursor#last()
      */
     public boolean last() throws Exception
     {
@@ -155,8 +155,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#next()
+    /* 
+     * @see Cursor#next()
      */
     public boolean next() throws Exception
     {
@@ -164,8 +164,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.Cursor#previous()
+    /* 
+     * @see Cursor#previous()
      */
     public boolean previous() throws Exception
     {
@@ -173,8 +173,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see java.lang.Iterable#iterator()
+    /* 
+     * @see Iterable#iterator()
      */
     public Iterator<ServerEntry> iterator()
     {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Thu May 22 19:16:32 2008
@@ -876,10 +876,11 @@
         AttributesTableModel model = new AttributesTableModel( entry, id, dn, false );
         entryTbl.setModel( model );
 
-        model = new AttributesTableModel( partition.getIndices( id ), id, dn, false );
-        idxTbl.setModel( model );
-
-        validate();
+        // TODO use utility method to getIndices below
+//        model = new AttributesTableModel( partition.getIndices( id ), id, dn, false );
+//        idxTbl.setModel( model );
+//
+//        validate();
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Thu May 22 19:16:32 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -452,9 +453,9 @@
     }
 
 
-    public final ServerEntry lookup( Long id ) throws Exception
+    public final ClonedServerEntry lookup( Long id ) throws Exception
     {
-        return store.lookup( id );
+        return new ClonedServerEntry( store.lookup( id ) );
     }
 
 
@@ -561,26 +562,14 @@
     }
 
 
-    @Override
-    public ServerEntry getIndices( Long id ) throws Exception
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
     public Index<String, ServerEntry> getPresenceIndex()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return store.getPresenceIndex();
     }
 
 
-    @Override
     public Index<Long, ServerEntry> getSubLevelIndex()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return store.getSubLevelIndex();
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Thu May 22 19:16:32 2008
@@ -31,15 +31,13 @@
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.entry.ServerStringValue;
-import org.apache.directory.server.core.enumeration.ReferralHandlingEnumeration;
-import org.apache.directory.server.core.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.event.EventInterceptor;
+import org.apache.directory.server.core.filtering.EntryFilter;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
@@ -53,6 +51,7 @@
 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 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.jndi.ServerLdapContext;
@@ -880,7 +879,7 @@
         Partition partition = opContext.getPartition();
         LdapDN suffix = partition.getSuffixDn();
         Invocation invocation = InvocationStack.getInstance().peek();
-        Cursor<ServerEntry> list = invocation.getProxy().search(
+        EntryFilteringCursor list = invocation.getProxy().search(
             new SearchOperationContext( registries, suffix, AliasDerefMode.DEREF_ALWAYS, getReferralFilter(),
                 getControls() ), SEARCH_BYPASS );
         addReferrals( list, suffix );
@@ -892,16 +891,16 @@
     {
         // remove referrals immediately before removing the partition
         Invocation invocation = InvocationStack.getInstance().peek();
-        Cursor<ServerEntry> list = invocation.getProxy().search(
+        EntryFilteringCursor cursor = invocation.getProxy().search(
             new SearchOperationContext( registries, opContext.getDn(), AliasDerefMode.DEREF_ALWAYS,
                 getReferralFilter(), getControls() ), SEARCH_BYPASS );
 
-        deleteReferrals( list, opContext.getDn() );
+        deleteReferrals( cursor, opContext.getDn() );
         next.removeContextPartition( opContext );
     }
 
 
-    private void addReferrals( Cursor<ServerEntry> referrals, LdapDN base ) throws Exception
+    private void addReferrals( EntryFilteringCursor referrals, LdapDN base ) throws Exception
     {
         while ( referrals.next() )
         {
@@ -922,12 +921,12 @@
     }
 
 
-    private void deleteReferrals( Cursor<ServerEntry> referrals, LdapDN base ) throws Exception
+    private void deleteReferrals( EntryFilteringCursor referrals, LdapDN base ) throws Exception
     {
         while ( referrals.next() )
         {
             ServerEntry r = referrals.get();
-            LdapDN referral;
+//            LdapDN referral;
             LdapDN result = new LdapDN( r.getDn() );
             result.normalize( atRegistry.getNormalizerMapping() );
 
@@ -943,8 +942,7 @@
     }
 
 
-    public Cursor<ServerEntry> search( NextInterceptor next, SearchOperationContext opContext )
-        throws Exception
+    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -1002,11 +1000,13 @@
 
             if ( farthest == null )
             {
-                SearchResultFilteringEnumeration srfe = ( SearchResultFilteringEnumeration ) next.search( opContext );
+                EntryFilteringCursor srfe = next.search( opContext );
+                
                 // TODO FixMe
                 //return new ReferralHandlingEnumeration( srfe, lut, opContext.getRegistries(), nexus, controls
                 //    .getSearchScope(), true );
-                return null;
+                
+                throw new NotImplementedException();
             }
 
             ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
@@ -1026,10 +1026,9 @@
         }
     }
 
-    class ReferralFilter implements SearchResultFilter//, SearchResultEnumerationAppender 
+    class ReferralFilter implements EntryFilter//, SearchResultEnumerationAppender 
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
-            throws NamingException
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry result ) throws Exception
         {
             return false;
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Thu May 22 19:16:32 2008
@@ -36,8 +36,9 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
-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.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -196,11 +197,11 @@
          * OID registry.  To prevent this we need to load all the OID's in advance
          * regardless of whether they are used or not.
          */
-        Cursor<ServerEntry> ne = dao.listAllNames();
+        EntryFilteringCursor cursor = dao.listAllNames();
         
-        while ( ne.next() )
+        while ( cursor.next() )
         {
-            ServerEntry entry = ne.get();
+            ServerEntry entry = cursor.get();
             String oid = entry.get( mOidAT ).getString();
             EntryAttribute names = entry.get( mNameAT );
             targetRegistries.getOidRegistry().register( oid, oid );
@@ -211,7 +212,7 @@
             }
         }
         
-        ne.close();
+        cursor.close();
         
         
         Map<String, Schema> allSchemaMap = getSchemas();
@@ -424,14 +425,14 @@
         
         LOG.debug( "{} schema: loading objectClasses", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
-            ServerEntry result = list.get();
+            ClonedServerEntry result = list.get();
             LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            ServerEntry attrs = lookupPartition( resultDN );
+            ClonedServerEntry attrs = lookupPartition( resultDN );
             ObjectClass oc = factory.getObjectClass( attrs, targetRegistries, schema.getSchemaName() );
             
             try
@@ -525,7 +526,7 @@
         
         LOG.debug( "{} schema: loading attributeTypes", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
@@ -623,7 +624,7 @@
         
         LOG.debug( "{} schema: loading matchingRules", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
@@ -656,7 +657,7 @@
         
         LOG.debug( "{} schema: loading syntaxes", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
@@ -688,7 +689,7 @@
         
         LOG.debug( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
@@ -722,11 +723,11 @@
         
         LOG.debug( "{} schema: loading normalizers", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
-            ServerEntry result = list.get();
+            ClonedServerEntry result = list.get();
             LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
@@ -777,11 +778,12 @@
     }
 
     
-    private ServerEntry lookupPartition( LdapDN dn ) throws Exception
+    private ClonedServerEntry lookupPartition( LdapDN dn ) throws Exception
     {
         return partition.lookup( new LookupOperationContext( registries, dn ) );
     }
     
+    
     private void loadComparators( Schema schema, Registries targetRegistries ) throws Exception
     {
         LdapDN dn = staticComparatorsDNs.get( schema.getSchemaName() );
@@ -800,14 +802,14 @@
         
         LOG.debug( "{} schema: loading comparators", schema.getSchemaName() );
         
-        Cursor<ServerEntry> list = partition.list( new ListOperationContext( registries, dn ) );
+        EntryFilteringCursor list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.next() )
         {
-            ServerEntry result = list.get();
+            ClonedServerEntry result = list.get();
             LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            ServerEntry attrs = lookupPartition( resultDN );
+            ClonedServerEntry attrs = lookupPartition( resultDN );
             Comparator comparator = factory.getComparator( attrs, targetRegistries );
             ComparatorDescription comparatorDescription = getComparatorDescription( schema.getSchemaName(), attrs );
             targetRegistries.getComparatorRegistry().register( comparatorDescription, comparator );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Thu May 22 19:16:32 2008
@@ -22,15 +22,17 @@
 
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.EmptyCursor;
+import org.apache.directory.server.core.cursor.SingletonCursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerBinaryValue;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.entry.ServerStringValue;
-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.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -42,8 +44,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.invocation.Invocation;
-import org.apache.directory.server.core.invocation.InvocationStack;
+import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
@@ -137,7 +138,7 @@
 
     private TopFilter topFilter;
 
-    private List<SearchResultFilter> filters = new ArrayList<SearchResultFilter>();
+    private List<EntryFilter> filters = new ArrayList<EntryFilter>();
 
     /**
      * the global schema object registries
@@ -381,18 +382,11 @@
     }
 
 
-    /**
-     *
-     */
-    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext )
-        throws Exception
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
-        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
-        Invocation invocation = InvocationStack.getInstance().peek();
-        // TODO FixMe
-        //return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, binaryAttributeFilter,
-        //    "List Schema Filter" );
-        return null;
+        EntryFilteringCursor cursor = nextInterceptor.list( opContext );
+        cursor.addEntryFilter( binaryAttributeFilter );
+        return cursor;
     }
 
 
@@ -661,11 +655,8 @@
     }
 
 
-    /**
-     *
-     */
-    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor,
-        SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) 
+        throws Exception
     {
         LdapDN base = opContext.getDn();
         SearchControls searchCtls = opContext.getSearchControls();
@@ -684,21 +675,19 @@
         // Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
         if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
         {
-            Cursor<ServerEntry> result = nextInterceptor.search( opContext );
-
-            Invocation invocation = InvocationStack.getInstance().peek();
+            EntryFilteringCursor cursor = nextInterceptor.search( opContext );
 
             if ( searchCtls.getReturningAttributes() != null )
             {
-                // TODO FixMe
-                //return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, topFilter,
-                //    "Search Schema Filter top" );
-                return null;
+                cursor.addEntryFilter( topFilter );
+                return cursor;
             }
 
-            // TODO FixMe
-            //return new SearchResultFilteringEnumeration( result, searchCtls, invocation, filters,
-            //    "Search Schema Filter" );
+            for ( EntryFilter ef : filters )
+            {
+                cursor.addEntryFilter( ef );
+            }
+            
             return null;
         }
 
@@ -732,9 +721,7 @@
                 }
                 else
                 {
-                    // TODO FixMe
-                    //return new EmptyEnumeration<ServerSearchResult>();
-                    return null;
+                    return new EntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
                 }
 
                 String nodeOid = registries.getOidRegistry().getOid( node.getAttribute() );
@@ -746,16 +733,11 @@
                 {
                     // call.setBypass( true );
                     ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
-                    ServerSearchResult result = new ServerSearchResult( base, null, serverEntry );
-                    // TODO FixMe
-                    //return new SingletonEnumeration<ServerSearchResult>( result );
-                    return null;
+                    return new EntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
                 }
                 else
                 {
-                    // TODO FixMe
-                    //return new EmptyEnumeration<ServerSearchResult>();
-                    return null;
+                    return new EntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
                 }
             }
             else if ( filter instanceof PresenceNode )
@@ -767,28 +749,25 @@
                 {
                     // call.setBypass( true );
                     ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
-                    ServerSearchResult result = new ServerSearchResult( base, null, serverEntry, false );
-                    // TODO FixMe
-                    //return new SingletonEnumeration<ServerSearchResult>( result );
-                    return null;
+                    EntryFilteringCursor cursor = new EntryFilteringCursor( 
+                        new SingletonCursor<ServerEntry>( serverEntry ), opContext );
+                    return cursor;
                 }
             }
         }
 
         // In any case not handled previously, just return an empty result
-        // TODO FixMe
-        //return new EmptyEnumeration<ServerSearchResult>();
-        return null;
+        return new EntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
     }
 
 
     /**
      * Search for an entry, using its DN. Binary attributes and ObjectClass attribute are removed.
      */
-    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext )
+    public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext )
         throws Exception
     {
-        ServerEntry result = nextInterceptor.lookup( opContext );
+        ClonedServerEntry result = nextInterceptor.lookup( opContext );
 
         if ( result == null )
         {
@@ -1529,12 +1508,12 @@
      * @see <a href= "http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#binary">
      *      java.naming.ldap.attributes.binary</a>
      */
-    private class BinaryAttributeFilter implements SearchResultFilter
+    private class BinaryAttributeFilter implements EntryFilter
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry result )
             throws Exception
         {
-            filterBinaryAttributes( result.getServerEntry() );
+            filterBinaryAttributes( result );
             return true;
         }
     }
@@ -1542,13 +1521,12 @@
     /**
      * Filters objectClass attribute to inject top when not present.
      */
-    private class TopFilter implements SearchResultFilter
+    private class TopFilter implements EntryFilter
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+        public boolean accept( SearchingOperationContext operation, ClonedServerEntry result )
             throws Exception
         {
-            filterObjectClass( result.getServerEntry() );
-
+            filterObjectClass( result );
             return true;
         }
     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=659365&r1=659364&r2=659365&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Thu May 22 19:16:32 2008
@@ -29,10 +29,10 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerModification;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
@@ -157,7 +157,7 @@
     public Map<String, Schema> getSchemas() throws Exception
     {
         Map<String, Schema> schemas = new HashMap<String, Schema>();
-        Cursor<ServerEntry> list = listSchemas();
+        EntryFilteringCursor list = listSchemas();
 
         while ( list.next() )
         {
@@ -173,7 +173,7 @@
     public Set<String> getSchemaNames() throws Exception
     {
         Set<String> schemaNames = new HashSet<String>();
-        Cursor<ServerEntry> list = listSchemas();
+        EntryFilteringCursor list = listSchemas();
 
         while ( list.next() )
         {
@@ -185,7 +185,7 @@
     }
 
 
-    private Cursor<ServerEntry> listSchemas() throws Exception
+    private EntryFilteringCursor listSchemas() throws Exception
     {
         LdapDN base = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
         base.normalize( attrRegistry.getNormalizerMapping() );
@@ -224,19 +224,19 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return false;
             }
 
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one matchingRule for oid of " + oid );
             }
@@ -245,9 +245,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -270,19 +270,19 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return false;
             }
 
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one attributeType for oid of " + oid );
             }
@@ -291,9 +291,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -316,19 +316,19 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return false;
             }
 
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one attributeType for oid of " + oid );
             }
@@ -337,9 +337,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -362,19 +362,19 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return false;
             }
 
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one syntax for oid of " + oid );
             }
@@ -383,9 +383,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -408,19 +408,19 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return false;
             }
 
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one syntaxChecker for oid of " + oid );
             }
@@ -429,9 +429,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -502,21 +502,21 @@
         filter.addNode( oidAVA );
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            if ( !ne.next() )
+            if ( !cursor.next() )
             {
                 return null;
             }
 
-            ServerEntry sr = ne.get();
+            ServerEntry sr = cursor.get();
             
-            if ( ne.next() )
+            if ( cursor.next() )
             {
                 throw new NamingException( "Got more than one result for the entity name: " + entityName );
             }
@@ -525,9 +525,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
     }
@@ -624,23 +624,23 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
             
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                set.add( ne.get() );
+                set.add( cursor.get() );
             }
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 
@@ -675,23 +675,23 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
             
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                set.add( ne.get() );
+                set.add( cursor.get() );
             }
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 
@@ -699,7 +699,7 @@
     }
 
 
-    public Cursor<ServerEntry> listAllNames() throws Exception
+    public EntryFilteringCursor listAllNames() throws Exception
     {
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -752,23 +752,23 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
             
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                set.add( ne.get() );
+                set.add( cursor.get() );
             }
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 
@@ -800,23 +800,23 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
             
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                set.add( ne.get() );
+                set.add( cursor.get() );
             }
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 
@@ -842,16 +842,16 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
 
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                ServerEntry sr = ne.get();
+                ServerEntry sr = cursor.get();
                 EntryAttribute disabled = sr.get( disabledAttributeType );
 
                 if ( disabled == null )
@@ -866,9 +866,9 @@
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 
@@ -922,23 +922,23 @@
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        Cursor<ServerEntry> ne = null;
+        EntryFilteringCursor cursor = null;
 
         try
         {
-            ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+            cursor = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
                 AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
             
-            while ( ne.next() )
+            while ( cursor.next() )
             {
-                set.add( ne.get() );
+                set.add( cursor.get() );
             }
         }
         finally
         {
-            if ( ne != null )
+            if ( cursor != null )
             {
-                ne.close();
+                cursor.close();
             }
         }
 



Mime
View raw message