[jbosscache-commits] JBoss Cache SVN: r5562 - in core/trunk/src: main/java/org/jboss/cache/commands and 8 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Apr 14 16:55:04 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-14 16:55:04 -0400 (Mon, 14 Apr 2008)
New Revision: 5562

Added:
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/UpdateDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/state/BaseCacheDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/state/BaseDataVersionCommand.java
Removed:
   core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java
   core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
   core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CrudMethodTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
   core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
   core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
   core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
Log:
Updated commands and how they are used

Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -58,7 +58,7 @@
     */
    public Object handleDataGravitationCleanupCommand(InvocationContext ctx, DataGravitationCleanupCommand command) throws Throwable
    {
-      return factory.buildDataGravitationCleanupCommand(command.getPrimary(), command.getBackup());
+      return factory.buildDataGravitationCleanupCommand(command.getFqn(), command.getBackup());
    }
 
    public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
@@ -145,7 +145,7 @@
 
    public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
    {
-      Fqn transformedFrom = getBackupFqn(command.getFrom());
+      Fqn transformedFrom = getBackupFqn(command.getFqn());
       Fqn transformedTo = getBackupFqn(command.getTo());
       return factory.buildMoveCommand(transformedFrom, transformedTo);
    }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -4,10 +4,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.commands.functional.MarshallableCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.notifications.Notifier;
 
 /**
@@ -20,33 +18,14 @@
    protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{};
    protected Log log = LogFactory.getLog(getClass());
    protected Notifier notifier;
-   protected CacheData cacheData;
    protected CacheSPI spi;
-   protected Configuration configuration;
    protected static boolean trace;
 
    @Inject
-   public void init(Notifier notifier, CacheData cacheData, CacheSPI spi, Configuration configuration)
+   public void init(Notifier notifier, CacheSPI spi)
    {
       this.notifier = notifier;
-      this.cacheData = cacheData;
       this.spi = spi;
-      this.configuration = configuration;
       trace = log.isTraceEnabled();
    }
-
-   public Notifier getNotifier()
-   {
-      return notifier;
-   }
-
-   public CacheData getCacheData()
-   {
-      return cacheData;
-   }
-
-   public CacheSPI getSpi()
-   {
-      return spi;
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,7 +2,6 @@
 
 import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.functional.MarshallableCommand;
 
 /**
  * Defines a command that manipulates data on cache.
@@ -10,10 +9,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public interface CacheDataCommand extends MarshallableCommand, CacheCommand
+public interface CacheDataCommand extends CacheCommand
 {
    /**
-    * Returns the node on which this command operates.
+    * Returns the Fqn of the node on which this command operates.
     */
    public Fqn getFqn();
 

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,12 +2,8 @@
 
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.commands.state.DataVersionCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
 
 /**
  * Implements functionality defined by {@link org.jboss.cache.CacheSPI#evict(org.jboss.cache.Fqn)}
@@ -15,29 +11,16 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class EvictNodeCommand extends BaseCommand implements DataVersionCommand
+public class EvictNodeCommand extends BaseDataVersionCommand
 {
    public static final int METHOD_ID = 8;
    public static final int VERSIONED_METHOD_ID = 9;
 
-   /* dependencies*/
-   protected CacheData cacheData;
-
-   /* parameters*/
-   protected Fqn fqn;
-   protected DataVersion dataVersion;
-
    public EvictNodeCommand(Fqn fqn)
    {
       this.fqn = fqn;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData)
-   {
-      this.cacheData = cacheData;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       return cacheData.evict(fqn);
@@ -53,37 +36,8 @@
       return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
    }
 
-   public Fqn getFqn()
+   protected boolean isVersionedId(int id)
    {
-      return fqn;
+      return VERSIONED_METHOD_ID == id;
    }
-
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
-   public Object[] getParameters()
-   {
-      if (isVersioned())
-         return new Object[]{fqn, dataVersion};
-      else
-         return new Object[]{fqn};
-   }
-
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-      if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[1];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -3,10 +3,8 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 
 /**
  * Checks whether a given node exists in current in-memory state of the cache.
@@ -17,14 +15,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class ExistsNodeCommand extends BaseCommand implements CacheDataCommand
+public class ExistsNodeCommand extends BaseCacheDataCommand
 {
    public static final int METHOD_ID = 16;
 
-   private CacheData cacheData;
-
-   private Fqn fqn;
-
    public ExistsNodeCommand()
    {
    }
@@ -34,12 +28,6 @@
       this.fqn = fqn;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData)
-   {
-      this.cacheData = cacheData;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       Node n = cacheData.peek(fqn, false);
@@ -51,23 +39,8 @@
       return handler.handleExistsNodeCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public int getCommandId()
    {
       return METHOD_ID;
    }
-
-   public Object[] getParameters()
-   {
-      return new Object[]{fqn};
-   }
-
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -3,10 +3,8 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -18,14 +16,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class GetChildrenNamesCommand extends BaseCommand implements CacheDataCommand
+public class GetChildrenNamesCommand extends BaseCacheDataCommand
 {
    public static final int METHOD_ID = 23;
 
-   private CacheData cacheData;
-
-   private Fqn fqn;
-
    public GetChildrenNamesCommand()
    {
    }
@@ -35,12 +29,6 @@
       this.fqn = fqn;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData)
-   {
-      this.cacheData = cacheData;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       NodeSPI n = cacheData.findNode(fqn);
@@ -68,23 +56,8 @@
       return handler.handleGetChildrenNamesCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public int getCommandId()
    {
       return METHOD_ID;
    }
-
-   public Object[] getParameters()
-   {
-      return new Object[]{fqn};
-   }
-
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -68,4 +68,21 @@
    {
       fqn = (Fqn) args[0];
    }
+
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      GetDataMapCommand that = (GetDataMapCommand) o;
+
+      if (fqn != null ? !fqn.equals(that.fqn) : that.fqn != null) return false;
+
+      return true;
+   }
+
+   public int hashCode()
+   {
+      return (fqn != null ? fqn.hashCode() : 0);
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,15 +1,10 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 
 /**
  * Implements functionality defined by {@link org.jboss.cache.CacheSPI#get(String, Object)}
@@ -17,18 +12,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class GetKeyValueCommand extends BaseCommand implements CacheDataCommand
+public class GetKeyValueCommand extends BaseCacheDataCommand
 {
    public static final int METHOD_ID = 26;
 
-   private static final Log log = LogFactory.getLog(GetKeyValueCommand.class);
-
-   /* dependencies*/
-   private CacheData cacheData;
-   private Notifier notifier;
-
-   /* parameters */
-   private Fqn<?> fqn;
    private Object key;
    boolean sendNodeEvent;
 
@@ -43,13 +30,6 @@
       this.sendNodeEvent = sendNodeEvent;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData, Notifier notifier)
-   {
-      this.cacheData = cacheData;
-      this.notifier = notifier;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       if (log.isTraceEnabled())
@@ -74,11 +54,6 @@
       return handler.handleGetKeyValueCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public Object getKey()
    {
       return key;
@@ -99,15 +74,41 @@
       return METHOD_ID;
    }
 
+   @Override
    public Object[] getParameters()
    {
       return new Object[]{fqn, key, sendNodeEvent};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       fqn = (Fqn) args[0];
       key = args[1];
       sendNodeEvent = (Boolean) args[2];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      GetKeyValueCommand that = (GetKeyValueCommand) o;
+
+      if (sendNodeEvent != that.sendNodeEvent) return false;
+      if (key != null ? !key.equals(that.key) : that.key != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (key != null ? key.hashCode() : 0);
+      result = 31 * result + (sendNodeEvent ? 1 : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -3,10 +3,8 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -17,14 +15,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class GetKeysCommand extends BaseCommand implements CacheDataCommand
+public class GetKeysCommand extends BaseCacheDataCommand
 {
    public static final int METHOD_ID = 25;
 
-   private CacheData cacheData;
-
-   private Fqn fqn;
-
    public GetKeysCommand()
    {
    }
@@ -34,12 +28,6 @@
       this.fqn = fqn;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData)
-   {
-      this.cacheData = cacheData;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       NodeSPI n = cacheData.findNode(fqn);
@@ -56,23 +44,8 @@
       return handler.handleGetKeysCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public int getCommandId()
    {
       return METHOD_ID;
    }
-
-   public Object[] getParameters()
-   {
-      return new Object[]{fqn};
-   }
-
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,10 +2,8 @@
 
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 
 /**
  * Implements functionality defined by {@link org.jboss.cache.Cache#getNode(org.jboss.cache.Fqn)}
@@ -13,14 +11,10 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class GetNodeCommand extends BaseCommand implements CacheDataCommand
+public class GetNodeCommand extends BaseCacheDataCommand
 {
    public static final int METHOD_ID = 31;
 
-   private CacheData cacheData;
-
-   private Fqn fqn;
-
    public GetNodeCommand()
    {
    }
@@ -30,12 +24,6 @@
       this.fqn = fqn;
    }
 
-   @Inject
-   public void initialize(CacheData cacheData)
-   {
-      this.cacheData = cacheData;
-   }
-
    public Object perform(InvocationContext ctx)
    {
       return cacheData.findNode(fqn);
@@ -46,23 +34,8 @@
       return handler.handleGetNodeCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public int getCommandId()
    {
       return METHOD_ID;
    }
-
-   public Object[] getParameters()
-   {
-      return new Object[]{fqn};
-   }
-
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,19 +1,14 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.optimistic.DataVersion;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -37,12 +32,8 @@
 {
    public static final int METHOD_ID = 47;
 
-   private static final Log log = LogFactory.getLog(InvalidateCommand.class);
-
    /* dependencies*/
    private boolean isOptimisticLocking;
-   private Notifier notifier;
-   private CacheSPI cacheSpi;//todo this is ugly, revisit
    private TransactionManager transactionManager;
 
    public InvalidateCommand(Fqn fqn)
@@ -51,18 +42,16 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, Notifier notifier, CacheSPI cacheSPI, TransactionManager txManager, boolean isOptimisticLocking)
+   public void initialize(TransactionManager txManager, Configuration configuration)
    {
-      super.initialize(cacheData);
-      this.notifier = notifier;
-      this.cacheSpi = cacheSPI;
       this.transactionManager = txManager;
-      this.isOptimisticLocking = isOptimisticLocking;
+      this.isOptimisticLocking = configuration.isNodeLockingOptimistic();
    }
 
+   @Override
    public Object perform(InvocationContext ctx)
    {
-      Node node = cacheSpi.getNode(fqn); // force interceptor chain, load if necessary from cache loader.
+      Node node = spi.getNode(fqn); // force interceptor chain, load if necessary from cache loader.
 
       if (node == null)
       {
@@ -83,7 +72,7 @@
                log.trace("Node doesn't exist; creating a tombstone with data version " + dataVersion);
             // create the node we need.
             Map m = Collections.emptyMap();
-            InvocationContext ic = cacheSpi.getInvocationContext();
+            InvocationContext ic = spi.getInvocationContext();
             Option o = ic.getOptionOverrides();
             boolean origCacheModeLocal = o.isCacheModeLocal();
             o.setCacheModeLocal(true);
@@ -96,7 +85,7 @@
                {
                   suspended = transactionManager.suspend();
                }
-               cacheSpi.put(fqn, m);
+               spi.put(fqn, m);
                if (suspended != null) transactionManager.resume(suspended);
                ic.getOptionOverrides().setCacheModeLocal(origCacheModeLocal);
             }
@@ -137,7 +126,7 @@
          log.warn("node " + fqn + " not found");
          return;
       }
-      InvocationContext ctx = cacheSpi.getInvocationContext();
+      InvocationContext ctx = spi.getInvocationContext();
       notifier.notifyNodeEvicted(fqn, true, ctx);
       n.clearDataDirect();
       n.setDataLoaded(false);
@@ -146,7 +135,7 @@
       notifier.notifyNodeEvicted(fqn, false, ctx);
    }
 
-
+   @Override
    public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
    {
       return handler.handleInvalidateCommand(ctx, this);
@@ -160,21 +149,15 @@
    }
 
    @Override
-   public int getCommandId()
+   protected boolean isVersionedId(int id)
    {
-      return METHOD_ID;
+      // invalidate commands are *always* versioned.
+      return true;
    }
 
    @Override
-   public Object[] getParameters()
+   public int getCommandId()
    {
-      return new Object[]{fqn, dataVersion};
+      return METHOD_ID;
    }
-
-   @Override
-   public void setState(int commandId, Object[] args)
-   {
-      fqn = (Fqn) args[0];
-      dataVersion = (DataVersion) args[1];
-   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -4,12 +4,10 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
 import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.transaction.TransactionTable;
 
 /**
@@ -18,17 +16,13 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class MoveCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand
+public class MoveCommand extends BaseCacheDataCommand implements TxCacheCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 36;
 
-   /* dependencies */
-   private CacheData cacheData;
-   private Notifier notifier;
    private TransactionTable transactionTable;
 
    /* params */
-   private Fqn from;
    private Fqn to;
 
    public MoveCommand()
@@ -37,27 +31,25 @@
 
    public MoveCommand(Fqn from, Fqn to)
    {
-      this.from = from;
+      this.fqn = from;
       this.to = to;
    }
 
    @Inject
-   public void initialize(CacheData cacheData, Notifier notifier, TransactionTable txTable)
+   public void initialize(TransactionTable txTable)
    {
-      this.cacheData = cacheData;
-      this.notifier = notifier;
       this.transactionTable = txTable;
    }
 
    public Object perform(InvocationContext ctx)
    {
-      _move(from, to, false, ctx);
+      _move(fqn, to, false, ctx);
       return null;
    }
 
    public void rollback()
    {
-      _move(Fqn.fromRelativeElements(to, from.getLastElement()), from.getParent(), true, null);
+      _move(Fqn.fromRelativeElements(to, fqn.getLastElement()), fqn.getParent(), true, null);
    }
 
 
@@ -115,16 +107,6 @@
       }
    }
 
-   public Fqn getFqn()
-   {
-      return from;
-   }
-
-   public Fqn getFrom()
-   {
-      return from;
-   }
-
    public Fqn getTo()
    {
       return to;
@@ -135,14 +117,38 @@
       return METHOD_ID;
    }
 
+   @Override
    public Object[] getParameters()
    {
-      return new Object[]{from, to};
+      return new Object[]{fqn, to};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
-      from = (Fqn) args[0];
+      fqn = (Fqn) args[0];
       to = (Fqn) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      MoveCommand that = (MoveCommand) o;
+
+      if (to != null ? !to.equals(that.to) : that.to != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (to != null ? to.hashCode() : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,18 +1,13 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
 import org.jboss.cache.commands.functional.TxCacheCommand;
-import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -26,31 +21,21 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class PutDataMapCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class PutDataMapCommand extends BaseDataVersionCommand implements TxCacheCommand, GlobalTransactionCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 1;
    public static final int ERASE_METHOD_ID = 2;
    public static final int VERSIONED_METHOD_ID = 37;
    public static final int ERASE_VERSIONED_METHOD_ID = 38;
 
-   private static Log log = LogFactory.getLog(PutDataMapCommand.class);
-
    /* dependencies*/
    private GlobalTransaction globalTransaction;
-   private CacheData cacheData;
-   private Notifier notifier;
    private TransactionTable transactionTable;
 
    /* parameters*/
-   private Fqn fqn;
    private Map data;
    boolean createUndoOps;
    private boolean eraseContents;
-   protected DataVersion dataVersion;
-
-   /**
-    * internally used for rollback
-    */
    private Map oldData;
 
    public PutDataMapCommand()
@@ -67,10 +52,8 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, Notifier notifier, TransactionTable txTable)
+   public void initialize(TransactionTable txTable)
    {
-      this.cacheData = cacheData;
-      this.notifier = notifier;
       this.transactionTable = txTable;
    }
 
@@ -112,11 +95,6 @@
       return handler.handlePutDataMapCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public Map getData()
    {
       return data;
@@ -132,21 +110,6 @@
       return createUndoOps;
    }
 
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
    public GlobalTransaction getGlobalTransaction()
    {
       return globalTransaction;
@@ -174,6 +137,7 @@
       }
    }
 
+   @Override
    public Object[] getParameters()
    {
       if (isVersioned())
@@ -182,6 +146,7 @@
          return new Object[]{globalTransaction, fqn, data, createUndoOps};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       globalTransaction = (GlobalTransaction) args[0];
@@ -189,7 +154,40 @@
       data = (Map) args[2];
       createUndoOps = (Boolean) args[3];
       eraseContents = commandId == ERASE_METHOD_ID;
-      if (commandId == VERSIONED_METHOD_ID || commandId == ERASE_VERSIONED_METHOD_ID)
-         dataVersion = (DataVersion) args[4];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
    }
+
+   protected boolean isVersionedId(int id)
+   {
+      return id == VERSIONED_METHOD_ID || id == ERASE_VERSIONED_METHOD_ID;
+   }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      PutDataMapCommand that = (PutDataMapCommand) o;
+
+      if (createUndoOps != that.createUndoOps) return false;
+      if (eraseContents != that.eraseContents) return false;
+      if (data != null ? !data.equals(that.data) : that.data != null) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (data != null ? data.hashCode() : 0);
+      result = 31 * result + (createUndoOps ? 1 : 0);
+      result = 31 * result + (eraseContents ? 1 : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,18 +1,13 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.commands.functional.TxCacheCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -27,32 +22,22 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class PutKeyValueCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class PutKeyValueCommand extends BaseDataVersionCommand implements TxCacheCommand, GlobalTransactionCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 3;
    public static final int VERSIONED_METHOD_ID = 39;
    public static final int PUT_FOR_EXT_READ_METHOD_ID = 45;
    public static final int PUT_FOR_EXT_READ_VERSIONED_METHOD_ID = 46;
 
-   private static final Log log = LogFactory.getLog(PutKeyValueCommand.class);
-
    /* dependencies*/
    private TransactionTable transactionTable;
-   private CacheData cacheData;
-   private Notifier notifier;
 
    /* parametres */
    private GlobalTransaction globalTransaction;
-   private Fqn fqn;
    private Object key;
    private Object value;
    private boolean createUndoOps;
    private boolean isPutForExternalRead;
-   private DataVersion dataVersion;
-
-   /**
-    * Used internally for the rollback operation.
-    */
    private Object oldValue;
 
    public PutKeyValueCommand()
@@ -70,11 +55,9 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, Notifier notifier, TransactionTable transactionTable)
+   public void initialize(TransactionTable transactionTable)
    {
       this.transactionTable = transactionTable;
-      this.notifier = notifier;
-      this.cacheData = cacheData;
    }
 
    public Object perform(InvocationContext ctx)
@@ -127,11 +110,6 @@
       return isPutForExternalRead;
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public Object getKey()
    {
       return key;
@@ -147,21 +125,6 @@
       return createUndoOps;
    }
 
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
    public GlobalTransaction getGlobalTransaction()
    {
       return globalTransaction;
@@ -194,6 +157,7 @@
       }
    }
 
+   @Override
    public Object[] getParameters()
    {
       if (isVersioned())
@@ -202,6 +166,7 @@
          return new Object[]{globalTransaction, fqn, key, value, createUndoOps};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       globalTransaction = (GlobalTransaction) args[0];
@@ -210,7 +175,43 @@
       value = args[3];
       createUndoOps = (Boolean) args[4];
       isPutForExternalRead = (commandId == PUT_FOR_EXT_READ_METHOD_ID || commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID);
-      if (commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID || commandId == VERSIONED_METHOD_ID)
-         dataVersion = (DataVersion) args[5];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[5];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      PutKeyValueCommand that = (PutKeyValueCommand) o;
+
+      if (createUndoOps != that.createUndoOps) return false;
+      if (isPutForExternalRead != that.isPutForExternalRead) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+      if (key != null ? !key.equals(that.key) : that.key != null) return false;
+      if (value != null ? !value.equals(that.value) : that.value != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (key != null ? key.hashCode() : 0);
+      result = 31 * result + (value != null ? value.hashCode() : 0);
+      result = 31 * result + (createUndoOps ? 1 : 0);
+      result = 31 * result + (isPutForExternalRead ? 1 : 0);
+      return result;
+   }
+
+   protected boolean isVersionedId(int commandId)
+   {
+      return commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID || commandId == VERSIONED_METHOD_ID;
+   }
+
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,18 +1,13 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
-import org.jboss.cache.commands.*;
-import org.jboss.cache.commands.state.DataVersionCommand;
-import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.CommandsVisitor;
 import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -27,29 +22,19 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class RemoveDataCommand extends BaseCommand implements TxCacheCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveDataCommand extends BaseDataVersionCommand implements TxCacheCommand, GlobalTransactionCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 7;
    public static final int VERSIONED_METHOD_ID = 42;
 
-   private static final Log log = LogFactory.getLog(RemoveDataCommand.class);
-
    /* dependencies*/
-   private CacheData cacheData;
    private TransactionTable transactionTable;
-   private Notifier notifier;
 
    /* parameters*/
    private GlobalTransaction globalTransaction;
-   private Fqn fqn;
    private boolean createUndoops;
    private boolean sendNodeEvent;
    private boolean eviction;
-   private DataVersion dataVersion;
-
-   /**
-    * internally used for rollback.
-    */
    private HashMap originalData;
 
    public RemoveDataCommand()
@@ -57,11 +42,9 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, TransactionTable transactionTable, Notifier notifier)
+   public void initialize(TransactionTable transactionTable)
    {
-      this.cacheData = cacheData;
       this.transactionTable = transactionTable;
-      this.notifier = notifier;
    }
 
    public RemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
@@ -157,31 +140,6 @@
       return handler.handleRemoveDataCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
-   public HashMap getOriginalData()
-   {
-      return originalData;
-   }
-
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
    public boolean isEviction()
    {
       return eviction;
@@ -212,6 +170,7 @@
       return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
    }
 
+   @Override
    public Object[] getParameters()
    {
       if (isVersioned())
@@ -220,11 +179,46 @@
          return new Object[]{globalTransaction, fqn, createUndoops};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       globalTransaction = (GlobalTransaction) args[0];
       fqn = (Fqn) args[1];
       createUndoops = (Boolean) args[2];
-      if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[3];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[3];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      RemoveDataCommand that = (RemoveDataCommand) o;
+
+      if (createUndoops != that.createUndoops) return false;
+      if (eviction != that.eviction) return false;
+      if (sendNodeEvent != that.sendNodeEvent) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (createUndoops ? 1 : 0);
+      result = 31 * result + (sendNodeEvent ? 1 : 0);
+      result = 31 * result + (eviction ? 1 : 0);
+      return result;
+   }
+
+   protected boolean isVersionedId(int id)
+   {
+      return id == VERSIONED_METHOD_ID;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,18 +1,13 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.commands.state.DataVersionCommand;
-import org.jboss.cache.commands.state.GlobalTransactionCommand;
 import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -27,28 +22,18 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class RemoveKeyCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveKeyCommand extends BaseDataVersionCommand implements TxCacheCommand, GlobalTransactionCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 6;
    public static final int VERSIONED_METHOD_ID = 41;
 
-   private static final Log log = LogFactory.getLog(RemoveKeyCommand.class);
-
    /* dependencies */
-   private CacheData cacheData;
-   private Notifier notifier;
    private TransactionTable transactionTable;
 
    /* parameters */
    private GlobalTransaction globalTransaction;
-   private Fqn fqn;
    private Object key;
    private boolean createUndoOps;
-   private DataVersion dataVersion;
-
-   /**
-    * internally used for rollback
-    */
    private Object oldValue;
 
    public RemoveKeyCommand()
@@ -64,10 +49,8 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, Notifier notifier, TransactionTable transactionTable)
+   public void initialize(TransactionTable transactionTable)
    {
-      this.cacheData = cacheData;
-      this.notifier = notifier;
       this.transactionTable = transactionTable;
    }
 
@@ -105,11 +88,6 @@
       return handler.handleRemoveKeyCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public Object getKey()
    {
       return key;
@@ -120,21 +98,6 @@
       return createUndoOps;
    }
 
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
    public GlobalTransaction getGlobalTransaction()
    {
       return globalTransaction;
@@ -155,6 +118,7 @@
       return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
    }
 
+   @Override
    public Object[] getParameters()
    {
       if (isVersioned())
@@ -163,12 +127,45 @@
          return new Object[]{globalTransaction, fqn, key, createUndoOps};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       globalTransaction = (GlobalTransaction) args[0];
       fqn = (Fqn) args[1];
       key = args[2];
       createUndoOps = (Boolean) args[3];
-      if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[4];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      RemoveKeyCommand that = (RemoveKeyCommand) o;
+
+      if (createUndoOps != that.createUndoOps) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+      if (key != null ? !key.equals(that.key) : that.key != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (key != null ? key.hashCode() : 0);
+      result = 31 * result + (createUndoOps ? 1 : 0);
+      return result;
+   }
+
+   protected boolean isVersionedId(int id)
+   {
+      return id == VERSIONED_METHOD_ID;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,19 +1,14 @@
 package org.jboss.cache.commands.cachedata;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsVisitor;
-import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseDataVersionCommand;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.commands.functional.TxCacheCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionTable;
@@ -24,28 +19,19 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public class RemoveNodeCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveNodeCommand extends BaseDataVersionCommand implements TxCacheCommand, GlobalTransactionCommand, UpdateDataCommand
 {
    public static final int METHOD_ID = 5;
    public static final int VERSIONED_METHOD_ID = 40;
 
-   private static final Log log = LogFactory.getLog(RemoveNodeCommand.class);
-
-   /*dependencies*/
-   private CacheData cacheData;
    private boolean isOptimistic;
    private TransactionTable transactionTable;
-   private Notifier notifier;
 
    /*parameters*/
    private GlobalTransaction globalTransaction;
-   private Fqn fqn;
    private boolean createUndoOps;
    private boolean skipSendingNodeEvents;
    private boolean eviction;
-   private DataVersion dataVersion;
-
-   /*internal data for rollback */
    private Fqn parentFqn;
    private NodeSPI targetNode;
 
@@ -63,11 +49,9 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, TransactionTable txTable, Notifier notifier, Configuration configuration)
+   public void initialize(TransactionTable txTable, Configuration configuration)
    {
-      this.cacheData = cacheData;
       this.transactionTable = txTable;
-      this.notifier = notifier;
       this.isOptimistic = configuration.isNodeLockingOptimistic();
    }
 
@@ -178,26 +162,6 @@
       return handler.handleRemoveNodeCommand(ctx, this);
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
-   public DataVersion getDataVersion()
-   {
-      return dataVersion;
-   }
-
-   public void setDataVersion(DataVersion dataVersion)
-   {
-      this.dataVersion = dataVersion;
-   }
-
-   public boolean isVersioned()
-   {
-      return dataVersion != null;
-   }
-
    public boolean isSkipSendingNodeEvents()
    {
       return skipSendingNodeEvents;
@@ -228,6 +192,7 @@
       return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
    }
 
+   @Override
    public Object[] getParameters()
    {
       if (isVersioned())
@@ -236,15 +201,50 @@
          return new Object[]{globalTransaction, fqn, createUndoOps, skipSendingNodeEvents};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       globalTransaction = (GlobalTransaction) args[0];
       fqn = (Fqn) args[1];
       createUndoOps = (Boolean) args[2];
       skipSendingNodeEvents = (Boolean) args[3];
-      if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[4];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
    }
 
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      RemoveNodeCommand that = (RemoveNodeCommand) o;
+
+      if (createUndoOps != that.createUndoOps) return false;
+      if (eviction != that.eviction) return false;
+      if (skipSendingNodeEvents != that.skipSendingNodeEvents) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (createUndoOps ? 1 : 0);
+      result = 31 * result + (skipSendingNodeEvents ? 1 : 0);
+      result = 31 * result + (eviction ? 1 : 0);
+      return result;
+   }
+
+   protected boolean isVersionedId(int id)
+   {
+      return id == VERSIONED_METHOD_ID;
+   }
+
    public void setSkipSendingNodeEvents(boolean skipSendingNodeEvents)
    {
       this.skipSendingNodeEvents = skipSendingNodeEvents;

Added: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/UpdateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/UpdateDataCommand.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/UpdateDataCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -0,0 +1,17 @@
+package org.jboss.cache.commands.cachedata;
+
+import org.jboss.cache.Fqn;
+
+/**
+ * Interface that depicts that this command somehow updates data
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 2.2.0
+ */
+public interface UpdateDataCommand
+{
+   /**
+    * @return Fqn of the node being updated
+    */
+   Fqn getFqn();
+}

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -82,4 +82,27 @@
       address = (Address) args[0];
       buddyPoolName = (String) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      AnnounceBuddyPoolNameCommand that = (AnnounceBuddyPoolNameCommand) o;
+
+      if (address != null ? !address.equals(that.address) : that.address != null) return false;
+      if (buddyPoolName != null ? !buddyPoolName.equals(that.buddyPoolName) : that.buddyPoolName != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (address != null ? address.hashCode() : 0);
+      result = 31 * result + (buddyPoolName != null ? buddyPoolName.hashCode() : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,7 +1,5 @@
 package org.jboss.cache.commands.remote;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyGroup;
@@ -20,7 +18,6 @@
 public class AssignToBuddyGroupCommand extends BaseCommand implements CacheCommand
 {
    public static final int METHOD_ID = 29;
-   private static final Log log = LogFactory.getLog(AssignToBuddyGroupCommand.class);
 
    private BuddyManager buddyManager;
 
@@ -78,9 +75,33 @@
       return new Object[]{group, state};
    }
 
+   @SuppressWarnings("unchecked")
    public void setState(int commandId, Object[] args)
    {
       group = (BuddyGroup) args[0];
       state = (Map) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      AssignToBuddyGroupCommand that = (AssignToBuddyGroupCommand) o;
+
+      if (group != null ? !group.equals(that.group) : that.group != null) return false;
+      if (state != null ? !state.equals(that.state) : that.state != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (group != null ? group.hashCode() : 0);
+      result = 31 * result + (state != null ? state.hashCode() : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,7 +1,5 @@
 package org.jboss.cache.commands.remote;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CacheCommand;
@@ -10,8 +8,8 @@
 import org.jboss.cache.commands.cachedata.ExistsNodeCommand;
 import org.jboss.cache.commands.cachedata.GetChildrenNamesCommand;
 import org.jboss.cache.commands.cachedata.GetDataMapCommand;
+import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.marshall.MethodCallWrapper;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -24,7 +22,6 @@
 public class ClusteredGetCommand extends BaseCommand implements CacheCommand
 {
    public static final int METHOD_ID = 22;
-   private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
 
    private CacheDataCommand cacheDataComand;
    private Boolean searchBackupSubtrees;
@@ -40,6 +37,12 @@
       this.cacheDataComand = cacheDataComand;
    }
 
+   @Inject
+   public void initialize(CacheData cacheData)
+   {
+      this.cacheData = cacheData;
+   }
+
    /**
     * A 'clustered get' call, called from a remote ClusteredCacheLoader.
     *
@@ -128,7 +131,7 @@
 
    public Object[] getParameters()
    {
-      return new Object[]{new MethodCallWrapper(cacheDataComand), searchBackupSubtrees};  //To change body of implemented methods use File | Settings | File Templates.
+      return new Object[]{cacheDataComand, searchBackupSubtrees};  //To change body of implemented methods use File | Settings | File Templates.
    }
 
    public void setState(int commandId, Object[] args)
@@ -136,4 +139,29 @@
       cacheDataComand = (CacheDataCommand) args[0];
       searchBackupSubtrees = (Boolean) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      ClusteredGetCommand that = (ClusteredGetCommand) o;
+
+      if (cacheDataComand != null ? !cacheDataComand.equals(that.cacheDataComand) : that.cacheDataComand != null)
+         return false;
+      if (searchBackupSubtrees != null ? !searchBackupSubtrees.equals(that.searchBackupSubtrees) : that.searchBackupSubtrees != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (cacheDataComand != null ? cacheDataComand.hashCode() : 0);
+      result = 31 * result + (searchBackupSubtrees != null ? searchBackupSubtrees.hashCode() : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,17 +1,15 @@
 package org.jboss.cache.commands.remote;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.BaseCommand;
 import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.CommandsVisitor;
 import org.jboss.cache.commands.cachedata.EvictNodeCommand;
 import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
 import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.invocation.CacheData;
@@ -19,7 +17,6 @@
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.transaction.GlobalTransaction;
 
-import java.util.Set;
 import java.util.List;
 
 /**
@@ -30,10 +27,9 @@
  *        todo this calls other commands through the invocation chain, check wheter direct call is not okay
  *        todo it is not natural for this command to extend TxCC, revisit
  */
-public class DataGravitationCleanupCommand extends BaseCommand implements TxCacheCommand, GlobalTransactionCommand
+public class DataGravitationCleanupCommand extends BaseCacheDataCommand implements TxCacheCommand, GlobalTransactionCommand
 {
    public static final int METHOD_ID = 34;
-   private static final Log log = LogFactory.getLog(DataGravitationCleanupCommand.class);
 
    /* dependencies */
    private BuddyManager buddyManager;
@@ -44,7 +40,6 @@
 
    /* parameters */
    private GlobalTransaction globalTransaction;
-   private Fqn primary;
    private Fqn backup;
 
    public DataGravitationCleanupCommand()
@@ -53,19 +48,18 @@
 
    public DataGravitationCleanupCommand(Fqn primary, Fqn backup)
    {
-      this.primary = primary;
+      this.fqn = primary;
       this.backup = backup;
    }
 
    @Inject
    public void initialize(BuddyManager buddyManager, InterceptorChain invoker, CacheTransactionHelper transactionHelper,
-                          CommandsFactory commandsFactory, CacheData cacheData)
+                          CommandsFactory commandsFactory)
    {
       this.buddyManager = buddyManager;
       this.invoker = invoker;
       this.transactionHelper = transactionHelper;
       this.commandsFactory = commandsFactory;
-      this.cacheData = cacheData;
    }
 
    public Object perform(InvocationContext invocationContext) throws Throwable
@@ -73,15 +67,15 @@
       if (buddyManager.isDataGravitationRemoveOnFind())
       {
          if (log.isTraceEnabled())
-            log.trace("DataGravitationCleanup: Removing primary (" + primary + ") and backup (" + backup + ")");
+            log.trace("DataGravitationCleanup: Removing primary (" + fqn + ") and backup (" + backup + ")");
 
          invocationContext.getOptionOverrides().setCacheModeLocal(true);
          GlobalTransaction gtx = transactionHelper.getCurrentTransaction();
-         if (!executeRemove(gtx, primary))
+         if (!executeRemove(gtx, fqn))
          {
             // only attempt to clean up the backup if the primary did not exist - a waste of a call otherwise.
             invocationContext.getOptionOverrides().setCacheModeLocal(true);
-            Object result = executeRemove(gtx, primary);
+            Object result = executeRemove(gtx, fqn);
             if (wasNodeRemoved(result))
             {
                // if this is a DIRECT child of a DEAD buddy backup region, then remove the empty dead region structural node.
@@ -108,8 +102,8 @@
       else
       {
          if (log.isTraceEnabled())
-            log.trace("DataGravitationCleanup: Evicting primary (" + primary + ") and backup (" + backup + ")");
-         evictNode(primary);
+            log.trace("DataGravitationCleanup: Evicting primary (" + fqn + ") and backup (" + backup + ")");
+         evictNode(fqn);
          evictNode(backup);
       }
       return null;
@@ -156,11 +150,6 @@
       //nothing
    }
 
-   public Fqn getPrimary()
-   {
-      return primary;
-   }
-
    public Fqn getBackup()
    {
       return backup;
@@ -176,14 +165,41 @@
       this.globalTransaction = gtx;
    }
 
+   @Override
    public Object[] getParameters()
    {
-      return new Object[]{primary, backup};  //To change body of implemented methods use File | Settings | File Templates.
+      return new Object[]{fqn, backup};  //To change body of implemented methods use File | Settings | File Templates.
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
-      primary = (Fqn) args[0];
+      fqn = (Fqn) args[0];
       backup = (Fqn) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      DataGravitationCleanupCommand that = (DataGravitationCleanupCommand) o;
+
+      if (backup != null ? !backup.equals(that.backup) : that.backup != null) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 31 * result + (backup != null ? backup.hashCode() : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,21 +1,17 @@
 package org.jboss.cache.commands.remote;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.RPCManager;
-import org.jboss.cache.commands.BaseCommand;
-import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CommandsVisitor;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.marshall.NodeData;
 
 import java.util.LinkedList;
@@ -29,18 +25,14 @@
  * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
  * todo - this should not be a command as none relally visits it. It was inherited this way from old CacheImpl
  */
-public class GravitateDataCommand extends BaseCommand implements CacheCommand
+public class GravitateDataCommand extends BaseCacheDataCommand implements CacheCommand
 {
    public static final int METHOD_ID = 35;
-   private static final Log log = LogFactory.getLog(GravitateDataCommand.class);
 
    /* dependencies */
-   private CacheSPI spi; //todo ugly dependency, revisit
    private RPCManager rpcManager;
-   private CacheData cacheData;
 
    /* parametres */
-   private Fqn fqn;
    private boolean searchSubtrees;
 
    public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
@@ -50,11 +42,9 @@
    }
 
    @Inject
-   public void initialize(CacheSPI spi, RPCManager manager, CacheData cacheData)
+   public void initialize(RPCManager manager)
    {
-      this.spi = spi;
       this.rpcManager = manager;
-      this.cacheData = cacheData;
    }
 
    public Object perform(InvocationContext ctx)
@@ -168,24 +158,43 @@
       return METHOD_ID;
    }
 
-   public Fqn getFqn()
-   {
-      return fqn;
-   }
-
    public boolean isSearchSubtrees()
    {
       return searchSubtrees;
    }
 
+   @Override
    public Object[] getParameters()
    {
       return new Object[]{fqn, searchSubtrees};
    }
 
+   @Override
    public void setState(int commandId, Object[] args)
    {
       fqn = (Fqn) args[0];
       searchSubtrees = (Boolean) args[1];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      if (!super.equals(o)) return false;
+
+      GravitateDataCommand that = (GravitateDataCommand) o;
+
+      if (searchSubtrees != that.searchSubtrees) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = super.hashCode();
+      result = 31 * result + (searchSubtrees ? 1 : 0);
+      return result;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,7 +1,5 @@
 package org.jboss.cache.commands.remote;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.commands.BaseCommand;
@@ -16,7 +14,6 @@
 public class RemoveFromBuddyGroupCommand extends BaseCommand implements CacheCommand
 {
    public static final int METHOD_ID = 30;
-   private static final Log log = LogFactory.getLog(RemoveFromBuddyGroupCommand.class);
 
    private BuddyManager buddyManager;
 
@@ -70,4 +67,23 @@
    {
       groupName = (String) args[0];
    }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      RemoveFromBuddyGroupCommand that = (RemoveFromBuddyGroupCommand) o;
+
+      if (groupName != null ? !groupName.equals(that.groupName) : that.groupName != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return (groupName != null ? groupName.hashCode() : 0);
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,9 +2,10 @@
 
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.BaseCommand;
-import org.jboss.cache.commands.*;
+import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.functional.MarshallableCommand;
-import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.marshall.MethodCallWrapper;
@@ -53,7 +54,7 @@
 
    public Object perform(InvocationContext ctx) throws Throwable
    {
-      if (singleModification != null) return processSingleCommand(singleModification);
+      if (isSingleCommand()) return processSingleCommand(singleModification);
 
       for (MarshallableCommand command : modifications) processSingleCommand(command);
 
@@ -114,7 +115,7 @@
 
    public int getCommandId()
    {
-      return singleModification == null ? MULTIPLE_METHOD_ID : SINGLE_METHOD_ID;
+      return isSingleCommand() ? MULTIPLE_METHOD_ID : SINGLE_METHOD_ID;
    }
 
    public List<MarshallableCommand> getModifications()
@@ -122,9 +123,14 @@
       return modifications;
    }
 
+   public MarshallableCommand getSingleModification()
+   {
+      return singleModification;
+   }
+
    public Object[] getParameters()
    {
-      if (singleModification == null)
+      if (isSingleCommand())
          return new Object[]{toMethodCallList()};
       else
          return new Object[]{new MethodCallWrapper(singleModification)};
@@ -143,6 +149,11 @@
       }
    }
 
+   public boolean isSingleCommand()
+   {
+      return singleModification != null;
+   }
+
    private List<MethodCallWrapper> toMethodCallList()
    {
       List<MethodCallWrapper> l = new ArrayList<MethodCallWrapper>(modifications.size());
@@ -151,10 +162,34 @@
    }
 
    @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      ReplicateCommand that = (ReplicateCommand) o;
+
+      if (modifications != null ? !modifications.equals(that.modifications) : that.modifications != null) return false;
+      if (singleModification != null ? !singleModification.equals(that.singleModification) : that.singleModification != null)
+         return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (singleModification != null ? singleModification.hashCode() : 0);
+      result = 31 * result + (modifications != null ? modifications.hashCode() : 0);
+      return result;
+   }
+
+   @Override
    public String toString()
    {
       return "ReplicateCommand{" +
-            "modifications=" + (modifications == null ? singleModification : modifications) +
+            "modifications=" + (isSingleCommand() ? singleModification : modifications) +
             '}';
    }
 }
\ No newline at end of file

Added: core/trunk/src/main/java/org/jboss/cache/commands/state/BaseCacheDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/state/BaseCacheDataCommand.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/state/BaseCacheDataCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -0,0 +1,67 @@
+package org.jboss.cache.commands.state;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.cachedata.CacheDataCommand;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.CacheData;
+
+/**
+ * Base version of {@link org.jboss.cache.commands.cachedata.CacheDataCommand} which handles common behaviour
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 2.2.0
+ */
+public abstract class BaseCacheDataCommand extends BaseCommand implements CacheDataCommand
+{
+   protected Fqn fqn;
+   protected CacheData cacheData;
+
+   @Inject
+   public void initialize(CacheData cacheData)
+   {
+      this.cacheData = cacheData;
+   }
+
+   public Fqn getFqn()
+   {
+      return fqn;
+   }
+
+   /**
+    * Basic versions of these methods
+    */
+   public Object[] getParameters()
+   {
+      return new Object[]{fqn};
+   }
+
+   /**
+    * Basic versions of these methods
+    */
+   public void setState(int commandId, Object[] args)
+   {
+      fqn = (Fqn) args[0];
+   }
+
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      BaseCacheDataCommand that = (BaseCacheDataCommand) o;
+
+      return !(fqn != null ? !fqn.equals(that.fqn) : that.fqn != null);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (fqn != null ? fqn.hashCode() : 0);
+      result = 31 * result + getClass().hashCode();
+      return result;
+   }
+}

Added: core/trunk/src/main/java/org/jboss/cache/commands/state/BaseDataVersionCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/state/BaseDataVersionCommand.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/state/BaseDataVersionCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -0,0 +1,63 @@
+package org.jboss.cache.commands.state;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.optimistic.DataVersion;
+
+/**
+ * Base version of {@link org.jboss.cache.commands.cachedata.CacheDataCommand} which handles common behaviour
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 2.2.0
+ */
+public abstract class BaseDataVersionCommand extends BaseCacheDataCommand implements DataVersionCommand
+{
+
+   protected DataVersion dataVersion;
+
+   public DataVersion getDataVersion()
+   {
+      return dataVersion;
+   }
+
+   public void setDataVersion(DataVersion dataVersion)
+   {
+      this.dataVersion = dataVersion;
+   }
+
+   public boolean isVersioned()
+   {
+      return dataVersion != null;
+   }
+
+   // basic implementations
+   public Object[] getParameters()
+   {
+      if (isVersioned())
+         return new Object[]{fqn, dataVersion};
+      else
+         return new Object[]{fqn};
+   }
+
+   // basic implementations
+   public void setState(int commandId, Object[] args)
+   {
+      fqn = (Fqn) args[0];
+      if (isVersionedId(commandId)) dataVersion = (DataVersion) args[1];
+   }
+
+   protected abstract boolean isVersionedId(int id);
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (!super.equals(o)) return false;
+      BaseDataVersionCommand that = (BaseDataVersionCommand) o;
+      return !(fqn != null ? !fqn.equals(that.fqn) : that.fqn != null);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return 31 * super.hashCode() + (dataVersion != null ? dataVersion.hashCode() : 0);
+   }
+}
\ No newline at end of file

Modified: core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,7 +1,7 @@
 package org.jboss.cache.commands.state;
 
+import org.jboss.cache.commands.cachedata.CacheDataCommand;
 import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.commands.CacheCommand;
 
 /**
  * Commands that know how to deal with versioned data.
@@ -9,7 +9,7 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public interface DataVersionCommand extends CacheCommand
+public interface DataVersionCommand extends CacheDataCommand
 {
    public DataVersion getDataVersion();
 
@@ -17,7 +17,6 @@
 
    /**
     * Has data version set? (i.e. not null)
-    * // todo: should this be an abstract class rather than an interface?  isVersioned() is implemented exactly the same way in all subclasses.
     */
    public boolean isVersioned();
 }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -22,7 +22,6 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
-import org.apache.commons.logging.LogFactory;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -105,13 +104,13 @@
    @Override
    public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
    {
-      if (command.getFrom() != null)
+      if (command.getFqn() != null)
       {
          if (command.getTo() != null)
          {
             loadIfNeeded(ctx, command.getTo(), null, false, false, true, ctx.getMethodCall(), txTable.get(ctx.getGlobalTransaction()), false, true, false);
          }
-         loadIfNeeded(ctx, command.getFrom(), null, false, false, true, ctx.getMethodCall(), txTable.get(ctx.getGlobalTransaction()), true, true, false);
+         loadIfNeeded(ctx, command.getFqn(), null, false, false, true, ctx.getMethodCall(), txTable.get(ctx.getGlobalTransaction()), true, true, false);
       }
       return invokeNextInterceptor(ctx, command);
    }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -5,13 +5,13 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.functional.TxCacheCommand;
 import org.jboss.cache.commands.cachedata.MoveCommand;
 import org.jboss.cache.commands.cachedata.PutDataMapCommand;
 import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.cachedata.RemoveDataCommand;
 import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
 import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
@@ -245,9 +245,9 @@
       {
          return returnValue;
       }
-      Fqn newNodeFqn = Fqn.fromRelativeElements(command.getTo(), command.getFrom().getLastElement());
-      recursiveMove(command.getFrom(), newNodeFqn);
-      loader.remove(command.getFrom());
+      Fqn newNodeFqn = Fqn.fromRelativeElements(command.getTo(), command.getFqn().getLastElement());
+      recursiveMove(command.getFqn(), newNodeFqn);
+      loader.remove(command.getFqn());
       return returnValue;
    }
 
@@ -440,8 +440,8 @@
 
       public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
       {
-         Fqn moveFrom = command.getFrom();
-         affectedFqns.add(command.getFrom());
+         Fqn moveFrom = command.getFqn();
+         affectedFqns.add(command.getFqn());
          affectedFqns.add(moveFrom);
          Modification mod = new Modification(Modification.ModificationType.MOVE, moveFrom, command.getTo());
          modifications.add(mod);

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -22,6 +22,7 @@
 package org.jboss.cache.interceptors;
 
 import org.apache.commons.logging.Log;
+import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
@@ -33,6 +34,7 @@
 import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
 import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
 import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
 import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
@@ -43,7 +45,6 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.marshall.MethodDeclarations;
 
 import java.util.Collections;
 import java.util.Map;
@@ -184,7 +185,7 @@
 
    public Object handleDefault(InvocationContext ctx, CacheCommand command) throws Throwable
    {
-      if (command != null) //call originated from an command
+      if (command != null) //call originated from a command
       {
          return invoke(ctx);
       }
@@ -192,121 +193,96 @@
       int methodId = ctx.getMethodCall().getId();
       switch (methodId)
       {
-         case MethodDeclarations.putDataEraseMethodLocal_id:
-         case MethodDeclarations.putDataMethodLocal_id:
-         case MethodDeclarations.putDataEraseVersionedMethodLocal_id:
-         case MethodDeclarations.putDataVersionedMethodLocal_id:
-         {
+
+         case PutDataMapCommand.ERASE_METHOD_ID:
+         case PutDataMapCommand.ERASE_VERSIONED_METHOD_ID:
+         case PutDataMapCommand.METHOD_ID:
+         case PutDataMapCommand.VERSIONED_METHOD_ID:
             return next.handlePutDataMapCommand(ctx, (PutDataMapCommand) command);
-         }
-         case MethodDeclarations.putKeyValMethodLocal_id:
-         case MethodDeclarations.putKeyValVersionedMethodLocal_id:
-         case MethodDeclarations.putForExternalReadMethodLocal_id:
-         case MethodDeclarations.putForExternalReadVersionedMethodLocal_id:
-         {
+
+         case PutKeyValueCommand.METHOD_ID:
+         case PutKeyValueCommand.VERSIONED_METHOD_ID:
+         case PutKeyValueCommand.PUT_FOR_EXT_READ_METHOD_ID:
+         case PutKeyValueCommand.PUT_FOR_EXT_READ_VERSIONED_METHOD_ID:
             return next.handlePutKeyValueCommand(ctx, (PutKeyValueCommand) command);
-         }
-         case MethodDeclarations.removeNodeMethodLocal_id:
-         case MethodDeclarations.removeNodeVersionedMethodLocal_id:
-         {
+
+         case RemoveNodeCommand.METHOD_ID:
+         case RemoveNodeCommand.VERSIONED_METHOD_ID:
             return next.handleRemoveNodeCommand(ctx, (RemoveNodeCommand) command);
-         }
-         case MethodDeclarations.removeDataMethodLocal_id:
-         case MethodDeclarations.removeDataVersionedMethodLocal_id:
-         {
+
+         case RemoveDataCommand.METHOD_ID:
+         case RemoveDataCommand.VERSIONED_METHOD_ID:
             return next.handleRemoveDataCommand(ctx, (RemoveDataCommand) command);
-         }
-         case MethodDeclarations.evictNodeMethodLocal_id:
-         case MethodDeclarations.evictVersionedNodeMethodLocal_id:
-         {
+
+         case EvictNodeCommand.METHOD_ID:
+         case EvictNodeCommand.VERSIONED_METHOD_ID:
             return next.handleEvictFqnCommand(ctx, (EvictNodeCommand) command);
-         }
-         case MethodDeclarations.invalidateMethodLocal_id:
-         {
+
+         case InvalidateCommand.METHOD_ID:
             return next.handleInvalidateCommand(ctx, (InvalidateCommand) command);
-         }
-         case MethodDeclarations.removeKeyMethodLocal_id:
-         case MethodDeclarations.removeKeyVersionedMethodLocal_id:
-         {
+
+         case RemoveKeyCommand.METHOD_ID:
+         case RemoveKeyCommand.VERSIONED_METHOD_ID:
             return next.handleRemoveKeyCommand(ctx, (RemoveKeyCommand) command);
-         }
-         case MethodDeclarations.getDataMapMethodLocal_id:
-         {
+
+         case GetDataMapCommand.METHOD_ID:
             return next.handleGetDataMapCommand(ctx, (GetDataMapCommand) command);
-         }
-         case MethodDeclarations.existsMethod_id:
-         {
+
+         case ExistsNodeCommand.METHOD_ID:
             return next.handleExistsNodeCommand(ctx, (ExistsNodeCommand) command);
-         }
-         case MethodDeclarations.getKeyValueMethodLocal_id:
-         {
+
+         case GetKeyValueCommand.METHOD_ID:
             return next.handleGetKeyValueCommand(ctx, (GetKeyValueCommand) command);
-         }
-         case MethodDeclarations.getNodeMethodLocal_id:
-         {
+
+         case GetNodeCommand.METHOD_ID:
             return next.handleGetNodeCommand(ctx, (GetNodeCommand) command);
-         }
-         case MethodDeclarations.getKeysMethodLocal_id:
-         {
+
+         case GetKeysCommand.METHOD_ID:
             return next.handleGetKeysCommand(ctx, (GetKeysCommand) command);
-         }
-         case MethodDeclarations.getChildrenNamesMethodLocal_id:
-         {
+
+         case GetChildrenNamesCommand.METHOD_ID:
             return next.handleGetChildrenNamesCommand(ctx, (GetChildrenNamesCommand) command);
-         }
-         case MethodDeclarations.moveMethodLocal_id:
-         {
+
+         case MoveCommand.METHOD_ID:
             return next.handleMoveCommand(ctx, (MoveCommand) command);
-         }
-         case MethodDeclarations.dataGravitationMethod_id:
-         {
-            return next.handleMoveCommand(ctx, (MoveCommand) command);
-         }
-         case MethodDeclarations.prepareMethod_id:
-         {
+
+         case GravitateDataCommand.METHOD_ID:
+            return next.handleGravitateDataCommand(ctx, (GravitateDataCommand) command);
+
+         case PrepareCommand.METHOD_ID:
             return next.handlePrepareCommand(ctx, (PrepareCommand) command);
-         }
-         case MethodDeclarations.rollbackMethod_id:
-         {
+
+         case RollbackCommand.METHOD_ID:
             return next.handleRollbackCommand(ctx, (RollbackCommand) command);
-         }
-         case MethodDeclarations.commitMethod_id:
-         {
+
+         case CommitCommand.METHOD_ID:
             return next.handleCommitCommand(ctx, (CommitCommand) command);
-         }
-         case MethodDeclarations.optimisticPrepareMethod_id:
-         {
+
+         case OptimisticPrepareCommand.METHOD_ID:
             return next.handleOptimisticPrepareCommand(ctx, (OptimisticPrepareCommand) command);
-         }
-         case MethodDeclarations.replicateMethod_id:
-         case MethodDeclarations.replicateAllMethod_id:
-         {
-            return next.handleReplicateCommand(ctx, (ReplicateCommand) command);
-         }
-         case MethodDeclarations.remoteAnnounceBuddyPoolNameMethod_id:
-         {
+
+         case ReplicateCommand.SINGLE_METHOD_ID:
+         case ReplicateCommand.MULTIPLE_METHOD_ID:
+            throw new CacheException("Replicate calls should never be passed up the interceptor chain!");
+
+         case AnnounceBuddyPoolNameCommand.METHOD_ID:
             return next.handleAnnounceBuddyPoolName(ctx, (AnnounceBuddyPoolNameCommand) command);
-         }
-         case MethodDeclarations.remoteRemoveFromBuddyGroupMethod_id:
-         {
+
+         case RemoveFromBuddyGroupCommand.METHOD_ID:
             return next.handleRemoveFromBuddyGroupCommand(ctx, (RemoveFromBuddyGroupCommand) command);
-         }
-         case MethodDeclarations.remoteAssignToBuddyGroupMethod_id:
-         {
+
+         case AssignToBuddyGroupCommand.METHOD_ID:
             return next.handleAssignToBuddyGroupCommand(ctx, (AssignToBuddyGroupCommand) command);
-         }
-         case MethodDeclarations.dataGravitationCleanupMethod_id:
-         {
+
+         case DataGravitationCleanupCommand.METHOD_ID:
             return next.handleDataGravitationCleanupCommand(ctx, (DataGravitationCleanupCommand) command);
-         }
-         case MethodDeclarations.blockChannelMethodLocal_id:
-         {
+
+         case BlockChannelCommand.METHOD_ID:
             return next.handleBlockChannelCommand(ctx, (BlockChannelCommand) command);
-         }
-         case MethodDeclarations.unblockChannelMethodLocal_id:
-         {
+
+         case UnblockChannelCommand.METHOD_ID:
             return next.handleUnblockChannelCommand(ctx, (UnblockChannelCommand) command);
-         }
+
       }
       return null;
    }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -14,8 +14,13 @@
 import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.cachedata.InvalidateCommand;
+import org.jboss.cache.commands.cachedata.MoveCommand;
+import org.jboss.cache.commands.cachedata.PutDataMapCommand;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
+import org.jboss.cache.commands.cachedata.RemoveDataCommand;
+import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
+import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
 import org.jboss.cache.commands.functional.TxCacheCommand;
-import org.jboss.cache.commands.cachedata.*;
 import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
@@ -25,16 +30,24 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.optimistic.TransactionWorkspace;
 import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.*;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.OptimisticTransactionEntry;
+import org.jboss.cache.transaction.TransactionEntry;
+import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.cache.transaction.TxUtil;
 
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -73,19 +86,21 @@
       this.txTable = txTable;
    }
 
-   protected boolean skipMethodCall(InvocationContext ctx)
-   {
-      Option optionOverride = ctx.getOptionOverrides();
-      if (optionOverride != null && optionOverride.isCacheModeLocal() && (ctx.getTransaction() == null ||
-            MethodDeclarations.isTransactionLifecycleMethod(ctx.getMethodCall().getMethodId())))
-      {
-         // skip replication!!
-         return true;
-      }
-      if (trace) log.trace("(" + rpcManager.getLocalAddress() + ") method call " + ctx.getMethodCall());
-      return false;
-   }
+   // todo: revisit.  This is not used anywhere but it's functionality is necessary.  Expecting a bug here.
 
+//   protected boolean skipMethodCall(InvocationContext ctx)
+//   {
+//      Option optionOverride = ctx.getOptionOverrides();
+//      if (optionOverride != null && optionOverride.isCacheModeLocal() && (ctx.getTransaction() == null ||
+//            MethodDeclarations.isTransactionLifecycleMethod(ctx.getMethodCall().getMethodId())))
+//      {
+//         // skip replication!!
+//         return true;
+//      }
+//      if (trace) log.trace("(" + rpcManager.getLocalAddress() + ") method call " + ctx.getMethodCall());
+//      return false;
+//   }
+
    public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
    {
       return handleCrudMethod(ctx, command.getFqn(), null, command);
@@ -108,12 +123,12 @@
 
    public Object handleDataGravitationCleanupCommand(InvocationContext ctx, DataGravitationCleanupCommand command) throws Throwable
    {
-      return handleCrudMethod(ctx, command.getPrimary(), null, command);
+      return handleCrudMethod(ctx, command.getFqn(), null, command);
    }
 
    public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
    {
-      return handleCrudMethod(ctx, command.getTo(), command.getFrom(), command);
+      return handleCrudMethod(ctx, command.getTo(), command.getFqn(), command);
    }
 
    public Object handleRemoveDataCommand(InvocationContext ctx, RemoveDataCommand command) throws Throwable
@@ -299,15 +314,15 @@
 
       public Object handleDataGravitationCleanupCommand(InvocationContext ctx, DataGravitationCleanupCommand command) throws Throwable
       {
-         return addFqn(command.getPrimary());
+         return addFqn(command.getFqn());
       }
 
       public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
       {
          if (containsPutForExternalRead) return null;
-         result.add(command.getFrom());
+         result.add(command.getFqn());
          // now if this is a "move" operation, then we also have another Fqn -
-         Object le = command.getFrom().getLastElement();
+         Object le = command.getFqn().getLastElement();
          Fqn parent = command.getTo();
          result.add(Fqn.fromRelativeElements(parent, le));
          return null;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -79,7 +79,7 @@
       List<Fqn> fqns = new ArrayList<Fqn>();
       fqns.add((Fqn) command.getTo());
       //  peek into Node and get a hold of all child fqns as these need to be in the workspace.
-      NodeSPI node = cacheData.peek(command.getFrom(), true, true);
+      NodeSPI node = cacheData.peek(command.getFqn(), true, true);
       greedyGetFqns(fqns, node, (Fqn) command.getTo());
       if (trace) log.trace("Adding Fqns " + fqns + " for a move() operation.");
       for (Fqn f : fqns)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -13,8 +13,8 @@
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.NodeSPI;
+import org.jboss.cache.commands.cachedata.*;
 import org.jboss.cache.commands.functional.TxCacheCommand;
-import org.jboss.cache.commands.cachedata.*;
 import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
@@ -146,7 +146,7 @@
    {
       GlobalTransaction gtx = getGlobalTransaction(ctx);
       TransactionWorkspace workspace = getTransactionWorkspace(gtx);
-      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFrom(), workspace, true, true);
+      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
       if (ctx.isOriginLocal() && ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
       {
          throw new CacheException("Setting a data version while performing a move() is not supported!!");

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -173,15 +173,15 @@
       if (ctx.isSupressLocking()) return invokeNextInterceptor(ctx, command);
       long timeout = ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout);
       // this call will ensure the node gets a WL and it's current parent gets RL.
-      if (trace) log.trace("Attempting to get WL on node to be moved [" + command.getFrom() + "]");
-      if (command.getFrom() != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
+      if (trace) log.trace("Attempting to get WL on node to be moved [" + command.getFqn() + "]");
+      if (command.getFqn() != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
       {
-         lockManager.lock(ctx, command.getFrom(), NodeLock.LockType.WRITE, false, timeout, true, false, null, false);
+         lockManager.lock(ctx, command.getFqn(), NodeLock.LockType.WRITE, false, timeout, true, false, null, false);
          if (ctx.getGlobalTransaction() != null)
          {
-            txTable.get(ctx.getGlobalTransaction()).addRemovedNode(command.getFrom());
+            txTable.get(ctx.getGlobalTransaction()).addRemovedNode(command.getFqn());
          }
-         lockManager.acquireLocksOnChildren(cacheData.peek(command.getFrom(), true, false), NodeLock.LockType.WRITE, ctx);
+         lockManager.acquireLocksOnChildren(cacheData.peek(command.getFqn(), true, false), NodeLock.LockType.WRITE, ctx);
       }
       if (command.getTo() != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
       {
@@ -192,7 +192,7 @@
       }
       Object retValue = invokeNextInterceptor(ctx, command);
       // do a REAL remove here.
-      NodeSPI n = cacheData.peek(command.getFrom(), true, false);
+      NodeSPI n = cacheData.peek(command.getFqn(), true, false);
       if (n != null)
       {
          n.getLock().releaseAll(Thread.currentThread());

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -12,6 +12,28 @@
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
+import org.jboss.cache.commands.cachedata.CacheDataCommand;
+import org.jboss.cache.commands.cachedata.EvictNodeCommand;
+import org.jboss.cache.commands.cachedata.ExistsNodeCommand;
+import org.jboss.cache.commands.cachedata.GetChildrenNamesCommand;
+import org.jboss.cache.commands.cachedata.GetDataMapCommand;
+import org.jboss.cache.commands.cachedata.GetKeyValueCommand;
+import org.jboss.cache.commands.cachedata.GetKeysCommand;
+import org.jboss.cache.commands.cachedata.InvalidateCommand;
+import org.jboss.cache.commands.cachedata.UpdateDataCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
+import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
+import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ClusteredGetCommand;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
+import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.ComponentName;
 import org.jboss.cache.factories.annotations.Inject;
@@ -97,103 +119,78 @@
       throw new RuntimeException("Needs to be overridden!");
    }
 
-   /**
-    * This is "replicate" call with a single MethodCall argument.
-    *
-    * @param call
-    */
-   protected Fqn extractFqnFromMethodCall(MethodCall call)
+   protected Fqn extractFqn(MarshallableCommand cmd)
    {
-      MethodCall c0 = (MethodCall) call.getArgs()[0];
-      return extractFqn(c0);
-   }
+      if (cmd == null) throw new NullPointerException("Command is null");
 
-   /**
-    * This is "replicate" call with a list of MethodCall argument.
-    *
-    * @param call
-    */
-   protected Fqn extractFqnFromListOfMethodCall(MethodCall call)
-   {
-      Object[] args = call.getArgs();
-      // We simply pick the first one and assume everyone will need to operate under the same region!
-      MethodCall c0 = (MethodCall) ((List) args[0]).get(0);
-      return extractFqn(c0);
-   }
-
-   protected Fqn extractFqn(MethodCall methodCall)
-   {
-      if (methodCall == null)
-      {
-         throw new NullPointerException("method call is null");
-      }
-
       Fqn fqn = null;
-      Object[] args = methodCall.getArgs();
-      switch (methodCall.getMethodId())
+      //Object[] args = cmd.getParameters();
+      switch (cmd.getCommandId())
       {
-         case MethodDeclarations.optimisticPrepareMethod_id:
-         case MethodDeclarations.prepareMethod_id:
+         case OptimisticPrepareCommand.METHOD_ID:
+         case PrepareCommand.METHOD_ID:
+
             // Prepare method has a list of modifications. We will just take the first one and extract.
-            List modifications = (List) args[1];
-            fqn = extractFqn((MethodCall) modifications.get(0));
+            PrepareCommand pc = (PrepareCommand) cmd;
+            List modifications = pc.getModifications();
+            fqn = extractFqn((MarshallableCommand) modifications.get(0));
 
-            // the last arg of a prepare call is the one-phase flag
-            boolean one_phase_commit = (Boolean) args[args.length - 1];
-
             // If this is two phase commit, map the FQN to the GTX so
             // we can find it when the commit/rollback comes through
-            if (!one_phase_commit)
-            {
-               transactions.put((GlobalTransaction) args[0], fqn);
-            }
+            if (!pc.isOnePhaseCommit()) transactions.put(pc.getGlobalTransaction(), fqn);
+
             break;
-         case MethodDeclarations.rollbackMethod_id:
-         case MethodDeclarations.commitMethod_id:
+
+         case RollbackCommand.METHOD_ID:
+         case CommitCommand.METHOD_ID:
             // We stored the fqn in the transactions map during the prepare phase
-            fqn = transactions.remove(args[0]);
+            fqn = transactions.remove(((GlobalTransactionCommand) cmd).getGlobalTransaction());
             break;
-//         case MethodDeclarations.getPartialStateMethod_id:
-         case MethodDeclarations.dataGravitationMethod_id:
-         case MethodDeclarations.evictNodeMethodLocal_id:
-         case MethodDeclarations.evictVersionedNodeMethodLocal_id:
-         case MethodDeclarations.invalidateMethodLocal_id:
-         case MethodDeclarations.getChildrenNamesMethodLocal_id:
-         case MethodDeclarations.getDataMapMethodLocal_id:
-         case MethodDeclarations.getKeysMethodLocal_id:
-         case MethodDeclarations.getKeyValueMethodLocal_id:
-         case MethodDeclarations.existsMethod_id:
-            fqn = (Fqn) args[0];
+
+         case GravitateDataCommand.METHOD_ID:
+         case EvictNodeCommand.METHOD_ID:
+         case EvictNodeCommand.VERSIONED_METHOD_ID:
+         case InvalidateCommand.METHOD_ID:
+         case GetChildrenNamesCommand.METHOD_ID:
+         case GetDataMapCommand.METHOD_ID:
+         case GetKeyValueCommand.METHOD_ID:
+         case GetKeysCommand.METHOD_ID:
+         case ExistsNodeCommand.METHOD_ID:
+            fqn = ((CacheDataCommand) cmd).getFqn();
             break;
-         case MethodDeclarations.dataGravitationCleanupMethod_id:
-            fqn = (Fqn) args[1];
+
+         case DataGravitationCleanupCommand.METHOD_ID:
+            fqn = ((DataGravitationCleanupCommand) cmd).getFqn();
             break;
-         case MethodDeclarations.remoteAnnounceBuddyPoolNameMethod_id:
-         case MethodDeclarations.remoteAssignToBuddyGroupMethod_id:
-         case MethodDeclarations.remoteRemoveFromBuddyGroupMethod_id:
+
+         case AnnounceBuddyPoolNameCommand.METHOD_ID:
+         case AssignToBuddyGroupCommand.METHOD_ID:
+         case RemoveFromBuddyGroupCommand.METHOD_ID:
             break;
-         case MethodDeclarations.replicateMethod_id:
-         case MethodDeclarations.clusteredGetMethod_id:
+
             // possible when we have a replication queue.
-            fqn = extractFqn((MethodCall) args[0]);
+         case ReplicateCommand.SINGLE_METHOD_ID:
+            fqn = extractFqn(((ReplicateCommand) cmd).getSingleModification());
             break;
+         case ReplicateCommand.MULTIPLE_METHOD_ID:
+            fqn = extractFqn(((ReplicateCommand) cmd).getModifications().get(0));
+            break;
+         case ClusteredGetCommand.METHOD_ID:
+            fqn = ((ClusteredGetCommand) cmd).getCacheDataComand().getFqn();
+            break;
          default:
-            if (MethodDeclarations.isCrudMethod(methodCall.getMethodId()))
+            if (cmd instanceof UpdateDataCommand)
             {
-               fqn = (Fqn) args[1];
+               fqn = ((UpdateDataCommand) cmd).getFqn();
             }
             else
             {
-               throw new IllegalArgumentException("AbstractMarshaller.extractFqn(): Unknown id in method call: " + methodCall);
+               throw new IllegalArgumentException("AbstractMarshaller.extractFqn(): Unknown id in method call: " + cmd);
             }
             break;
-
       }
 
-      if (trace)
-      {
-         log.trace("extract(): received " + methodCall + "extracted fqn: " + fqn);
-      }
+      if (trace) log.trace("extract(): received " + cmd + "extracted fqn: " + fqn);
 
       return fqn;
    }

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -92,10 +92,10 @@
             region = rrv.region;
             o = rrv.returnValue;
          }
-         else if (o instanceof MethodCall)
+         else if (o instanceof MarshallableCommand)
          {
-            MethodCall call = (MethodCall) o;
-            region = extractFqnRegion(call);
+            MarshallableCommand marshallableCommand = (MarshallableCommand) o;
+            region = extractFqnRegion(marshallableCommand);
          }
 
          if (trace) log.trace("Region based call.  Using region " + region);
@@ -248,35 +248,14 @@
       return region;
    }
 
-   private Fqn extractFqnRegion(MethodCall call) throws Exception
+   private Fqn extractFqnRegion(MarshallableCommand cmd) throws Exception
    {
-      Fqn fqn;
-      if (isReplicateMethod(call))
-      {
-         fqn = extractFqnFromMethodCall(call);
-      }
-      else if (isReplicateAllMethod(call))
-      {
-         fqn = extractFqnFromListOfMethodCall(call);
-      }
-      else
-      {
-         fqn = extractFqn(call);
-      }
+      Fqn fqn = extractFqn(cmd);
 
       Region r = getRegion(fqn);
       return r == null ? null : r.getFqn();
    }
 
-   protected boolean isReplicateMethod(MethodCall call)
-   {
-      return call.getMethodId() == MethodDeclarations.replicateMethod_id || call.getMethod().equals(MethodDeclarations.replicateMethod);
-   }
-
-   protected boolean isReplicateAllMethod(MethodCall call)
-   {
-      return call.getMethodId() == MethodDeclarations.replicateAllMethod_id || call.getMethod().equals(MethodDeclarations.replicateAllMethod);
-   }
    // --------- Marshalling methods
 
    private void marshallObject(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -7,6 +7,8 @@
 package org.jboss.cache.marshall;
 
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
 
 import java.lang.reflect.Method;
 
@@ -49,9 +51,9 @@
    {
       switch (this.getMethodId())
       {
-         case MethodDeclarations.prepareMethod_id:
+         case PrepareCommand.METHOD_ID:
             return (Boolean) this.getArgs()[3];
-         case MethodDeclarations.optimisticPrepareMethod_id:
+         case OptimisticPrepareCommand.METHOD_ID:
             return (Boolean) this.getArgs()[4];
          default:
             return false;

Deleted: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,43 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.marshall;
-
-import java.lang.reflect.Method;
-
-/**
- * Factory class to create instances of org.jboss.cache.marshall.MethodCall
- *
- * @author <a href="galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision$
- */
-public class MethodCallFactory
-{
-
-   /**
-    * Creates and initialised an instance of MethodCall.
-    *
-    * @param methodId  Method ID of the MethodCall
-    * @param arguments list of parameters
-    * @return a new instance of MethodCall with the method id initialised
-    */
-   public static MethodCall create(int methodId, Object... arguments)
-   {
-      return new MethodCall(MethodDeclarations.lookupMethod(methodId), methodId, arguments);
-   }
-
-   /**
-    * Creates and initialised an instance of MethodCall
-    *
-    * @param method    Method instance of the MethodCall
-    * @param arguments list of parameters
-    * @return a new instance of MethodCall with the method id set to -1 (uninitialized).
-    */
-   public static MethodCall createWithNullId(Method method, Object... arguments)
-   {
-      return new MethodCall(method, arguments);
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,6 +2,9 @@
 
 import org.jboss.cache.commands.functional.MarshallableCommand;
 
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 /**
  * This wrapper class is used when passing in {@link org.jboss.cache.commands.CacheCommand}s into JGroups RPC APIs.
  *
@@ -18,12 +21,29 @@
       this.command = command;
    }
 
+   public MethodCallWrapper()
+   {
+      throw new RuntimeException("Should never be invoked!");
+   }
+
+   @Override
+   public void readExternal(ObjectInput in)
+   {
+      throw new RuntimeException("Should never be invoked!");
+   }
+
+   @Override
+   public void writeExternal(ObjectOutput out)
+   {
+      throw new RuntimeException("Should never be invoked!");
+   }
+
    public MarshallableCommand getCommand()
    {
       return command;
    }
 
-
+   @Override
    public String toString()
    {
       return "MethodCallWrapper[" +

Deleted: core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,583 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.marshall;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.util.BitEncodedIntegerSet;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Class containing Method and Method id definitions as well methods
- * allowing lookup operations both ways.
- *
- * @author <a href="galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision$
- */
-public class MethodDeclarations
-{
-   private static Log log = LogFactory.getLog(MethodDeclarations.class);
-
-   static final BitEncodedIntegerSet crudMethodIds = new BitEncodedIntegerSet();
-   static final BitEncodedIntegerSet transactionLifecycleMethodIds = new BitEncodedIntegerSet();
-   static final BitEncodedIntegerSet buddyGroupOrganisationMethodIds = new BitEncodedIntegerSet();
-   static final BitEncodedIntegerSet blockUnblockMethodIds = new BitEncodedIntegerSet();
-   static final BitEncodedIntegerSet putMethodIds = new BitEncodedIntegerSet();
-   static final BitEncodedIntegerSet methodsThatNeedToReturnValuesToRemoteCallers = new BitEncodedIntegerSet();
-
-   // maintain a list of method IDs that correspond to Methods
-   // Mapping ids to Methods are done via an array lookup where the subscript is a method id.
-   static final Method[] methods = new Method[48]; // the largest method id is 47 so this array needs to accommodate a subscript of 47.
-
-   // and for reverse lookup
-   static final Map<Method, Integer> methodIds = new HashMap<Method, Integer>();
-
-   public static final Method putDataMethodLocal;
-
-   public static final Method putDataEraseMethodLocal;
-
-   public static final Method putKeyValMethodLocal;
-
-   public static final Method removeNodeMethodLocal;
-
-   public static final Method removeKeyMethodLocal;
-
-   public static final Method removeDataMethodLocal;
-
-   public static final Method evictNodeMethodLocal;
-
-   public static final Method evictVersionedNodeMethodLocal;
-
-   public static final Method prepareMethod;
-
-   public static final Method commitMethod;
-
-   public static final Method rollbackMethod;
-
-   public static final Method replicateMethod;
-
-   public static final Method replicateAllMethod;
-
-   public static final Method getKeyValueMethodLocal;
-
-   public static final Method getNodeMethodLocal;
-
-   public static final Method getKeysMethodLocal;
-
-   public static final Method getChildrenNamesMethodLocal;
-
-   public static final Method getDataMapMethodLocal;
-
-   public static final Method existsMethod;
-
-   public static final Method optimisticPrepareMethod;
-
-   public static final Method clusteredGetMethod;
-
-   public static final Method remoteAssignToBuddyGroupMethod;
-
-   public static final Method remoteRemoveFromBuddyGroupMethod;
-
-   public static final Method remoteAnnounceBuddyPoolNameMethod;
-
-   public static final Method dataGravitationCleanupMethod;
-
-   public static final Method dataGravitationMethod;
-
-   public static final Method moveMethodLocal;
-
-   public static final Method blockChannelMethodLocal;
-
-   public static final Method unblockChannelMethodLocal;
-
-   public static final Method putForExternalReadMethodLocal;
-
-   // these are basic cachedata methods that are version-aware - JBCACHE-843.
-
-   public static final Method putDataVersionedMethodLocal;
-
-   public static final Method putDataEraseVersionedMethodLocal;
-
-   public static final Method putKeyValVersionedMethodLocal;
-
-   public static final Method putForExternalReadVersionedMethodLocal;
-
-   public static final Method removeNodeVersionedMethodLocal;
-
-   public static final Method removeKeyVersionedMethodLocal;
-
-   public static final Method removeDataVersionedMethodLocal;
-
-   public static final Method invalidateMethodLocal;
-
-   //not all of these are used for RPC - trim accordingly.
-   public static final int putDataMethodLocal_id = 1;
-
-   public static final int putDataEraseMethodLocal_id = 2;
-
-   public static final int putKeyValMethodLocal_id = 3;
-
-   //    public static final int putFailFastKeyValueMethodLocal_id = 4;  // this method is no longer needed.
-
-   public static final int removeNodeMethodLocal_id = 5;
-
-   public static final int removeKeyMethodLocal_id = 6;
-
-   public static final int removeDataMethodLocal_id = 7;
-
-   public static final int evictNodeMethodLocal_id = 8;
-
-   public static final int evictVersionedNodeMethodLocal_id = 9;
-
-   public static final int prepareMethod_id = 10;
-
-   public static final int commitMethod_id = 11;
-
-   public static final int rollbackMethod_id = 12;
-
-   public static final int replicateMethod_id = 13;
-
-   public static final int replicateAllMethod_id = 14;
-
-   /**
-    * This method does not have a corresponding lang.Method as it was only used internally within the _remove
-    * method for rolling back.
-    */
-//   public static final int addChildMethodLocal_id = 15;
-
-   public static final int existsMethod_id = 16;
-
-//   public static final int releaseAllLocksMethodLocal_id = 17;
-
-   public static final int optimisticPrepareMethod_id = 18;
-
-//   public static final int getPartialStateMethod_id = 19;
-
-   public static final int clusteredGetMethod_id = 22;
-
-   public static final int getChildrenNamesMethodLocal_id = 23;
-
-   public static final int getDataMapMethodLocal_id = 24;
-
-   public static final int getKeysMethodLocal_id = 25;
-
-   public static final int getKeyValueMethodLocal_id = 26;
-
-   public static final int remoteAnnounceBuddyPoolNameMethod_id = 28;
-
-   public static final int remoteAssignToBuddyGroupMethod_id = 29;
-
-   public static final int remoteRemoveFromBuddyGroupMethod_id = 30;
-
-   /* Method id added as they did not exist before refactoring */
-   public static final int getNodeMethodLocal_id = 31;
-
-//   public static final int printMethodLocal_id = 32;
-
-//   public static final int lockMethodLocal_id = 33;
-
-   public static final int dataGravitationCleanupMethod_id = 34;
-
-   public static final int dataGravitationMethod_id = 35;
-
-   public static final int moveMethodLocal_id = 36;
-
-   // these are basic cachedata methods that are version-aware - JBCACHE-843.
-
-   public static final int putDataVersionedMethodLocal_id = 37;
-
-   public static final int putDataEraseVersionedMethodLocal_id = 38;
-
-   public static final int putKeyValVersionedMethodLocal_id = 39;
-
-   public static final int removeNodeVersionedMethodLocal_id = 40;
-
-   public static final int removeKeyVersionedMethodLocal_id = 41;
-
-   public static final int removeDataVersionedMethodLocal_id = 42;
-
-   public static final int blockChannelMethodLocal_id = 43;
-
-   public static final int unblockChannelMethodLocal_id = 44;
-
-   public static final int putForExternalReadMethodLocal_id = 45;
-
-   public static final int putForExternalReadVersionedMethodLocal_id = 46;
-
-   public static final int invalidateMethodLocal_id = 47;
-
-
-   static
-   {
-//      try
-//      {
-      // these methods need to return values even to remote callers.
-      methodsThatNeedToReturnValuesToRemoteCallers.add(dataGravitationMethod_id);
-      methodsThatNeedToReturnValuesToRemoteCallers.add(clusteredGetMethod_id);
-
-      /*done*/
-      getDataMapMethodLocal = null;//= CacheImpl.class.getDeclaredMethod("_getData", Fqn.class);
-      /*done*/
-      existsMethod = null;//= CacheImpl.class.getDeclaredMethod("exists", Fqn.class);
-      /*done*/
-      putDataMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class);
-      /*done*/
-      putDataEraseMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class);
-      /*done*/
-      putKeyValMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class);
-      /*done*/
-      putForExternalReadMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_putForExternalRead", GlobalTransaction.class, Fqn.class, Object.class, Object.class);
-      /*done*/
-      removeNodeMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class, boolean.class);
-      /*done*/
-      removeKeyMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class);
-      /* done*/
-      removeDataMethodLocal = null;//CacheImpl.class.getDeclaredMethod("_removeData", GlobalTransaction.class, Fqn.class, boolean.class);
-      /* done*/
-      evictNodeMethodLocal = null;//("_evict", Fqn.class);
-      /* done*/
-      evictVersionedNodeMethodLocal = null;//("_evict", Fqn.class, DataVersion.class);
-
-      /* done*/
-      prepareMethod = null;//("prepare", GlobalTransaction.class, List.class, Address.class, boolean.class);
-      /* done*/
-      commitMethod = null;//("commit", GlobalTransaction.class);
-      /* done*/
-      rollbackMethod = null;//("rollback", GlobalTransaction.class);
-      /* done*/
-      optimisticPrepareMethod = null;//("optimisticPrepare", GlobalTransaction.class, List.class, Map.class, Address.class, boolean.class);
-
-      /* done*/
-      replicateMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("_replicate", MethodCall.class);
-      /* done*/
-      replicateAllMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("_replicate", List.class);
-
-      /** done*/
-      remoteAnnounceBuddyPoolNameMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("announceBuddyPoolName", Address.class, String.class);
-      /** done*/
-      remoteRemoveFromBuddyGroupMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("removeFromBuddyGroup", String.class);
-      /** done*/
-      remoteAssignToBuddyGroupMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("assignToBuddyGroup", BuddyGroup.class, Map.class);
-      /** done */
-      dataGravitationCleanupMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("dataGravitationCleanup", Fqn.class, Fqn.class);
-      /** done */
-      clusteredGetMethod = null;//RemoteCacheInvocationDelegate.class.getDeclaredMethod("clusteredGet", MethodCall.class, Boolean.class);
-
-      /* done*/
-      getKeyValueMethodLocal = null;//("_get", Fqn.class, Object.class, boolean.class);
-      /* done*/
-      getNodeMethodLocal = null;//("_get", Fqn.class);
-      /* done*/
-      getKeysMethodLocal = null;//("_getKeys", Fqn.class);
-
-      /* done*/
-      getChildrenNamesMethodLocal = null;//("_getChildrenNames", Fqn.class);
-
-      // ------------ buddy replication
-
-      /*done*/
-      dataGravitationMethod = null;//CacheSPI.class.getDeclaredMethod("gravitateData", Fqn.class, boolean.class);
-
-      // ------------ move() api
-      /* done*/
-      moveMethodLocal = null;//("_move", Fqn.class, Fqn.class);
-      /* done*/
-      blockChannelMethodLocal = null;//("_block");
-      /* done*/
-      unblockChannelMethodLocal = null;//("_unblock");
-
-      // ------------ version-aware methods - see JBCACHE-843
-      /**done**/
-      putDataVersionedMethodLocal = null;//("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, DataVersion.class);
-      /**done*/
-      putDataEraseVersionedMethodLocal = null;//("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class, DataVersion.class);
-      /**done */
-      putKeyValVersionedMethodLocal = null;//("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class, DataVersion.class);
-      /*done*/
-      putForExternalReadVersionedMethodLocal = null;//("_putForExternalRead", GlobalTransaction.class, Fqn.class, Object.class, Object.class, DataVersion.class);
-      /** done*/
-      removeNodeVersionedMethodLocal = null;//("_remove", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
-      /* done*/
-      removeKeyVersionedMethodLocal = null;//("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class, DataVersion.class);
-      /*done */
-      removeDataVersionedMethodLocal = null;//("_removeData", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
-
-      /*done */
-      invalidateMethodLocal = null;//("invalidate", Fqn.class, DataVersion.class);
-
-//      }
-//      catch (NoSuchMethodException e)
-//      {
-//         throw new ExceptionInInitializerError(e);
-//      }
-
-      methods[putDataMethodLocal_id] = putDataMethodLocal;
-      methods[putDataEraseMethodLocal_id] = putDataEraseMethodLocal;
-      methods[putKeyValMethodLocal_id] = putKeyValMethodLocal;
-      methods[removeNodeMethodLocal_id] = removeNodeMethodLocal;
-      methods[removeKeyMethodLocal_id] = removeKeyMethodLocal;
-      methods[removeDataMethodLocal_id] = removeDataMethodLocal;
-      methods[evictNodeMethodLocal_id] = evictNodeMethodLocal;
-      methods[evictVersionedNodeMethodLocal_id] = evictVersionedNodeMethodLocal;
-      methods[prepareMethod_id] = prepareMethod;
-      methods[commitMethod_id] = commitMethod;
-      methods[rollbackMethod_id] = rollbackMethod;
-      methods[replicateMethod_id] = replicateMethod;
-      methods[replicateAllMethod_id] = replicateAllMethod;
-      methods[existsMethod_id] = existsMethod;
-      methods[optimisticPrepareMethod_id] = optimisticPrepareMethod;
-      methods[clusteredGetMethod_id] = clusteredGetMethod;
-      methods[getChildrenNamesMethodLocal_id] = getChildrenNamesMethodLocal;
-      methods[getDataMapMethodLocal_id] = getDataMapMethodLocal;
-      methods[getKeysMethodLocal_id] = getKeysMethodLocal;
-      methods[getKeyValueMethodLocal_id] = getKeyValueMethodLocal;
-      methods[remoteAnnounceBuddyPoolNameMethod_id] = remoteAnnounceBuddyPoolNameMethod;
-      methods[remoteAssignToBuddyGroupMethod_id] = remoteAssignToBuddyGroupMethod;
-      methods[remoteRemoveFromBuddyGroupMethod_id] = remoteRemoveFromBuddyGroupMethod;
-      /* Mappings added as they did not exist before refactoring */
-      methods[getNodeMethodLocal_id] = getNodeMethodLocal;
-
-      methods[dataGravitationCleanupMethod_id] = dataGravitationCleanupMethod;
-      methods[dataGravitationMethod_id] = dataGravitationMethod;
-
-      methods[moveMethodLocal_id] = moveMethodLocal;
-      methods[blockChannelMethodLocal_id] = blockChannelMethodLocal;
-      methods[unblockChannelMethodLocal_id] = unblockChannelMethodLocal;
-
-      methods[putDataVersionedMethodLocal_id] = putDataVersionedMethodLocal;
-      methods[putDataEraseVersionedMethodLocal_id] = putDataEraseVersionedMethodLocal;
-      methods[putKeyValVersionedMethodLocal_id] = putKeyValVersionedMethodLocal;
-      methods[removeDataVersionedMethodLocal_id] = removeDataVersionedMethodLocal;
-      methods[removeKeyVersionedMethodLocal_id] = removeKeyVersionedMethodLocal;
-      methods[removeNodeVersionedMethodLocal_id] = removeNodeVersionedMethodLocal;
-
-      methods[putForExternalReadVersionedMethodLocal_id] = putForExternalReadVersionedMethodLocal;
-      methods[putForExternalReadMethodLocal_id] = putForExternalReadMethodLocal;
-
-      methods[invalidateMethodLocal_id] = invalidateMethodLocal;
-
-      for (int id = 0; id < methods.length; id++)
-      {
-         if (methods[id] != null) methodIds.put(methods[id], id);
-      }
-
-      putMethodIds.add(putDataMethodLocal_id);
-      putMethodIds.add(putDataEraseMethodLocal_id);
-      putMethodIds.add(putKeyValMethodLocal_id);
-      putMethodIds.add(putDataEraseVersionedMethodLocal_id);
-      putMethodIds.add(putDataVersionedMethodLocal_id);
-      putMethodIds.add(putKeyValVersionedMethodLocal_id);
-      putMethodIds.add(putForExternalReadMethodLocal_id);
-      putMethodIds.add(putForExternalReadVersionedMethodLocal_id);
-
-      crudMethodIds.addAll(putMethodIds);
-      crudMethodIds.add(removeNodeMethodLocal_id);
-      crudMethodIds.add(removeKeyMethodLocal_id);
-      crudMethodIds.add(removeDataMethodLocal_id);
-      crudMethodIds.add(dataGravitationCleanupMethod_id);
-      crudMethodIds.add(moveMethodLocal_id);
-      crudMethodIds.add(removeNodeVersionedMethodLocal_id);
-      crudMethodIds.add(removeKeyVersionedMethodLocal_id);
-      crudMethodIds.add(removeDataVersionedMethodLocal_id);
-
-
-      transactionLifecycleMethodIds.add(commitMethod_id);
-      transactionLifecycleMethodIds.add(rollbackMethod_id);
-      transactionLifecycleMethodIds.add(prepareMethod_id);
-      transactionLifecycleMethodIds.add(optimisticPrepareMethod_id);
-
-      buddyGroupOrganisationMethodIds.add(remoteAnnounceBuddyPoolNameMethod_id);
-      buddyGroupOrganisationMethodIds.add(remoteAssignToBuddyGroupMethod_id);
-      buddyGroupOrganisationMethodIds.add(remoteRemoveFromBuddyGroupMethod_id);
-
-      blockUnblockMethodIds.add(blockChannelMethodLocal_id);
-      blockUnblockMethodIds.add(unblockChannelMethodLocal_id);
-
-   }
-
-   public static int lookupMethodId(Method method)
-   {
-      Integer methodIdInteger = methodIds.get(method);
-      int methodId = -1;
-
-      if (methodIdInteger != null)
-      {
-         methodId = methodIdInteger;
-      }
-      else
-      {
-         if (log.isWarnEnabled())
-         {
-            log.warn("Method " + method + " is not registered with " + CacheMarshaller200.class);
-         }
-      }
-
-      return methodId;
-   }
-
-   public static Method lookupMethod(int id)
-   {
-      Method method = methods[id];
-      if (method == null)
-      {
-         if (log.isErrorEnabled())
-         {
-            log.error("Method id " + id + " is not registered");
-         }
-         throw new CacheException("Method id " + id + " is not registered with " + CacheMarshaller200.class);
-      }
-      return method;
-   }
-
-   /**
-    * Returns true if the method is a CRUD method.
-    */
-   public static boolean isCrudMethod(int id)
-   {
-      return crudMethodIds.contains(id);
-   }
-
-   public static boolean isTransactionLifecycleMethod(int id)
-   {
-      return transactionLifecycleMethodIds.contains(id);
-   }
-
-   public static boolean isBuddyGroupOrganisationMethod(int id)
-   {
-      return buddyGroupOrganisationMethodIds.contains(id);
-   }
-
-   public static boolean isPutMethod(int id)
-   {
-      return putMethodIds.contains(id);
-   }
-
-   public static boolean isGetMethod(int methodId)
-   {
-      return methodId == getChildrenNamesMethodLocal_id || methodId == getDataMapMethodLocal_id || methodId == existsMethod_id
-            || methodId == getKeysMethodLocal_id || methodId == getKeyValueMethodLocal_id || methodId == getNodeMethodLocal_id;
-   }
-
-   public static boolean isBlockUnblockMethod(int id)
-   {
-      return blockUnblockMethodIds.contains(id);
-   }
-
-   /**
-    * Returns the versioned equivalent of a crud method.
-    */
-   public static Method getVersionedMethod(int methodId)
-   {
-      return methods[getVersionedMethodId(methodId)];
-   }
-
-   /**
-    * Counterpart to {@link #getVersionedMethod(int)}
-    */
-   public static Method getUnversionedMethod(int methodId)
-   {
-      return methods[getUnversionedMethodId(methodId)];
-   }
-
-
-   public static boolean isDataGravitationMethod(int methodId)
-   {
-      return methodId == MethodDeclarations.dataGravitationCleanupMethod_id || methodId == MethodDeclarations.dataGravitationMethod_id;
-   }
-
-   /**
-    * Tests whether remote calls to this method should return the value to the caller or just return a null (more efficient if the caller won't use this value anyway)
-    *
-    * @param methodId
-    * @return true if the caller expects the value to come back.
-    */
-   public static boolean returnValueForRemoteCall(int methodId)
-   {
-      return methodsThatNeedToReturnValuesToRemoteCallers.contains(methodId);
-   }
-
-   public static int getUnversionedMethodId(int methodId)
-   {
-      if (isCrudMethod(methodId))
-      {
-         switch (methodId)
-         {
-            case putForExternalReadVersionedMethodLocal_id:
-               return putForExternalReadMethodLocal_id;
-            case putDataEraseVersionedMethodLocal_id:
-               return putDataEraseMethodLocal_id;
-            case putDataVersionedMethodLocal_id:
-               return putDataMethodLocal_id;
-            case putKeyValVersionedMethodLocal_id:
-               return putKeyValMethodLocal_id;
-            case removeDataVersionedMethodLocal_id:
-               return removeDataMethodLocal_id;
-            case removeKeyVersionedMethodLocal_id:
-               return removeKeyMethodLocal_id;
-            case removeNodeVersionedMethodLocal_id:
-               return removeNodeMethodLocal_id;
-            case moveMethodLocal_id:
-               return moveMethodLocal_id;
-            default:
-               throw new CacheException("Unrecognised method id " + methodId);
-         }
-      }
-      else
-      {
-         throw new CacheException("Attempting to look up a versioned equivalent of a non-cachedata method");
-      }
-   }
-
-   public static int getVersionedMethodId(int methodId)
-   {
-      if (isCrudMethod(methodId))
-      {
-         switch (methodId)
-         {
-            case putForExternalReadMethodLocal_id:
-               return putForExternalReadVersionedMethodLocal_id;
-            case putDataEraseMethodLocal_id:
-               return putDataEraseVersionedMethodLocal_id;
-            case putDataMethodLocal_id:
-               return putDataVersionedMethodLocal_id;
-            case putKeyValMethodLocal_id:
-               return putKeyValVersionedMethodLocal_id;
-            case removeDataMethodLocal_id:
-               return removeDataVersionedMethodLocal_id;
-            case removeKeyMethodLocal_id:
-               return removeKeyVersionedMethodLocal_id;
-            case removeNodeMethodLocal_id:
-               return removeNodeVersionedMethodLocal_id;
-            case moveMethodLocal_id:
-               return moveMethodLocal_id;
-            default:
-               throw new CacheException("Unrecognised method id " + methodId);
-         }
-      }
-      else
-      {
-         throw new CacheException("Attempting to look up a versioned equivalent of a non-cachedata method");
-      }
-   }
-
-   /**
-    * Returns true if the method call is declared in the public Cache API.  This includes all put, get, remove, getChildrenNames,
-    * exists calls, but not calls like commit, rollback, prepare, block, unblock, etc.
-    *
-    * @param id method call id to test
-    * @return true if this is an API method call.
-    */
-   public static boolean isAPIMethodCall(int id)
-   {
-      return isCrudMethod(id) || isGetMethod(id);
-   }
-}
-

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -12,6 +12,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
+import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
@@ -22,8 +23,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.lang.reflect.Method;
-
 /**
  * Tests the "activate/deactivate" functionality of LegacyTreeCacheMarshaller.
  *
@@ -183,10 +182,9 @@
       rman.activate(A);
       assertTrue(rman.hasRegion(A, Region.Type.MARSHALLING));
 
-      MethodCall result = (MethodCall) testee.objectFromByteBuffer(callBytes);
-      Method method = result.getMethod();
+      CacheCommand result = (CacheCommand) testee.objectFromByteBuffer(callBytes);
       assertEquals("Did not get replicate method when passing" +
-            " call for active node", MethodDeclarations.replicateMethod, method);
+            " call for active node", ReplicateCommand.class, result.getClass());
    }
 
 }

Deleted: core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,138 +0,0 @@
-package org.jboss.cache.marshall;
-
-import org.jboss.cache.commands.cachedata.*;
-import org.jboss.cache.commands.channel.BlockChannelCommand;
-import org.jboss.cache.commands.channel.UnblockChannelCommand;
-import org.jboss.cache.commands.functional.MarshallableCommand;
-import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
-import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
-import org.jboss.cache.commands.remote.ClusteredGetCommand;
-import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
-import org.jboss.cache.commands.remote.GravitateDataCommand;
-import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
-import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * A simple test that ensures wire level compatibility of method ids and parameters between 2.1.0 and 2.2.0 (onwards).
- * <p/>
- * Sadly, this test cannot be automated easily.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 2.2.0
- */
- at Test(groups = "manual")
-public class BackwardCompatTest
-{
-   private SortedMap<Integer, Field> fieldMap = new TreeMap<Integer, Field>();
-   private List<Integer> unusedIds;
-   private SortedMap<Integer, Class<? extends MarshallableCommand>> commands = new TreeMap<Integer, Class<? extends MarshallableCommand>>();
-
-   @BeforeTest
-   public void setUp() throws Exception
-   {
-      Field[] fields = MethodDeclarations.class.getFields();
-      for (Field f : fields)
-      {
-         if (f.getName().endsWith("_id"))
-         {
-            // this is a method id.
-            Integer fieldValue = (Integer) f.get(MethodDeclarations.class);
-            fieldMap.put(fieldValue, f);
-         }
-      }
-
-      System.out.println("Map size: " + fieldMap.size());
-
-      // unused IDs.  For some reason or the other these were not used in JBoss Cache 2.1.0, but may have been used in prior versions.
-      // as such they should never be used in this or future versions.
-      Integer[] unusedIdArray = {0, 4, 15, 17, 19, 20, 21, 27, 32, 33};
-      unusedIds = Arrays.asList(unusedIdArray);
-
-      // initialise all commands
-      commands.put(ExistsNodeCommand.METHOD_ID, ExistsNodeCommand.class);
-      commands.put(GetChildrenNamesCommand.METHOD_ID, GetChildrenNamesCommand.class);
-      commands.put(GetDataMapCommand.METHOD_ID, GetDataMapCommand.class);
-      commands.put(GetKeysCommand.METHOD_ID, GetKeysCommand.class);
-      commands.put(GetKeyValueCommand.METHOD_ID, GetKeyValueCommand.class);
-      commands.put(GetNodeCommand.METHOD_ID, GetNodeCommand.class);
-      commands.put(MoveCommand.METHOD_ID, MoveCommand.class);
-      commands.put(PutDataMapCommand.ERASE_METHOD_ID, PutDataMapCommand.class);
-      commands.put(PutDataMapCommand.METHOD_ID, PutDataMapCommand.class);
-      commands.put(PutDataMapCommand.ERASE_VERSIONED_METHOD_ID, PutDataMapCommand.class);
-      commands.put(PutDataMapCommand.VERSIONED_METHOD_ID, PutDataMapCommand.class);
-      commands.put(PutKeyValueCommand.METHOD_ID, PutKeyValueCommand.class);
-      commands.put(PutKeyValueCommand.PUT_FOR_EXT_READ_METHOD_ID, PutKeyValueCommand.class);
-      commands.put(PutKeyValueCommand.PUT_FOR_EXT_READ_VERSIONED_METHOD_ID, PutKeyValueCommand.class);
-      commands.put(PutKeyValueCommand.VERSIONED_METHOD_ID, PutKeyValueCommand.class);
-      commands.put(RemoveDataCommand.METHOD_ID, RemoveDataCommand.class);
-      commands.put(RemoveDataCommand.VERSIONED_METHOD_ID, RemoveDataCommand.class);
-      commands.put(RemoveKeyCommand.METHOD_ID, RemoveKeyCommand.class);
-      commands.put(RemoveKeyCommand.VERSIONED_METHOD_ID, RemoveKeyCommand.class);
-      commands.put(RemoveNodeCommand.METHOD_ID, RemoveNodeCommand.class);
-      commands.put(RemoveNodeCommand.VERSIONED_METHOD_ID, RemoveNodeCommand.class);
-      commands.put(BlockChannelCommand.METHOD_ID, BlockChannelCommand.class);
-      commands.put(UnblockChannelCommand.METHOD_ID, UnblockChannelCommand.class);
-      commands.put(AnnounceBuddyPoolNameCommand.METHOD_ID, AnnounceBuddyPoolNameCommand.class);
-      commands.put(AssignToBuddyGroupCommand.METHOD_ID, AssignToBuddyGroupCommand.class);
-      commands.put(ClusteredGetCommand.METHOD_ID, ClusteredGetCommand.class);
-      commands.put(DataGravitationCleanupCommand.METHOD_ID, DataGravitationCleanupCommand.class);
-      commands.put(RemoveFromBuddyGroupCommand.METHOD_ID, RemoveFromBuddyGroupCommand.class);
-      commands.put(ReplicateCommand.SINGLE_METHOD_ID, ReplicateCommand.class);
-      commands.put(ReplicateCommand.MULTIPLE_METHOD_ID, ReplicateCommand.class);
-      commands.put(CommitCommand.METHOD_ID, CommitCommand.class);
-      commands.put(OptimisticPrepareCommand.METHOD_ID, OptimisticPrepareCommand.class);
-      commands.put(PrepareCommand.METHOD_ID, PrepareCommand.class);
-      commands.put(RollbackCommand.METHOD_ID, RollbackCommand.class);
-      commands.put(EvictNodeCommand.METHOD_ID, EvictNodeCommand.class);
-      commands.put(EvictNodeCommand.VERSIONED_METHOD_ID, EvictNodeCommand.class);
-      commands.put(GravitateDataCommand.METHOD_ID, GravitateDataCommand.class);
-      commands.put(InvalidateCommand.METHOD_ID, InvalidateCommand.class);
-   }
-
-   public void testUnusedMethodIds()
-   {
-      // ensure that the unused method ids aren't used by any of the Commands.
-      for (Integer i : unusedIds)
-      {
-         assert !commands.containsKey(i) : "Id [" + i + "] is used by Command " + commands.get(i).getName();
-         assert !fieldMap.containsKey(i) : "Id [" + i + "] is used by MethodDeclarations class in field " + fieldMap.get(i).getName();
-      }
-   }
-
-   public void testMethodCalls() throws Exception
-   {
-      assert 47 == fieldMap.lastKey();
-      assert 47 == commands.lastKey() : "Expected commands last key to be 47; was " + commands.lastKey();
-      printMaps();
-      assert commands.size() == fieldMap.size() : "Was expecting commands and fieldMap sizes to be the same.  FieldMap size is " + fieldMap.size() + " and commands size is " + commands.size();
-   }
-
-   private void printMaps()
-   {
-      for (int i = 0; i < fieldMap.lastKey(); i++)
-      {
-         boolean unused = unusedIds.contains(i);
-         System.out.print("ID: " + i);
-         if (unused)
-         {
-            System.out.println(" *** UNUSED");
-         }
-         else
-         {
-            System.out.println(" Field: " + fieldMap.get(i).getName() + " Command: " + commands.get(i));
-         }
-      }
-   }
-}

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -3,7 +3,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.commands.CacheCommand;
+import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.Test;
 
 import java.io.ByteArrayInputStream;
@@ -34,7 +34,7 @@
 
       byte[] buf = marshaller.objectToByteBuffer(replicateCommand);
 
-      assertMethodCallsEquals(replicateCommand, (CacheCommand) marshaller.objectFromByteBuffer(buf));
+      assertEquals(replicateCommand, marshaller.objectFromByteBuffer(buf));
    }
 
    protected Map createMap(int size)

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -10,6 +10,9 @@
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.ComponentRegistry;
 import static org.testng.AssertJUnit.assertEquals;
@@ -51,28 +54,6 @@
       marshaller = null;
    }
 
-   protected void assertMethodCallsEquals(CacheCommand call1, CacheCommand call2)
-   {
-      if (call1 == call2) return;
-
-//      assertEquals("Method IDs should match", call1.getMethodId(), call2.getMethodId());
-//      assertEquals("Method names should match", call1.getName(), call2.getName());
-//      assertEquals("Method reflection objects should match", call1.getMethod(), call2.getMethod());
-//      if (call1.getArgs() == null || call2.getArgs() == null)
-//      {
-//         assertNull("Both args should be null", call1.getArgs());
-//         assertNull("Both args should be null", call2.getArgs());
-//      }
-//      else
-//      {
-//         Object[] call1Args = call1.getArgs();
-//         Object[] call2Args = call2.getArgs();
-//
-//         assertObjectArraysAreEqual(call1Args, call2Args);
-//      }
-      assertEquals(call1, call2);
-   }
-
    protected void assertObjectArraysAreEqual(Object[] a1, Object[] a2)
    {
       assertEquals("Number of args should match", a1.length, a2.length);
@@ -133,29 +114,27 @@
    public void testMethodCall() throws Exception
    {
       Fqn fqn = Fqn.fromElements(3, false);
-      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
-      byte[] asBytes = marshaller.objectToByteBuffer(call);
+      CacheCommand cmd = new PutKeyValueCommand(null, fqn, "key", "value", false, false);
+      byte[] asBytes = marshaller.objectToByteBuffer(cmd);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
 
       assertTrue("Unmarshalled object should be a method call", o2 instanceof MethodCall);
-      MethodCall m2 = (MethodCall) o2;
+      CacheCommand cmd2 = (CacheCommand) o2;
 
-      //todo - revisit after refactoring
-//      assertMethodCallsEquals(call, m2);
+      assertEquals(cmd, cmd2);
    }
 
    public void testNestedMethodCall() throws Exception
    {
       Fqn fqn = Fqn.fromElements(3, false);
-      MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
-      MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call);
-      byte[] asBytes = marshaller.objectToByteBuffer(replicateCall);
+      MarshallableCommand cmd = new PutKeyValueCommand(null, fqn, "key", "value", false, false);
+      CacheCommand replicateCmd = new ReplicateCommand(cmd);
+      byte[] asBytes = marshaller.objectToByteBuffer(replicateCmd);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
-      assertTrue("Unmarshalled object should be a method call", o2 instanceof MethodCall);
-      MethodCall m2 = (MethodCall) o2;
+      assertTrue("Unmarshalled object should be a method call", o2 instanceof CacheCommand);
+      CacheCommand cmd2 = (CacheCommand) o2;
 
-      //todo - revisit after refactoring
-//      assertMethodCallsEquals(replicateCall, m2);
+      assertEquals(replicateCmd, cmd2);
    }
 
    public void testLargeString() throws Exception
@@ -233,26 +212,26 @@
    protected void doReplicationQueueTest() throws Exception
    {
       // replication queue takes a list of replicate() MethodCalls and wraps them in a single replicate call.
-      List<MethodCall> calls = new ArrayList<MethodCall>();
+      List<MarshallableCommand> calls = new ArrayList<MarshallableCommand>();
 
       Fqn f = Fqn.fromElements("BlahBlah", 3, false);
       String k = "key", v = "value";
 
-      MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, f, k, v, true);
-      MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, actualCall);
+      MarshallableCommand cmd = new PutKeyValueCommand(null, f, k, v, true, false);
+      MarshallableCommand replCmd = new ReplicateCommand(cmd);
 
-      calls.add(replicateCall);
+      calls.add(replCmd);
 
-      actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, f, k, v, true);
-      replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, actualCall);
+      cmd = new PutKeyValueCommand(null, f, k, v, true, false);
+      replCmd = new ReplicateCommand(cmd);
 
-      calls.add(replicateCall);
+      calls.add(replCmd);
 
-      MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateAllMethod_id, calls);
+      MarshallableCommand replAllCmd = new ReplicateCommand(calls);
 
-      byte[] buf = marshaller.objectToByteBuffer(call);
-      //todo - revisit after refactoring
-//      assertMethodCallsEquals(call, (MethodCall) marshaller.objectFromByteBuffer(buf));
+      byte[] buf = marshaller.objectToByteBuffer(replAllCmd);
+
+      assertEquals(replAllCmd, marshaller.objectFromByteBuffer(buf));
    }
 
 }

Deleted: core/trunk/src/test/java/org/jboss/cache/marshall/CrudMethodTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CrudMethodTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CrudMethodTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,75 +0,0 @@
-/*
- *
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.marshall;
-
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * Checks CRUD methods
- *
- * @author Bela Ban
- * @version $Id$
- */
- at Test(groups = {"functional"})
-public class CrudMethodTest
-{
-   public void testPutMethods()
-   {
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataEraseMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putKeyValMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataEraseVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putKeyValVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putForExternalReadMethodLocal_id));
-      assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putForExternalReadVersionedMethodLocal_id));
-   }
-
-   public void testTransactionLifecycleMethods()
-   {
-      assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.commitMethod_id));
-      assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.rollbackMethod_id));
-      assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.prepareMethod_id));
-      assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.optimisticPrepareMethod_id));
-   }
-
-   public void testCrudMethods()
-   {
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataEraseMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putKeyValMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeDataMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeKeyMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeNodeMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.dataGravitationCleanupMethod_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.moveMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataEraseVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putKeyValVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeDataVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeKeyVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeNodeVersionedMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putForExternalReadMethodLocal_id));
-      assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putForExternalReadVersionedMethodLocal_id));
-
-      assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getKeyValueMethodLocal_id));
-      assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getNodeMethodLocal_id));
-      assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getKeysMethodLocal_id));
-      assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getChildrenNamesMethodLocal_id));
-   }
-
-   public void testBuddyGroupOrganisationMethods()
-   {
-      assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod_id));
-      assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteAssignToBuddyGroupMethod_id));
-      assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteRemoveFromBuddyGroupMethod_id));
-   }
-}

Deleted: core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,42 +0,0 @@
-package org.jboss.cache.marshall;
-
-import org.jboss.cache.transaction.GlobalTransaction;
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
- * @deprecated MethodCall will be legacy
- */
- at Test(groups = {"functional"})
-public class MethodCallFactoryTest
-{
-   public void testVarArgsMethod()
-   {
-      GlobalTransaction gtx = new GlobalTransaction();
-      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
-
-      assertEquals(gtx, c.getArgs()[0]);
-   }
-
-   public void testObjectArrayMethod()
-   {
-      GlobalTransaction gtx = new GlobalTransaction();
-      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
-
-      assertEquals(gtx, c.getArgs()[0]);
-   }
-
-   public void testMultipleArrayElems()
-   {
-      GlobalTransaction gtx = new GlobalTransaction();
-      MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx, gtx, gtx);
-
-      assertEquals(gtx, c.getArgs()[0]);
-      assertEquals(gtx, c.getArgs()[1]);
-      assertEquals(gtx, c.getArgs()[2]);
-
-      assertEquals(3, c.getArgs().length);
-   }
-
-}

Deleted: core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -1,93 +0,0 @@
-package org.jboss.cache.marshall;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.invocation.CacheInvocationDelegate;
-import org.jboss.cache.misc.TestingUtil;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-
-/**
- * Tests whether remote calls to RPC methods suppress return values (as sometimes expected)
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
- * @since 2.0.0
- * todo - revisit after command refactoring
- */
- at Test(groups = {"functional"})
-public class RemoteCallerReturnValuesTest
-{
-   private CacheSPI<Object, Object> cache;
-   private Fqn fqn = Fqn.fromString("/a");
-   private Object key = "key";
-   private Object value = "value";
-   private Method invokeMethod;
-
-   @BeforeMethod(alwaysRun = true)
-   public void setUp() throws Exception
-   {
-      cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
-      cache.put(fqn, key, value);
-      CacheInvocationDelegate rcid = TestingUtil.getInvocationDelegate(cache);
-      invokeMethod = cache.getClass().getSuperclass().getDeclaredMethod("invoke", MethodCall.class);
-   }
-
-   @AfterMethod(alwaysRun = true)
-   public void tearDown()
-   {
-      cache.stop();
-   }
-
-   public void testMethodsThatShouldReturnValues() throws Throwable
-   {
-//      MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal_id, fqn);
-//      assert rcid._replicate(mc) == null;
-//      List l = rcid.clusteredGet(mc, false);
-
-//      assert l != null;
-//      assert (Boolean) l.get(0);
-//      assert l.get(1).equals(Collections.singleton(key));
-   }
-
-
-   /**
-    * The purpose of this test is to ensure that these remote method calls - when called using _replicate - will always return null
-    * since a return value is not neeeded.
-    *
-    * @throws Throwable
-    */
-   public void testMethodsThatShouldReturnNull() throws Throwable
-   {
-      doNullReturnTest(MethodDeclarations.getDataMapMethodLocal_id, Collections.singletonMap(key, value), fqn);
-      doNullReturnTest(MethodDeclarations.getNodeMethodLocal_id, cache.getNode(fqn), fqn);
-      doNullReturnTest(MethodDeclarations.getKeysMethodLocal_id, Collections.singleton(key), fqn);
-      doNullReturnTest(MethodDeclarations.getChildrenNamesMethodLocal_id, Collections.emptySet(), fqn);
-      doNullReturnTest(MethodDeclarations.putKeyValMethodLocal_id, value, null, fqn, key, value, true);
-      doNullReturnTest(MethodDeclarations.removeKeyMethodLocal_id, value, null, fqn, key, true);
-   }
-
-
-   private void doNullReturnTest(int methodId, Object expectedretValForLocalTest, Object... args) throws Throwable
-   {
-//      MethodCall mc = MethodCallFactory.create(methodId, args);
-//      // "local" version of the call:
-//      Object retVal = invokeCallDirectly(mc);
-//      assert retVal != null && retVal.equals(expectedretValForLocalTest);
-//
-//      // now try this using the replicate method.
-//      Object retVal2 = rcid._replicate(mc);
-//      assert retVal2 == null;
-   }
-
-   private Object invokeCallDirectly(MethodCall mc) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
-   {
-      invokeMethod.setAccessible(true);
-      return invokeMethod.invoke(cache, mc);
-   }
-}

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -11,21 +11,22 @@
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.VersionedNode;
 import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.commands.functional.TxCacheCommand;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.invocation.NodeInvocationDelegate;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import org.jgroups.Address;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.jgroups.Address;
 
 import javax.transaction.RollbackException;
 import javax.transaction.Transaction;
@@ -156,8 +157,8 @@
 
       List<?> calls = dummy.getAllCalled();
 
-      assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.class, calls.get(0));
+      assertEquals(CommitCommand.class, calls.get(1));
    }
 
    public void testRollbackTransaction() throws Exception
@@ -187,7 +188,7 @@
       List<?> calls = dummy.getAllCalled();
 
       assertEquals(1, calls.size());
-      assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
+      assertEquals(RollbackCommand.class, calls.get(0));
    }
 
    public void testRemotePrepareTransaction() throws Throwable
@@ -226,7 +227,7 @@
       commandsFactory = new CommandsFactory();
       //call our remote method
       List<TxCacheCommand> cacheCommands = injectDataVersion(entry.getModifications());
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, cacheCommands, (Map)null, (Address)remoteGtx.getAddress(), false);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, cacheCommands, (Map) null, (Address) remoteGtx.getAddress(), false);
 
       TestingUtil.replicateCommand(c, prepareCommand);
 
@@ -243,7 +244,7 @@
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
       assertEquals(1, entry.getModifications().size());
       List<?> calls = dummy.getAllCalled();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.class, calls.get(2));
 
       assertEquals(1, c.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, c.getTransactionTable().getNumLocalTransactions());

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -11,10 +11,10 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.TxInterceptor;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
@@ -297,7 +297,7 @@
       {
          public Object hanldeDefault(InvocationContext ctx, CacheCommand command) throws Throwable
          {
-            if (Thread.currentThread().getName().equals(slowThreadName) && ctx.getMethodCall().getMethodId() == MethodDeclarations.optimisticPrepareMethod_id)
+            if (Thread.currentThread().getName().equals(slowThreadName) && ctx.getMethodCall().getMethodId() == OptimisticPrepareCommand.METHOD_ID)
             {
                Thread.sleep(1000);
             }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,10 +2,9 @@
 
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.marshall.MethodCall;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -19,20 +18,16 @@
  */
 public class MockFailureInterceptor extends ChainedInterceptor
 {
-   private List<Method> allCalled = new ArrayList<Method>();
-   private List<Method> failurelist = new ArrayList<Method>();
+   private List<Class<? extends CacheCommand>> allCalled = new ArrayList<Class<? extends CacheCommand>>();
+   private List<Class<? extends CacheCommand>> failurelist = new ArrayList<Class<? extends CacheCommand>>();
    private List<Integer> allCalledIdsList = new ArrayList<Integer>();
 
    @Override
    public Object handleDefault(InvocationContext ctx, CacheCommand command) throws Throwable
    {
-      MethodCall m = ctx.getMethodCall();
-//      if (!MethodDeclarations.isBlockUnblockMethod(m.getMethodId()))
-//      {
-         if (failurelist.contains(m.getMethod())) throw new Exception("Failure in method " + m);
-         allCalled.add(m.getMethod());
-         allCalledIdsList.add(m.getMethodId());
-//      }
+      if (failurelist.contains(command.getClass())) throw new Exception("Failure in method " + command);
+      allCalled.add(command.getClass());
+      allCalledIdsList.add(((MarshallableCommand) command).getCommandId());
 
       return null;
    }
@@ -40,7 +35,7 @@
    /**
     * @return Returns the failurelist.
     */
-   public List<Method> getFailurelist()
+   public List<Class<? extends CacheCommand>> getFailurelist()
    {
       return failurelist;
    }
@@ -48,7 +43,7 @@
    /**
     * @param failurelist The failurelist to set.
     */
-   public void setFailurelist(List<Method> failurelist)
+   public void setFailurelist(List<Class<? extends CacheCommand>> failurelist)
    {
       this.failurelist = failurelist;
    }
@@ -56,7 +51,7 @@
    /**
     * @return Returns the called.
     */
-   public List<Method> getAllCalled()
+   public List<Class<? extends CacheCommand>> getAllCalled()
    {
       return allCalled;
    }
@@ -64,7 +59,7 @@
    /**
     * @param called The called to set.
     */
-   public void setAllCalled(List<Method> called)
+   public void setAllCalled(List<Class<? extends CacheCommand>> called)
    {
       this.allCalled = called;
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -2,11 +2,9 @@
 
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodDeclarations;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -21,15 +19,14 @@
 public class MockInterceptor extends ChainedInterceptor
 {
    CacheCommand calledCommand;
-   private List<Method> calledlist = new ArrayList<Method>();
+   private List<Class<? extends CacheCommand>> calledlist = new ArrayList<Class<? extends CacheCommand>>();
    private List<Integer> calledIdsList = new ArrayList<Integer>();
 
    @Override
    public synchronized Object handleDefault(InvocationContext ctx, CacheCommand command) throws Throwable
    {
-      MethodCall m = ctx.getMethodCall();
-      calledlist.add(m.getMethod());
-      calledIdsList.add(m.getMethodId());
+      calledlist.add(command.getClass());
+      calledIdsList.add(((MarshallableCommand) command).getCommandId());
       calledCommand = command;
       return null;
    }
@@ -42,8 +39,13 @@
       return calledCommand;
    }
 
-   public List<Method> getAllCalled()
+   public Class<? extends CacheCommand> getCalledCommandClass()
    {
+      return calledCommand.getClass();
+   }
+
+   public List<Class<? extends CacheCommand>> getAllCalled()
+   {
       return calledlist;
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -9,8 +9,9 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.interceptors.CallInterceptor;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
@@ -80,8 +81,8 @@
       mgr.commit();
 
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
 
       //assert what should be the results of our call
       assertEquals(0, workspace.getNodes().size());
@@ -171,8 +172,8 @@
       assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
 
    }
 
@@ -229,8 +230,8 @@
       assertEquals(3, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
    }
 
 
@@ -289,8 +290,8 @@
 
       assertEquals(3, entry.getModifications().size());
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
       assertEquals(2, listener.getNodesAdded());
    }
 
@@ -351,8 +352,8 @@
       assertEquals(3, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
 
       assertEquals(2, listener.getNodesAdded());
    }
@@ -402,8 +403,8 @@
       assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
-      assert dummy.getAllCalled().contains(MethodDeclarations.commitMethod);
-      assert dummy.getAllCalled().contains(MethodDeclarations.optimisticPrepareMethod);
+      assert dummy.getAllCalled().contains(CommitCommand.class);
+      assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
 
       assertEquals(2, listener.getNodesAdded());
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -8,10 +8,10 @@
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
 import org.jboss.cache.loader.SamplePojo;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -83,7 +83,7 @@
       assertTrue(entry.getLocks().isEmpty());
 
       assertTrue(!cache.exists("/one/two"));
-      assertEquals(MethodDeclarations.putKeyValMethodLocal, dummy.getCalledCommand());
+      assertEquals(PutKeyValueCommand.class, dummy.getCalledCommandClass());
       txManager.commit();
 
       cache.stop();
@@ -113,7 +113,7 @@
       assertTrue(entry.getLocks().isEmpty());
 
       assertTrue(!cache.exists("/one/two"));
-      assertEquals(MethodDeclarations.putKeyValMethodLocal, dummy.getCalledCommand());
+      assertEquals(PutKeyValueCommand.class, dummy.getCalledCommandClass());
 
       txManager.commit();
       // we should now remove stuff from the InvocationCtx
@@ -157,7 +157,7 @@
       assertTrue(entry.getLocks().isEmpty());
 
       assertTrue(!cache.exists("/one/two"));
-      assertEquals(MethodDeclarations.putKeyValMethodLocal, dummy.getCalledCommand());
+      assertEquals(PutKeyValueCommand.class, dummy.getCalledCommandClass());
 
       txManager.commit();
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -8,11 +8,13 @@
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.loader.SamplePojo;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -84,8 +86,8 @@
 
       List calls = dummy.getAllCalledIds();
 
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
    }
 
    public void testRollbackTransaction() throws Exception
@@ -111,7 +113,7 @@
       List calls = dummy.getAllCalledIds();
 
       assertEquals(1, calls.size());
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(0));
    }
 
    public void testRemotePrepareTransaction() throws Exception
@@ -171,7 +173,7 @@
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
       assertEquals(1, entry.getModifications().size());
       List calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -234,7 +236,7 @@
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
       assertEquals(1, entry.getModifications().size());
       List calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -252,7 +254,7 @@
       }
       //we should have the commit as well now
       assertNull(mgr.getTransaction());
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(3));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(3));
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
    }
@@ -424,7 +426,7 @@
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
       assertEquals(1, entry.getModifications().size());
       List calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -442,7 +444,7 @@
       }
       //we should have the commit as well now
       assertNull(mgr.getTransaction());
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(3));
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
    }
@@ -490,12 +492,12 @@
 
       List calls = dummy.getAllCalledIds();
 
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
       List calls2 = dummy2.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls2.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls2.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls2.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls2.get(1));
 
       destroyCache(cache2);
    }
@@ -512,7 +514,7 @@
       CacheSPI cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
       MockFailureInterceptor dummy2 = new MockFailureInterceptor();
       List failures = new ArrayList();
-      failures.add(MethodDeclarations.optimisticPrepareMethod);
+      failures.add(OptimisticPrepareCommand.class);
       dummy2.setFailurelist(failures);
       setAlteredInterceptorChain(dummy2, cache2);
 
@@ -552,12 +554,12 @@
 
 
       List calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(1));
 
       //we have no prepare - as it failed - but we have a commit
       List calls2 = dummy2.getAllCalledIds();
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls2.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls2.get(0));
 
       destroyCache(cache2);
    }
@@ -577,7 +579,7 @@
       setAlteredInterceptorChain(dummy, cache);
 
       List failures = new ArrayList();
-      failures.add(MethodDeclarations.optimisticPrepareMethod);
+      failures.add(OptimisticPrepareCommand.class);
       dummy.setFailurelist(failures);
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
@@ -616,7 +618,7 @@
 
 
       List calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(0));
 
       //we have no prepare - as it failed - but we have a commit
       List calls2 = dummy2.getAllCalledIds();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -13,15 +13,14 @@
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.loader.SamplePojo;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jboss.cache.transaction.TransactionTable;
+import org.jgroups.Address;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
-import org.jgroups.Address;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -62,8 +61,8 @@
 
       List<?> calls = dummy.getAllCalledIds();
 
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
       //flesh this out a bit more
 
    }
@@ -96,8 +95,8 @@
       assertNull(mgr.getTransaction());
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
@@ -128,7 +127,7 @@
 
       List<?> calls = dummy.getAllCalledIds();
       assertEquals(1, calls.size());
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(0));
 
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -214,8 +213,8 @@
       assertNull(mgr.getTransaction());
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
       boolean failed = false;
       try
       {
@@ -261,8 +260,8 @@
       assertNull(mgr.getTransaction());
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -298,8 +297,8 @@
 
       //test local calls
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
       assertNull(mgr.getTransaction());
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -314,7 +313,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map)null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -333,7 +332,7 @@
 
       //assert that the method has been passed up the stack
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
       //assert we have the tx in th table
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -373,7 +372,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map)null, (Address)remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -393,7 +392,7 @@
 
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
 
       //assert we have two current transactions
       assertEquals(2, cache.getTransactionTable().getNumGlobalTransactions());
@@ -404,8 +403,8 @@
 
       //check local calls
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(1));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(1));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(2));
 
       //assert we have only 1 transaction left
 
@@ -456,7 +455,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address)remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -489,8 +488,8 @@
       assertNull(table.getLocalTransaction(remoteGtx));
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
@@ -499,8 +498,8 @@
       mgr.commit();
 
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(3));
 
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -544,7 +543,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map)null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -576,8 +575,8 @@
       assertNull(table.getLocalTransaction(remoteGtx));
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(1));
 
       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
@@ -586,8 +585,8 @@
       mgr.commit();
 
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(3));
 
 
       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -625,8 +624,8 @@
 
       //test local calls
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
       assertNull(mgr.getTransaction());
 
@@ -642,7 +641,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map)null, (Address)remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -664,7 +663,7 @@
       assertEquals(1, table.get(remoteGtx).getModifications().size());
 
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
       assertNull(mgr.getTransaction());
 //	    call our remote method
@@ -716,8 +715,8 @@
 
       //test local calls
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
@@ -726,7 +725,7 @@
       GlobalTransactionCommand command = (GlobalTransactionCommand) entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map)null, (Address)remoteGtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, command);
@@ -746,7 +745,7 @@
       assertEquals(1, table.get(remoteGtx).getModifications().size());
 
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
 
 //	    call our remote method
       RollbackCommand rollbackCommand = commandsFactory.buildRollbackCommand(remoteGtx);
@@ -760,8 +759,8 @@
       }
 
       calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
-      assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(3));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
+      assertEquals(RollbackCommand.METHOD_ID, calls.get(3));
 
       assertNull(table.get(remoteGtx));
       assertNull(table.getLocalTransaction(remoteGtx));
@@ -802,11 +801,11 @@
 
 
       List<?> calls = dummy.getAllCalledIds();
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(1));
 
-      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
-      assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
+      assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
+      assertEquals(CommitCommand.METHOD_ID, calls.get(3));
       cache.stop();
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -10,10 +10,10 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.interceptors.InvocationContextInterceptor;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
@@ -21,19 +21,16 @@
 import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
 import org.jboss.cache.interceptors.base.ChainedInterceptor;
 import org.jboss.cache.loader.SamplePojo;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodCallFactory;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
 import org.jboss.cache.util.CachePrinter;
+import org.jgroups.Address;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.jgroups.Address;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -114,7 +111,7 @@
       assertEquals(null, dummy.getCalledCommand());
 
       commandsFactory = new CommandsFactory();
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map)null, (Address) gtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map) null, (Address) gtx.getAddress(), Boolean.FALSE);
       //now let us do a prepare
       TestingUtil.replicateCommand(cache, prepareCommand);
 
@@ -167,7 +164,7 @@
       //lets change one of the underlying version numbers
       workspace.getNode(Fqn.fromString("/one/two")).getNode().setVersion(new DefaultDataVersion(2));
       //now let us do a prepare
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map)null, (Address) gtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map) null, (Address) gtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -214,7 +211,7 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map)null, (Address) gtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map) null, (Address) gtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -225,7 +222,6 @@
          assertTrue(true);
       }
 
-      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
       CommitCommand commitCommand = commandsFactory.buildCommitCommand(gtx);
       TestingUtil.replicateCommand(cache, commitCommand);
 
@@ -238,7 +234,7 @@
       assertEquals(1, entry.getModifications().size());
 
 
-      assertEquals(commitMethod.getMethod(), dummy.getCalledCommand());
+      assertEquals(commitCommand, dummy.getCalledCommand());
       NodeSPI<Object, Object> node = workspace.getNode(Fqn.ROOT).getNode();
       //assert we can navigate
 
@@ -292,7 +288,7 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map)null, (Address)gtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map) null, (Address) gtx.getAddress(), Boolean.FALSE);
       try
       {
          TestingUtil.replicateCommand(cache, prepareCommand);
@@ -371,7 +367,7 @@
 
       //lets change one of the underlying version numbers
       //now let us do a prepare
-      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map)null, (Address)gtx.getAddress(), Boolean.FALSE);
+      OptimisticPrepareCommand prepareCommand = commandsFactory.buildOptimisticPrepareCommand(gtx, entry.getModifications(), (Map) null, (Address) gtx.getAddress(), Boolean.FALSE);
 
       try
       {
@@ -383,7 +379,6 @@
          assertTrue(true);
       }
 
-      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
       RollbackCommand rollbackCommand = commandsFactory.buildRollbackCommand(null);
       TestingUtil.replicateCommand(cache, rollbackCommand);
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java	2008-04-14 18:13:55 UTC (rev 5561)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java	2008-04-14 20:55:04 UTC (rev 5562)
@@ -8,8 +8,6 @@
 import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodDeclarations;
 import org.jboss.cache.misc.TestingUtil;
 import org.jgroups.Address;
 import org.jgroups.blocks.RspFilter;
@@ -196,7 +194,7 @@
       private boolean isCommitMethod(CacheCommand call)
       {
          //todo reimplement
-//         return call.getMethodId() == MethodDeclarations.commitMethod_id ||
+//         return call.getMethodId() == CommitCommand.METHOD_ID ||
 //               (call.getMethodId() == MethodDeclarations.replicateMethod_id && isCommitMethod((MethodCall) call.getArgs()[0]));
          return false;
       }




More information about the jbosscache-commits mailing list