You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/02/19 18:46:20 UTC

svn commit: r745943 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java

Author: elecharny
Date: Thu Feb 19 17:46:18 2009
New Revision: 745943

URL: http://svn.apache.org/viewvc?rev=745943&view=rev
Log:
Inverted the logic for the byPass handling. It's now possible to call the methods using a bypass.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=745943&r1=745942&r2=745943&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Thu Feb 19 17:46:18 2009
@@ -219,26 +219,7 @@
 
     public LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
     {
-        return getMatchedName( opContext, null );
-    }
-    
-    
-    private void push( OperationContext opContext )
-    {
-        InvocationStack.getInstance().push( opContext );
-    }
-    
-    
-    private OperationContext pop()
-    {
-        return InvocationStack.getInstance().pop();
-    }
-
-
-    public LdapDN getMatchedName( GetMatchedNameOperationContext opContext, Collection<String> byPassed ) throws Exception
-    {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -250,18 +231,30 @@
             pop();
         }
     }
+    
+    
+    public LdapDN getMatchedName( GetMatchedNameOperationContext opContext, Collection<String> byPassed ) throws Exception
+    {
+        opContext.setByPassed( byPassed );
+        return getMatchedName( opContext );
+    }
 
 
-    public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
+    private void push( OperationContext opContext )
     {
-        return getSuffix( opContext, null );
+        InvocationStack.getInstance().push( opContext );
+    }
+    
+    
+    private OperationContext pop()
+    {
+        return InvocationStack.getInstance().pop();
     }
 
 
-    public LdapDN getSuffix( GetSuffixOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -275,16 +268,16 @@
     }
 
 
-    public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
+    public LdapDN getSuffix( GetSuffixOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        return listSuffixes( opContext, null );
+        opContext.setByPassed( byPassed );
+        return getSuffix( opContext );
     }
 
 
-    public Set<String> listSuffixes( ListSuffixOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -298,16 +291,16 @@
     }
 
 
-    public boolean compare( CompareOperationContext opContext ) throws Exception
+    public Set<String> listSuffixes( ListSuffixOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        return compare( opContext, null );
+        opContext.setByPassed( byPassed );
+        return listSuffixes( opContext );
     }
 
 
-    public boolean compare( CompareOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public boolean compare( CompareOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -321,16 +314,16 @@
     }
 
 
-    public void delete( DeleteOperationContext opContext ) throws Exception
+    public boolean compare( CompareOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        delete( opContext, null );
+        opContext.setByPassed( byPassed );
+        return compare( opContext );
     }
 
 
-    public void delete( DeleteOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public void delete( DeleteOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -344,16 +337,16 @@
     }
 
 
-    public void add( AddOperationContext opContext ) throws Exception
+    public void delete( DeleteOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        add( opContext, null );
+        opContext.setByPassed( byPassed );
+        delete( opContext );
     }
 
 
-    public void add( AddOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public void add( AddOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -367,16 +360,16 @@
     }
 
 
-    public void modify( ModifyOperationContext opContext ) throws Exception
+    public void add( AddOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        modify( opContext, null );
+        opContext.setByPassed( byPassed );
+        add( opContext );
     }
 
 
-    public void modify( ModifyOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public void modify( ModifyOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -390,16 +383,16 @@
     }
 
 
-    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+    public void modify( ModifyOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        return list( opContext, null );
+        opContext.setByPassed( byPassed );
+        modify( opContext );
     }
 
 
-    public EntryFilteringCursor list( ListOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -413,6 +406,13 @@
     }
 
 
+    public EntryFilteringCursor list( ListOperationContext opContext, Collection<String> byPassed ) throws Exception
+    {
+        opContext.setByPassed( byPassed );
+        return list( opContext );
+    }
+
+
     public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
     {
         EntryFilteringCursor cursor = search( opContext, null );
@@ -531,14 +531,7 @@
 
     public boolean hasEntry( EntryOperationContext opContext ) throws Exception
     {
-        return hasEntry( opContext, null );
-    }
-
-
-    public boolean hasEntry( EntryOperationContext opContext, Collection<String> byPassed ) throws Exception
-    {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -552,16 +545,16 @@
     }
 
 
-    public void rename( RenameOperationContext opContext ) throws Exception
+    public boolean hasEntry( EntryOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        rename( opContext, null );
+        opContext.setByPassed( byPassed );
+        return hasEntry( opContext );
     }
 
 
-    public void rename( RenameOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public void rename( RenameOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -575,16 +568,16 @@
     }
 
 
-    public void move( MoveOperationContext opContext ) throws Exception
+    public void rename( RenameOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        move( opContext, null );
+        opContext.setByPassed( byPassed );
+        rename( opContext );
     }
 
 
-    public void move( MoveOperationContext opContext, Collection<String> byPassed ) throws Exception
+    public void move( MoveOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -598,17 +591,16 @@
     }
 
 
-    public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
+    public void move( MoveOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        moveAndRename( opContext, null );
+        opContext.setByPassed( byPassed );
+        move( opContext );
     }
 
 
-    public void moveAndRename( MoveAndRenameOperationContext opContext, Collection<String> byPassed )
-            throws Exception
+    public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -621,23 +613,23 @@
         }
     }
 
-    /**
-     * TODO : check if we can find another way to protect ourselves from recursion.
-     *
-     * @param opContext The operation context
-     * @param byPassed bypass instructions to skip interceptors
-     * @throws Exception if bind fails
-     */
-    public void bind( BindOperationContext opContext, Collection<String> byPassed )
+
+    public void moveAndRename( MoveAndRenameOperationContext opContext, Collection<String> byPassed )
             throws Exception
     {
-        ensureStarted();
         opContext.setByPassed( byPassed );
+        moveAndRename( opContext );
+    }
+
+
+    public void unbind( UnbindOperationContext opContext ) throws Exception
+    {
+        ensureStarted();
         push( opContext );
         
         try
         {
-            service.getInterceptorChain().bind( opContext );
+            service.getInterceptorChain().unbind( opContext );
         }
         finally
         {
@@ -648,13 +640,34 @@
 
     public void unbind( UnbindOperationContext opContext, Collection<String> byPassed ) throws Exception
     {
-        ensureStarted();
         opContext.setByPassed( byPassed );
+        unbind( opContext );
+    }
+
+
+    /**
+     * TODO : check if we can find another way to protect ourselves from recursion.
+     *
+     * @param opContext The operation context
+     * @param byPassed bypass instructions to skip interceptors
+     * @throws Exception if bind fails
+     */
+    public void bind( BindOperationContext opContext, Collection<String> byPassed )
+            throws Exception
+    {
+        opContext.setByPassed( byPassed );
+        bind( opContext );
+    }
+
+    
+    public void bind( BindOperationContext opContext ) throws Exception
+    {
+        ensureStarted();
         push( opContext );
         
         try
         {
-            service.getInterceptorChain().unbind( opContext );
+            service.getInterceptorChain().bind( opContext );
         }
         finally
         {
@@ -663,18 +676,6 @@
     }
 
 
-    public void bind( BindOperationContext opContext ) throws Exception
-    {
-        bind( opContext, null );
-    }
-
-
-    public void unbind( UnbindOperationContext opContext ) throws Exception
-    {
-        unbind( opContext, null );
-    }
-
-
     public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
     {
         if ( opContext.getDn().size() == 0 )
@@ -714,15 +715,7 @@
 
     public void addContextPartition( AddContextPartitionOperationContext opContext ) throws Exception
     {
-        addContextPartition( opContext, null );
-    }
-
-
-    public void addContextPartition( AddContextPartitionOperationContext opContext, Collection<String> byPassed )
-            throws Exception
-    {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -736,17 +729,17 @@
     }
 
 
-    public void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception
+    public void addContextPartition( AddContextPartitionOperationContext opContext, Collection<String> byPassed )
+            throws Exception
     {
-        removeContextPartition( opContext, null );
+        opContext.setByPassed( byPassed );
+        addContextPartition( opContext );
     }
 
 
-    public void removeContextPartition( RemoveContextPartitionOperationContext opContext, Collection<String> byPassed )
-            throws Exception
+    public void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception
     {
         ensureStarted();
-        opContext.setByPassed( byPassed );
         push( opContext );
         
         try
@@ -760,6 +753,14 @@
     }
 
 
+    public void removeContextPartition( RemoveContextPartitionOperationContext opContext, Collection<String> byPassed )
+            throws Exception
+    {
+        opContext.setByPassed( byPassed );
+        removeContextPartition( opContext );
+    }
+
+
     private void ensureStarted() throws ServiceUnavailableException
     {
         if ( !service.isStarted() )