directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r541123 [15/25] - in /directory/apacheds/branches/apacheds-sasl-branch: ./ benchmarks/ bootstrap-extract/ bootstrap-extract/src/ bootstrap-extract/src/main/ bootstrap-extract/src/main/java/ bootstrap-extract/src/main/java/org/ bootstrap-ext...
Date Thu, 24 May 2007 00:27:07 GMT
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java Wed May 23 17:26:40 2007
@@ -24,7 +24,6 @@
 import java.lang.reflect.Method;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -40,6 +39,12 @@
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -47,8 +52,8 @@
 import org.apache.directory.server.core.sp.LdapClassLoader;
 import org.apache.directory.server.core.subtree.SubentryService;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
@@ -56,6 +61,7 @@
 import org.apache.directory.shared.ldap.trigger.LdapOperation;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
+import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
 import org.apache.directory.shared.ldap.util.DirectoryClassUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,10 +75,12 @@
  */
 public class TriggerService extends BaseInterceptor
 {
-    public static final String SERVICE_NAME = "triggerService";
-    
     /** the logger for this class */
     private static final Logger log = LoggerFactory.getLogger( TriggerService.class );
+
+    /** The service name */
+    public static final String NAME = "triggerService";
+    
     
     /** the entry trigger attribute string: entryTrigger */
     private static final String ENTRY_TRIGGER_ATTR = "entryTriggerSpecification";
@@ -111,7 +119,7 @@
      * @param entry the target entry that is considered as the trigger source
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void addPrescriptiveTriggerSpecs( List triggerSpecs, PartitionNexusProxy proxy,
+    private void addPrescriptiveTriggerSpecs( List<TriggerSpecification> triggerSpecs, PartitionNexusProxy proxy,
         LdapDN dn, Attributes entry ) throws NamingException
     {
         
@@ -124,11 +132,11 @@
          * to be in the same naming context as their access point so the subentries
          * effecting their parent entry applies to them as well.
          */
-        if ( entry.get( "objectClass" ).contains( "subentry" ) )
+        if ( entry.get( SchemaConstants.OBJECT_CLASS_AT ).contains( SchemaConstants.SUBENTRY_OC ) )
         {
             LdapDN parentDn = ( LdapDN ) dn.clone();
             parentDn.remove( dn.size() - 1 );
-            entry = proxy.lookup( parentDn, PartitionNexusProxy.LOOKUP_BYPASS );
+            entry = proxy.lookup( new LookupOperationContext( parentDn ), PartitionNexusProxy.LOOKUP_BYPASS );
         }
 
         Attribute subentries = entry.get( TRIGGER_SUBENTRIES_ATTR );
@@ -152,7 +160,7 @@
      * @param entry the target entry that is considered as the trigger source
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void addEntryTriggerSpecs( Collection triggerSpecs, Attributes entry ) throws NamingException
+    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, Attributes entry ) throws NamingException
     {
         Attribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR );
         if ( entryTrigger == null )
@@ -180,15 +188,23 @@
         }
     }
     
-    public Map getActionTimeMappedTriggerSpecsForOperation( List triggerSpecs, LdapOperation ldapOperation )
+    /**
+     * Return a selection of trigger specifications for a certain type of trigger action time.
+     * 
+     * @NOTE: This method serves as an extion point for new Action Time types.
+     * 
+     * @param triggerSpecs
+     * @param ldapOperation
+     */
+    public Map<ActionTime, List<TriggerSpecification>> getActionTimeMappedTriggerSpecsForOperation( List<TriggerSpecification> triggerSpecs, LdapOperation ldapOperation )
     {
-        List afterTriggerSpecs = new ArrayList();
-        Map triggerSpecMap = new HashMap();
+        List<TriggerSpecification> afterTriggerSpecs = new ArrayList<TriggerSpecification>();
+        Map<ActionTime, List<TriggerSpecification>> triggerSpecMap = new HashMap<ActionTime, List<TriggerSpecification>>();
         
-        Iterator it = triggerSpecs.iterator();
+        Iterator<TriggerSpecification> it = triggerSpecs.iterator();
         while ( it.hasNext() )
         {
-            TriggerSpecification triggerSpec = ( TriggerSpecification ) it.next();
+            TriggerSpecification triggerSpec = it.next();
             if ( triggerSpec.getLdapOperation().equals( ldapOperation ) )
             {
                 if ( triggerSpec.getActionTime().equals( ActionTime.AFTER ) )
@@ -197,7 +213,7 @@
                 }
                 else
                 {
-                    // TODO
+                	
                 }    
             }
         }
@@ -229,12 +245,15 @@
         this.enabled = true; // TODO: Get this from the configuration if needed.
     }
 
-    public void add( NextInterceptor next, LdapDN normName, Attributes addedEntry ) throws NamingException
+    public void add( NextInterceptor next, OperationContext addContext ) throws NamingException
     {
+    	LdapDN name = addContext.getDn();
+    	Attributes entry = ((AddOperationContext)addContext).getEntry();
+    	
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.add( normName, addedEntry );
+            next.add( addContext );
             return;
         }
         
@@ -242,196 +261,177 @@
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
-        StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( invocation, normName, addedEntry );
+        StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( invocation, name, entry );
 
         // Gather Trigger Specifications which apply to the entry being deleted.
-        List triggerSpecs = new ArrayList();
-        addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, addedEntry );
+        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, entry );
+
         /**
          *  NOTE: We do not handle entryTriggerSpecs for ADD operation.
          */
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.ADD.
-        Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.ADD );
+        Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.ADD );
         
-        next.add( normName, addedEntry );
-        triggerSpecCache.subentryAdded( normName, addedEntry );
+        next.add( addContext );
+        triggerSpecCache.subentryAdded( name, entry );
         
         // Fire AFTER Triggers.
-        List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
 
-    public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
+    public void delete( NextInterceptor next, OperationContext deleteContext ) throws NamingException
     {
+    	LdapDN name = deleteContext.getDn();
+    	
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.delete( normName );
+            next.delete( deleteContext );
             return;
         }
         
         // Gather supplementary data.
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes deletedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes deletedEntry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
-        StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( invocation, normName );
+        StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( invocation, name );
 
         // Gather Trigger Specifications which apply to the entry being deleted.
-        List triggerSpecs = new ArrayList();
-        addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, deletedEntry );
+        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, deletedEntry );
         addEntryTriggerSpecs( triggerSpecs, deletedEntry );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.DELETE.
-        Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.DELETE );
+        Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.DELETE );
         
-        next.delete( normName );
-        triggerSpecCache.subentryDeleted( normName, deletedEntry );
+        next.delete( deleteContext );
+        triggerSpecCache.subentryDeleted( name, deletedEntry );
         
         // Fire AFTER Triggers.
-        List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
     
-    public void modify( NextInterceptor next, LdapDN normName, int modOp, Attributes mods ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.modify( normName, modOp, mods );
+            next.modify( opContext );
             return;
         }
         
-        // Gather supplementary data.
-        Invocation invocation = InvocationStack.getInstance().peek();
-        PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes modifiedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
-        ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
-        StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, normName, modOp, mods );
-
-        // Gather Trigger Specifications which apply to the entry being modified.
-        List triggerSpecs = new ArrayList();
-        addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, modifiedEntry );
-        addEntryTriggerSpecs( triggerSpecs, modifiedEntry );
-        
-        // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFY.
-        Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY );
-        
-        next.modify( normName, modOp, mods );
-        triggerSpecCache.subentryModified( normName, modOp, mods, modifiedEntry );
-        
-        // Fire AFTER Triggers.
-        List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
-        executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN normName, ModificationItemImpl[] mods ) throws NamingException
-    {
-        // Bypass trigger handling if the service is disabled.
-        if ( !enabled )
-        {
-            next.modify( normName, mods );
-            return;
-        }
+        LdapDN normName = opContext.getDn();
         
         // Gather supplementary data.
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes modifiedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
-        StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, normName, mods );
+        StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, opContext );
 
         // Gather Trigger Specifications which apply to the entry being modified.
-        List triggerSpecs = new ArrayList();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, modifiedEntry );
         addEntryTriggerSpecs( triggerSpecs, modifiedEntry );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFY.
-        Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY );
+        Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY );
         
-        next.modify( normName, mods );
-        triggerSpecCache.subentryModified( normName, mods, modifiedEntry );
+        next.modify( opContext );
+        triggerSpecCache.subentryModified( opContext, modifiedEntry );
         
         // Fire AFTER Triggers.
-        List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
     
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void rename( NextInterceptor next, OperationContext renameContext ) throws NamingException
     {
+        LdapDN name = renameContext.getDn();
+        String newRdn = ((RenameOperationContext)renameContext).getNewRdn();
+        boolean deleteOldRn = ((RenameOperationContext)renameContext).getDelOldDn();
+        
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.rename( renameContext );
             return;
         }
         
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes renamedEntry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes renamedEntry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
-        LdapDN newRDN = new LdapDN( newRn );
+        LdapDN newRDN = new LdapDN( newRdn );
         LdapDN oldSuperiorDN = ( LdapDN ) name.clone();
         oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         LdapDN newSuperiorDN = ( LdapDN ) oldSuperiorDN.clone();
         LdapDN oldDN = ( LdapDN ) name.clone();
         LdapDN newDN = ( LdapDN ) name.clone();
-        newDN.add( newRn );
+        newDN.add( newRdn );
         
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
             invocation, deleteOldRn, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
         
         // Gather Trigger Specifications which apply to the entry being renamed.
-        List triggerSpecs = new ArrayList();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, renamedEntry );
         addEntryTriggerSpecs( triggerSpecs, renamedEntry );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFYDN_RENAME.
-        Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFYDN_RENAME );
+        Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFYDN_RENAME );
         
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.rename( renameContext );
         triggerSpecCache.subentryRenamed( name, newDN );
         
         // Fire AFTER Triggers.
-        List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
     
-    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void moveAndRename( NextInterceptor next, OperationContext moveAndRenameContext ) throws NamingException
     {
+        LdapDN oriChildName = moveAndRenameContext.getDn();
+        LdapDN parent = ((MoveAndRenameOperationContext)moveAndRenameContext).getParent();
+        String newRn = ((MoveAndRenameOperationContext)moveAndRenameContext).getNewRdn();
+        boolean deleteOldRn = ((MoveAndRenameOperationContext)moveAndRenameContext).getDelOldDn();
+
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.move( oriChildName, newParentName, newRn, deleteOldRn );
+            next.moveAndRename( moveAndRenameContext );
             return;
         }
         
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes movedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes movedEntry = proxy.lookup( new LookupOperationContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
         LdapDN newRDN = new LdapDN( newRn );
         LdapDN oldSuperiorDN = ( LdapDN ) oriChildName.clone();
         oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
-        LdapDN newSuperiorDN = ( LdapDN ) newParentName.clone();
+        LdapDN newSuperiorDN = ( LdapDN ) parent.clone();
         LdapDN oldDN = ( LdapDN ) oriChildName.clone();
-        LdapDN newDN = ( LdapDN ) newParentName.clone();
+        LdapDN newDN = ( LdapDN ) parent.clone();
         newDN.add( newRn );
 
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
             invocation, deleteOldRn, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
 
         // Gather Trigger Specifications which apply to the entry being exported.
-        List exportTriggerSpecs = new ArrayList();
+        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( exportTriggerSpecs, proxy, oriChildName, movedEntry );
         addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
         
@@ -440,13 +440,13 @@
         // will not be valid at the new location.
         // This will certainly be fixed by the SubentryService,
         // but after this service.
-        Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        Attributes importedEntry = proxy.lookup( new LookupOperationContext( oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
         // As the target entry does not exist yet and so
         // its subentry operational attributes are not there,
         // we need to construct an entry to represent it
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
-        SubentryService subentryService = ( SubentryService ) chain.get( "subentryService" );
+        SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
         Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
         NamingEnumeration attrList = importedEntry.getAll();
         while ( attrList.hasMore() )
@@ -456,39 +456,42 @@
         
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
-        List importTriggerSpecs = new ArrayList();
+        List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFYDN_EXPORT.
-        Map exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
+        Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFYDN_IMPORT.
-        Map importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
+        Map<ActionTime, List<TriggerSpecification>> importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
         
-        next.move( oriChildName, newParentName, newRn, deleteOldRn );
+        next.moveAndRename( moveAndRenameContext );
         triggerSpecCache.subentryRenamed( oldDN, newDN );
         
         // Fire AFTER Triggers.
-        List afterExportTriggerSpecs = ( List ) exportTriggerMap.get( ActionTime.AFTER );
-        List afterImportTriggerSpecs = ( List ) importTriggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterExportTriggerSpecs = exportTriggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterImportTriggerSpecs = importTriggerMap.get( ActionTime.AFTER );
         executeTriggers( afterExportTriggerSpecs, injector, callerRootCtx );
         executeTriggers( afterImportTriggerSpecs, injector, callerRootCtx );
     }
     
     
-    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException
+    public void move( NextInterceptor next, OperationContext moveContext ) throws NamingException
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.move( oriChildName, newParentName );
+            next.move( moveContext );
             return;
         }
         
+        LdapDN oriChildName = moveContext.getDn();
+        LdapDN newParentName = ((MoveOperationContext)moveContext).getParent();
+        
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes movedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes movedEntry = proxy.lookup( new LookupOperationContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
@@ -504,7 +507,7 @@
             invocation, false, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
 
         // Gather Trigger Specifications which apply to the entry being exported.
-        List exportTriggerSpecs = new ArrayList();
+        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( exportTriggerSpecs, proxy, oriChildName, movedEntry );
         addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
         
@@ -513,15 +516,16 @@
         // will not be valid at the new location.
         // This will certainly be fixed by the SubentryService,
         // but after this service.
-        Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        Attributes importedEntry = proxy.lookup( new LookupOperationContext( oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
         // As the target entry does not exist yet and so
         // its subentry operational attributes are not there,
         // we need to construct an entry to represent it
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
-        SubentryService subentryService = ( SubentryService ) chain.get( "subentryService" );
+        SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
         Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
         NamingEnumeration attrList = importedEntry.getAll();
+        
         while ( attrList.hasMore() )
         {
             fakeImportedEntry.put( ( Attribute ) attrList.next() );
@@ -529,21 +533,21 @@
         
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
-        List importTriggerSpecs = new ArrayList();
+        List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
         addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFYDN_EXPORT.
-        Map exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
+        Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
         
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFYDN_IMPORT.
-        Map importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
+        Map<ActionTime, List<TriggerSpecification>> importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
         
-        next.move( oriChildName, newParentName );
+        next.move( moveContext );
         triggerSpecCache.subentryRenamed( oldDN, newDN );
         
         // Fire AFTER Triggers.
-        List afterExportTriggerSpecs = ( List ) exportTriggerMap.get( ActionTime.AFTER );
-        List afterImportTriggerSpecs = ( List ) importTriggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterExportTriggerSpecs = exportTriggerMap.get( ActionTime.AFTER );
+        List<TriggerSpecification> afterImportTriggerSpecs = importTriggerMap.get( ActionTime.AFTER );
         executeTriggers( afterExportTriggerSpecs, injector, callerRootCtx );
         executeTriggers( afterImportTriggerSpecs, injector, callerRootCtx );
     }
@@ -552,15 +556,15 @@
     // Utility Methods
     ////////////////////////////////////////////////////////////////////////////
     
-    private Object executeTriggers( List triggerSpecs, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws NamingException
+    private Object executeTriggers( List<TriggerSpecification> triggerSpecs, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws NamingException
     {
         Object result = null;
         
-        Iterator it = triggerSpecs.iterator();
+        Iterator<TriggerSpecification> it = triggerSpecs.iterator();
         
         while( it.hasNext() )
         {
-            TriggerSpecification tsec = ( TriggerSpecification ) it.next();
+            TriggerSpecification tsec = it.next();
             
             // TODO: Replace the Authorization Code with a REAL one.
             if ( triggerExecutionAuthorizer.hasPermission() )
@@ -582,22 +586,28 @@
 
     private Object executeTrigger( TriggerSpecification tsec, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws NamingException
     {
-        List arguments = new ArrayList();
-        arguments.addAll( injector.getArgumentsToInject( tsec.getStoredProcedureParameters() ) );
-        List typeList = new ArrayList();
-        typeList.addAll( getTypesFromValues( arguments ) );
-        
-        Class[] types = ( Class[] ) ( getTypesFromValues( arguments ).toArray( EMPTY_CLASS_ARRAY ) );
-        Object[] values = arguments.toArray();
+    	List<Object> returnValues = new ArrayList<Object>();
+    	List<SPSpec> spSpecs = tsec.getSPSpecs();
+        for ( SPSpec spSpec : spSpecs )
+        {
+        	List<Object> arguments = new ArrayList<Object>();
+        	arguments.addAll( injector.getArgumentsToInject( spSpec.getParameters() ) );
+        	List<Class> typeList = new ArrayList<Class>();
+            typeList.addAll( getTypesFromValues( arguments ) );
+            Class[] types = getTypesFromValues( arguments ).toArray( EMPTY_CLASS_ARRAY );
+            Object[] values = arguments.toArray();
+            Object returnValue = executeProcedure( callerRootCtx, spSpec.getName(), types, values );
+            returnValues.add(returnValue);
+		}
         
-        return executeProcedure( callerRootCtx, tsec.getStoredProcedureName(), types, values );
+        return returnValues; 
     }
     
     private static Class[] EMPTY_CLASS_ARRAY = new Class[ 0 ];
     
-    private List getTypesFromValues( List objects )
+    private List<Class> getTypesFromValues( List objects )
     {
-        List types = new ArrayList();
+        List<Class> types = new ArrayList<Class>();
         
         Iterator it = objects.iterator();
         

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Wed May 23 17:26:40 2007
@@ -38,8 +38,12 @@
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
@@ -65,8 +69,6 @@
 {
     /** the attribute id for prescriptive trigger: prescriptiveTrigger */
     private static final String PRESCRIPTIVE_TRIGGER_ATTR = "prescriptiveTriggerSpecification";
-    /** the attribute id for an object class: objectClass */
-    private static final String OC_ATTR = "objectClass";
     /** the object class for trigger subentries: triggerExecutionSubentry */
     private static final String TRIGGER_SUBENTRY_OC = "triggerExecutionSubentry";
 
@@ -76,7 +78,7 @@
     /** cloned startup environment properties we use for subentry searching */
     private final Hashtable env;
     /** a map of strings to TriggerSpecification collections */
-    private final Map triggerSpecs = new HashMap();
+    private final Map<String, List<TriggerSpecification>> triggerSpecs = new HashMap<String, List<TriggerSpecification>>();
     /** a handle on the partition nexus */
     private final PartitionNexus nexus;
     /** a normalizing TriggerSpecification parser */
@@ -111,20 +113,25 @@
         // search all naming contexts for trigger subentenries
         // generate TriggerSpecification arrays for each subentry
         // add that subentry to the hash
-        Iterator suffixes = nexus.listSuffixes();
+        Iterator suffixes = nexus.listSuffixes( null );
+        
         while ( suffixes.hasNext() )
         {
             String suffix = ( String ) suffixes.next();
             LdapDN baseDn = new LdapDN( suffix );
-            ExprNode filter = new SimpleNode( OC_ATTR, TRIGGER_SUBENTRY_OC, AssertionEnum.EQUALITY );
+            ExprNode filter = new SimpleNode( SchemaConstants.OBJECT_CLASS_AT, TRIGGER_SUBENTRY_OC, AssertionEnum.EQUALITY );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-            NamingEnumeration results = nexus.search( baseDn, env, filter, ctls );
+            NamingEnumeration results = 
+                nexus.search( 
+                    new SearchOperationContext( baseDn, env, filter, ctls ) );
+            
             while ( results.hasMore() )
             {
                 SearchResult result = ( SearchResult ) results.next();
                 String subentryDn = result.getName();
                 Attribute triggerSpec = result.getAttributes().get( PRESCRIPTIVE_TRIGGER_ATTR );
+                
                 if ( triggerSpec == null )
                 {
                     log.warn( "Found triggerExecutionSubentry '" + subentryDn + "' without any " + PRESCRIPTIVE_TRIGGER_ATTR );
@@ -135,6 +142,7 @@
                 normSubentryName.normalize( attrRegistry.getNormalizerMapping() );
                 subentryAdded( normSubentryName, result.getAttributes() );
             }
+            
             results.close();
         }
     }
@@ -156,12 +164,14 @@
     {
         // only do something if the entry contains prescriptiveTrigger
         Attribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
-        if ( !hasPrescriptiveTrigger( entry ) )
+        
+        if ( triggerSpec == null )
         {
             return;
         }
         
-        List subentryTriggerSpecs = new ArrayList();
+        List<TriggerSpecification> subentryTriggerSpecs = new ArrayList<TriggerSpecification>();
+        
         for ( int ii = 0; ii < triggerSpec.size(); ii++ )
         {
             TriggerSpecification item = null;
@@ -169,15 +179,16 @@
             try
             {
                 item = triggerSpecParser.parse( ( String ) triggerSpec.get( ii ) );
+                subentryTriggerSpecs.add( item );
             }
             catch ( ParseException e )
             {
                 String msg = "TriggerSpecification parser failure on '" + item + "'. Cannnot add Trigger Specificaitons to TriggerSpecCache.";
                 log.error( msg, e );
             }
-
-            subentryTriggerSpecs.add( item );
+            
         }
+        
         triggerSpecs.put( normName.toString(), subentryTriggerSpecs );
     }
 
@@ -193,18 +204,23 @@
     }
 
 
-    public void subentryModified( LdapDN normName, ModificationItemImpl[] mods, Attributes entry ) throws NamingException
+    public void subentryModified( OperationContext opContext, Attributes entry ) throws NamingException
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {
             return;
         }
 
+        LdapDN normName = opContext.getDn();
+        ModificationItemImpl[] mods = ((ModifyOperationContext)opContext).getModItems();
+
         boolean isTriggerSpecModified = false;
+        
         for ( int ii = 0; ii < mods.length; ii++ )
         {
             isTriggerSpecModified |= mods[ii].getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR );
         }
+        
         if ( isTriggerSpecModified )
         {
             subentryDeleted( normName, entry );
@@ -213,27 +229,12 @@
     }
 
 
-    public void subentryModified( LdapDN normName, int modOp, Attributes mods, Attributes entry ) throws NamingException
-    {
-        if ( !hasPrescriptiveTrigger( entry ) )
-        {
-            return;
-        }
-
-        if ( mods.get( PRESCRIPTIVE_TRIGGER_ATTR ) != null )
-        {
-            subentryDeleted( normName, entry );
-            subentryAdded( normName, entry );
-        }
-    }
-
-
-    public List getSubentryTriggerSpecs( String subentryDn )
+    public List<TriggerSpecification> getSubentryTriggerSpecs( String subentryDn )
     {
-        List subentryTriggerSpecs = ( List ) triggerSpecs.get( subentryDn );
+        List<TriggerSpecification> subentryTriggerSpecs = triggerSpecs.get( subentryDn );
         if ( subentryTriggerSpecs == null )
         {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         return Collections.unmodifiableList( subentryTriggerSpecs );
     }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java Wed May 23 17:26:40 2007
@@ -21,9 +21,8 @@
 package org.apache.directory.server.core.authn;
 
 
-import java.security.NoSuchAlgorithmException;
-
 import org.apache.directory.server.core.authn.SimpleAuthenticator;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 import junit.framework.TestCase;
 
@@ -48,24 +47,24 @@
     public void testGetAlgorithmForHashedPassword()
     {
         String digestetValue = "{SHA}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
-        assertEquals( "SHA", auth.getAlgorithmForHashedPassword( digestetValue ) );
+        assertEquals( "SHA", auth.getAlgorithmForHashedPassword( StringTools.getBytesUtf8( digestetValue ) ) );
         assertEquals( "SHA", auth.getAlgorithmForHashedPassword( digestetValue.getBytes() ) );
 
         String noAlgorithm = "Secret1!";
-        assertEquals( null, auth.getAlgorithmForHashedPassword( noAlgorithm ) );
+        assertEquals( null, auth.getAlgorithmForHashedPassword( StringTools.getBytesUtf8( noAlgorithm ) ) );
         assertEquals( null, auth.getAlgorithmForHashedPassword( noAlgorithm.getBytes() ) );
 
         String unknownAlgorithm = "{XYZ}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
-        assertEquals( null, auth.getAlgorithmForHashedPassword( unknownAlgorithm ) );
+        assertEquals( null, auth.getAlgorithmForHashedPassword( StringTools.getBytesUtf8( unknownAlgorithm ) ) );
         assertEquals( null, auth.getAlgorithmForHashedPassword( unknownAlgorithm.getBytes() ) );
     }
 
 
-    public void testCreateDigestedPassword() throws NoSuchAlgorithmException
+    public void testCreateDigestedPassword() throws IllegalArgumentException
     {
         String pwd = "Secret1!";
         String expected = "{SHA}znbJr3+tymFoQD4+Njh4ITtI7Cc=";
-        String digested = auth.createDigestedPassword( "SHA", pwd );
+        String digested = auth.createDigestedPassword( "SHA", StringTools.getBytesUtf8( pwd ) );
 
         assertEquals( expected, digested );
     }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Wed May 23 17:26:40 2007
@@ -34,6 +34,7 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -41,6 +42,7 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.DirectoryServiceListener;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.aci.ACITuple;
@@ -152,22 +154,21 @@
         final int count;
 
 
-        public MockProxy(int count)
+        public MockProxy(int count) throws NamingException 
         {
             super( new DeadContext(), new MockDirectoryService() );
             this.count = count;
         }
 
 
-        public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
+        public NamingEnumeration<SearchResult> search( OperationContext opContext )
             throws NamingException
         {
             return new BogusEnumeration( count );
         }
 
 
-        public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls,
-                                         Collection bypass ) throws NamingException
+        public NamingEnumeration<SearchResult> search( OperationContext opContext, Collection bypass ) throws NamingException
         {
             return new BogusEnumeration( count );
         }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Wed May 23 17:26:40 2007
@@ -21,36 +21,34 @@
 
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
 
 import junit.framework.TestCase;
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Context;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-
 
 /**
  * Unit test cases for InterceptorChain methods.
@@ -64,7 +62,7 @@
         { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2" ),
             new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
     private InterceptorChain chain;
-    private List interceptors = new ArrayList( interceptorArray.length );
+    private List<Interceptor> interceptors = new ArrayList<Interceptor>( interceptorArray.length );
 
 
     protected void setUp() throws Exception
@@ -100,7 +98,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -126,7 +124,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -150,7 +148,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "0" );
         bypass.add( "1" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -159,7 +157,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -184,7 +182,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "0" );
         bypass.add( "4" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -193,7 +191,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -214,7 +212,7 @@
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
-        Collection bypass = new HashSet();
+        Set<String> bypass = new HashSet<String>();
         bypass.add( "1" );
         bypass.add( "3" );
         Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
@@ -223,7 +221,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -250,7 +248,7 @@
 
         try
         {
-            chain.lookup( dn );
+            chain.lookup( new LookupOperationContext( dn ) );
         }
         catch ( Exception e )
         {
@@ -287,163 +285,141 @@
         }
 
 
-        public Attributes getRootDSE( NextInterceptor next ) throws NamingException
+        public Attributes getRootDSE( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.getRootDSE();
+            return next.getRootDSE( opContext );
         }
 
 
-        public LdapDN getMatchedName ( NextInterceptor next, LdapDN name ) throws NamingException
+        public LdapDN getMatchedName ( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.getMatchedName( name );
+            return next.getMatchedName( opContext );
         }
 
 
-        public LdapDN getSuffix ( NextInterceptor next, LdapDN name ) throws NamingException
+        public LdapDN getSuffix ( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.getSuffix( name );
+            return next.getSuffix( opContext );
         }
 
 
-        public Iterator listSuffixes ( NextInterceptor next ) throws NamingException
+        public Iterator listSuffixes ( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.listSuffixes();
+            return next.listSuffixes( opContext );
         }
 
 
-        public void addContextPartition( NextInterceptor next, PartitionConfiguration cfg )
+        public void addContextPartition( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
             interceptors.add( this );
-            next.addContextPartition( cfg );
+            next.addContextPartition( opContext );
         }
 
 
-        public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+        public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            next.removeContextPartition( suffix );
+            next.removeContextPartition( opContext );
         }
 
 
-        public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
+        public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.compare( name, oid, value );
+            return next.compare( opContext );
         }
 
 
-        public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+        public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            next.delete( name );
+            next.delete( opContext );
         }
 
 
-        public void add(NextInterceptor next, LdapDN name, Attributes entry)
+        public void add(NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
             interceptors.add( this );
-            next.add(name, entry );
-        }
-
-
-        public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes attributes ) throws NamingException
-        {
-            interceptors.add( this );
-            next.modify( name, modOp, attributes );
-        }
-
-
-        public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-        {
-            interceptors.add( this );
-            next.modify( name, items );
+            next.add( opContext );
         }
 
 
-        public NamingEnumeration list( NextInterceptor next, LdapDN baseName ) throws NamingException
+        public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.list( baseName );
+            next.modify( opContext );
         }
 
 
-        public NamingEnumeration search( NextInterceptor next, LdapDN baseName, Map environment, ExprNode filter,
-            SearchControls searchControls ) throws NamingException
+        public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.search( baseName, environment, filter, searchControls );
+            return next.list( opContext );
         }
 
 
-        public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
+        public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.lookup( name );
+            return next.search( opContext );
         }
 
 
-        public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
+        public Attributes lookup( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.lookup( dn, attrIds );
+            return next.lookup( opContext );
         }
 
 
-        public boolean hasEntry( NextInterceptor next, LdapDN name ) throws NamingException
+        public boolean hasEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            return next.hasEntry( name );
+            return next.hasEntry( opContext );
         }
 
 
-        public boolean isSuffix( NextInterceptor next, LdapDN name ) throws NamingException
-        {
-            interceptors.add( this );
-            return next.isSuffix( name );
-        }
-
-
-        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn )
+        public void rename( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
             interceptors.add( this );
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.rename( opContext );
         }
 
 
-        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName ) throws NamingException
+        public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            next.move( oldName, newParentName );
+            next.move( opContext );
         }
 
 
-        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn )
+        public void moveAndRename( NextInterceptor next, OperationContext opContext )
             throws NamingException
         {
             interceptors.add( this );
-            next.move( oldName, newParentName, newRn, deleteOldRn );
+            next.moveAndRename( opContext );
         }
 
 
-        public void bind( NextInterceptor next, LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId )
-            throws NamingException
+        public void bind( NextInterceptor next, OperationContext opContext )
+        throws NamingException
         {
             interceptors.add( this );
-            next.bind( bindDn, credentials, mechanisms, saslAuthId );
+            next.bind( opContext );
         }
 
 
-        public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
+        public void unbind( NextInterceptor next, OperationContext opContext ) throws NamingException
         {
             interceptors.add( this );
-            next.unbind( bindDn );
+            next.unbind( opContext );
         }
     }
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java Wed May 23 17:26:40 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
+import org.apache.directory.shared.ldap.util.AttributesSerializerUtils;
 
 import junit.framework.TestCase;
 
@@ -58,7 +59,7 @@
         
         attrs.put( attr0 );
         attrs.put( attr1 );
-        AttributesSerializer serializer = new AttributesSerializer();
+        AttributesSerializerUtils serializer = new AttributesSerializerUtils();
         byte[] buf = serializer.serialize( attrs );
         AttributesImpl deserialized = ( AttributesImpl ) serializer.deserialize( buf );
 

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumerationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumerationTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumerationTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumerationTest.java Wed May 23 17:26:40 2007
@@ -22,15 +22,16 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.math.BigInteger;
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.util.LongComparator;
+
 import jdbm.RecordManager;
 import jdbm.btree.BTree;
 import jdbm.recman.BaseRecordManager;
 
-import org.apache.directory.shared.ldap.util.BigIntegerComparator;
+//import org.apache.directory.shared.ldap.util.BigIntegerComparator;
 
 import junit.framework.TestCase;
 
@@ -53,7 +54,7 @@
     {
         tempFile = File.createTempFile( "jdbm", "test" );
         rm = new BaseRecordManager( tempFile.getAbsolutePath() );
-        tree = BTree.createInstance( rm, new BigIntegerComparator() );
+        tree = BTree.createInstance( rm, new LongComparator() );
     }
     
     protected void tearDown() throws Exception
@@ -73,7 +74,7 @@
     
     public void testOneElement() throws IOException, NamingException
     {
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         BTreeEnumeration bte = new BTreeEnumeration( tree );
         assertTrue( bte.hasMore() );
@@ -91,32 +92,32 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
         BTreeEnumeration bte = new BTreeEnumeration( tree );
 
         assertTrue( bte.hasMore() );
-        assertEquals( new BigInteger( "1" ), bte.next() );
+        assertEquals( 1L, bte.next() );
 
         assertTrue( bte.hasMore() );
-        assertEquals( new BigInteger( "2" ), bte.next() );
+        assertEquals( 2L, bte.next() );
 
         assertTrue( bte.hasMore() );
-        assertEquals( new BigInteger( "4" ), bte.next() );
+        assertEquals( 4L, bte.next() );
 
         assertTrue( bte.hasMore() );
-        assertEquals( new BigInteger( "5" ), bte.next() );
+        assertEquals( 5L, bte.next() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeIteratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeIteratorTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeIteratorTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeIteratorTest.java Wed May 23 17:26:40 2007
@@ -22,15 +22,16 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.math.BigInteger;
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.util.LongComparator;
+
 import jdbm.RecordManager;
 import jdbm.btree.BTree;
 import jdbm.recman.BaseRecordManager;
 
-import org.apache.directory.shared.ldap.util.BigIntegerComparator;
+//import org.apache.directory.shared.ldap.util.BigIntegerComparator;
 
 import junit.framework.TestCase;
 
@@ -53,7 +54,7 @@
     {
         tempFile = File.createTempFile( "jdbm", "test" );
         rm = new BaseRecordManager( tempFile.getAbsolutePath() );
-        tree = BTree.createInstance( rm, new BigIntegerComparator() );
+        tree = BTree.createInstance( rm, new LongComparator() );
     }
     
     protected void tearDown() throws Exception
@@ -73,7 +74,7 @@
     
     public void testOneElement() throws IOException, NamingException
     {
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         BTreeIterator bte = new BTreeIterator( tree, true );
         assertTrue( bte.hasNext() );
@@ -91,32 +92,32 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
         BTreeIterator bte = new BTreeIterator( tree, true );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "1" ), bte.next() );
+        assertEquals( 1L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "2" ), bte.next() );
+        assertEquals( 2L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "4" ), bte.next() );
+        assertEquals( 4L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "5" ), bte.next() );
+        assertEquals( 5L, bte.next() );
 
         assertFalse( "iterator consumed should not have elements", bte.hasNext() );
     }
@@ -131,32 +132,32 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
         BTreeIterator bte = new BTreeIterator( tree, false );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "5" ), bte.next() );
+        assertEquals( 5L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "4" ), bte.next() );
+        assertEquals( 4L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "2" ), bte.next() );
+        assertEquals( 2L, bte.next() );
 
         assertTrue( bte.hasNext() );
-        assertEquals( new BigInteger( "1" ), bte.next() );
+        assertEquals( 1L, bte.next() );
 
         assertFalse( "iterator consumed should not have elements", bte.hasNext() );
     }

Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumerationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumerationTest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumerationTest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumerationTest.java Wed May 23 17:26:40 2007
@@ -22,7 +22,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.math.BigInteger;
 
 import javax.naming.NamingException;
 
@@ -31,7 +30,8 @@
 import jdbm.recman.BaseRecordManager;
 
 import org.apache.directory.server.core.partition.impl.btree.Tuple;
-import org.apache.directory.shared.ldap.util.BigIntegerComparator;
+import org.apache.directory.shared.ldap.util.LongComparator;
+//import org.apache.directory.shared.ldap.util.BigIntegerComparator;
 
 import junit.framework.TestCase;
 
@@ -54,7 +54,7 @@
     {
         tempFile = File.createTempFile( "jdbm", "test" );
         rm = new BaseRecordManager( tempFile.getAbsolutePath() );
-        tree = BTree.createInstance( rm, new BigIntegerComparator() );
+        tree = BTree.createInstance( rm, new LongComparator() );
     }
     
     protected void tearDown() throws Exception
@@ -67,19 +67,19 @@
 
     public void testEmptyBTree() throws NamingException
     {
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, BigInteger.ONE );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, 1L );
         assertFalse( "enumeration on empty btree should not have elements", bte.hasMore() );
     }
     
     
     public void testOneElement() throws IOException, NamingException
     {
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, BigInteger.ONE );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, 1L );
         assertTrue( bte.hasMore() );
         Tuple tuple = ( Tuple ) bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
+        assertEquals( 1L, tuple.getKey() );
         assertEquals( value, tuple.getValue() );
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -94,39 +94,39 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, BigInteger.ONE );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, 1L );
         
         Tuple tuple = ( Tuple ) bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "1" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 1L, tuple.getValue() );
 
         bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "2" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 2L, tuple.getValue() );
 
         bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "4" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 4L, tuple.getValue() );
 
         bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "5" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 5L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -141,30 +141,30 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "3" ), false );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 3L, false );
         
         Tuple tuple = ( Tuple ) bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "2" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 2L, tuple.getValue() );
 
         bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "1" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 1L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -179,21 +179,21 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, BigInteger.ZERO, false );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 0L, false );
         
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -208,25 +208,25 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, BigInteger.ONE, false );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 1L, false );
         
         Tuple tuple = ( Tuple ) bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "1" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 1L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -241,30 +241,30 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "3" ), true );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 3L, true );
         
         Tuple tuple = ( Tuple ) bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "4" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 4L, tuple.getValue() );
 
         bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "5" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 5L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -279,21 +279,21 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "6" ), true );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 6L, true );
         
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -308,25 +308,25 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "5" ), true );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 5L, true );
         
         Tuple tuple = ( Tuple ) bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "5" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 5L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -341,35 +341,35 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "4" ), false );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 4L, false );
         
         Tuple tuple = ( Tuple ) bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "4" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 4L, tuple.getValue() );
 
         bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "2" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 2L, tuple.getValue() );
 
         bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "1" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 1L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }
@@ -384,30 +384,30 @@
          * 4, -
          * 5, -
          */
-        BigInteger value = new BigInteger( "1" );
+        Long value = 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
-        value = value.add( BigInteger.ONE );
+        value += 1L;
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
 
-        value = value.add( BigInteger.ONE );
+        value += 1L;
         tree.insert( value, EMPTY_BYTES, true );
         
-        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new BigIntegerComparator(), 
-            BigInteger.ONE, new BigInteger( "4" ), true );
+        BTreeTupleEnumeration bte = new BTreeTupleEnumeration( tree, new LongComparator(), 
+            1L, 4L, true );
         
         Tuple tuple = ( Tuple ) bte.next();
         assertTrue( bte.hasMore() );
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "4" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 4L, tuple.getValue() );
 
         bte.next();
-        assertEquals( BigInteger.ONE, tuple.getKey() );
-        assertEquals( new BigInteger( "5" ), tuple.getValue() );
+        assertEquals( 1L, tuple.getKey() );
+        assertEquals( 5L, tuple.getValue() );
 
         assertFalse( "enumeration consumed should not have elements", bte.hasMore() );
     }



Mime
View raw message