directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r687551 - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/filtering/ main/java/org/apache/directory/server/core/partition/impl/btree/ test/java/org/apache/directory/server/core/authz/support/
Date Thu, 21 Aug 2008 04:20:30 GMT
Author: akarasulu
Date: Wed Aug 20 21:20:28 2008
New Revision: 687551

URL: http://svn.apache.org/viewvc?rev=687551&view=rev
Log:
added setter for ClosureMonitor on cursors, removed unnecessary checks and cleaned up some
code comments on tests

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=687551&r1=687550&r2=687551&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
Wed Aug 20 21:20:28 2008
@@ -25,8 +25,8 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.directory.server.core.cursor.ClosureMonitor;
 import org.apache.directory.server.core.cursor.Cursor;
-import org.apache.directory.server.core.cursor.CursorClosedException;
 import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
@@ -66,8 +66,6 @@
     
     /** the first accepted search result that is pre fetched */
     private ClonedServerEntry prefetched;
-    
-    private Exception reason;
 
     
     // ------------------------------------------------------------------------
@@ -191,20 +189,6 @@
     }
 
     
-    protected void checkClosed( String operation ) throws Exception
-    {
-        if ( isClosed() )
-        {
-            if ( reason != null )
-            {
-                throw reason;
-            }
-            
-            throw new CursorClosedException( "Attempting " + operation + " operation on a
closed Cursor." );
-        }
-    }
-
-
     // ------------------------------------------------------------------------
     // Cursor Interface Methods
     // ------------------------------------------------------------------------
@@ -230,7 +214,6 @@
      */
     public void afterLast() throws Exception
     {
-        checkClosed( "afterLast()" );
         wrapped.afterLast();
         prefetched = null;
     }
@@ -268,7 +251,6 @@
      */
     public void beforeFirst() throws Exception
     {
-        checkClosed( "beforeFirst()" );
         wrapped.beforeFirst();
         prefetched = null;
     }
@@ -295,10 +277,15 @@
      */
     public void close( Exception reason ) throws Exception
     {
-        this.reason = reason;
         wrapped.close( reason );
         prefetched = null;
     }
+    
+    
+    public final void setClosureMonitor( ClosureMonitor monitor )
+    {
+        wrapped.setClosureMonitor( monitor );
+    }
 
 
     /* 
@@ -329,7 +316,6 @@
      */
     public ClonedServerEntry get() throws Exception
     {
-        checkClosed( "get()" );
         if ( available() )
         {
             return prefetched;
@@ -508,11 +494,9 @@
             throw new OperationAbandonedException();
         }
         
-        checkClosed( "next()" );
         ClonedServerEntry tempResult = null;
         outer: while ( wrapped.next() )
         {
-            checkClosed( "next()" );
             boolean accepted = true;
             
             ServerEntry tempEntry = wrapped.get();
@@ -554,8 +538,6 @@
             
             for ( EntryFilter filter : filters )
             {
-                checkClosed( "next()" );
-
                 // if a filter rejects then short and continue with outer loop
                 if ( ! ( accepted &= filter.accept( getOperationContext(), tempResult
) ) )
                 {
@@ -591,11 +573,9 @@
             throw new OperationAbandonedException();
         }
         
-        checkClosed( "previous()" );
         ClonedServerEntry tempResult = null;
         outer: while ( wrapped.previous() )
         {
-            checkClosed( "previous()" );
             boolean accepted = true;
             tempResult = new ClonedServerEntry( wrapped.get() );
             
@@ -628,7 +608,6 @@
             
             for ( EntryFilter filter : filters )
             {
-                checkClosed( "previous()" );
                 // if a filter rejects then short and continue with outer loop
                 if ( ! ( accepted &= filter.accept( getOperationContext(), tempResult
) ) )
                 {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java?rev=687551&r1=687550&r2=687551&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
Wed Aug 20 21:20:28 2008
@@ -22,6 +22,7 @@
 
 import java.util.Iterator;
 
+import org.apache.directory.server.core.cursor.ClosureMonitor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -93,6 +94,12 @@
         indexCursor.beforeFirst();
     }
 
+    
+    public final void setClosureMonitor( ClosureMonitor monitor )
+    {
+        indexCursor.setClosureMonitor( monitor );
+    }
+    
 
     /* 
      * @see Cursor#close()

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=687551&r1=687550&r2=687551&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Wed Aug 20 21:20:28 2008
@@ -28,6 +28,7 @@
 import org.apache.directory.server.core.ReferralHandlingMode;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.changelog.ChangeLog;
+import org.apache.directory.server.core.cursor.ClosureMonitor;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
@@ -222,70 +223,57 @@
 
         public void addRequestControl( Control requestControl )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void addRequestControls( Control[] requestControls )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void addResponseControl( Control responseControl )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public Collection<String> getByPassed()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public LdapDN getDn()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public String getName()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public Control getRequestControl( String numericOid )
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public Control getResponseControl( String numericOid )
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public int getResponseControlCount()
         {
-            // TODO Auto-generated method stub
             return 0;
         }
 
 
         public Control[] getResponseControls()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
@@ -298,190 +286,155 @@
 
         public boolean hasBypass()
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean hasRequestControl( String numericOid )
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean hasRequestControls()
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean hasResponseControl( String numericOid )
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean hasResponseControls()
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean isBypassed( String interceptorName )
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public boolean isCollateralOperation()
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public ClonedServerEntry lookup( LdapDN dn, Collection<String> bypass ) throws
Exception
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public LookupOperationContext newLookupContext( LdapDN dn )
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public void setByPassed( Collection<String> byPassed )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void setCollateralOperation( boolean collateralOperation )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void setDn( LdapDN dn )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public LdapPrincipal getEffectivePrincipal()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public OperationContext getFirstOperation()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public OperationContext getLastOperation()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public OperationContext getNextOperation()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public OperationContext getPreviousOperation()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public boolean isFirstOperation()
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public void add( ServerEntry entry, Collection<String> bypass ) throws Exception
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void delete( LdapDN dn, Collection<String> bypass ) throws Exception
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public void modify( LdapDN dn, List<Modification> mods, Collection<String>
bypass ) throws Exception
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public boolean hasEntry( LdapDN dn, Collection<String> byPass ) throws Exception
         {
-            // TODO Auto-generated method stub
             return false;
         }
 
 
         public ReferralHandlingMode getReferralHandlingMode()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
         {
-            // TODO Auto-generated method stub
-            
         }
 
 
         public ClonedServerEntry getEntry()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
 
         public void setEntry( ClonedServerEntry entry )
         {
-            // TODO Auto-generated method stub
-            
         }
     }
 
@@ -817,20 +770,16 @@
 
         public CoreSession getAdminSession() throws Exception
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
         public EventService getEventService()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
         public void setEventService( EventService eventService )
         {
-            // TODO Auto-generated method stub
-            
         }
     }
 
@@ -1057,8 +1006,11 @@
 
         public void close( Exception reason ) throws Exception
         {
-            // TODO Auto-generated method stub
-            
+        }
+
+
+        public void setClosureMonitor( ClosureMonitor monitor )
+        {
         }
     }
 }



Mime
View raw message