directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1202944 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ core-api/src/test/java/org/apache/directory/server/core/api/ interceptors/schema/src/main/java/org/apache/directory/se...
Date Thu, 17 Nov 2011 00:11:38 GMT
Author: elecharny
Date: Thu Nov 17 00:11:37 2011
New Revision: 1202944

URL: http://svn.apache.org/viewvc?rev=1202944&view=rev
Log:
Code cleanup :
- removal of useless methods
- added some Javadoc and comments

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java?rev=1202944&r1=1202943&r2=1202944&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
Thu Nov 17 00:11:37 2011
@@ -21,17 +21,14 @@ package org.apache.directory.server.core
 
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.LdapPrincipal;
-import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -298,22 +295,6 @@ public abstract class AbstractOperationC
 
 
     /**
-     * Gets the set of bypassed Interceptors.
-     *
-     * @return the set of bypassed Interceptors
-     */
-    public Collection<String> getByPassed()
-    {
-        if ( byPassed == null )
-        {
-            return Collections.emptyList();
-        }
-
-        return Collections.unmodifiableCollection( byPassed );
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public final void setInterceptors( List<String> interceptors )
@@ -337,8 +318,6 @@ public abstract class AbstractOperationC
 
         return interceptor;
     }
-
-
     
     
     /**
@@ -360,44 +339,9 @@ public abstract class AbstractOperationC
         this.currentInterceptor = currentInterceptor;
     }
 
-    
-    /**
-     * Sets the set of bypassed Interceptors.
-     * 
-     * @param byPassed the set of bypassed Interceptors
-     */
-    public void setByPassed( Collection<String> byPassed )
-    {
-        this.byPassed = byPassed;
-    }
-
-
-    /**
-     * Checks to see if an Interceptor is bypassed for this operation.
-     *
-     * @param interceptorName the interceptorName of the Interceptor to check for bypass
-     * @return true if the Interceptor should be bypassed, false otherwise
-     */
-    public boolean isBypassed( String interceptorName )
-    {
-        return byPassed != null && byPassed.contains( interceptorName );
-    }
-
-
-    /**
-     * Checks to see if any Interceptors are bypassed by this operation.
-     *
-     * @return true if at least one bypass exists
-     */
-    public boolean hasBypass()
-    {
-        return byPassed != null && !byPassed.isEmpty();
-    }
-
 
     private void setup( AbstractOperationContext opContext )
     {
-        opContext.setPreviousOperation( this );
         next = opContext;
         opContext.setAuthorizedPrincipal( authorizedPrincipal );
     }
@@ -406,18 +350,6 @@ public abstract class AbstractOperationC
     /**
      * {@inheritDoc}
      */
-    public void add( Entry entry, Collection<String> byPassed ) throws LdapException
-    {
-        AddOperationContext addContext = new AddOperationContext( session, entry );
-        setup( addContext );
-        addContext.setByPassed( byPassed );
-        session.getDirectoryService().getOperationManager().add( addContext );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public void delete( Dn dn ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( session, dn );
@@ -429,19 +361,6 @@ public abstract class AbstractOperationC
     /**
      * {@inheritDoc}
      */
-    public boolean hasEntry( Dn dn, Collection<String> byPassed ) throws LdapException
-    {
-        HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( session,
dn );
-        setup( hasEntryContext );
-        hasEntryContext.setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.HAS_ENTRY
) );
-
-        return session.getDirectoryService().getOperationManager().hasEntry( hasEntryContext
);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
     {
         if ( lookupContext != next )
@@ -453,41 +372,6 @@ public abstract class AbstractOperationC
     }
 
 
-    /**
-     * {@inheritDoc}
-     */
-    public Entry lookup( Dn dn, Collection<String> byPassed ) throws LdapException
-    {
-        LookupOperationContext lookupContext = newLookupContext( dn );
-        lookupContext.setByPassed( byPassed );
-        return session.getDirectoryService().getOperationManager().lookup( lookupContext
);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Entry lookup( Dn dn, Collection<String> byPassed, String... attrIds ) throws
LdapException
-    {
-        LookupOperationContext lookupContext = newLookupContext( dn );
-        lookupContext.setByPassed( byPassed );
-        lookupContext.setAttrsId( attrIds );
-        return session.getDirectoryService().getOperationManager().lookup( lookupContext
);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed
) throws LdapException
-    {
-        ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods
);
-        setup( modifyContext );
-        modifyContext.setByPassed( byPassed );
-        session.getDirectoryService().getOperationManager().modify( modifyContext );
-    }
-
-
     // TODO - need synchronization here and where we update links
     /**
      * {@inheritDoc}
@@ -496,6 +380,7 @@ public abstract class AbstractOperationC
     {
         LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
         setup( lookupContext );
+        
         return lookupContext;
     }
 
@@ -518,73 +403,6 @@ public abstract class AbstractOperationC
     // OperationContext Linked List Methods
     // -----------------------------------------------------------------------
     /**
-     * {@inheritDoc}
-     */
-    public boolean isFirstOperation()
-    {
-        return previous == null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public OperationContext getFirstOperation()
-    {
-        if ( previous == null )
-        {
-            return this;
-        }
-
-        return previous.getFirstOperation();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public OperationContext getLastOperation()
-    {
-        if ( next == null )
-        {
-            return this;
-        }
-
-        return next.getLastOperation();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public OperationContext getNextOperation()
-    {
-        return next;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void setNextOperation( OperationContext next )
-    {
-        this.next = next;
-    }
-
-
-    public OperationContext getPreviousOperation()
-    {
-        return previous;
-    }
-
-
-    protected void setPreviousOperation( OperationContext previous )
-    {
-        this.previous = previous;
-    }
-
-
-    /**
      * @param entry the entry to set
      */
     public void setEntry( Entry entry )

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java?rev=1202944&r1=1202943&r2=1202944&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
Thu Nov 17 00:11:37 2011
@@ -20,15 +20,12 @@
 package org.apache.directory.server.core.api.interceptor.context;
 
 
-import java.util.Collection;
 import java.util.List;
 
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.entry.ClonedServerEntry;
-import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -43,51 +40,6 @@ import org.apache.directory.shared.ldap.
 public interface OperationContext
 {
     /**
-     * Checks to see if this operation is the first operation in a chain of
-     * operations performed on the DirectoryService.  The first operation in
-     * a sequence of operations, is not a byproduct of another operation
-     * unlike operations following in the sequence.  The other operations
-     * following the first, occur as a side effect to complete this first
-     * operation.
-     * 
-     * @return true if the operation is the first, false otherwise
-     */
-    boolean isFirstOperation();
-    
-    
-    /**
-     * Gets the first, direct operation issued against the DirectoryService.
-     *
-     * @return the first, direct operation issued
-     */
-    OperationContext getFirstOperation();
-    
-    
-    /**
-     * Gets the previous, operation issued on the DirectoryService.
-     *
-     * @return the previous, operation issued
-     */
-    OperationContext getPreviousOperation();
-    
-    
-    /**
-     * Gets the next, indirect operation issued on the DirectoryService.
-     *
-     * @return the next, indirect operation issued
-     */
-    OperationContext getNextOperation();
-    
-    
-    /**
-     * Gets the last, operation issued on the DirectoryService.
-     *
-     * @return the last, operation issued
-     */
-    OperationContext getLastOperation();
-    
-    
-    /**
      * @return The number of the current interceptor in the list
      */
     int getCurrentInterceptor();
@@ -263,30 +215,6 @@ public interface OperationContext
     
     
     /**
-     * Checks to see if an Interceptor is bypassed for this operation.
-     *
-     * @param interceptorName the interceptorName of the Interceptor to check for bypass
-     * @return true if the Interceptor should be bypassed, false otherwise
-     */
-    boolean isBypassed( String interceptorName );
-
-
-    /**
-     * Checks to see if any Interceptors are bypassed by this Invocation.
-     *
-     * @return true if at least one bypass exists
-     */
-    boolean hasBypass();
-    
-    
-    /**
-     * Gets the set of bypassed Interceptors.
-     *
-     * @return the set of bypassed Interceptors
-     */
-    Collection<String> getByPassed();
-    
-    /**
      * Gets the next interceptor in the list of interceptors. The
      * position in the list will be incremented.
      * 
@@ -304,14 +232,6 @@ public interface OperationContext
     
     
     /**
-     * Sets the set of bypassed Interceptors.
-     * 
-     * @param byPassed the set of bypassed Interceptors
-     */
-    void setByPassed( Collection<String> byPassed );
-    
-    
-    /**
      * Gets the session associated with this operation.
      *
      * @return the session associated with this operation
@@ -322,26 +242,12 @@ public interface OperationContext
     // -----------------------------------------------------------------------
     // Utility Factory Methods to Create New OperationContexts
     // -----------------------------------------------------------------------
-    
-    
     LookupOperationContext newLookupContext( Dn dn );
 
     
-    Entry lookup( Dn dn, Collection<String> byPass ) throws LdapException;
-    
-    
-    Entry lookup( Dn dn, Collection<String> byPass, String... attrIds ) throws LdapException;
-    
-    
     Entry lookup( LookupOperationContext lookupContext ) throws LdapException;
     
     
-    void modify( Dn dn, List<Modification> mods, Collection<String> byPass )
throws LdapException;
-    
-    
-    void add( Entry entry, Collection<String> byPass ) throws LdapException;
-    
-    
     /**
      * Process the delete for inner operations. This is only valid for SubschemaSubentry
      * operations, and will most certainly be removed later.
@@ -353,17 +259,6 @@ public interface OperationContext
 
 
     /**
-     * Checks to see if an entry exists.
-     *
-     * @param dn the distinguished name of the entry to check
-     * @param byPass collection of {@link Interceptor}'s to bypass for this check
-     * @return true if the entry exists, false if it does not
-     * @throws Exception on failure to perform this operation
-     */
-    boolean hasEntry( Dn dn, Collection<String> byPass ) throws LdapException;
-    
-    
-    /**
      * Set the throwReferral flag to true
      */
     void throwReferral();

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1202944&r1=1202943&r2=1202944&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
Thu Nov 17 00:11:37 2011
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.server.core.api;
 
-import java.util.Collection;
 import java.util.List;
 
 import org.apache.directory.server.core.api.CoreSession;
@@ -32,7 +31,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -52,14 +50,7 @@ public class MockOperation implements Op
     }
 
 
-    public EntryFilteringCursor search( SearchOperationContext searchContext )
-        throws LdapException
-    {
-        return new BaseEntryFilteringCursor( new MockCursor( count ), searchContext );
-    }
-
-
-    public EntryFilteringCursor search( SearchOperationContext searchContext, Collection<String>
bypass ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         return new BaseEntryFilteringCursor( new MockCursor( count ), searchContext );
     }
@@ -80,12 +71,6 @@ public class MockOperation implements Op
     }
 
 
-    public Collection<String> getByPassed()
-    {
-        return null;
-    }
-
-
     public Dn getDn()
     {
         return null;
@@ -128,12 +113,6 @@ public class MockOperation implements Op
     }
 
 
-    public boolean hasBypass()
-    {
-        return false;
-    }
-
-
     public boolean hasRequestControl( String numericOid )
     {
         return false;
@@ -158,52 +137,18 @@ public class MockOperation implements Op
     }
 
 
-    public boolean isBypassed( String interceptorName )
-    {
-        return false;
-    }
-
-
-    public boolean isCollateralOperation()
-    {
-        return false;
-    }
-
-
-    public Entry lookup( Dn dn, Collection<String> bypass ) throws LdapException
-    {
-        return null;
-    }
-
-
     public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
     {
         return null;
     }
 
 
-    public Entry lookup( Dn dn, Collection<String> byPass, String... attrIds ) throws
LdapException
-    {
-        return null;
-    }
-    
-
     public LookupOperationContext newLookupContext( Dn dn )
     {
         return null;
     }
 
 
-    public void setByPassed( Collection<String> byPassed )
-    {
-    }
-
-
-    public void setCollateralOperation( boolean collateralOperation )
-    {
-    }
-
-
     public void setDn( Dn dn )
     {
     }
@@ -215,57 +160,11 @@ public class MockOperation implements Op
     }
 
 
-    public OperationContext getFirstOperation()
-    {
-        return null;
-    }
-
-
-    public OperationContext getLastOperation()
-    {
-        return null;
-    }
-
-
-    public OperationContext getNextOperation()
-    {
-        return null;
-    }
-
-
-    public OperationContext getPreviousOperation()
-    {
-        return null;
-    }
-
-
-    public boolean isFirstOperation()
-    {
-        return false;
-    }
-
-
-    public void add( Entry entry, Collection<String> bypass ) throws LdapException
-    {
-    }
-
-
     public void delete( Dn dn ) throws LdapException
     {
     }
 
 
-    public void modify( Dn dn, List<Modification> mods, Collection<String> bypass
) throws LdapException
-    {
-    }
-
-
-    public boolean hasEntry( Dn dn, Collection<String> byPass ) throws LdapException
-    {
-        return false;
-    }
-
-
     public ReferralHandlingMode getReferralHandlingMode()
     {
         return null;
@@ -313,15 +212,12 @@ public class MockOperation implements Op
     @Override
     public void setInterceptors( List<String> interceptors )
     {
-        // TODO Auto-generated method stub
-        
     }
 
 
     @Override
     public String getNextInterceptor()
     {
-        // TODO Auto-generated method stub
         return "";
     }
 

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java?rev=1202944&r1=1202943&r2=1202944&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
(original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
Thu Nov 17 00:11:37 2011
@@ -160,7 +160,17 @@ public class SchemaSubentryManager
     }
 
     
-
+    /**
+     * Find the next interceptor in an operation's list of interceptors, assuming that
+     * we are already processing an operation, and we have stopped in a specific
+     * interceptor.<br/>
+     * For instance, if the list of all the interceptors is : <br/>
+     * [A, B, C, D, E, F]<br/>
+     * and we ave two operations op1 and op2 with the following interceptors list : <br/>
+     * op1 -> [A, D, F]<br/>
+     * op2 -> [B, C, E]<br/>
+     * then assuming that we have stopped at D, then op1.next -> F and op2.next ->
E.
+     */
     private Interceptor findNextInterceptor( OperationEnum operation, DirectoryService directoryService
)
     {
         Interceptor interceptor = null;
@@ -198,6 +208,9 @@ public class SchemaSubentryManager
     }
     
     
+    /**
+     * Find the position in the operation's list knowing the inteceptor name.
+     */
     private int findPosition( OperationEnum operation, Interceptor interceptor, DirectoryService
directoryService )
     {
         int position = 1;
@@ -221,11 +234,15 @@ public class SchemaSubentryManager
     
     
     /**
-     * @TODO
+     * Update the SubschemaSubentry with all the modifications
      */
     public void modifySchemaSubentry( ModifyOperationContext modifyContext, boolean doCascadeModify
) throws LdapException
     {
         DirectoryService directoryService = modifyContext.getSession().getDirectoryService();
+        
+        // Compute the next interceptor for the Add and Delete operation, starting from
+        // the schemaInterceptor. We also need to get the position of this next interceptor
+        // in the operation's list.
         Interceptor nextAdd = findNextInterceptor( OperationEnum.ADD, directoryService );
         int positionAdd = findPosition( OperationEnum.ADD, nextAdd, directoryService );
         Interceptor nextDelete = findNextInterceptor( OperationEnum.DELETE, directoryService
);



Mime
View raw message