[jbosscache-commits] JBoss Cache SVN: r5712 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 24 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Apr 28 06:08:56 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-28 06:08:55 -0400 (Mon, 28 Apr 2008)
New Revision: 5712

Added:
   core/trunk/src/main/java/org/jboss/cache/DataContainer.java
   core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java
   core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/VisitorInterceptor.java
Removed:
   core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/ChainedInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/CacheSPI.java
   core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
   core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
   core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
   core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
   core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.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/factories/ComponentRegistry.java
   core/trunk/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
   core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.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/MarshalledValueInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
   core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
   core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
   core/trunk/src/main/java/org/jboss/cache/jmx/JmxUtil.java
   core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
   core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
   core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
   core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainTestBase.java
   core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/invocation/InterceptorChainTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
   core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
   core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.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/NodeInterceptorGetChildrenNamesTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
Log:
More refactoring and renaming

Modified: core/trunk/src/main/java/org/jboss/cache/CacheSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheSPI.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/CacheSPI.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -9,7 +9,7 @@
 import net.jcip.annotations.ThreadSafe;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.marshall.Marshaller;
@@ -26,7 +26,7 @@
 /**
  * A more detailed interface to {@link Cache}, which is used when writing plugins for or extending JBoss Cache.  A reference
  * to this interface should only be obtained when it is passed in to your code, for example when you write an
- * {@link ChainedInterceptor} or {@link CacheLoader}.
+ * {@link org.jboss.cache.interceptors.base.VisitorInterceptor} or {@link CacheLoader}.
  * <p/>
  * <B><I>You should NEVER attempt to directly cast a {@link Cache} instance to this interface.  In future, the implementation may not allow it.</I></B>
  * <p/>
@@ -82,11 +82,11 @@
     * From 2.1.0, Interceptor authors should obtain this by injection rather than this method.  See the
     * {@link org.jboss.cache.factories.annotations.Inject} annotation.
     *
-    * @return an immutable {@link List} of {@link ChainedInterceptor}s configured for this cache, or
+    * @return an immutable {@link List} of {@link org.jboss.cache.interceptors.base.VisitorInterceptor}s configured for this cache, or
     *         <code>null</code> if {@link Cache#create() create()} has not been invoked
     *         and the interceptors thus do not exist.
     */
-   List<ChainedInterceptor> getInterceptorChain();
+   List<VisitorInterceptor> getInterceptorChain();
 
    /**
     * Retrieves an instance of a {@link Marshaller}, which is capable of
@@ -111,7 +111,7 @@
     * @param i        the interceptor to add
     * @param position the position to add the interceptor
     */
-   void addInterceptor(ChainedInterceptor i, int position);
+   void addInterceptor(VisitorInterceptor i, int position);
 
    /**
     * Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type.  Throws a
@@ -120,7 +120,7 @@
     * @param i                interceptor to add
     * @param afterInterceptor interceptor type after which to place custom interceptor
     */
-   void addInterceptor(ChainedInterceptor i, Class<? extends ChainedInterceptor> afterInterceptor);
+   void addInterceptor(VisitorInterceptor i, Class<? extends VisitorInterceptor> afterInterceptor);
 
    /**
     * Removes the interceptor at a specified position, where the first interceptor in the chain
@@ -135,7 +135,7 @@
     *
     * @param interceptorType type of interceptor to remove
     */
-   void removeInterceptor(Class<? extends ChainedInterceptor> interceptorType);
+   void removeInterceptor(Class<? extends VisitorInterceptor> interceptorType);
 
    /**
     * Retrieves the current CacheCacheLoaderManager instance associated with the current Cache instance.

Copied: core/trunk/src/main/java/org/jboss/cache/DataContainer.java (from rev 5706, core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -0,0 +1,592 @@
+package org.jboss.cache;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.marshall.NodeData;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.transaction.GlobalTransaction;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A container for the root node in the cache - should be used to access any nodes, walk trees, etc.
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class DataContainer
+{
+
+   private static final Log log = LogFactory.getLog(DataContainer.class);
+
+   private Configuration configuration;
+
+   /**
+    * Root node.
+    */
+   private NodeSPI root;
+
+   @Inject
+   public void injectDependencies(Configuration configuration)
+   {
+      this.configuration = configuration;
+   }
+
+   /**
+    * Set<Fqn> of Fqns of the topmost node of internal regions that should
+    * not included in standard state transfers.
+    */
+   private final Set<Fqn> internalFqns = new HashSet<Fqn>();
+
+   public void registerInternalFqn(Fqn fqn)
+   {
+      internalFqns.add(fqn);
+   }
+
+
+   /**
+    * Finds a node given a fully qualified name.
+    * Whenever nodes are created, and the global transaction is not null, the created
+    * nodes have to be added to the transaction's {@link org.jboss.cache.transaction.TransactionEntry}
+    * field.<br>
+    * When a lock is acquired on a node, a reference to the lock has to be
+    * {@link org.jboss.cache.transaction.TransactionEntry#addLock(org.jboss.cache.lock.NodeLock) added to the list of locked nodes}
+    * in the {@link org.jboss.cache.transaction.TransactionEntry}.
+    * <p>This operation will also apply different locking to the cache nodes, depending on
+    * <tt>operation_type</tt>. If it is <tt>read</tt> type, all nodes will be acquired with
+    * read lock. Otherwise, the operation is <tt>write</tt> type, all parent nodes will be acquired
+    * with read lock while the destination node acquires write lock.</p>
+    *
+    * @param fqn Fully qualified name for the corresponding node.
+    * @return DataNode
+    */
+   public NodeSPI findNode(Fqn fqn)
+   {
+      try
+      {
+         return findNode(fqn, null);
+      }
+      catch (CacheException e)
+      {
+         log.warn("Unexpected error", e);
+         return null;
+      }
+   }
+
+   /**
+    * Finds a node given a fully qualified name and DataVersion.  Does not include invalid nodes.
+    */
+   public NodeSPI findNode(Fqn fqn, DataVersion version)
+   {
+      return findNode(fqn, version, false);
+   }
+
+   public NodeSPI findNodeCheck(GlobalTransaction tx, Fqn fqn, boolean includeInvalid)
+   {
+      NodeSPI n = findNode(fqn, null, includeInvalid);
+      if (n == null)
+      {
+         String errStr = "node " + fqn + " not found (globalTransaction=" + tx + ", caller=" + Thread.currentThread() + ")";
+         if (log.isTraceEnabled())
+         {
+            log.trace(errStr);
+         }
+         throw new NodeNotExistsException(errStr);
+      }
+      return n;
+   }
+
+   public NodeSPI findNode(Fqn fqn, DataVersion version, boolean includeInvalidNodes)
+   {
+      if (fqn == null) return null;
+
+      NodeSPI toReturn = peek(fqn, false, includeInvalidNodes);
+
+      if (toReturn != null && version != null && configuration.isNodeLockingOptimistic())
+      {
+         // we need to check the version of the data node...
+         DataVersion nodeVersion = toReturn.getVersion();
+         if (log.isTraceEnabled())
+         {
+            log.trace("looking for optimistic node [" + fqn + "] with version [" + version + "].  My version is [" + nodeVersion + "]");
+         }
+         if (nodeVersion.newerThan(version))
+         {
+            // we have a versioning problem; throw an exception!
+            throw new CacheException("Unable to validate versions.");
+         }
+      }
+      return toReturn;
+   }
+
+
+   public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
+   {
+      if (fqn == null || fqn.size() == 0) return getRoot();
+      NodeSPI n = getRoot();
+      int fqnSize = fqn.size();
+      for (int i = 0; i < fqnSize; i++)
+      {
+         Object obj = fqn.get(i);
+         n = n.getChildDirect(obj);
+         if (n == null)
+         {
+            return null;
+         }
+         else if (!includeDeletedNodes && n.isDeleted())
+         {
+            return null;
+         }
+         else if (!includeInvalidNodes && !n.isValid())
+         {
+            return null;
+         }
+      }
+      return n;
+   }
+
+
+   public List<NodeData> getNodeData(List<NodeData> list, NodeSPI node)
+   {
+      NodeData data = new NodeData(BuddyFqnTransformer.getActualFqn(node.getFqn()), node.getDataDirect());
+      list.add(data);
+      for (Object childNode : node.getChildrenDirect())
+      {
+         getNodeData(list, (NodeSPI) childNode);
+      }
+      return list;
+   }
+
+
+   public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes)
+   {
+      return peek(fqn, includeDeletedNodes, false);
+   }
+
+   /**
+    * Returns true if the FQN exists and the node has children.
+    */
+   public boolean hasChild(Fqn fqn)
+   {
+      if (fqn == null) return false;
+
+      NodeSPI n = findNode(fqn);
+      return n != null && n.hasChildrenDirect();
+   }
+
+
+   public NodeSPI getRoot()
+   {
+      return root;
+   }
+
+   public List<Fqn> getNodesForEviction(Fqn parent, boolean recursive)
+   {
+      List<Fqn> result = new ArrayList<Fqn>();
+      NodeSPI node = peek(parent, false);
+      if (recursive)
+      {
+         recursiveAddEvictionNodes(node, result);
+      }
+      else
+      {
+         if (node == null)
+         {
+            result.add(parent);
+            return result;
+         }
+         buildNodesForEviction(node, result);
+      }
+      return result;
+   }
+
+   private void recursiveAddEvictionNodes(NodeSPI node, List<Fqn> result)
+   {
+      for (NodeSPI child : (Set<NodeSPI>) node.getChildrenDirect())
+      {
+         recursiveAddEvictionNodes(child, result);
+      }
+      buildNodesForEviction(node, result);
+   }
+
+   private void buildNodesForEviction(Node node, List<Fqn> nodes)
+   {
+      if (node == null || node.isResident())
+      {
+         return;
+      }
+      Fqn fqn = node.getFqn();
+      if (fqn.isRoot())
+      {
+         for (Object childName : node.getChildrenNames())
+         {
+            if (!node.isResident()) nodes.add(Fqn.fromRelativeElements(fqn, childName));
+         }
+      }
+      else
+      {
+         nodes.add(fqn);
+      }
+   }
+
+   @Override
+   public String toString()
+   {
+      return toString(false);
+   }
+
+   public boolean exists(Fqn fqn)
+   {
+      return peek(fqn, false, false) != null;
+   }
+
+   /**
+    * Returns a Set<Fqn> of Fqns of the topmost node of internal regions that
+    * should not included in standard state transfers. Will include
+    * {@link BuddyManager#BUDDY_BACKUP_SUBTREE} if buddy replication is
+    * enabled.
+    *
+    * @return an unmodifiable Set<Fqn>.  Will not return <code>null</code>.
+    */
+   public Set<Fqn> getInternalFqns()
+   {
+      return Collections.unmodifiableSet(internalFqns);
+   }
+
+   /**
+    * Returns a debug string with optional details of contents.
+    */
+   public String toString(boolean details)
+   {
+      StringBuffer sb = new StringBuffer();
+      int indent = 0;
+
+      if (!details)
+      {
+         sb.append(getClass().getName()).append(" [").append(getNumberOfNodes()).append(" nodes, ");
+         sb.append(getNumberOfLocksHeld()).append(" locks]");
+      }
+      else
+      {
+         if (root == null)
+            return sb.toString();
+         for (Object n : root.getChildrenDirect())
+         {
+            ((NodeSPI) n).print(sb, indent);
+            sb.append("\n");
+         }
+      }
+      return sb.toString();
+   }
+
+   /**
+    * Returns the number of read or write locks held across the entire cache.
+    */
+   public int getNumberOfLocksHeld()
+   {
+      return numLocks(root);
+   }
+
+   private int numLocks(NodeSPI n)
+   {
+      int num = 0;
+      if (n != null)
+      {
+         if (n.getLock().isLocked())
+         {
+            num++;
+         }
+         for (Object cn : n.getChildrenDirect(true))
+         {
+            num += numLocks((NodeSPI) cn);
+         }
+      }
+      return num;
+   }
+
+   /**
+    * Returns an <em>approximation</em> of the total number of nodes in the
+    * cache. Since this method doesn't acquire any locks, the number might be
+    * incorrect, or the method might even throw a
+    * ConcurrentModificationException
+    */
+   public int getNumberOfNodes()
+   {
+      return numNodes(root) - 1;
+   }
+
+   private int numNodes(NodeSPI n)
+   {
+      int count = 1;// for n
+      if (n != null)
+      {
+         for (Object child : n.getChildrenDirect())
+         {
+            count += numNodes((NodeSPI) child);
+         }
+      }
+      return count;
+   }
+
+   /**
+    * Prints information about the contents of the nodes in the cache's current
+    * in-memory state.  Does not load any previously evicted nodes from a
+    * cache loader, so evicted nodes will not be included.
+    */
+   public String printDetails()
+   {
+      StringBuffer sb = new StringBuffer();
+      root.printDetails(sb, 0);
+      sb.append("\n");
+      return sb.toString();
+   }
+
+
+   /**
+    * Returns lock information.
+    */
+   public String printLockInfo()
+   {
+      StringBuffer sb = new StringBuffer("\n");
+      int indent = 0;
+
+      for (Object n : root.getChildrenDirect())
+      {
+         ((NodeSPI) n).getLock().printLockInfo(sb, indent);
+         sb.append("\n");
+      }
+      return sb.toString();
+   }
+
+   /**
+    * Returns an <em>approximation</em> of the total number of attributes in
+    * this sub cache.
+    *
+    * @see #getNumberOfAttributes
+    */
+   public int getNumberOfAttributes(Fqn fqn)
+   {
+      return numAttributes(findNode(fqn));
+   }
+
+   private int numAttributes(NodeSPI n)
+   {
+      int count = 0;
+      for (Object child : n.getChildrenDirect())
+      {
+         count += numAttributes((NodeSPI) child);
+      }
+      count += n.getDataDirect().size();
+      return count;
+   }
+
+   /**
+    * Returns an <em>approximation</em> of the total number of attributes in
+    * the cache. Since this method doesn't acquire any locks, the number might
+    * be incorrect, or the method might even throw a
+    * ConcurrentModificationException
+    */
+   public int getNumberOfAttributes()
+   {
+      return numAttributes(root);
+   }
+
+   /**
+    * Internal method; not to be used externally.
+    * Returns true if the node was found, false if not.
+    *
+    * @param f
+    */
+   public boolean realRemove(Fqn f, boolean skipMarkerCheck)
+   {
+      NodeSPI n = peek(f, true);
+      if (n == null)
+      {
+         return false;
+      }
+
+
+      if (log.isTraceEnabled()) log.trace("Performing a real remove for node " + f + ", marked for removal.");
+      if (skipMarkerCheck || n.isDeleted())
+      {
+         if (n.getFqn().isRoot())
+         {
+            // do not actually delete; just remove deletion marker
+            n.markAsDeleted(true);
+            // but now remove all children, since the call has been to remove("/")
+            n.removeChildrenDirect();
+
+            // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
+            // be aware that it is no longer valid.
+            n.setValid(false, true);
+            n.setValid(true, false);
+            return true;
+         }
+         else
+         {
+            // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
+            // be aware that it is no longer valid.
+            n.setValid(false, true);
+            return n.getParent().removeChildDirect(n.getFqn().getLastElement());
+         }
+      }
+      else
+      {
+         if (log.isDebugEnabled()) log.debug("Node " + f + " NOT marked for removal as expected, not removing!");
+         return false;
+      }
+   }
+
+   public void evict(Fqn fqn, boolean recursive)
+   {
+      List<Fqn> toEvict = getNodesForEviction(fqn, recursive);
+      for (Fqn aFqn : toEvict)
+      {
+         evict(aFqn);
+      }
+   }
+
+   public boolean evict(Fqn fqn)
+   {
+      if (peek(fqn, false, true) == null) return true;
+      if (log.isTraceEnabled())
+         log.trace("evict(" + fqn + ")");
+      if (hasChild(fqn))
+      {
+         removeData(fqn);
+         return false;
+      }
+      else
+      {
+         removeNode(fqn);
+         return true;
+      }
+   }
+
+   private void removeNode(Fqn fqn)
+   {
+      NodeSPI targetNode = findNode(fqn, null, true);
+      if (targetNode == null) return;
+      NodeSPI parentNode = targetNode.getParent();
+      if (parentNode != null)
+      {
+         parentNode.removeChildDirect(fqn.getLastElement());
+         parentNode.setChildrenLoaded(false);
+      }
+   }
+
+   protected void removeData(Fqn fqn)
+   {
+      NodeSPI n = findNode(fqn, null);
+      if (n == null)
+      {
+         log.warn("node " + fqn + " not found");
+         return;
+      }
+      n.clearDataDirect();
+      n.setDataLoaded(false);
+   }
+
+   /**
+    * Traverses the tree to the given Fqn, creating nodes if needed.  Returns a list of nodes created, as well as a reference to the last node.
+    * <p/>
+    * E.g.,
+    * <code>
+    * Object[] results = createNode(myFqn);
+    * results[0] // this is a List&lt;NodeSPI&gt; of nodes <i>created</i> in getting to the target node.
+    * results[1] // is a NodeSPI reference to the target node, regardless of whether it was <i>created</i> or just <i>found</i>.
+    * </code>
+    *
+    * @param fqn fqn to find
+    * @return see above.
+    */
+   public Object[] createNodes(Fqn fqn)
+   {
+      List<NodeSPI> result = new ArrayList<NodeSPI>(fqn.size());
+      Fqn tmpFqn = Fqn.ROOT;
+
+      int size = fqn.size();
+
+      // root node
+      NodeSPI n = root;
+      for (int i = 0; i < size; i++)
+      {
+         Object childName = fqn.get(i);
+         tmpFqn = Fqn.fromRelativeElements(tmpFqn, childName);
+
+         NodeSPI childNode;
+         Map children = n.getChildrenMapDirect();
+         childNode = children == null ? null : (NodeSPI) children.get(childName);
+
+         if (childNode == null)
+         {
+            childNode = n.addChildDirect(Fqn.fromElements(childName));
+            result.add(childNode);
+         }
+
+         n = childNode;
+      }
+      return new Object[]{result, n};
+   }
+
+   /**
+    * Returns true if a node has all children loaded and initialized.
+    * todo - this belongs to NodeSPI, should be moved in 3.x
+    */
+   public boolean allInitialized(NodeSPI<?, ?> n)
+   {
+      if (!n.isChildrenLoaded())
+      {
+         return false;
+      }
+      for (NodeSPI child : n.getChildrenDirect())
+      {
+         if (!child.isDataLoaded())
+         {
+            return false;
+         }
+      }
+      return true;
+
+   }
+
+   public void createNodesLocally(Fqn<?> fqn, Map<?, ?> data) throws CacheException
+   {
+      int treeNodeSize;
+      if ((treeNodeSize = fqn.size()) == 0) return;
+      NodeSPI n = root;
+      for (int i = 0; i < treeNodeSize; i++)
+      {
+         Object childName = fqn.get(i);
+         NodeSPI childNode = n.addChildDirect(Fqn.fromElements(childName));
+         if (childNode == null)
+         {
+            if (log.isTraceEnabled())
+            {
+               log.trace("failed to find or create child " + childName + " of node " + n.getFqn());
+            }
+            return;
+         }
+         if (i == treeNodeSize - 1)
+         {
+            // set data
+            childNode.putAllDirect(data);
+         }
+         n = childNode;
+      }
+   }
+
+   public void setRoot(NodeSPI root)
+   {
+      this.root = root;
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -12,7 +12,6 @@
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 
 import java.io.InputStream;
 
@@ -22,7 +21,7 @@
  * This is a special instance of a {@link ComponentFactory} which contains bootstrap information for the
  * {@link ComponentRegistry}.
  * <p/>
- * E.g., {@link #bootstrap(org.jboss.cache.invocation.CacheLifecycleManager, CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a
+ * E.g., {@link #bootstrap(LifecycleManager , CacheSPI, org.jboss.cache.config.Configuration)} is used to create a cache, a
  * {@link ComponentRegistry}, and then wire dependencies as needed.
  * <p/>
  * In JBoss Cache 2.0.x, this was a singleton and you had to use {@link #getInstance()} to obtain an instance.  From
@@ -115,7 +114,7 @@
 
    protected CacheSPI<K, V> createAndWire(Configuration configuration) throws Exception
    {
-      CacheLifecycleManager lifecycleManager = new CacheLifecycleManager(configuration);
+      LifecycleManager lifecycleManager = new LifecycleManager(configuration);
       CacheSPI<K, V> spi = new CacheInvocationDelegate<K, V>();
       bootstrap(lifecycleManager, spi, configuration);
       componentRegistry.wire();
@@ -125,7 +124,7 @@
    /**
     * Bootstraps this factory with a Configuration and a ComponentRegistry.
     */
-   protected void bootstrap(CacheLifecycleManager lifecycleManager, CacheSPI spi, Configuration configuration)
+   protected void bootstrap(LifecycleManager lifecycleManager, CacheSPI spi, Configuration configuration)
    {
       // injection bootstrap stuff
       componentRegistry = lifecycleManager.getComponentRegistry();
@@ -133,7 +132,7 @@
       this.configuration = configuration;
 
       // make sure we set the CacheLifecycleManager and CacheSPI instance in the component registry.
-      componentRegistry.registerComponent(CacheLifecycleManager.class.getName(), lifecycleManager, CacheLifecycleManager.class);
+      componentRegistry.registerComponent(LifecycleManager.class.getName(), lifecycleManager, LifecycleManager.class);
       componentRegistry.registerComponent(CacheSPI.class.getName(), spi, CacheSPI.class);
    }
 

Copied: core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java (from rev 5706, core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -0,0 +1,517 @@
+package org.jboss.cache;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InterceptorChain;
+import org.jboss.cache.invocation.NodeInvocationDelegate;
+import org.jboss.cache.loader.CacheLoaderManager;
+import org.jboss.cache.lock.LockStrategyFactory;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.notifications.Notifier;
+
+import javax.management.MBeanServerFactory;
+import javax.transaction.TransactionManager;
+import java.util.ArrayList;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class LifecycleManager
+{
+   private static Log log = LogFactory.getLog(LifecycleManager.class);
+
+   private CacheStatus cacheStatus;
+
+   /* dependencies*/
+   private Configuration configuration;
+   private Notifier notifier;
+   private RegionManager regionManager;
+   private NodeFactory nodeFactory;
+   private DataContainer cacheData;
+   private BuddyManager buddyManager;
+   private RPCManager rpcManager;
+   private ComponentRegistry componentRegistry;
+
+
+   @Inject
+   public void initialize(Configuration configuration, Notifier notifier, RegionManager regionManager, NodeFactory nodeFactory,
+                          DataContainer cacheData, BuddyManager buddyManager, RPCManager rpcManager,
+                          ComponentRegistry componentRegistry)
+   {
+      this.configuration = configuration;
+      this.notifier = notifier;
+      this.regionManager = regionManager;
+      this.nodeFactory = nodeFactory;
+      this.buddyManager = buddyManager;
+      this.rpcManager = rpcManager;
+      this.cacheData = cacheData;
+      this.componentRegistry = componentRegistry;
+   }
+
+   /**
+    * Hook to shut down the cache when the JVM exits.
+    */
+   private Thread shutdownHook;
+   /**
+    * A flag that the shutdown hook sets before calling cache.stop().  Allows stop() to identify if it has been called
+    * from a shutdown hook.
+    */
+   private boolean invokedFromShutdownHook;
+
+   public LifecycleManager(Configuration configuration)
+   {
+      this.configuration = configuration;
+      this.componentRegistry = new ComponentRegistry(configuration);
+      this.cacheStatus = CacheStatus.INSTANTIATED;
+   }
+
+   /**
+    * Lifecycle method. This is like initialize.
+    *
+    * @throws Exception
+    */
+   public void create() throws CacheException
+   {
+      if (!cacheStatus.createAllowed())
+      {
+         if (cacheStatus.needToDestroyFailedCache())
+            destroy();
+         else
+            return;
+      }
+      try
+      {
+         internalCreate();
+      }
+      catch (Throwable t)
+      {
+         handleLifecycleTransitionFailure(t);
+      }
+   }
+
+   /**
+    * Lifecyle method.
+    *
+    * @throws CacheException
+    */
+   public void start() throws CacheException
+   {
+      if (!cacheStatus.startAllowed())
+      {
+         if (cacheStatus.needToDestroyFailedCache())
+            destroy(); // this will take us back to DESTROYED
+
+         if (cacheStatus.needCreateBeforeStart())
+            create();
+         else
+            return;
+      }
+
+      try
+      {
+         internalStart();
+      }
+      catch (Throwable t)
+      {
+//         if (log.isTraceEnabled()) log.trace("InternalStart had problems: ", t);
+         handleLifecycleTransitionFailure(t);
+      }
+   }
+
+   /**
+    * Lifecycle method.
+    */
+   public void destroy()
+   {
+      if (!cacheStatus.destroyAllowed())
+      {
+         if (cacheStatus.needStopBeforeDestroy())
+         {
+            try
+            {
+               stop();
+            }
+            catch (CacheException e)
+            {
+               log.warn("Needed to call stop() before destroying but stop() " +
+                     "threw exception. Proceeding to destroy", e);
+            }
+         }
+         else
+            return;
+      }
+
+      try
+      {
+         internalDestroy();
+      }
+      finally
+      {
+         // We always progress to destroyed
+         cacheStatus = CacheStatus.DESTROYED;
+      }
+   }
+
+   /**
+    * Lifecycle method.
+    */
+   public void stop()
+   {
+      if (!cacheStatus.stopAllowed())
+      {
+         return;
+      }
+
+      // Trying to stop() from FAILED is valid, but may not work
+      boolean failed = cacheStatus == CacheStatus.FAILED;
+
+      try
+      {
+         internalStop();
+      }
+      catch (Throwable t)
+      {
+         if (failed)
+         {
+            log.warn("Attempted to stop() from FAILED state, " +
+                  "but caught exception; try calling destroy()", t);
+         }
+         handleLifecycleTransitionFailure(t);
+      }
+   }
+
+   /**
+    * The actual start implementation.
+    */
+   private void internalStart() throws CacheException, IllegalArgumentException
+   {
+      // re-wire all dependencies in case stuff has changed since the cache was created
+
+      // remove any components whose construction may have depended upon a configuration that may have changed.
+      removeConfigurationDependentComponents();
+
+      // this will recreate any missing components based on the current config
+      //todo [mmarkus] updateDependencies should be moved in this class. Component registry's is not to care
+      // todo about particular instances that are manipulated there ; it should be keept generic
+      // todo [MANIK] NOT true.  The ComponentRegistry is a state machine and is responsible for maintaining states and dependencies.
+      componentRegistry.updateDependencies();
+      componentRegistry.wireDependencies(cacheData.getRoot());
+
+      cacheStatus = CacheStatus.STARTING;
+
+      // start all internal components
+      componentRegistry.start();
+
+      //todo this is important info that needs to be printed, add it somewhere ...
+//      if (log.isDebugEnabled())
+      //log.debug("ChainedInterceptor chain is:\n" + CachePrinter.printInterceptorChain(cacheCommand));
+
+//      if (configuration.getNodeLockingScheme() == Configuration.NodeLockingScheme.OPTIMISTIC && transactionManager == null)
+//      {
+//         log.fatal("No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used!  Expect errors!!");
+//      }
+
+      correctRootNodeType();
+
+      switch (configuration.getCacheMode())
+      {
+         case LOCAL:
+            log.debug("cache mode is local, will not create the channel");
+            break;
+         case REPL_SYNC:
+         case REPL_ASYNC:
+         case INVALIDATION_ASYNC:
+         case INVALIDATION_SYNC:
+            // reconfigure log category so that the instance name is reflected as well.
+            configureLogCategory();
+            break;
+         default:
+            throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
+      }
+
+      startManualComponents();
+
+      // start any eviction threads.
+      if (regionManager.isUsingEvictions())
+      {
+         regionManager.startEvictionThread();
+      }
+
+      notifier.notifyCacheStarted();
+
+      addShutdownHook();
+
+      log.info("JBoss Cache version: " + Version.printVersion());
+
+      cacheStatus = CacheStatus.STARTED;
+   }
+
+   private void addShutdownHook()
+   {
+      ArrayList al = MBeanServerFactory.findMBeanServer(null);
+      boolean registerShutdownHook = (configuration.getShutdownHookBehavior() == Configuration.ShutdownHookBehavior.DEFAULT && al.size() == 0)
+            || configuration.getShutdownHookBehavior() == Configuration.ShutdownHookBehavior.REGISTER;
+
+      if (registerShutdownHook)
+      {
+         if (log.isTraceEnabled())
+            log.trace("Registering a shutdown hook.  Configured behavior = " + configuration.getShutdownHookBehavior());
+         shutdownHook = new Thread()
+         {
+            @Override
+            public void run()
+            {
+               try
+               {
+                  invokedFromShutdownHook = true;
+                  stop();
+               }
+               finally
+               {
+                  invokedFromShutdownHook = false;
+               }
+            }
+         };
+
+         Runtime.getRuntime().addShutdownHook(shutdownHook);
+      }
+      else
+      {
+         if (log.isTraceEnabled())
+            log.trace("Not registering a shutdown hook.  Configured behavior = " + configuration.getShutdownHookBehavior());
+      }
+   }
+
+   /**
+    * The actual create implementation.
+    *
+    * @throws CacheException
+    */
+   private void internalCreate() throws CacheException
+   {
+      // Include our clusterName in our log category
+      configureLogCategory();
+
+      componentRegistry.wire();
+      correctRootNodeType();
+
+      LockStrategyFactory.setIsolationLevel(configuration.getIsolationLevel());
+
+      cacheStatus = CacheStatus.CREATED;
+   }
+
+   /**
+    * Sets the cacheStatus to FAILED and rethrows the problem as one
+    * of the declared types. Converts any non-RuntimeException Exception
+    * to CacheException.
+    *
+    * @param t
+    * @throws CacheException
+    * @throws RuntimeException
+    * @throws Error
+    */
+   private void handleLifecycleTransitionFailure(Throwable t)
+         throws RuntimeException, Error
+   {
+      cacheStatus = CacheStatus.FAILED;
+      if (t instanceof CacheException)
+         throw (CacheException) t;
+      else if (t instanceof RuntimeException)
+         throw (RuntimeException) t;
+      else if (t instanceof Error)
+         throw (Error) t;
+      else
+         throw new CacheException(t);
+   }
+
+   /**
+    * The actual destroy implementation.
+    */
+   private void internalDestroy()
+   {
+      cacheStatus = CacheStatus.DESTROYING;
+      // The rest of these should have already been taken care of in stop,
+      // but we do it here as well in case stop failed.
+      rpcManager.stop();
+      componentRegistry.reset();
+   }
+
+   /**
+    * The actual stop implementation.
+    */
+   private void internalStop()
+   {
+      cacheStatus = CacheStatus.STOPPING;
+      // if this is called from a source other than the shutdown hook, deregister the shutdown hook.
+      if (!invokedFromShutdownHook && shutdownHook != null) Runtime.getRuntime().removeShutdownHook(shutdownHook);
+      componentRegistry.stop();
+      if (notifier != null)
+      {
+         notifier.notifyCacheStopped();
+         notifier.removeAllCacheListeners();
+      }
+      // unset transaction manager reference
+      cacheStatus = CacheStatus.STOPPED;
+      // empty in-memory state
+      cacheData.getRoot().clearDataDirect();
+      cacheData.getRoot().removeChildrenDirect();
+   }
+
+   //todo - this should reather be implemented as follows:
+   // List<Component>comps = registry.detComponentsDependingOn(a component)
+   // registry.unregsiterComponents(comps);
+   private void removeConfigurationDependentComponents()
+   {
+      // remove the Interceptor.class component though, since it may pertain to an old config
+
+      componentRegistry.unregisterComponent(InterceptorChain.class); // the interceptor chain will need reconstructing in case the cfg has changed before calling start()
+      componentRegistry.unregisterComponent(Marshaller.class);
+      componentRegistry.unregisterComponent(TransactionManager.class);
+      componentRegistry.unregisterComponent(BuddyManager.class);
+      componentRegistry.unregisterComponent(CacheLoaderManager.class);
+   }
+
+   /**
+    * Creates a new root node if one does not exist, or if the existing one does not match the type according to the configuration.
+    */
+   private void correctRootNodeType()
+   {
+      // create a new root temporarily.
+      NodeSPI tempRoot = nodeFactory.createRootDataNode();
+      // if we don't already have a root or the new (temp) root is of a different class (optimistic vs pessimistic) to
+      // the current root, then we use the new one.
+
+      Class currentRootType = cacheData.getRoot() == null ? null : ((NodeInvocationDelegate) cacheData.getRoot()).getDelegationTarget().getClass();
+      Class tempRootType = ((NodeInvocationDelegate) tempRoot).getDelegationTarget().getClass();
+
+      if (!tempRootType.equals(currentRootType)) cacheData.setRoot(tempRoot);
+   }
+
+   /**
+    * Set our log category to include our clusterName, if we have one.
+    */
+   private void configureLogCategory()
+   {
+      StringBuilder category = new StringBuilder(getClass().getName());
+      if (configuration != null)
+      {
+         if (rpcManager != null)
+         {
+            String clusterName = configuration.getClusterName();
+            if (clusterName != null)
+            {
+               category.append('.');
+               category.append(clusterName);
+               if (rpcManager.getLocalAddress() != null)
+               {
+                  category.append('.');
+                  category.append(rpcManager.getLocalAddress().toString().replace('.', '_'));
+               }
+            }
+         }
+         else
+         {
+            // we're in LOCAL mode
+            category.append("_LOCAL");
+         }
+      }
+      // replace .s with _s otherwise Log4J will strip them out
+      log = LogFactory.getLog(category.toString());
+   }
+
+   public void startManualComponents()
+   {
+      // these 2 components need to be started manually since they can only be started after ALL other components have started.
+      // i.e., rpcManager's start() method may do state transfers.  State transfers will rely on the interceptor chain being started.
+      // the interceptor chain cannot start until the rpcManager is started.  And similarly, the buddyManager relies on the
+      // rpcManager being started.
+      if (rpcManager != null) rpcManager.start();
+      if (buddyManager != null)
+      {
+         buddyManager.init();
+         if (buddyManager.isEnabled())
+         {
+            cacheData.registerInternalFqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
+         }
+      }
+   }
+
+   /**
+    * For local calls, if chache is not in STARTED mode will throw an IllegalStateException.
+    * For remote cache, if cache is STRTED returns true. If cache is STARTING waits for the cache to wait
+    * for {@link org.jboss.cache.config.Configuration#getStateRetrievalTimeout()} milliseconds, if cache starts
+    * returns true, otherwise returns false.
+    */
+   public boolean allowsInvocation(boolean originLocal)
+   {
+      if (getCacheStatus().allowInvocations()) return true;
+      // only throw an exception if this is a locally originating call - JBCACHE-1179
+      if (originLocal)
+      {
+         throw new IllegalStateException("Cache not in STARTED state!");
+      }
+      if (getCacheStatus() == CacheStatus.STARTING)
+      {
+         try
+         {
+            blockUntilCacheStarts();
+            return true;
+         }
+         catch (InterruptedException e)
+         {
+            Thread.currentThread().interrupt();
+         }
+      }
+      else
+      {
+         log.warn("Received a remote call but the cache is not in STARTED state - ignoring call.");
+      }
+      return false;
+   }
+
+   /**
+    * Blocks until the current cache instance is in it's {@link org.jboss.cache.CacheStatus#STARTED started} phase.  Blocks
+    * for up to {@link org.jboss.cache.config.Configuration#getStateRetrievalTimeout()} milliseconds, throwing an IllegalStateException
+    * if the cache doesn't reach this state even after this maximum wait time.
+    *
+    * @throws InterruptedException  if interrupted while waiting
+    * @throws IllegalStateException if even after waiting the cache has not started.
+    */
+   private void blockUntilCacheStarts() throws InterruptedException, IllegalStateException
+   {
+      int pollFrequencyMS = 100;
+      long startupWaitTime = configuration.getStateRetrievalTimeout();
+      long giveUpTime = System.currentTimeMillis() + startupWaitTime;
+
+      while (System.currentTimeMillis() < giveUpTime)
+      {
+         if (getCacheStatus().allowInvocations()) break;
+         Thread.sleep(pollFrequencyMS);
+      }
+
+      // check if we have started.
+      if (!getCacheStatus().allowInvocations())
+         throw new IllegalStateException("Cache not in STARTED state, even after waiting " + configuration.getStateRetrievalTimeout() + " millis.");
+   }
+
+
+   public CacheStatus getCacheStatus()
+   {
+      return cacheStatus;
+   }
+
+   public ComponentRegistry getComponentRegistry()
+   {
+      return componentRegistry;
+   }
+
+   public void setCacheStatus(CacheStatus cacheStatus)
+   {
+      this.cacheStatus = cacheStatus;
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -13,7 +13,6 @@
 import org.jboss.cache.config.RuntimeConfig;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Stop;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.lock.LockUtil;
@@ -88,7 +87,7 @@
    private TransactionManager txManager;
    private TransactionTable txTable;
    private InterceptorChain interceptorChain;
-   private CacheLifecycleManager lifecycleManager;
+   private LifecycleManager lifecycleManager;
 
    private boolean isUsingBuddyReplication;
    private boolean isInLocalMode;
@@ -97,7 +96,7 @@
    private void setupDependencies(ChannelMessageListener messageListener, Configuration configuration, Notifier notifier,
                                   CacheSPI spi, Marshaller marshaller, TransactionTable txTable,
                                   TransactionManager txManager, InvocationContextContainer container, InterceptorChain interceptorChain,
-                                  CacheLifecycleManager lifecycleManager)
+                                  LifecycleManager lifecycleManager)
    {
       this.messageListener = messageListener;
       this.configuration = configuration;

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -9,8 +9,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import static org.jboss.cache.AbstractNode.NodeFlags.*;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.CacheInjectionMethods;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.lock.IdentityLock;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,6 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -26,6 +25,7 @@
 import org.jboss.cache.commands.write.RemoveDataCommand;
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jgroups.Address;
 
 import java.util.ArrayList;

Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -15,7 +15,6 @@
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
@@ -26,6 +25,7 @@
 import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Stop;
 import org.jboss.cache.lock.TimeoutException;

Modified: core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -3,10 +3,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.RPCManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;

Deleted: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,416 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
-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.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.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveDataCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jgroups.Address;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Factory for all types of cache commands.
- * Here are some of the purposes of this class:
- * <pre>
- *   - not creating <code>CacheCommands</code> directly (i.e. through new usage) as this would reduce unit testability
- *   - reduce the coupling between commands and other components. e.g. considering a commands that needs to knwo whether
- *     locking type is optimistic, we will pass in a 'optimistic' boolean flag rather than entire Configuration object
- * </pre>
- *
- * @author Mircea.Markus at jboss.com
- * @since 2.2
- */
-public class CommandsFactory
-{
-   private RPCManager rpcManager;
-   private ComponentRegistry registry;
-
-   public CommandsFactory()
-   {
-   }
-
-   public CommandsFactory(RPCManager rpcManager, ComponentRegistry registry)
-   {
-      this.rpcManager = rpcManager;
-      this.registry = registry;
-   }
-
-   @Inject
-   public void initialize(RPCManager rpc, ComponentRegistry registry)
-   {
-      this.rpcManager = rpc;
-      this.registry = registry;
-   }
-
-   public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContents)
-   {
-      PutDataMapCommand cmd = new PutDataMapCommand(gtx, fqn, data, createUndoOps, eraseContents);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
-   {
-      PutKeyValueCommand command = new PutKeyValueCommand(gtx, fqn, key, value, createUndoOps, putForExternalRead);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public ReplicateCommand buildReplicateCommand(ReplicableCommand command)
-   {
-      ReplicateCommand cmd = new ReplicateCommand(command);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public ReplicateCommand buildReplicateCommand(List<ReplicableCommand> modifications)
-   {
-      ReplicateCommand cmd = new ReplicateCommand(modifications);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, ReversibleCommand command, boolean onePhaseCommit)
-   {
-      return buildPrepareCommand(gtx, Collections.singletonList(command), rpcManager.getLocalAddress(), onePhaseCommit);
-   }
-
-   public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List<ReversibleCommand> modifications, Address address, boolean onePhaseCommit)
-   {
-      PrepareCommand cmd = new PrepareCommand(gtx, modifications, address, onePhaseCommit);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public CommitCommand buildCommitCommand(GlobalTransaction gtx)
-   {
-      CommitCommand cmd = new CommitCommand(gtx);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public DataGravitationCleanupCommand buildDataGravitationCleanupCommand(Fqn primaryFqn, Fqn backupFqn)
-   {
-      DataGravitationCleanupCommand command = new DataGravitationCleanupCommand(primaryFqn, backupFqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean searchSubtrees)
-   {
-      GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn, boolean eviction, boolean skipSendingNodeEvents, boolean createUndoOps)
-   {
-      RemoveNodeCommand command = new RemoveNodeCommand(gtx, fqn, createUndoOps, skipSendingNodeEvents, eviction);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RemoveDataCommand buildRemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
-   {
-      RemoveDataCommand command = new RemoveDataCommand(gtx, fqn, createUndoops, sendNodeEvent, eviction);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public EvictNodeCommand buildEvictFqnCommand(Fqn fqn)
-   {
-      EvictNodeCommand command = new EvictNodeCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public InvalidateCommand buildInvalidateCommand(Fqn fqn)
-   {
-      InvalidateCommand command = new InvalidateCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn<?> fqn, Object key, boolean b)
-   {
-      RemoveKeyCommand command = new RemoveKeyCommand(tx, fqn, key, b);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GetDataMapCommand buildGetDataMapCommand(Fqn fqn)
-   {
-      GetDataMapCommand command = new GetDataMapCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RemoteExistsNodeCommand buildExistsNodeCommand(Fqn fqn)
-   {
-      RemoteExistsNodeCommand command = new RemoteExistsNodeCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GetKeyValueCommand buildGetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
-   {
-      GetKeyValueCommand command = new GetKeyValueCommand(fqn, key, sendNodeEvent);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GetNodeCommand buildGetNodeCommand(Fqn fqn)
-   {
-      GetNodeCommand command = new GetNodeCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GetKeysCommand buildGetKeysCommand(Fqn fqn)
-   {
-      GetKeysCommand command = new GetKeysCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
-   {
-      GetChildrenNamesCommand command = new GetChildrenNamesCommand(fqn);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public MoveCommand buildMoveCommand(Fqn from, Fqn to)
-   {
-      MoveCommand command = new MoveCommand(from, to);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public GravitateDataCommand buildGravitateDataCacheCommand(Fqn fqn, boolean searchSubtrees)
-   {
-      GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
-   {
-      RollbackCommand cmd = new RollbackCommand(gtx);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, List<ReversibleCommand> modifications, Map data, Address address, boolean onePhaseCommit)
-   {
-      OptimisticPrepareCommand cmd = new OptimisticPrepareCommand(gtx, modifications, data, address, onePhaseCommit);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-
-   public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, ReversibleCommand command)
-   {
-      List<ReversibleCommand> list = (List<ReversibleCommand>) (command != null ? Collections.singletonList(command) : Collections.emptyList());
-      return buildOptimisticPrepareCommand(gtx, list, null, null, false);
-   }
-
-   public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName)
-   {
-      AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address, buddyPoolName);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName)
-   {
-      RemoveFromBuddyGroupCommand command = new RemoveFromBuddyGroupCommand(groupName);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public AssignToBuddyGroupCommand buildAssignToBuddyGroupCommand(BuddyGroup group, Map<Fqn, byte[]> state)
-   {
-      AssignToBuddyGroupCommand command = new AssignToBuddyGroupCommand(group, state);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public ClusteredGetCommand buildClusteredGetCommand(Boolean searchBackupSubtrees, DataCommand cacheDataComand)
-   {
-      ClusteredGetCommand command = new ClusteredGetCommand(searchBackupSubtrees, cacheDataComand);
-      registry.wireDependencies(command);
-      return command;
-   }
-
-   public CreateNodeCommand buildCreateNodeCommand(Fqn fqn)
-   {
-      CreateNodeCommand cmd = new CreateNodeCommand(fqn);
-      registry.wireDependencies(cmd);
-      return cmd;
-   }
-
-   /**
-    * Builds a cache command based on the ID passed in and an object array of parameters
-    *
-    * @param id         id of the command to build
-    * @param parameters parameters attached to the command
-    * @return a newly constructed cache command
-    */
-   public ReplicableCommand fromStream(int id, Object[] parameters)
-   {
-      // todo: must be a better way to do this!!!
-      ReplicableCommand returnValue;
-      switch (id)
-      {
-         case RemoteExistsNodeCommand.METHOD_ID:
-            returnValue = new RemoteExistsNodeCommand();
-            break;
-
-         case GetChildrenNamesCommand.METHOD_ID:
-            returnValue = new GetChildrenNamesCommand();
-            break;
-
-         case GetDataMapCommand.METHOD_ID:
-            returnValue = new GetDataMapCommand();
-            break;
-
-         case GetKeysCommand.METHOD_ID:
-            returnValue = new GetKeysCommand();
-            break;
-
-         case GetKeyValueCommand.METHOD_ID:
-            returnValue = new GetKeyValueCommand();
-            break;
-
-         case GetNodeCommand.METHOD_ID:
-            returnValue = new GetNodeCommand();
-            break;
-
-         case MoveCommand.METHOD_ID:
-            returnValue = new MoveCommand();
-            break;
-
-         case PutDataMapCommand.METHOD_ID:
-         case PutDataMapCommand.ERASE_METHOD_ID:
-         case PutDataMapCommand.ERASE_VERSIONED_METHOD_ID:
-         case PutDataMapCommand.VERSIONED_METHOD_ID:
-            returnValue = new PutDataMapCommand();
-            break;
-
-         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:
-            returnValue = new PutKeyValueCommand();
-            break;
-
-         case RemoveDataCommand.METHOD_ID:
-         case RemoveDataCommand.VERSIONED_METHOD_ID:
-            returnValue = new RemoveDataCommand();
-            break;
-
-         case RemoveKeyCommand.METHOD_ID:
-         case RemoveKeyCommand.VERSIONED_METHOD_ID:
-            returnValue = new RemoveKeyCommand();
-            break;
-
-         case RemoveNodeCommand.METHOD_ID:
-         case RemoveNodeCommand.VERSIONED_METHOD_ID:
-            returnValue = new RemoveNodeCommand();
-            break;
-
-         case CreateNodeCommand.METHOD_ID:
-            returnValue = new CreateNodeCommand();
-            break;
-
-            // --- transactional method calls
-
-         case PrepareCommand.METHOD_ID:
-            returnValue = new PrepareCommand();
-            break;
-
-         case OptimisticPrepareCommand.METHOD_ID:
-            returnValue = new OptimisticPrepareCommand();
-            break;
-
-         case CommitCommand.METHOD_ID:
-            returnValue = new CommitCommand();
-            break;
-
-         case RollbackCommand.METHOD_ID:
-            returnValue = new RollbackCommand();
-            break;
-
-            // --- replicate methods
-         case ReplicateCommand.MULTIPLE_METHOD_ID:
-         case ReplicateCommand.SINGLE_METHOD_ID:
-            returnValue = new ReplicateCommand();
-            break;
-
-         case InvalidateCommand.METHOD_ID:
-            returnValue = new InvalidateCommand();
-            break;
-
-         case ClusteredGetCommand.METHOD_ID:
-            returnValue = new ClusteredGetCommand();
-            break;
-
-            // ---- Buddy replication - group organisation commands
-         case AnnounceBuddyPoolNameCommand.METHOD_ID:
-            returnValue = new AnnounceBuddyPoolNameCommand();
-            break;
-         case AssignToBuddyGroupCommand.METHOD_ID:
-            returnValue = new AssignToBuddyGroupCommand();
-            break;
-         case RemoveFromBuddyGroupCommand.METHOD_ID:
-            returnValue = new RemoveFromBuddyGroupCommand();
-            break;
-         case DataGravitationCleanupCommand.METHOD_ID:
-            returnValue = new DataGravitationCleanupCommand();
-            break;
-         case GravitateDataCommand.METHOD_ID:
-            returnValue = new GravitateDataCommand();
-            break;
-
-
-         default:
-            throw new CacheException("Unknown command id " + id + "!");
-      }
-
-      returnValue.setParameters(id, parameters);
-      registry.wireDependencies(returnValue);
-      return returnValue;
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -36,7 +36,7 @@
    Object[] getParameters();
 
    /**
-    * Used by the {@link org.jboss.cache.commands.CommandsFactory} to create a command from raw data read off a stream.
+    * Used by the {@link org.jboss.cache.factories.CommandsFactory} to create a command from raw data read off a stream.
     *
     * @param commandId  command id to set.  This is usually unused but *could* be used in the event of a command having multiple IDs, such as {@link org.jboss.cache.commands.write.PutKeyValueCommand}.
     * @param parameters object array of args

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,9 +1,9 @@
 package org.jboss.cache.commands.read;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 
 /**
  * // TODO: MANIK: Document this
@@ -14,10 +14,10 @@
 public abstract class AbstractDataCommand implements DataCommand
 {
    protected Fqn fqn;
-   protected CacheData cacheData;
+   protected DataContainer cacheData;
 
    @Inject
-   public void initialize(CacheData cacheData)
+   public void initialize(DataContainer cacheData)
    {
       this.cacheData = cacheData;
    }

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -2,6 +2,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.ReplicableCommand;
@@ -9,7 +10,6 @@
 import org.jboss.cache.commands.read.GetDataMapCommand;
 import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.invocation.InterceptorChain;
 
 import java.util.ArrayList;
@@ -26,7 +26,7 @@
 
    private DataCommand cacheDataComand;
    private Boolean searchBackupSubtrees;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private InterceptorChain interceptorChain;
 
    private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
@@ -45,7 +45,7 @@
    }
 
    @Inject
-   public void initialize(CacheData cacheData, InterceptorChain interceptorChain)
+   public void initialize(DataContainer cacheData, InterceptorChain interceptorChain)
    {
       this.cacheData = cacheData;
       this.interceptorChain = interceptorChain;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -2,17 +2,17 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.write.EvictNodeCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.invocation.CacheTransactionHelper;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -34,7 +34,7 @@
    private CacheTransactionHelper transactionHelper;
    private InterceptorChain invoker;
    private CommandsFactory commandsFactory;
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
    private static final Log log = LogFactory.getLog(DataGravitationCleanupCommand.class);
    private static boolean trace;
@@ -59,7 +59,7 @@
 
    @Inject
    public void initialize(BuddyManager buddyManager, InterceptorChain invoker, CacheTransactionHelper transactionHelper,
-                          CommandsFactory commandsFactory, CacheData cacheData)
+                          CommandsFactory commandsFactory, DataContainer cacheData)
    {
       this.buddyManager = buddyManager;
       this.invoker = invoker;

Copied: core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java (from rev 5706, core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -0,0 +1,418 @@
+package org.jboss.cache.factories;
+
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.commands.read.GetChildrenNamesCommand;
+import org.jboss.cache.commands.read.GetDataMapCommand;
+import org.jboss.cache.commands.read.GetKeyValueCommand;
+import org.jboss.cache.commands.read.GetKeysCommand;
+import org.jboss.cache.commands.read.GetNodeCommand;
+import org.jboss.cache.commands.read.GravitateDataCommand;
+import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+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.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.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveDataCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jgroups.Address;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Factory for all types of cache commands.
+ * Here are some of the purposes of this class:
+ * <pre>
+ *   - not creating <code>CacheCommands</code> directly (i.e. through new usage) as this would reduce unit testability
+ *   - reduce the coupling between commands and other components. e.g. considering a commands that needs to knwo whether
+ *     locking type is optimistic, we will pass in a 'optimistic' boolean flag rather than entire Configuration object
+ * </pre>
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class CommandsFactory
+{
+   private RPCManager rpcManager;
+   private ComponentRegistry registry;
+
+   public CommandsFactory()
+   {
+   }
+
+   public CommandsFactory(RPCManager rpcManager, ComponentRegistry registry)
+   {
+      this.rpcManager = rpcManager;
+      this.registry = registry;
+   }
+
+   @Inject
+   public void initialize(RPCManager rpc, ComponentRegistry registry)
+   {
+      this.rpcManager = rpc;
+      this.registry = registry;
+   }
+
+   public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContents)
+   {
+      PutDataMapCommand cmd = new PutDataMapCommand(gtx, fqn, data, createUndoOps, eraseContents);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
+   {
+      PutKeyValueCommand command = new PutKeyValueCommand(gtx, fqn, key, value, createUndoOps, putForExternalRead);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public ReplicateCommand buildReplicateCommand(ReplicableCommand command)
+   {
+      ReplicateCommand cmd = new ReplicateCommand(command);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public ReplicateCommand buildReplicateCommand(List<ReplicableCommand> modifications)
+   {
+      ReplicateCommand cmd = new ReplicateCommand(modifications);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, ReversibleCommand command, boolean onePhaseCommit)
+   {
+      return buildPrepareCommand(gtx, Collections.singletonList(command), rpcManager.getLocalAddress(), onePhaseCommit);
+   }
+
+   public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List<ReversibleCommand> modifications, Address address, boolean onePhaseCommit)
+   {
+      PrepareCommand cmd = new PrepareCommand(gtx, modifications, address, onePhaseCommit);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public CommitCommand buildCommitCommand(GlobalTransaction gtx)
+   {
+      CommitCommand cmd = new CommitCommand(gtx);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public DataGravitationCleanupCommand buildDataGravitationCleanupCommand(Fqn primaryFqn, Fqn backupFqn)
+   {
+      DataGravitationCleanupCommand command = new DataGravitationCleanupCommand(primaryFqn, backupFqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean searchSubtrees)
+   {
+      GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn, boolean eviction, boolean skipSendingNodeEvents, boolean createUndoOps)
+   {
+      RemoveNodeCommand command = new RemoveNodeCommand(gtx, fqn, createUndoOps, skipSendingNodeEvents, eviction);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RemoveDataCommand buildRemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
+   {
+      RemoveDataCommand command = new RemoveDataCommand(gtx, fqn, createUndoops, sendNodeEvent, eviction);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public EvictNodeCommand buildEvictFqnCommand(Fqn fqn)
+   {
+      EvictNodeCommand command = new EvictNodeCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public InvalidateCommand buildInvalidateCommand(Fqn fqn)
+   {
+      InvalidateCommand command = new InvalidateCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn<?> fqn, Object key, boolean b)
+   {
+      RemoveKeyCommand command = new RemoveKeyCommand(tx, fqn, key, b);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GetDataMapCommand buildGetDataMapCommand(Fqn fqn)
+   {
+      GetDataMapCommand command = new GetDataMapCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RemoteExistsNodeCommand buildExistsNodeCommand(Fqn fqn)
+   {
+      RemoteExistsNodeCommand command = new RemoteExistsNodeCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GetKeyValueCommand buildGetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
+   {
+      GetKeyValueCommand command = new GetKeyValueCommand(fqn, key, sendNodeEvent);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GetNodeCommand buildGetNodeCommand(Fqn fqn)
+   {
+      GetNodeCommand command = new GetNodeCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GetKeysCommand buildGetKeysCommand(Fqn fqn)
+   {
+      GetKeysCommand command = new GetKeysCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
+   {
+      GetChildrenNamesCommand command = new GetChildrenNamesCommand(fqn);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public MoveCommand buildMoveCommand(Fqn from, Fqn to)
+   {
+      MoveCommand command = new MoveCommand(from, to);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public GravitateDataCommand buildGravitateDataCacheCommand(Fqn fqn, boolean searchSubtrees)
+   {
+      GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
+   {
+      RollbackCommand cmd = new RollbackCommand(gtx);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, List<ReversibleCommand> modifications, Map data, Address address, boolean onePhaseCommit)
+   {
+      OptimisticPrepareCommand cmd = new OptimisticPrepareCommand(gtx, modifications, data, address, onePhaseCommit);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+
+   public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, ReversibleCommand command)
+   {
+      List<ReversibleCommand> list = (List<ReversibleCommand>) (command != null ? Collections.singletonList(command) : Collections.emptyList());
+      return buildOptimisticPrepareCommand(gtx, list, null, null, false);
+   }
+
+   public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName)
+   {
+      AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address, buddyPoolName);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName)
+   {
+      RemoveFromBuddyGroupCommand command = new RemoveFromBuddyGroupCommand(groupName);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public AssignToBuddyGroupCommand buildAssignToBuddyGroupCommand(BuddyGroup group, Map<Fqn, byte[]> state)
+   {
+      AssignToBuddyGroupCommand command = new AssignToBuddyGroupCommand(group, state);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public ClusteredGetCommand buildClusteredGetCommand(Boolean searchBackupSubtrees, DataCommand cacheDataComand)
+   {
+      ClusteredGetCommand command = new ClusteredGetCommand(searchBackupSubtrees, cacheDataComand);
+      registry.wireDependencies(command);
+      return command;
+   }
+
+   public CreateNodeCommand buildCreateNodeCommand(Fqn fqn)
+   {
+      CreateNodeCommand cmd = new CreateNodeCommand(fqn);
+      registry.wireDependencies(cmd);
+      return cmd;
+   }
+
+   /**
+    * Builds a cache command based on the ID passed in and an object array of parameters
+    *
+    * @param id         id of the command to build
+    * @param parameters parameters attached to the command
+    * @return a newly constructed cache command
+    */
+   public ReplicableCommand fromStream(int id, Object[] parameters)
+   {
+      // todo: must be a better way to do this!!!
+      ReplicableCommand returnValue;
+      switch (id)
+      {
+         case RemoteExistsNodeCommand.METHOD_ID:
+            returnValue = new RemoteExistsNodeCommand();
+            break;
+
+         case GetChildrenNamesCommand.METHOD_ID:
+            returnValue = new GetChildrenNamesCommand();
+            break;
+
+         case GetDataMapCommand.METHOD_ID:
+            returnValue = new GetDataMapCommand();
+            break;
+
+         case GetKeysCommand.METHOD_ID:
+            returnValue = new GetKeysCommand();
+            break;
+
+         case GetKeyValueCommand.METHOD_ID:
+            returnValue = new GetKeyValueCommand();
+            break;
+
+         case GetNodeCommand.METHOD_ID:
+            returnValue = new GetNodeCommand();
+            break;
+
+         case MoveCommand.METHOD_ID:
+            returnValue = new MoveCommand();
+            break;
+
+         case PutDataMapCommand.METHOD_ID:
+         case PutDataMapCommand.ERASE_METHOD_ID:
+         case PutDataMapCommand.ERASE_VERSIONED_METHOD_ID:
+         case PutDataMapCommand.VERSIONED_METHOD_ID:
+            returnValue = new PutDataMapCommand();
+            break;
+
+         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:
+            returnValue = new PutKeyValueCommand();
+            break;
+
+         case RemoveDataCommand.METHOD_ID:
+         case RemoveDataCommand.VERSIONED_METHOD_ID:
+            returnValue = new RemoveDataCommand();
+            break;
+
+         case RemoveKeyCommand.METHOD_ID:
+         case RemoveKeyCommand.VERSIONED_METHOD_ID:
+            returnValue = new RemoveKeyCommand();
+            break;
+
+         case RemoveNodeCommand.METHOD_ID:
+         case RemoveNodeCommand.VERSIONED_METHOD_ID:
+            returnValue = new RemoveNodeCommand();
+            break;
+
+         case CreateNodeCommand.METHOD_ID:
+            returnValue = new CreateNodeCommand();
+            break;
+
+            // --- transactional method calls
+
+         case PrepareCommand.METHOD_ID:
+            returnValue = new PrepareCommand();
+            break;
+
+         case OptimisticPrepareCommand.METHOD_ID:
+            returnValue = new OptimisticPrepareCommand();
+            break;
+
+         case CommitCommand.METHOD_ID:
+            returnValue = new CommitCommand();
+            break;
+
+         case RollbackCommand.METHOD_ID:
+            returnValue = new RollbackCommand();
+            break;
+
+            // --- replicate methods
+         case ReplicateCommand.MULTIPLE_METHOD_ID:
+         case ReplicateCommand.SINGLE_METHOD_ID:
+            returnValue = new ReplicateCommand();
+            break;
+
+         case InvalidateCommand.METHOD_ID:
+            returnValue = new InvalidateCommand();
+            break;
+
+         case ClusteredGetCommand.METHOD_ID:
+            returnValue = new ClusteredGetCommand();
+            break;
+
+            // ---- Buddy replication - group organisation commands
+         case AnnounceBuddyPoolNameCommand.METHOD_ID:
+            returnValue = new AnnounceBuddyPoolNameCommand();
+            break;
+         case AssignToBuddyGroupCommand.METHOD_ID:
+            returnValue = new AssignToBuddyGroupCommand();
+            break;
+         case RemoveFromBuddyGroupCommand.METHOD_ID:
+            returnValue = new RemoveFromBuddyGroupCommand();
+            break;
+         case DataGravitationCleanupCommand.METHOD_ID:
+            returnValue = new DataGravitationCleanupCommand();
+            break;
+         case GravitateDataCommand.METHOD_ID:
+            returnValue = new GravitateDataCommand();
+            break;
+
+
+         default:
+            throw new CacheException("Unknown command id " + id + "!");
+      }
+
+      returnValue.setParameters(id, parameters);
+      registry.wireDependencies(returnValue);
+      return returnValue;
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheSPI;
-import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.ConfigurationException;
 import org.jboss.cache.config.RuntimeConfig;
@@ -16,8 +17,6 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.util.BeanUtils;
 import org.jboss.cache.util.reflect.CachedMethod;
@@ -338,7 +337,7 @@
 
    private boolean isNonBootstrapClass(Class<?> componentClass)
    {
-      return !(componentClass.equals(CacheSPI.class) || componentClass.equals(CacheLifecycleManager.class) ||
+      return !(componentClass.equals(CacheSPI.class) || componentClass.equals(LifecycleManager.class) ||
             componentClass.equals(Cache.class) || componentClass.equals(ComponentRegistry.class) ||
             componentClass.equals(Configuration.class));
    }
@@ -397,17 +396,17 @@
       moveComponentsToState(overallState == STARTED ? STOPPED : CONSTRUCTED);
       moveComponentsToState(originalState);
       // re- add a few key components - this is a hack for now
-      CacheLifecycleManager clm = getComponent(CacheLifecycleManager.class);
+      LifecycleManager clm = getComponent(LifecycleManager.class);
       CacheSPI spi = getComponent(CacheSPI.class.getName(), CacheSPI.class);
       CommandsFactory commandsFactory = getComponent(CommandsFactory.class.getName(), CommandsFactory.class);
 
-      unregisterComponent(CacheLifecycleManager.class);
+      unregisterComponent(LifecycleManager.class);
       unregisterComponent(CacheSPI.class);
       unregisterComponent(CommandsFactory.class);
 
       overallState = CONSTRUCTED;
 
-      registerComponent(CacheLifecycleManager.class.getName(), clm, CacheLifecycleManager.class);
+      registerComponent(LifecycleManager.class.getName(), clm, LifecycleManager.class);
       registerComponent(CacheSPI.class.getName(), spi, CacheSPI.class);
       registerComponent(CommandsFactory.class.getName(), commandsFactory, CommandsFactory.class);
 
@@ -632,8 +631,8 @@
       Component deployerClassLoader = componentLookup.get("deployerClassLoader");
       Component spi = componentLookup.get(CacheSPI.class.getName());
       Component interceptorChain = componentLookup.get(InterceptorChain.class.getName());
-      Component lifeCycleManager = componentLookup.get(CacheLifecycleManager.class.getName());
-      Component cacheData = componentLookup.get(CacheData.class.getName());
+      Component lifeCycleManager = componentLookup.get(LifecycleManager.class.getName());
+      Component cacheData = componentLookup.get(DataContainer.class.getName());
       Component conf = componentLookup.get(Configuration.class.getName());
       Component cr = componentLookup.get(ComponentRegistry.class.getName());
 
@@ -653,7 +652,7 @@
       cr.changeState(CONSTRUCTED);
 
       bootstrap = new Bootstrap((ClassLoader) deployerClassLoader.instance, (InterceptorChain) interceptorChain.instance,
-            (CacheLifecycleManager) lifeCycleManager.instance, (CacheData) cacheData.instance, (CacheSPI) spi.instance,
+            (LifecycleManager) lifeCycleManager.instance, (DataContainer) cacheData.instance, (CacheSPI) spi.instance,
             (ComponentRegistry) cr.instance, (Configuration) conf.instance);
 
       overallState = null;
@@ -970,15 +969,15 @@
    class Bootstrap
    {
       final InterceptorChain interceptorChain;
-      final CacheLifecycleManager lifecycleManager;
-      final CacheData cacheData;
+      final LifecycleManager lifecycleManager;
+      final DataContainer cacheData;
       final CacheSPI cacheSPI;
       final ComponentRegistry componentRegistry;
       final Configuration configuration;
       private final ClassLoader deployerClassLoader;
 
-      Bootstrap(ClassLoader deployerClassLoader, InterceptorChain interceptorChain, CacheLifecycleManager lifecycleManager,
-                CacheData cacheData, CacheSPI cacheSPI, ComponentRegistry componentRegistry, Configuration configuration)
+      Bootstrap(ClassLoader deployerClassLoader, InterceptorChain interceptorChain, LifecycleManager lifecycleManager,
+                DataContainer cacheData, CacheSPI cacheSPI, ComponentRegistry componentRegistry, Configuration configuration)
       {
          this.deployerClassLoader = deployerClassLoader;
          this.lifecycleManager = lifecycleManager;
@@ -992,9 +991,9 @@
       boolean isBootstrapped()
       {
          return componentLookup.containsKey(Configuration.class.getName()) &&
-               componentLookup.containsKey(CacheLifecycleManager.class.getName()) &&
+               componentLookup.containsKey(LifecycleManager.class.getName()) &&
                componentLookup.containsKey(InterceptorChain.class.getName()) &&
-               componentLookup.containsKey(CacheData.class.getName()) &&
+               componentLookup.containsKey(DataContainer.class.getName()) &&
                componentLookup.containsKey(CacheSPI.class.getName()) &&
                componentLookup.containsKey(ComponentRegistry.class.getName()) &&
                componentLookup.containsKey("deployerClassLoader");
@@ -1007,8 +1006,8 @@
          registerComponent(Configuration.class.getName(), configuration, Configuration.class);
          registerComponent(ComponentRegistry.class.getName(), componentRegistry, ComponentRegistry.class);
          registerComponent(InterceptorChain.class.getName(), interceptorChain, InterceptorChain.class);
-         registerComponent(CacheLifecycleManager.class.getName(), lifecycleManager, CacheLifecycleManager.class);
-         registerComponent(CacheData.class.getName(), cacheData, CacheData.class);
+         registerComponent(LifecycleManager.class.getName(), lifecycleManager, LifecycleManager.class);
+         registerComponent(DataContainer.class.getName(), cacheData, DataContainer.class);
          registerComponent(CacheSPI.class.getName(), cacheSPI, CacheSPI.class);
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,10 +1,9 @@
 package org.jboss.cache.factories;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.RegionManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.config.ConfigurationException;
 import org.jboss.cache.factories.annotations.DefaultFactoryFor;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
 import org.jboss.cache.invocation.CacheTransactionHelper;
 import org.jboss.cache.invocation.InvocationContextContainer;
@@ -26,7 +25,7 @@
 @DefaultFactoryFor(classes = {StateTransferManager.class, TransactionTable.class, RegionManager.class, Notifier.class,
       ChannelMessageListener.class, CacheLoaderManager.class, Marshaller.class,
       InvocationContextContainer.class, CacheInvocationDelegate.class,
-      CacheTransactionHelper.class, CacheData.class, CommandsFactory.class, LockManager.class})
+      CacheTransactionHelper.class, DataContainer.class, CommandsFactory.class, LockManager.class})
 public class EmptyConstructorFactory extends ComponentFactory
 {
    @Override

Modified: core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -10,7 +10,7 @@
 import org.jboss.cache.config.ConfigurationException;
 import org.jboss.cache.factories.annotations.DefaultFactoryFor;
 import org.jboss.cache.interceptors.*;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.invocation.InterceptorChain;
 
 /**
@@ -33,10 +33,10 @@
       return new InterceptorChainFactory();
    }
 
-   private ChainedInterceptor createInterceptor(Class<? extends ChainedInterceptor> clazz) throws IllegalAccessException, InstantiationException
+   private VisitorInterceptor createInterceptor(Class<? extends VisitorInterceptor> clazz) throws IllegalAccessException, InstantiationException
    {
       //todo - no reason for the individual interceptors to be registered as components, all manipulation should be done through InterceptorChain
-      ChainedInterceptor chainedInterceptor = componentRegistry.getComponent(clazz.getName(), clazz);
+      VisitorInterceptor chainedInterceptor = componentRegistry.getComponent(clazz.getName(), clazz);
       if (chainedInterceptor == null)
       {
          chainedInterceptor = clazz.newInstance();
@@ -55,7 +55,7 @@
    {
       boolean optimistic = configuration.isNodeLockingOptimistic();
       // load the icInterceptor first
-      ChainedInterceptor first = createInterceptor(InvocationContextInterceptor.class);
+      VisitorInterceptor first = createInterceptor(InvocationContextInterceptor.class);
       InterceptorChain interceptorChain = new InterceptorChain(first);
 
       // load the cache management interceptor next
@@ -115,7 +115,7 @@
          interceptorChain.appendIntereceptor(createInterceptor(configuration.isUsingBuddyReplication() ? BuddyRegionAwareEvictionInterceptor.class : EvictionInterceptor.class));
 
       if (optimistic) interceptorChain.appendIntereceptor(createInterceptor(OptimisticNodeInterceptor.class));
-      ChainedInterceptor callInterceptor = createInterceptor(CallInterceptor.class);
+      VisitorInterceptor callInterceptor = createInterceptor(CallInterceptor.class);
       interceptorChain.appendIntereceptor(callInterceptor);
       if (log.isTraceEnabled()) log.trace("Finished building interceptor chain.");
       return interceptorChain;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,5 +1,6 @@
 package org.jboss.cache.interceptors;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
@@ -17,7 +18,6 @@
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -270,12 +270,12 @@
    {
 
       private List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
-      private CacheData cacheData;
+      private DataContainer cacheData;
       private CacheLoader loader;
       private Notifier notifier;
       private int txActs = 0;
 
-      public ActivationModificationsBuilder(CacheData cacheData, CacheLoader loader, Notifier notifier)
+      public ActivationModificationsBuilder(DataContainer cacheData, CacheLoader loader, Notifier notifier)
       {
          this.cacheData = cacheData;
          this.loader = loader;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -7,14 +7,14 @@
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.cluster.ReplicationQueue;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
@@ -29,7 +29,7 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
-public abstract class BaseRpcInterceptor extends ChainedInterceptor
+public abstract class BaseRpcInterceptor extends VisitorInterceptor
 {
    private BuddyManager buddyManager;
    private boolean usingBuddyReplication;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,9 +1,9 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.InvocationContext;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
@@ -18,7 +18,7 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  */
-public abstract class BaseTransactionalContextInterceptor extends ChainedInterceptor
+public abstract class BaseTransactionalContextInterceptor extends VisitorInterceptor
 {
    protected TransactionTable txTable;
    protected TransactionManager txManager;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,6 +1,7 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.CacheException;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
@@ -20,8 +21,7 @@
 import static org.jboss.cache.config.Configuration.CacheMode;
 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.invocation.CacheData;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.lock.LockManager;
@@ -44,7 +44,7 @@
  * @author Bela Ban
  * @version $Id$
  */
-public class CacheLoaderInterceptor extends ChainedInterceptor implements CacheLoaderInterceptorMBean
+public class CacheLoaderInterceptor extends VisitorInterceptor implements CacheLoaderInterceptorMBean
 {
    private long cacheLoads = 0;
    private long cacheMisses = 0;
@@ -54,7 +54,7 @@
    protected TransactionTable txTable = null;
    protected Configuration config;
    protected CacheLoader loader;
-   protected CacheData cacheData;
+   protected DataContainer cacheData;
    protected Notifier notifier;
 
    protected boolean isActivation = false;
@@ -70,7 +70,7 @@
 
    @Inject
    protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm, Configuration configuration,
-                                     CacheData cacheData, Configuration config, LockManager lockManager, Notifier notifier)
+                                     DataContainer cacheData, Configuration config, LockManager lockManager, Notifier notifier)
    {
       this.txTable = txTable;
       this.clm = clm;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -21,14 +21,14 @@
  */
 package org.jboss.cache.interceptors;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.read.GetKeyValueCommand;
 import org.jboss.cache.commands.write.EvictNodeCommand;
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -39,7 +39,7 @@
  * @author Jerry Gauthier
  * @version $Id$
  */
-public class CacheMgmtInterceptor extends ChainedInterceptor implements CacheMgmtInterceptorMBean
+public class CacheMgmtInterceptor extends VisitorInterceptor implements CacheMgmtInterceptorMBean
 {
    private long m_hit_times = 0;
    private long m_miss_times = 0;
@@ -51,10 +51,10 @@
    private long m_start = System.currentTimeMillis();
    private long m_reset = m_start;
 
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
    @Inject
-   public void setDependencies(CacheData cacheData)
+   public void setDependencies(DataContainer cacheData)
    {
       this.cacheData = cacheData;
    }

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,6 +1,7 @@
 package org.jboss.cache.interceptors;
 
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
@@ -22,7 +23,6 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -56,7 +56,7 @@
    private long cacheStores = 0;
    private CacheLoader loader;
    private Configuration configuration;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private CacheLoaderManager loaderManager;
 
    public CacheStoreInterceptor()
@@ -66,7 +66,7 @@
    }
 
    @Inject
-   protected void init(CacheData cacheData, CacheLoaderManager loaderManager, TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig, Configuration configuration)
+   protected void init(DataContainer cacheData, CacheLoaderManager loaderManager, TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig, Configuration configuration)
    {
       // never inject a CacheLoader at this stage - only a CacheLoaderManager, since the CacheLoaderManager only creates a CacheLoader instance when it @Starts.
       this.loaderManager = loaderManager;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -18,7 +18,7 @@
 import org.jboss.cache.config.Option;
 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.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionTable;
 
@@ -35,7 +35,7 @@
  * @author Bela Ban
  * @version $Id$
  */
-public class CallInterceptor extends ChainedInterceptor
+public class CallInterceptor extends VisitorInterceptor
 {
 
    //   private CacheLoaderManager cacheLoaderManager;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -8,12 +8,12 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -27,9 +27,9 @@
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.marshall.NodeData;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
@@ -73,13 +73,13 @@
     * cleanup commands corresponding to all gravitate calls made during the course of the transaction in question.
     */
    private Map<GlobalTransaction, List<ReplicableCommand>> cleanupCommands = new ConcurrentHashMap<GlobalTransaction, List<ReplicableCommand>>();
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private Configuration config;
    private CommandsFactory commandsFactory;
    private CacheSPI cacheSPI;
 
    @Inject
-   public void injectComponents(BuddyManager buddyManager, Configuration config, CacheData cacheData, CommandsFactory commandsFactory, CacheSPI cacheSPI)
+   public void injectComponents(BuddyManager buddyManager, Configuration config, DataContainer cacheData, CommandsFactory commandsFactory, CacheSPI cacheSPI)
    {
       this.buddyManager = buddyManager;
       this.cacheData = cacheData;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -7,6 +7,7 @@
  */
 package org.jboss.cache.interceptors;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
@@ -24,8 +25,7 @@
 import org.jboss.cache.eviction.EvictedEventNode;
 import org.jboss.cache.eviction.NodeEventType;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 /**
  * Eviction Interceptor.
@@ -36,14 +36,14 @@
  * @author Mircea.Markus at jboss.com
  * @version $Revision$
  */
-public class EvictionInterceptor extends ChainedInterceptor
+public class EvictionInterceptor extends VisitorInterceptor
 {
    protected RegionManager regionManager;
 
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
    @Inject
-   public void initialize(CacheData cacheData)
+   public void initialize(DataContainer cacheData)
    {
       this.cacheData = cacheData;
    }

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -30,7 +30,7 @@
 import org.jboss.cache.config.Configuration;
 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.interceptors.base.VisitorInterceptor;
 
 import java.util.Collections;
 import java.util.Map;
@@ -40,8 +40,10 @@
  *
  * @author Bela Ban
  * @version $Id$
+ * @deprecated this will be removed in a 3.x release.  Please use {@link org.jboss.cache.interceptors.base.VisitorInterceptor} instead, since it provides strongly typed callbacks which are more efficient.
  */
-public abstract class Interceptor extends ChainedInterceptor implements InterceptorMBean
+ at Deprecated
+public abstract class Interceptor extends VisitorInterceptor implements InterceptorMBean
 {
    protected CacheSPI<?, ?> cache;
    protected Log log = 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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -12,7 +12,6 @@
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.cluster.ReplicationQueue;
 import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
@@ -28,6 +27,7 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -11,7 +11,7 @@
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.commands.write.RemoveDataCommand;
 import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.marshall.MarshalledValue;
 import org.jboss.cache.marshall.MarshalledValueHelper;
 import org.jboss.cache.marshall.MarshalledValueMap;
@@ -34,7 +34,7 @@
  * @see org.jboss.cache.marshall.MarshalledValue
  * @since 2.1.0
  */
-public class MarshalledValueInterceptor extends ChainedInterceptor
+public class MarshalledValueInterceptor extends VisitorInterceptor
 {
 
    @Override

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -8,6 +8,7 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
@@ -16,7 +17,6 @@
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 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.optimistic.DefaultDataVersion;
@@ -44,14 +44,14 @@
     */
    private NodeFactory nodeFactory;
 
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
    private CacheSPI cache;
 
    private long lockAcquisitionTimeout;
 
    @Inject
-   private void injectDependencies(NodeFactory nodeFactory, CacheData cacheData, CacheSPI cacheSPI)
+   private void injectDependencies(NodeFactory nodeFactory, DataContainer cacheData, CacheSPI cacheSPI)
    {
       this.nodeFactory = nodeFactory;
       this.cacheData = cacheData;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -12,7 +12,7 @@
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.lock.TimeoutException;
 import org.jboss.cache.optimistic.TransactionWorkspace;
 import org.jboss.cache.optimistic.WorkspaceNode;
@@ -29,7 +29,7 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
-public abstract class OptimisticInterceptor extends ChainedInterceptor
+public abstract class OptimisticInterceptor extends VisitorInterceptor
 {
    protected TransactionManager txManager;
    protected TransactionTable txTable;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -8,6 +8,7 @@
 
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
@@ -28,7 +29,6 @@
 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.loader.CacheLoaderManager;
 import org.jboss.cache.notifications.Notifier;
 import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
@@ -58,12 +58,12 @@
    private NodeFactory nodeFactory;
    private Notifier notifier;
    private CacheLoaderManager cacheLoaderManager;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private long lockAcquisitionTimeout;
 
    @Inject
    protected void injectDependencies(Notifier notifier, NodeFactory nodeFactory, CacheLoaderManager cacheLoaderManager,
-                                     CacheData cacheData, Configuration configuration)
+                                     DataContainer cacheData, Configuration configuration)
    {
       this.notifier = notifier;
       this.nodeFactory = nodeFactory;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -10,7 +10,6 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VersionedDataCommand;
@@ -29,6 +28,7 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -8,21 +8,20 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 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.invocation.CacheData;
 import static org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.optimistic.DataVersioningException;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.optimistic.TransactionWorkspace;
 import org.jboss.cache.optimistic.WorkspaceNode;
 import org.jboss.cache.transaction.GlobalTransaction;
-import org.jgroups.Address;
 
 import java.util.Collection;
 import java.util.List;
@@ -52,10 +51,10 @@
 {
    private boolean useTombstones;
 
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
-   @Inject 
-   public void initialize(CacheSPI cache, CacheData cacheData)
+   @Inject
+   public void initialize(CacheSPI cache, DataContainer cacheData)
    {
       this.cacheData = cacheData;
       CacheMode mode = cache.getConfiguration().getCacheMode();

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,13 +1,13 @@
 package org.jboss.cache.interceptors;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.write.EvictNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.notifications.Notifier;
@@ -24,7 +24,7 @@
  * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  * @version $Id$
  */
-public class PassivationInterceptor extends ChainedInterceptor implements PassivationInterceptorMBean
+public class PassivationInterceptor extends VisitorInterceptor implements PassivationInterceptorMBean
 {
 
    private final AtomicLong passivations = new AtomicLong(0);
@@ -32,10 +32,10 @@
    protected CacheLoader loader;
    private Notifier notifier;
    private Configuration configuration;
-   private CacheData cacheData;
+   private DataContainer cacheData;
 
    @Inject
-   public void setDependencies(Notifier notifier, Configuration configuration, CacheData cacheData, CacheLoaderManager loaderManager)
+   public void setDependencies(Notifier notifier, Configuration configuration, DataContainer cacheData, CacheLoaderManager loaderManager)
    {
       this.notifier = notifier;
       this.configuration = configuration;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -6,6 +6,7 @@
  */
 package org.jboss.cache.interceptors;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
@@ -27,7 +28,6 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.PostProcessingChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.LockManager;
 import org.jboss.cache.lock.NodeLock;
@@ -58,13 +58,13 @@
 public class PessimisticLockInterceptor extends PostProcessingChainedInterceptor
 {
    private TransactionTable txTable;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private LockManager lockManager;
    private Configuration configuration;
    private long lockAcquisitionTimeout;
 
    @Inject
-   public void injectDependencies(Configuration configuration, CacheData cacheImpl, TransactionTable txTable, LockManager lockManager)
+   public void injectDependencies(Configuration configuration, DataContainer cacheImpl, TransactionTable txTable, LockManager lockManager)
    {
       lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
       this.cacheData = cacheImpl;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -8,10 +8,10 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.InvocationContext;
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.ReplicationException;
 import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VersionedDataCommand;
@@ -29,8 +29,8 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.CacheTransactionHelper;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.notifications.Notifier;
@@ -70,7 +70,7 @@
    private CacheTransactionHelper transactionHelper;
    private Notifier notifier;
    private InvocationContextContainer invocationContextContainer;
-   private CacheLifecycleManager lifecycleManager;
+   private LifecycleManager lifecycleManager;
 
    private final ModificationsReplayVisitor replayVisitorNoInject = new ModificationsReplayVisitor(false);
    private final ModificationsReplayVisitor replayVisitorWithInject = new ModificationsReplayVisitor(true);
@@ -87,7 +87,7 @@
    @Inject
    public void intialize(Configuration configuration, RPCManager rpcManager,
                          CacheTransactionHelper transactionHelper, Notifier notifier, InvocationContextContainer icc,
-                         CacheLifecycleManager lifecycleManager, CommandsFactory factory)
+                         LifecycleManager lifecycleManager, CommandsFactory factory)
    {
       this.configuration = configuration;
       this.commandsFactory = factory;

Deleted: core/trunk/src/main/java/org/jboss/cache/interceptors/base/ChainedInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/ChainedInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/ChainedInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,76 +0,0 @@
-package org.jboss.cache.interceptors.base;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.interceptors.InterceptorMBean;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 2.2
- */
-public class ChainedInterceptor extends AbstractVisitor implements InterceptorMBean
-{
-   private boolean statsEnabled = false;
-
-   private ChainedInterceptor next;
-
-   protected Log log;
-   protected boolean trace;
-
-   public ChainedInterceptor()
-   {
-      log = LogFactory.getLog(getClass());
-      trace = log.isTraceEnabled();
-   }
-
-   public boolean getStatisticsEnabled()
-   {
-      return statsEnabled;
-   }
-
-   public void setStatisticsEnabled(boolean enabled)
-   {
-      statsEnabled = enabled;
-   }
-
-   public Map<String, Object> dumpStatistics()
-   {
-      return Collections.emptyMap();
-   }
-
-   public void resetStatistics()
-   {
-   }
-
-   public ChainedInterceptor getNext()
-   {
-      return next;
-   }
-
-   public boolean hasNext()
-   {
-      return getNext() != null;
-   }
-
-   public void setNext(ChainedInterceptor next)
-   {
-      this.next = next;
-   }
-
-   public Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable
-   {
-      return command.acceptVisitor(ctx, getNext());
-   }
-
-   @Override
-   public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
-   {
-      return invokeNextInterceptor(ctx, command);
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -29,7 +29,7 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public abstract class PostProcessingChainedInterceptor extends ChainedInterceptor
+public abstract class PostProcessingChainedInterceptor extends VisitorInterceptor
 {
    @Override
    public final Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -25,12 +25,12 @@
 /**
  * Chained command interceptor that performs a skip check before calling each handler method.
  * This is usefull in scenarios where all handlers methods should be skiped if the same condition is true.
- * E.g. CacheStoreIntecepto would skip all method calls if we have a shared storage and this is not the designated node.
+ * E.g. CacheStoreInteceptor would skip all method calls if we have a shared storage and this is not the designated node.
  *
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
-public abstract class SkipCheckChainedInterceptor extends ChainedInterceptor
+public abstract class SkipCheckChainedInterceptor extends VisitorInterceptor
 {
    @Override
    public final Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable

Copied: core/trunk/src/main/java/org/jboss/cache/interceptors/base/VisitorInterceptor.java (from rev 5706, core/trunk/src/main/java/org/jboss/cache/interceptors/base/ChainedInterceptor.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/VisitorInterceptor.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/VisitorInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -0,0 +1,76 @@
+package org.jboss.cache.interceptors.base;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.AbstractVisitor;
+import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.interceptors.InterceptorMBean;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 2.2
+ */
+public class VisitorInterceptor extends AbstractVisitor implements InterceptorMBean
+{
+   private boolean statsEnabled = false;
+
+   private VisitorInterceptor next;
+
+   protected Log log;
+   protected boolean trace;
+
+   public VisitorInterceptor()
+   {
+      log = LogFactory.getLog(getClass());
+      trace = log.isTraceEnabled();
+   }
+
+   public boolean getStatisticsEnabled()
+   {
+      return statsEnabled;
+   }
+
+   public void setStatisticsEnabled(boolean enabled)
+   {
+      statsEnabled = enabled;
+   }
+
+   public Map<String, Object> dumpStatistics()
+   {
+      return Collections.emptyMap();
+   }
+
+   public void resetStatistics()
+   {
+   }
+
+   public VisitorInterceptor getNext()
+   {
+      return next;
+   }
+
+   public boolean hasNext()
+   {
+      return getNext() != null;
+   }
+
+   public void setNext(VisitorInterceptor next)
+   {
+      this.next = next;
+   }
+
+   public Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable
+   {
+      return command.acceptVisitor(ctx, getNext());
+   }
+
+   @Override
+   public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
+   {
+      return invokeNextInterceptor(ctx, command);
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -2,6 +2,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 
@@ -14,7 +15,7 @@
  * <p/>
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see org.jboss.cache.interceptors.base.ChainedInterceptor
+ * @see org.jboss.cache.interceptors.base.VisitorInterceptor
  * @see org.jboss.cache.InvocationContext
  * @since 2.1.0
  */
@@ -24,7 +25,7 @@
 
    protected Configuration configuration;
    protected InvocationContextContainer invocationContextContainer;
-   protected CacheLifecycleManager lifecycleManager;
+   protected LifecycleManager lifecycleManager;
    protected InterceptorChain invoker;
 
    protected boolean originLocal = true;
@@ -34,7 +35,7 @@
     */
    @Inject
    public void initialize(Configuration configuration, InvocationContextContainer invocationContextContainer,
-                          CacheLifecycleManager lifecycleManager, InterceptorChain interceptorChain)
+                          LifecycleManager lifecycleManager, InterceptorChain interceptorChain)
    {
       this.configuration = configuration;
       this.invocationContextContainer = invocationContextContainer;

Deleted: core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,598 +0,0 @@
-package org.jboss.cache.invocation;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * todo - consider moving all this functionality to node class itself
- *
- * @author Mircea.Markus at jboss.com
- * @since 2.2
- */
-// TODO: Rename to DataContainer (?) and move to org.jboss.cache
-public class CacheData
-{
-
-   private static final Log log = LogFactory.getLog(CacheData.class);
-
-   private Configuration configuration;
-
-   /**
-    * Root node.
-    */
-   private NodeSPI root;
-
-   @Inject
-   public void injectDependencies(Configuration configuration)
-   {
-      this.configuration = configuration;
-   }
-
-   /**
-    * Set<Fqn> of Fqns of the topmost node of internal regions that should
-    * not included in standard state transfers.
-    */
-   private final Set<Fqn> internalFqns = new HashSet<Fqn>();
-
-   public void registerInternalFqn(Fqn fqn)
-   {
-      internalFqns.add(fqn);
-   }
-
-
-   /**
-    * Finds a node given a fully qualified name.
-    * Whenever nodes are created, and the global transaction is not null, the created
-    * nodes have to be added to the transaction's {@link org.jboss.cache.transaction.TransactionEntry}
-    * field.<br>
-    * When a lock is acquired on a node, a reference to the lock has to be
-    * {@link org.jboss.cache.transaction.TransactionEntry#addLock(org.jboss.cache.lock.NodeLock) added to the list of locked nodes}
-    * in the {@link org.jboss.cache.transaction.TransactionEntry}.
-    * <p>This operation will also apply different locking to the cache nodes, depending on
-    * <tt>operation_type</tt>. If it is <tt>read</tt> type, all nodes will be acquired with
-    * read lock. Otherwise, the operation is <tt>write</tt> type, all parent nodes will be acquired
-    * with read lock while the destination node acquires write lock.</p>
-    *
-    * @param fqn Fully qualified name for the corresponding node.
-    * @return DataNode
-    */
-   public NodeSPI findNode(Fqn fqn)
-   {
-      try
-      {
-         return findNode(fqn, null);
-      }
-      catch (CacheException e)
-      {
-         log.warn("Unexpected error", e);
-         return null;
-      }
-   }
-
-   /**
-    * Finds a node given a fully qualified name and DataVersion.  Does not include invalid nodes.
-    */
-   public NodeSPI findNode(Fqn fqn, DataVersion version)
-   {
-      return findNode(fqn, version, false);
-   }
-
-   public NodeSPI findNodeCheck(GlobalTransaction tx, Fqn fqn, boolean includeInvalid)
-   {
-      NodeSPI n = findNode(fqn, null, includeInvalid);
-      if (n == null)
-      {
-         String errStr = "node " + fqn + " not found (globalTransaction=" + tx + ", caller=" + Thread.currentThread() + ")";
-         if (log.isTraceEnabled())
-         {
-            log.trace(errStr);
-         }
-         throw new NodeNotExistsException(errStr);
-      }
-      return n;
-   }
-
-   public NodeSPI findNode(Fqn fqn, DataVersion version, boolean includeInvalidNodes)
-   {
-      if (fqn == null) return null;
-
-      NodeSPI toReturn = peek(fqn, false, includeInvalidNodes);
-
-      if (toReturn != null && version != null && configuration.isNodeLockingOptimistic())
-      {
-         // we need to check the version of the data node...
-         DataVersion nodeVersion = toReturn.getVersion();
-         if (log.isTraceEnabled())
-         {
-            log.trace("looking for optimistic node [" + fqn + "] with version [" + version + "].  My version is [" + nodeVersion + "]");
-         }
-         if (nodeVersion.newerThan(version))
-         {
-            // we have a versioning problem; throw an exception!
-            throw new CacheException("Unable to validate versions.");
-         }
-      }
-      return toReturn;
-   }
-
-
-   public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
-   {
-      if (fqn == null || fqn.size() == 0) return getRoot();
-      NodeSPI n = getRoot();
-      int fqnSize = fqn.size();
-      for (int i = 0; i < fqnSize; i++)
-      {
-         Object obj = fqn.get(i);
-         n = n.getChildDirect(obj);
-         if (n == null)
-         {
-            return null;
-         }
-         else if (!includeDeletedNodes && n.isDeleted())
-         {
-            return null;
-         }
-         else if (!includeInvalidNodes && !n.isValid())
-         {
-            return null;
-         }
-      }
-      return n;
-   }
-
-
-   public List<NodeData> getNodeData(List<NodeData> list, NodeSPI node)
-   {
-      NodeData data = new NodeData(BuddyFqnTransformer.getActualFqn(node.getFqn()), node.getDataDirect());
-      list.add(data);
-      for (Object childNode : node.getChildrenDirect())
-      {
-         getNodeData(list, (NodeSPI) childNode);
-      }
-      return list;
-   }
-
-
-   public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes)
-   {
-      return peek(fqn, includeDeletedNodes, false);
-   }
-
-   /**
-    * Returns true if the FQN exists and the node has children.
-    */
-   public boolean hasChild(Fqn fqn)
-   {
-      if (fqn == null) return false;
-
-      NodeSPI n = findNode(fqn);
-      return n != null && n.hasChildrenDirect();
-   }
-
-
-   public NodeSPI getRoot()
-   {
-      return root;
-   }
-
-   public List<Fqn> getNodesForEviction(Fqn parent, boolean recursive)
-   {
-      List<Fqn> result = new ArrayList<Fqn>();
-      NodeSPI node = peek(parent, false);
-      if (recursive)
-      {
-         recursiveAddEvictionNodes(node, result);
-      }
-      else
-      {
-         if (node == null)
-         {
-            result.add(parent);
-            return result;
-         }
-         buildNodesForEviction(node, result);
-      }
-      return result;
-   }
-
-   private void recursiveAddEvictionNodes(NodeSPI node, List<Fqn> result)
-   {
-      for (NodeSPI child : (Set<NodeSPI>) node.getChildrenDirect())
-      {
-         recursiveAddEvictionNodes(child, result);
-      }
-      buildNodesForEviction(node, result);
-   }
-
-   private void buildNodesForEviction(Node node, List<Fqn> nodes)
-   {
-      if (node == null || node.isResident())
-      {
-         return;
-      }
-      Fqn fqn = node.getFqn();
-      if (fqn.isRoot())
-      {
-         for (Object childName : node.getChildrenNames())
-         {
-            if (!node.isResident()) nodes.add(Fqn.fromRelativeElements(fqn, childName));
-         }
-      }
-      else
-      {
-         nodes.add(fqn);
-      }
-   }
-
-   @Override
-   public String toString()
-   {
-      return toString(false);
-   }
-
-   public boolean exists(Fqn fqn)
-   {
-      return peek(fqn, false, false) != null;
-   }
-
-   /**
-    * Returns a Set<Fqn> of Fqns of the topmost node of internal regions that
-    * should not included in standard state transfers. Will include
-    * {@link BuddyManager#BUDDY_BACKUP_SUBTREE} if buddy replication is
-    * enabled.
-    *
-    * @return an unmodifiable Set<Fqn>.  Will not return <code>null</code>.
-    */
-   public Set<Fqn> getInternalFqns()
-   {
-      return Collections.unmodifiableSet(internalFqns);
-   }
-
-   /**
-    * Returns a debug string with optional details of contents.
-    */
-   public String toString(boolean details)
-   {
-      StringBuffer sb = new StringBuffer();
-      int indent = 0;
-
-      if (!details)
-      {
-         sb.append(getClass().getName()).append(" [").append(getNumberOfNodes()).append(" nodes, ");
-         sb.append(getNumberOfLocksHeld()).append(" locks]");
-      }
-      else
-      {
-         if (root == null)
-            return sb.toString();
-         for (Object n : root.getChildrenDirect())
-         {
-            ((NodeSPI) n).print(sb, indent);
-            sb.append("\n");
-         }
-      }
-      return sb.toString();
-   }
-
-   /**
-    * Returns the number of read or write locks held across the entire cache.
-    */
-   public int getNumberOfLocksHeld()
-   {
-      return numLocks(root);
-   }
-
-   private int numLocks(NodeSPI n)
-   {
-      int num = 0;
-      if (n != null)
-      {
-         if (n.getLock().isLocked())
-         {
-            num++;
-         }
-         for (Object cn : n.getChildrenDirect(true))
-         {
-            num += numLocks((NodeSPI) cn);
-         }
-      }
-      return num;
-   }
-
-   /**
-    * Returns an <em>approximation</em> of the total number of nodes in the
-    * cache. Since this method doesn't acquire any locks, the number might be
-    * incorrect, or the method might even throw a
-    * ConcurrentModificationException
-    */
-   public int getNumberOfNodes()
-   {
-      return numNodes(root) - 1;
-   }
-
-   private int numNodes(NodeSPI n)
-   {
-      int count = 1;// for n
-      if (n != null)
-      {
-         for (Object child : n.getChildrenDirect())
-         {
-            count += numNodes((NodeSPI) child);
-         }
-      }
-      return count;
-   }
-
-   /**
-    * Prints information about the contents of the nodes in the cache's current
-    * in-memory state.  Does not load any previously evicted nodes from a
-    * cache loader, so evicted nodes will not be included.
-    */
-   public String printDetails()
-   {
-      StringBuffer sb = new StringBuffer();
-      root.printDetails(sb, 0);
-      sb.append("\n");
-      return sb.toString();
-   }
-
-
-   /**
-    * Returns lock information.
-    */
-   public String printLockInfo()
-   {
-      StringBuffer sb = new StringBuffer("\n");
-      int indent = 0;
-
-      for (Object n : root.getChildrenDirect())
-      {
-         ((NodeSPI) n).getLock().printLockInfo(sb, indent);
-         sb.append("\n");
-      }
-      return sb.toString();
-   }
-
-   /**
-    * Returns an <em>approximation</em> of the total number of attributes in
-    * this sub cache.
-    *
-    * @see #getNumberOfAttributes
-    */
-   public int getNumberOfAttributes(Fqn fqn)
-   {
-      return numAttributes(findNode(fqn));
-   }
-
-   private int numAttributes(NodeSPI n)
-   {
-      int count = 0;
-      for (Object child : n.getChildrenDirect())
-      {
-         count += numAttributes((NodeSPI) child);
-      }
-      count += n.getDataDirect().size();
-      return count;
-   }
-
-   /**
-    * Returns an <em>approximation</em> of the total number of attributes in
-    * the cache. Since this method doesn't acquire any locks, the number might
-    * be incorrect, or the method might even throw a
-    * ConcurrentModificationException
-    */
-   public int getNumberOfAttributes()
-   {
-      return numAttributes(root);
-   }
-
-   /**
-    * Internal method; not to be used externally.
-    * Returns true if the node was found, false if not.
-    *
-    * @param f
-    */
-   public boolean realRemove(Fqn f, boolean skipMarkerCheck)
-   {
-      NodeSPI n = peek(f, true);
-      if (n == null)
-      {
-         return false;
-      }
-
-
-      if (log.isTraceEnabled()) log.trace("Performing a real remove for node " + f + ", marked for removal.");
-      if (skipMarkerCheck || n.isDeleted())
-      {
-         if (n.getFqn().isRoot())
-         {
-            // do not actually delete; just remove deletion marker
-            n.markAsDeleted(true);
-            // but now remove all children, since the call has been to remove("/")
-            n.removeChildrenDirect();
-
-            // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
-            // be aware that it is no longer valid.
-            n.setValid(false, true);
-            n.setValid(true, false);
-            return true;
-         }
-         else
-         {
-            // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
-            // be aware that it is no longer valid.
-            n.setValid(false, true);
-            return n.getParent().removeChildDirect(n.getFqn().getLastElement());
-         }
-      }
-      else
-      {
-         if (log.isDebugEnabled()) log.debug("Node " + f + " NOT marked for removal as expected, not removing!");
-         return false;
-      }
-   }
-
-   public void evict(Fqn fqn, boolean recursive)
-   {
-      List<Fqn> toEvict = getNodesForEviction(fqn, recursive);
-      for (Fqn aFqn : toEvict)
-      {
-         evict(aFqn);
-      }
-   }
-
-   public boolean evict(Fqn fqn)
-   {
-      if (peek(fqn, false, true) == null) return true;
-      if (log.isTraceEnabled())
-         log.trace("evict(" + fqn + ")");
-      if (hasChild(fqn))
-      {
-         removeData(fqn);
-         return false;
-      }
-      else
-      {
-         removeNode(fqn);
-         return true;
-      }
-   }
-
-   private void removeNode(Fqn fqn)
-   {
-      NodeSPI targetNode = findNode(fqn, null, true);
-      if (targetNode == null) return;
-      NodeSPI parentNode = targetNode.getParent();
-      if (parentNode != null)
-      {
-         parentNode.removeChildDirect(fqn.getLastElement());
-         parentNode.setChildrenLoaded(false);
-      }
-   }
-
-   protected void removeData(Fqn fqn)
-   {
-      NodeSPI n = findNode(fqn, null);
-      if (n == null)
-      {
-         log.warn("node " + fqn + " not found");
-         return;
-      }
-      n.clearDataDirect();
-      n.setDataLoaded(false);
-   }
-
-   /**
-    * Traverses the tree to the given Fqn, creating nodes if needed.  Returns a list of nodes created, as well as a reference to the last node.
-    * <p/>
-    * E.g.,
-    * <code>
-    * Object[] results = createNode(myFqn);
-    * results[0] // this is a List&lt;NodeSPI&gt; of nodes <i>created</i> in getting to the target node.
-    * results[1] // is a NodeSPI reference to the target node, regardless of whether it was <i>created</i> or just <i>found</i>.
-    * </code>
-    *
-    * @param fqn fqn to find
-    * @return see above.
-    */
-   public Object[] createNodes(Fqn fqn)
-   {
-      List<NodeSPI> result = new ArrayList<NodeSPI>(fqn.size());
-      Fqn tmpFqn = Fqn.ROOT;
-
-      int size = fqn.size();
-
-      // root node
-      NodeSPI n = root;
-      for (int i = 0; i < size; i++)
-      {
-         Object childName = fqn.get(i);
-         tmpFqn = Fqn.fromRelativeElements(tmpFqn, childName);
-
-         NodeSPI childNode;
-         Map children = n.getChildrenMapDirect();
-         childNode = children == null ? null : (NodeSPI) children.get(childName);
-
-         if (childNode == null)
-         {
-            childNode = n.addChildDirect(Fqn.fromElements(childName));
-            result.add(childNode);
-         }
-
-         n = childNode;
-      }
-      return new Object[]{result, n};
-   }
-
-   /**
-    * Returns true if a node has all children loaded and initialized.
-    * todo - this belongs to NodeSPI, should be moved in 3.x
-    */
-   public boolean allInitialized(NodeSPI<?, ?> n)
-   {
-      if (!n.isChildrenLoaded())
-      {
-         return false;
-      }
-      for (NodeSPI child : n.getChildrenDirect())
-      {
-         if (!child.isDataLoaded())
-         {
-            return false;
-         }
-      }
-      return true;
-
-   }
-
-   public void createNodesLocally(Fqn<?> fqn, Map<?, ?> data) throws CacheException
-   {
-      int treeNodeSize;
-      if ((treeNodeSize = fqn.size()) == 0) return;
-      NodeSPI n = root;
-      for (int i = 0; i < treeNodeSize; i++)
-      {
-         Object childName = fqn.get(i);
-         NodeSPI childNode = n.addChildDirect(Fqn.fromElements(childName));
-         if (childNode == null)
-         {
-            if (log.isTraceEnabled())
-            {
-               log.trace("failed to find or create child " + childName + " of node " + n.getFqn());
-            }
-            return;
-         }
-         if (i == treeNodeSize - 1)
-         {
-            // set data
-            childNode.putAllDirect(data);
-         }
-         n = childNode;
-      }
-   }
-
-   public void setRoot(NodeSPI root)
-   {
-      this.root = root;
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -3,7 +3,6 @@
 import org.jboss.cache.*;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
 import org.jboss.cache.commands.read.GetKeyValueCommand;
@@ -17,8 +16,9 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.marshall.Marshaller;
 import org.jboss.cache.notifications.Notifier;
@@ -56,7 +56,7 @@
    private RPCManager rpcManager;
    private RegionManager regionManager;
    private Marshaller marshaller;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private CommandsFactory commandsFactory;// tu be built here and imjected within any CacheCommand instance. Also pass this to the interceptor chain
    private CacheTransactionHelper transactionHelper;
 
@@ -64,7 +64,7 @@
    public void initialize(StateTransferManager stateTransferManager, CacheLoaderManager cacheLoaderManager, Notifier notifier,
                           TransactionManager transactionManager, BuddyManager buddyManager, TransactionTable transactionTable,
                           RPCManager rpcManager, RegionManager regionManager, Marshaller marshaller,
-                          CacheTransactionHelper transactionHelper, CommandsFactory commandsFactory, CacheData cacheData)
+                          CacheTransactionHelper transactionHelper, CommandsFactory commandsFactory, DataContainer cacheData)
    {
       this.stateTransferManager = stateTransferManager;
       this.cacheLoaderManager = cacheLoaderManager;
@@ -114,17 +114,17 @@
       return transactionManager;
    }
 
-   public void addInterceptor(ChainedInterceptor i, int position)
+   public void addInterceptor(VisitorInterceptor i, int position)
    {
       invoker.addInterceptor(i, position);
    }
 
-   public void addInterceptor(ChainedInterceptor i, Class<? extends ChainedInterceptor> afterInterceptor)
+   public void addInterceptor(VisitorInterceptor i, Class<? extends VisitorInterceptor> afterInterceptor)
    {
       invoker.addInterceptor(i, afterInterceptor);
    }
 
-   public List<ChainedInterceptor> getInterceptorChain()
+   public List<VisitorInterceptor> getInterceptorChain()
    {
       return invoker.getInterceptorsAsList();
    }
@@ -134,7 +134,7 @@
       invoker.removeInterceptor(position);
    }
 
-   public void removeInterceptor(Class<? extends ChainedInterceptor> interceptorType)
+   public void removeInterceptor(Class<? extends VisitorInterceptor> interceptorType)
    {
       invoker.removeInterceptor(interceptorType);
    }
@@ -577,7 +577,7 @@
       return getChildrenNames(Fqn.fromString(fqn));
    }
 
-   public CacheData getCacheData()
+   public DataContainer getCacheData()
    {
       return cacheData;
    }

Deleted: core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,523 +0,0 @@
-package org.jboss.cache.invocation;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheStatus;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.RegionManager;
-import org.jboss.cache.Version;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.lock.LockStrategyFactory;
-import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.Notifier;
-
-import javax.management.MBeanServerFactory;
-import javax.transaction.TransactionManager;
-import java.util.ArrayList;
-
-/**
- * @author Mircea.Markus at jboss.com
- * @since 2.2
- */
-// TODO: Rename to LifecycleManager and move to org.jboss.cache
-public class CacheLifecycleManager
-{
-   private static Log log = LogFactory.getLog(CacheLifecycleManager.class);
-
-   private CacheStatus cacheStatus;
-
-   /* dependencies*/
-   private Configuration configuration;
-   private Notifier notifier;
-   private RegionManager regionManager;
-   private NodeFactory nodeFactory;
-   private CacheData cacheData;
-   private BuddyManager buddyManager;
-   private RPCManager rpcManager;
-   private ComponentRegistry componentRegistry;
-
-
-   @Inject
-   public void initialize(Configuration configuration, Notifier notifier, RegionManager regionManager, NodeFactory nodeFactory,
-                          CacheData cacheData, BuddyManager buddyManager, RPCManager rpcManager,
-                          ComponentRegistry componentRegistry)
-   {
-      this.configuration = configuration;
-      this.notifier = notifier;
-      this.regionManager = regionManager;
-      this.nodeFactory = nodeFactory;
-      this.buddyManager = buddyManager;
-      this.rpcManager = rpcManager;
-      this.cacheData = cacheData;
-      this.componentRegistry = componentRegistry;
-   }
-
-   /**
-    * Hook to shut down the cache when the JVM exits.
-    */
-   private Thread shutdownHook;
-   /**
-    * A flag that the shutdown hook sets before calling cache.stop().  Allows stop() to identify if it has been called
-    * from a shutdown hook.
-    */
-   private boolean invokedFromShutdownHook;
-
-   public CacheLifecycleManager(Configuration configuration)
-   {
-      this.configuration = configuration;
-      this.componentRegistry = new ComponentRegistry(configuration);
-      this.cacheStatus = CacheStatus.INSTANTIATED;
-   }
-
-   /**
-    * Lifecycle method. This is like initialize.
-    *
-    * @throws Exception
-    */
-   public void create() throws CacheException
-   {
-      if (!cacheStatus.createAllowed())
-      {
-         if (cacheStatus.needToDestroyFailedCache())
-            destroy();
-         else
-            return;
-      }
-      try
-      {
-         internalCreate();
-      }
-      catch (Throwable t)
-      {
-         handleLifecycleTransitionFailure(t);
-      }
-   }
-
-   /**
-    * Lifecyle method.
-    *
-    * @throws CacheException
-    */
-   public void start() throws CacheException
-   {
-      if (!cacheStatus.startAllowed())
-      {
-         if (cacheStatus.needToDestroyFailedCache())
-            destroy(); // this will take us back to DESTROYED
-
-         if (cacheStatus.needCreateBeforeStart())
-            create();
-         else
-            return;
-      }
-
-      try
-      {
-         internalStart();
-      }
-      catch (Throwable t)
-      {
-//         if (log.isTraceEnabled()) log.trace("InternalStart had problems: ", t);
-         handleLifecycleTransitionFailure(t);
-      }
-   }
-
-   /**
-    * Lifecycle method.
-    */
-   public void destroy()
-   {
-      if (!cacheStatus.destroyAllowed())
-      {
-         if (cacheStatus.needStopBeforeDestroy())
-         {
-            try
-            {
-               stop();
-            }
-            catch (CacheException e)
-            {
-               log.warn("Needed to call stop() before destroying but stop() " +
-                     "threw exception. Proceeding to destroy", e);
-            }
-         }
-         else
-            return;
-      }
-
-      try
-      {
-         internalDestroy();
-      }
-      finally
-      {
-         // We always progress to destroyed
-         cacheStatus = CacheStatus.DESTROYED;
-      }
-   }
-
-   /**
-    * Lifecycle method.
-    */
-   public void stop()
-   {
-      if (!cacheStatus.stopAllowed())
-      {
-         return;
-      }
-
-      // Trying to stop() from FAILED is valid, but may not work
-      boolean failed = cacheStatus == CacheStatus.FAILED;
-
-      try
-      {
-         internalStop();
-      }
-      catch (Throwable t)
-      {
-         if (failed)
-         {
-            log.warn("Attempted to stop() from FAILED state, " +
-                  "but caught exception; try calling destroy()", t);
-         }
-         handleLifecycleTransitionFailure(t);
-      }
-   }
-
-   /**
-    * The actual start implementation.
-    */
-   private void internalStart() throws CacheException, IllegalArgumentException
-   {
-      // re-wire all dependencies in case stuff has changed since the cache was created
-
-      // remove any components whose construction may have depended upon a configuration that may have changed.
-      removeConfigurationDependentComponents();
-
-      // this will recreate any missing components based on the current config
-      //todo [mmarkus] updateDependencies should be moved in this class. Component registry's is not to care
-      // todo about particular instances that are manipulated there ; it should be keept generic
-      // todo [MANIK] NOT true.  The ComponentRegistry is a state machine and is responsible for maintaining states and dependencies.
-      componentRegistry.updateDependencies();
-      componentRegistry.wireDependencies(cacheData.getRoot());
-
-      cacheStatus = CacheStatus.STARTING;
-
-      // start all internal components
-      componentRegistry.start();
-
-      //todo this is important info that needs to be printed, add it somewhere ...
-//      if (log.isDebugEnabled())
-      //log.debug("ChainedInterceptor chain is:\n" + CachePrinter.printInterceptorChain(cacheCommand));
-
-//      if (configuration.getNodeLockingScheme() == Configuration.NodeLockingScheme.OPTIMISTIC && transactionManager == null)
-//      {
-//         log.fatal("No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used!  Expect errors!!");
-//      }
-
-      correctRootNodeType();
-
-      switch (configuration.getCacheMode())
-      {
-         case LOCAL:
-            log.debug("cache mode is local, will not create the channel");
-            break;
-         case REPL_SYNC:
-         case REPL_ASYNC:
-         case INVALIDATION_ASYNC:
-         case INVALIDATION_SYNC:
-            // reconfigure log category so that the instance name is reflected as well.
-            configureLogCategory();
-            break;
-         default:
-            throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
-      }
-
-      startManualComponents();
-
-      // start any eviction threads.
-      if (regionManager.isUsingEvictions())
-      {
-         regionManager.startEvictionThread();
-      }
-
-      notifier.notifyCacheStarted();
-
-      addShutdownHook();
-
-      log.info("JBoss Cache version: " + Version.printVersion());
-
-      cacheStatus = CacheStatus.STARTED;
-   }
-
-   private void addShutdownHook()
-   {
-      ArrayList al = MBeanServerFactory.findMBeanServer(null);
-      boolean registerShutdownHook = (configuration.getShutdownHookBehavior() == Configuration.ShutdownHookBehavior.DEFAULT && al.size() == 0)
-            || configuration.getShutdownHookBehavior() == Configuration.ShutdownHookBehavior.REGISTER;
-
-      if (registerShutdownHook)
-      {
-         if (log.isTraceEnabled())
-            log.trace("Registering a shutdown hook.  Configured behavior = " + configuration.getShutdownHookBehavior());
-         shutdownHook = new Thread()
-         {
-            @Override
-            public void run()
-            {
-               try
-               {
-                  invokedFromShutdownHook = true;
-                  stop();
-               }
-               finally
-               {
-                  invokedFromShutdownHook = false;
-               }
-            }
-         };
-
-         Runtime.getRuntime().addShutdownHook(shutdownHook);
-      }
-      else
-      {
-         if (log.isTraceEnabled())
-            log.trace("Not registering a shutdown hook.  Configured behavior = " + configuration.getShutdownHookBehavior());
-      }
-   }
-
-   /**
-    * The actual create implementation.
-    *
-    * @throws CacheException
-    */
-   private void internalCreate() throws CacheException
-   {
-      // Include our clusterName in our log category
-      configureLogCategory();
-
-      componentRegistry.wire();
-      correctRootNodeType();
-
-      LockStrategyFactory.setIsolationLevel(configuration.getIsolationLevel());
-
-      cacheStatus = CacheStatus.CREATED;
-   }
-
-   /**
-    * Sets the cacheStatus to FAILED and rethrows the problem as one
-    * of the declared types. Converts any non-RuntimeException Exception
-    * to CacheException.
-    *
-    * @param t
-    * @throws CacheException
-    * @throws RuntimeException
-    * @throws Error
-    */
-   private void handleLifecycleTransitionFailure(Throwable t)
-         throws RuntimeException, Error
-   {
-      cacheStatus = CacheStatus.FAILED;
-      if (t instanceof CacheException)
-         throw (CacheException) t;
-      else if (t instanceof RuntimeException)
-         throw (RuntimeException) t;
-      else if (t instanceof Error)
-         throw (Error) t;
-      else
-         throw new CacheException(t);
-   }
-
-   /**
-    * The actual destroy implementation.
-    */
-   private void internalDestroy()
-   {
-      cacheStatus = CacheStatus.DESTROYING;
-      // The rest of these should have already been taken care of in stop,
-      // but we do it here as well in case stop failed.
-      rpcManager.stop();
-      componentRegistry.reset();
-   }
-
-   /**
-    * The actual stop implementation.
-    */
-   private void internalStop()
-   {
-      cacheStatus = CacheStatus.STOPPING;
-      // if this is called from a source other than the shutdown hook, deregister the shutdown hook.
-      if (!invokedFromShutdownHook && shutdownHook != null) Runtime.getRuntime().removeShutdownHook(shutdownHook);
-      componentRegistry.stop();
-      if (notifier != null)
-      {
-         notifier.notifyCacheStopped();
-         notifier.removeAllCacheListeners();
-      }
-      // unset transaction manager reference
-      cacheStatus = CacheStatus.STOPPED;
-      // empty in-memory state
-      cacheData.getRoot().clearDataDirect();
-      cacheData.getRoot().removeChildrenDirect();
-   }
-
-   //todo - this should reather be implemented as follows:
-   // List<Component>comps = registry.detComponentsDependingOn(a component)
-   // registry.unregsiterComponents(comps);
-   private void removeConfigurationDependentComponents()
-   {
-      // remove the Interceptor.class component though, since it may pertain to an old config
-
-      componentRegistry.unregisterComponent(InterceptorChain.class); // the interceptor chain will need reconstructing in case the cfg has changed before calling start()
-      componentRegistry.unregisterComponent(Marshaller.class);
-      componentRegistry.unregisterComponent(TransactionManager.class);
-      componentRegistry.unregisterComponent(BuddyManager.class);
-      componentRegistry.unregisterComponent(CacheLoaderManager.class);
-   }
-
-   /**
-    * Creates a new root node if one does not exist, or if the existing one does not match the type according to the configuration.
-    */
-   private void correctRootNodeType()
-   {
-      // create a new root temporarily.
-      NodeSPI tempRoot = nodeFactory.createRootDataNode();
-      // if we don't already have a root or the new (temp) root is of a different class (optimistic vs pessimistic) to
-      // the current root, then we use the new one.
-
-      Class currentRootType = cacheData.getRoot() == null ? null : ((NodeInvocationDelegate) cacheData.getRoot()).getDelegationTarget().getClass();
-      Class tempRootType = ((NodeInvocationDelegate) tempRoot).getDelegationTarget().getClass();
-
-      if (!tempRootType.equals(currentRootType)) cacheData.setRoot(tempRoot);
-   }
-
-   /**
-    * Set our log category to include our clusterName, if we have one.
-    */
-   private void configureLogCategory()
-   {
-      StringBuilder category = new StringBuilder(getClass().getName());
-      if (configuration != null)
-      {
-         if (rpcManager != null)
-         {
-            String clusterName = configuration.getClusterName();
-            if (clusterName != null)
-            {
-               category.append('.');
-               category.append(clusterName);
-               if (rpcManager.getLocalAddress() != null)
-               {
-                  category.append('.');
-                  category.append(rpcManager.getLocalAddress().toString().replace('.', '_'));
-               }
-            }
-         }
-         else
-         {
-            // we're in LOCAL mode
-            category.append("_LOCAL");
-         }
-      }
-      // replace .s with _s otherwise Log4J will strip them out
-      log = LogFactory.getLog(category.toString());
-   }
-
-   public void startManualComponents()
-   {
-      // these 2 components need to be started manually since they can only be started after ALL other components have started.
-      // i.e., rpcManager's start() method may do state transfers.  State transfers will rely on the interceptor chain being started.
-      // the interceptor chain cannot start until the rpcManager is started.  And similarly, the buddyManager relies on the
-      // rpcManager being started.
-      if (rpcManager != null) rpcManager.start();
-      if (buddyManager != null)
-      {
-         buddyManager.init();
-         if (buddyManager.isEnabled())
-         {
-            cacheData.registerInternalFqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
-         }
-      }
-   }
-
-   /**
-    * For local calls, if chache is not in STARTED mode will throw an IllegalStateException.
-    * For remote cache, if cache is STRTED returns true. If cache is STARTING waits for the cache to wait
-    * for {@link org.jboss.cache.config.Configuration#getStateRetrievalTimeout()} milliseconds, if cache starts
-    * returns true, otherwise returns false.
-    */
-   public boolean allowsInvocation(boolean originLocal)
-   {
-      if (getCacheStatus().allowInvocations()) return true;
-      // only throw an exception if this is a locally originating call - JBCACHE-1179
-      if (originLocal)
-      {
-         throw new IllegalStateException("Cache not in STARTED state!");
-      }
-      if (getCacheStatus() == CacheStatus.STARTING)
-      {
-         try
-         {
-            blockUntilCacheStarts();
-            return true;
-         }
-         catch (InterruptedException e)
-         {
-            Thread.currentThread().interrupt();
-         }
-      }
-      else
-      {
-         log.warn("Received a remote call but the cache is not in STARTED state - ignoring call.");
-      }
-      return false;
-   }
-
-   /**
-    * Blocks until the current cache instance is in it's {@link org.jboss.cache.CacheStatus#STARTED started} phase.  Blocks
-    * for up to {@link org.jboss.cache.config.Configuration#getStateRetrievalTimeout()} milliseconds, throwing an IllegalStateException
-    * if the cache doesn't reach this state even after this maximum wait time.
-    *
-    * @throws InterruptedException  if interrupted while waiting
-    * @throws IllegalStateException if even after waiting the cache has not started.
-    */
-   private void blockUntilCacheStarts() throws InterruptedException, IllegalStateException
-   {
-      int pollFrequencyMS = 100;
-      long startupWaitTime = configuration.getStateRetrievalTimeout();
-      long giveUpTime = System.currentTimeMillis() + startupWaitTime;
-
-      while (System.currentTimeMillis() < giveUpTime)
-      {
-         if (getCacheStatus().allowInvocations()) break;
-         Thread.sleep(pollFrequencyMS);
-      }
-
-      // check if we have started.
-      if (!getCacheStatus().allowInvocations())
-         throw new IllegalStateException("Cache not in STARTED state, even after waiting " + configuration.getStateRetrievalTimeout() + " millis.");
-   }
-
-
-   public CacheStatus getCacheStatus()
-   {
-      return cacheStatus;
-   }
-
-   public ComponentRegistry getComponentRegistry()
-   {
-      return componentRegistry;
-   }
-
-   public void setCacheStatus(CacheStatus cacheStatus)
-   {
-      this.cacheStatus = cacheStatus;
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -6,7 +6,7 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -25,7 +25,7 @@
    /**
     * reference to the first interceptor in the chain
     */
-   private ChainedInterceptor firstInChain;
+   private VisitorInterceptor firstInChain;
 
    /**
     * used for invoking commands on the chain
@@ -37,7 +37,7 @@
    /**
     * Constructs an interceptor chain having the supplied interceptor as first.
     */
-   public InterceptorChain(ChainedInterceptor first)
+   public InterceptorChain(VisitorInterceptor first)
    {
       this.firstInChain = first;
    }
@@ -53,7 +53,7 @@
     *
     * @throws IllegalArgumentException if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)
     */
-   public synchronized void addInterceptor(ChainedInterceptor interceptor, int position)
+   public synchronized void addInterceptor(VisitorInterceptor interceptor, int position)
    {
       if (position == 0)
       {
@@ -62,7 +62,7 @@
          return;
       }
       if (firstInChain == null) return;
-      ChainedInterceptor it = firstInChain;
+      VisitorInterceptor it = firstInChain;
       int index = 0;
       while (it != null)
       {
@@ -90,7 +90,7 @@
          firstInChain = firstInChain.getNext();
          return;
       }
-      ChainedInterceptor it = firstInChain;
+      VisitorInterceptor it = firstInChain;
       int index = 0;
       while (it != null)
       {
@@ -111,7 +111,7 @@
    public int size()
    {
       int size = 0;
-      ChainedInterceptor it = firstInChain;
+      VisitorInterceptor it = firstInChain;
       while (it != null)
       {
          size++;
@@ -125,15 +125,15 @@
     * Returns an unmofiable list with all the interceptors in sequence.
     * If first in chain is null an empty list is returned.
     */
-   public List<ChainedInterceptor> getInterceptorsAsList()
+   public List<VisitorInterceptor> getInterceptorsAsList()
    {
-      List<ChainedInterceptor> result;
+      List<VisitorInterceptor> result;
       if (firstInChain == null)
       {
          result = Collections.EMPTY_LIST;
       }
-      List<ChainedInterceptor> retval = new LinkedList<ChainedInterceptor>();
-      ChainedInterceptor tmp = firstInChain;
+      List<VisitorInterceptor> retval = new LinkedList<VisitorInterceptor>();
+      VisitorInterceptor tmp = firstInChain;
       do
       {
          retval.add(tmp);
@@ -148,14 +148,14 @@
    /**
     * Removes all the occurences of supplied interceptor type from the chain.
     */
-   public synchronized void removeInterceptor(Class<? extends ChainedInterceptor> clazz)
+   public synchronized void removeInterceptor(Class<? extends VisitorInterceptor> clazz)
    {
       if (firstInChain.getClass() == clazz)
       {
          firstInChain = firstInChain.getNext();
       }
-      ChainedInterceptor it = firstInChain.getNext();
-      ChainedInterceptor prevIt = firstInChain;
+      VisitorInterceptor it = firstInChain.getNext();
+      VisitorInterceptor prevIt = firstInChain;
       while (it != null)
       {
          if (it.getClass() == clazz)
@@ -172,9 +172,9 @@
     *
     * @return true if the interceptor was added; i.e. the afterInterceptor exists
     */
-   public synchronized boolean addInterceptor(ChainedInterceptor toAdd, Class<? extends ChainedInterceptor> afterInterceptor)
+   public synchronized boolean addInterceptor(VisitorInterceptor toAdd, Class<? extends VisitorInterceptor> afterInterceptor)
    {
-      ChainedInterceptor it = firstInChain;
+      VisitorInterceptor it = firstInChain;
       while (it != null)
       {
          if (it.getClass().equals(afterInterceptor))
@@ -191,20 +191,20 @@
    /**
     * Returns the chain as a list.
     */
-   public List<ChainedInterceptor> asList()
+   public List<VisitorInterceptor> asList()
    {
-      List<ChainedInterceptor> result;
+      List<VisitorInterceptor> result;
       if (this.firstInChain == null)
       {
          result = null;
       }
       int num = 1;
-      ChainedInterceptor tmp = this.firstInChain;
+      VisitorInterceptor tmp = this.firstInChain;
       while ((tmp = tmp.getNext()) != null)
       {
          num++;
       }
-      List<ChainedInterceptor> retval = new ArrayList<ChainedInterceptor>(num);
+      List<VisitorInterceptor> retval = new ArrayList<VisitorInterceptor>(num);
       tmp = this.firstInChain;
       num = 0;
       do
@@ -220,9 +220,9 @@
    /**
     * Appends at the end.
     */
-   public void appendIntereceptor(ChainedInterceptor ci)
+   public void appendIntereceptor(VisitorInterceptor ci)
    {
-      ChainedInterceptor it = firstInChain;
+      VisitorInterceptor it = firstInChain;
       while (it.hasNext()) it = it.getNext();
       it.setNext(ci);
       // make sure we nullify the "next" pointer in the last interceptor.
@@ -278,7 +278,7 @@
    /**
     * @return the first interceptor in the chain.
     */
-   public ChainedInterceptor getFirstInChain()
+   public VisitorInterceptor getFirstInChain()
    {
       return firstInChain;
    }
@@ -288,7 +288,7 @@
     *
     * @param interceptor interceptor to be used as the first interceptor in the chain.
     */
-   public void setFirstInChain(ChainedInterceptor interceptor)
+   public void setFirstInChain(VisitorInterceptor interceptor)
    {
       this.firstInChain = interceptor;
    }

Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -23,10 +23,20 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
-import org.jboss.cache.config.*;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.BuddyReplicationConfig;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.RuntimeConfig;
 import org.jboss.cache.factories.XmlConfigurationParser;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.util.CachePrinter;
 import org.jgroups.Address;
 import org.jgroups.Channel;
@@ -43,6 +53,7 @@
 /**
  * Wrapper class that exposes a
  * {@link CacheJmxWrapperMBean JMX management interface}
+ *
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
@@ -925,7 +936,7 @@
       if (registerInterceptors && !interceptorsRegistered && server != null)
       {
          log.debug("Registering interceptors");
-         List<ChainedInterceptor> interc = cache.getInterceptorChain();
+         List<VisitorInterceptor> interc = cache.getInterceptorChain();
          if (interc != null && interc.size() > 0)
          {
             try

Modified: core/trunk/src/main/java/org/jboss/cache/jmx/JmxUtil.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/JmxUtil.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/JmxUtil.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -22,7 +22,7 @@
 package org.jboss.cache.jmx;
 
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 import javax.management.JMException;
 import javax.management.MBeanServer;
@@ -52,7 +52,7 @@
    public static final String INTERCEPTOR_KEY = ",cache-interceptor=";
 
    public static void registerCacheMBean(MBeanServer server, CacheJmxWrapperMBean cache, String cacheObjectName)
-           throws JMException
+         throws JMException
    {
       ObjectName on = new ObjectName(cacheObjectName);
       if (!server.isRegistered(on))
@@ -68,15 +68,15 @@
     * @param cache the cache having the set of interceptors to be registered
     * @param registerCache whether the cache itself should be registered
     */
-   public static void registerInterceptors(MBeanServer server, List<ChainedInterceptor> interceptors, String cacheObjectName)
-           throws JMException
+   public static void registerInterceptors(MBeanServer server, List<VisitorInterceptor> interceptors, String cacheObjectName)
+         throws JMException
    {
       if (server == null || interceptors == null || cacheObjectName == null)
       {
          return;
       }
 
-      for (ChainedInterceptor interceptor : interceptors)
+      for (VisitorInterceptor interceptor : interceptors)
       {
          if (!interceptor.getStatisticsEnabled())
             continue;
@@ -141,7 +141,7 @@
    }
 
    public static void unregisterCacheMBean(MBeanServer server, String cacheObjectName)
-           throws Exception
+         throws Exception
    {
       server.unregisterMBean(new ObjectName(cacheObjectName));
    }
@@ -153,15 +153,15 @@
    * @param cache the cache having the set of interceptors to be unregistered
    * @param unregisterCache whether the cache itself should be unregistered
    */
-   public static void unregisterInterceptors(MBeanServer server, List<ChainedInterceptor> interceptors, String cacheObjectName)
-           throws Exception
+   public static void unregisterInterceptors(MBeanServer server, List<VisitorInterceptor> interceptors, String cacheObjectName)
+         throws Exception
    {
       if (server == null || interceptors == null || cacheObjectName == null)
       {
          return;
       }
 
-      for (ChainedInterceptor interceptor : interceptors)
+      for (VisitorInterceptor interceptor : interceptors)
       {
          // for JDK 1.4, must parse name and remove package prefix
          // for JDK 1.5, can use getSimpleName() to establish class name without package prefix

Modified: core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -14,7 +14,6 @@
 import org.jboss.cache.Modification;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.RegionManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -22,6 +21,7 @@
 import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
 import org.jboss.cache.commands.remote.ClusteredGetCommand;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.lock.StripedLock;
 import org.jgroups.Address;

Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -2,14 +2,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.DataContainer;
 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.write.PutDataMapCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
@@ -30,13 +30,13 @@
 
    private Configuration configuration;
    private long lockAcquisitionTimeout;
-   private CacheData cacheData;
+   private DataContainer cacheData;
    private NodeSPI rootNode;
    private TransactionTable txTable;
    private CommandsFactory commandsFactory;
 
    @Inject
-   public void inject(Configuration configuration, CacheData cacheData, TransactionTable txTable,
+   public void inject(Configuration configuration, DataContainer cacheData, TransactionTable txTable,
                       CommandsFactory commandsFactory)
    {
       this.configuration = configuration;

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -10,8 +10,8 @@
 import org.jboss.cache.Region;
 import static org.jboss.cache.Region.Status;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,12 +1,12 @@
 package org.jboss.cache.marshall;
 
 import org.jboss.cache.InvocationContext;
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
 import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
 import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jgroups.Address;
@@ -30,12 +30,12 @@
 {
    protected InvocationContextContainer invocationContextContainer;
    protected InterceptorChain interceptorChain;
-   protected CacheLifecycleManager lifecycleManager;
+   protected LifecycleManager lifecycleManager;
    protected boolean trace;
 
    public CommandAwareRpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj,
                                     InvocationContextContainer container, InterceptorChain interceptorChain,
-                                    CacheLifecycleManager lifecycleManager)
+                                    LifecycleManager lifecycleManager)
    {
       super(channel, l, l2, server_obj);
       this.invocationContextContainer = container;

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,7 +1,7 @@
 package org.jboss.cache.marshall;
 
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jgroups.Channel;
@@ -25,7 +25,7 @@
     */
    public InactiveRegionAwareRpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object serverObj,
                                            InvocationContextContainer container, InterceptorChain interceptorChain,
-                                           CacheLifecycleManager lifecycleManager)
+                                           LifecycleManager lifecycleManager)
    {
       super(channel, l, l2, serverObj, container, interceptorChain, lifecycleManager);
    }

Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -2,8 +2,8 @@
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheSPI;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
 
 /**
@@ -23,7 +23,7 @@
    public static String printCacheDetails(Cache c)
    {
       // internal cast
-      CacheData ci = ((CacheInvocationDelegate) c).getCacheData();
+      DataContainer ci = ((CacheInvocationDelegate) c).getCacheData();
       return ci.printDetails();
    }
 
@@ -36,7 +36,7 @@
    public static String printCacheLockingInfo(Cache c)
    {
       // internal cast
-      CacheData cd = ((CacheInvocationDelegate) c).getCacheData();
+      DataContainer cd = ((CacheInvocationDelegate) c).getCacheData();
       return cd.printLockInfo();
    }
 
@@ -45,7 +45,7 @@
       StringBuilder b = new StringBuilder();
       int index = 0;
       b.append("\n");
-      for (ChainedInterceptor i : cache.getInterceptorChain())
+      for (VisitorInterceptor i : cache.getInterceptorChain())
       {
          b.append("# ");
          b.append(index);
@@ -57,7 +57,7 @@
       return b.toString();
    }
 
-   public static String printInterceptorChain(ChainedInterceptor i)
+   public static String printInterceptorChain(VisitorInterceptor i)
    {
       StringBuffer sb = new StringBuffer();
       if (i != null)

Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,7 +1,6 @@
 package org.jboss.cache;
 
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.CacheStarted;
@@ -253,7 +252,7 @@
       {
          // now DIRECTLY change the status of c2.
          // emulate the race condition where the remote cache is stopping but hasn't disconnected from the channel.
-         CacheLifecycleManager ci1 = (CacheLifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
+         LifecycleManager ci1 = (LifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
          ci1.setCacheStatus(CacheStatus.STOPPING);
 
          // Thanks to JBCACHE-1179, this should only log a warning and not throw an exception
@@ -262,7 +261,7 @@
       finally
       {
          // reset c[1] to running so the tearDown method can clean it up
-         CacheLifecycleManager ci1 = (CacheLifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
+         LifecycleManager ci1 = (LifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
          ci1.setCacheStatus(CacheStatus.STARTED);
       }
    }
@@ -280,7 +279,7 @@
          // there is a lousy race condition here - we need to make sure cache[1]'s start() method doesn't set status to STARTED
          // after we attempt to change this.
          TestingUtil.blockUntilCacheStatusAchieved(c[1], CacheStatus.STARTED, 1000);
-         CacheLifecycleManager ci1 = (CacheLifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
+         LifecycleManager ci1 = (LifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
          ci1.setCacheStatus(CacheStatus.STARTING);
          try
          {
@@ -300,7 +299,7 @@
             public void run()
             {
                TestingUtil.sleepThread(sleepTime);
-               CacheLifecycleManager ci1 = (CacheLifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
+               LifecycleManager ci1 = (LifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
                ci1.setCacheStatus(CacheStatus.STARTED);
             }
          }.start();
@@ -314,7 +313,7 @@
       finally
       {
          // reset c[1] to running so the tearDown method can clean it up
-         CacheLifecycleManager ci1 = (CacheLifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
+         LifecycleManager ci1 = (LifecycleManager) TestingUtil.extractField(c[1], "lifecycleManager");
          ci1.setCacheStatus(CacheStatus.STARTED);
       }
    }
@@ -327,7 +326,7 @@
       c[0].put(Fqn.ROOT, "k2", "v2");
 
       // now DIRECTLY change the status of c.
-      CacheLifecycleManager ci0 = (CacheLifecycleManager) TestingUtil.extractField(c[0], "lifecycleManager");
+      LifecycleManager ci0 = (LifecycleManager) TestingUtil.extractField(c[0], "lifecycleManager");
       ci0.setCacheStatus(CacheStatus.STOPPING);
 
       try
@@ -406,7 +405,7 @@
       c[0].put(Fqn.ROOT, "k2", "v2");
 
       // now DIRECTLY change the status of c.
-      CacheLifecycleManager ci0 = (CacheLifecycleManager) TestingUtil.extractField(c[0], "lifecycleManager");
+      LifecycleManager ci0 = (LifecycleManager) TestingUtil.extractField(c[0], "lifecycleManager");
       ci0.setCacheStatus(CacheStatus.STOPPING);
 
       // rollbacks should just log a message

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -7,7 +7,7 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.interceptors.PessimisticLockInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.optimistic.TransactionWorkspace;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import static org.testng.AssertJUnit.*;
@@ -82,7 +82,7 @@
       assert cache.getConfiguration().isNodeLockingOptimistic();
       boolean interceptorChainOK = false;
 
-      for (ChainedInterceptor i : cache.getInterceptorChain())
+      for (VisitorInterceptor i : cache.getInterceptorChain())
       {
          if (i instanceof PessimisticLockInterceptor) assert false : "Not an optimistic locking chain!!";
          if (i instanceof OptimisticNodeInterceptor) interceptorChainOK = true;

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -7,12 +7,12 @@
 package org.jboss.cache.buddyreplication;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.xml.XmlHelper;

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -13,7 +13,7 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.interceptors.DataGravitatorInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.xml.XmlHelper;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
@@ -92,7 +92,7 @@
 
       // test Data Gravitator
       boolean hasDG = false;
-      for (ChainedInterceptor interceptor : cache.getInterceptorChain())
+      for (VisitorInterceptor interceptor : cache.getInterceptorChain())
       {
          hasDG = hasDG || (interceptor instanceof DataGravitatorInterceptor);
       }

Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -3,7 +3,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.fail;
 import org.testng.annotations.AfterMethod;
@@ -53,11 +53,11 @@
 
    public void testInjectionAtHead()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
-      ChainedInterceptor x = new TestInterceptor();
+      VisitorInterceptor x = new TestInterceptor();
       cache.addInterceptor(x, 0);
 
       interceptors = cache.getInterceptorChain();
@@ -69,11 +69,11 @@
 
    public void testInjectionAtTail()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
-      ChainedInterceptor x = new TestInterceptor();
+      VisitorInterceptor x = new TestInterceptor();
       cache.addInterceptor(x, 6);
 
       interceptors = cache.getInterceptorChain();
@@ -85,11 +85,11 @@
 
    public void testInjectionInMiddle()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
-      ChainedInterceptor x = new TestInterceptor();
+      VisitorInterceptor x = new TestInterceptor();
       cache.addInterceptor(x, 3);
 
       interceptors = cache.getInterceptorChain();
@@ -101,11 +101,11 @@
 
    public void testInjectionBeyondTail()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
-      ChainedInterceptor x = new TestInterceptor();
+      VisitorInterceptor x = new TestInterceptor();
       try
       {
          cache.addInterceptor(x, 9);
@@ -119,8 +119,8 @@
 
    public void testRemoveAtHead()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
-      ChainedInterceptor afterHead = interceptors.get(1);
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
+      VisitorInterceptor afterHead = interceptors.get(1);
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
@@ -135,8 +135,8 @@
 
    public void testRemoveAtTail()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
-      ChainedInterceptor beforeTail = interceptors.get(4);
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
+      VisitorInterceptor beforeTail = interceptors.get(4);
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
@@ -154,7 +154,7 @@
 
    public void testRemoveAtMiddle()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
@@ -167,7 +167,7 @@
 
    public void testRemoveBeyondTail()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       assertEquals("Expecting 6 interceptors", 6, interceptors.size());
       assertInterceptorLinkage(interceptors);
 
@@ -183,7 +183,7 @@
    }
 
 
-   public static class TestInterceptor extends ChainedInterceptor
+   public static class TestInterceptor extends VisitorInterceptor
    {
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -7,7 +7,7 @@
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.interceptors.*;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.xml.XmlHelper;
@@ -48,8 +48,8 @@
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testBareConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -71,8 +71,8 @@
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testTxConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -118,8 +118,8 @@
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testSharedCacheLoaderConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -147,8 +147,8 @@
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testUnsharedCacheLoaderConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -173,8 +173,8 @@
       cache.getConfiguration().setCacheMode("repl_sync");
       cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testTxAndRepl interceptors are:\n" + list);
       assertNotNull(list);
@@ -198,8 +198,8 @@
       cache.getConfiguration().setNodeLockingOptimistic(true);
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       assertEquals(8, list.size());
 
@@ -222,8 +222,8 @@
       cache.getConfiguration().setCacheMode("REPL_SYNC");
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       assertEquals(9, list.size());
 
@@ -247,8 +247,8 @@
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       assertEquals(10, list.size());
 
@@ -273,8 +273,8 @@
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       assertEquals(10, list.size());
 
@@ -298,8 +298,8 @@
       cache.getConfiguration().setCacheMode("REPL_ASYNC");
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       assertEquals(6, list.size());
 
@@ -335,8 +335,8 @@
    {
       cache.getConfiguration().setExposeManagementStatistics(true);
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testCacheMgmtConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -366,8 +366,8 @@
       }
       );
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -401,8 +401,8 @@
       cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
       cache.create();// initialise various subsystems such as BRManager
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
       assertNotNull(list);
@@ -439,8 +439,8 @@
       cache.getConfiguration().setCacheMode("REPL_SYNC");
       cache.create();// initialise various subsystems such as BRManager
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
-      List<ChainedInterceptor> list = chain.asList();
-      Iterator<ChainedInterceptor> interceptors = list.iterator();
+      List<VisitorInterceptor> list = chain.asList();
+      Iterator<VisitorInterceptor> interceptors = list.iterator();
 
       System.out.println("testEvictionInterceptorConfig interceptors are:\n" + list);
       assertNotNull(list);

Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainTestBase.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainTestBase.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,8 +1,7 @@
 package org.jboss.cache.factories;
 
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
 
 import java.util.List;
 
@@ -11,10 +10,10 @@
  */
 public abstract class InterceptorChainTestBase
 {
-   protected void assertInterceptorLinkage(List<ChainedInterceptor> list)
+   protected void assertInterceptorLinkage(List<VisitorInterceptor> list)
    {
-      ChainedInterceptor previous = null;
-      for (ChainedInterceptor i : list)
+      VisitorInterceptor previous = null;
+      for (VisitorInterceptor i : list)
       {
          if (previous == null)
          {

Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -13,7 +13,6 @@
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.read.GetKeyValueCommand;
 import org.jboss.cache.commands.read.GetNodeCommand;
@@ -27,6 +26,7 @@
 import org.jboss.cache.eviction.DummyEvictionConfiguration;
 import org.jboss.cache.eviction.EvictedEventNode;
 import org.jboss.cache.eviction.NodeEventType;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;

Modified: core/trunk/src/test/java/org/jboss/cache/invocation/InterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocation/InterceptorChainTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/invocation/InterceptorChainTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,7 +1,11 @@
 package org.jboss.cache.invocation;
 
-import org.jboss.cache.interceptors.*;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.CallInterceptor;
+import org.jboss.cache.interceptors.InvalidationInterceptor;
+import org.jboss.cache.interceptors.InvocationContextInterceptor;
+import org.jboss.cache.interceptors.PessimisticLockInterceptor;
+import org.jboss.cache.interceptors.TxInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -17,11 +21,11 @@
 @Test(groups = {"functional"})
 public class InterceptorChainTest
 {
-   private ChainedInterceptor icInterceptor;
-   private ChainedInterceptor invalidationInterceptor;
-   private ChainedInterceptor txInterceptor;
-   private ChainedInterceptor pessimisticInterceptor;
-   private ChainedInterceptor callInterceptor;
+   private VisitorInterceptor icInterceptor;
+   private VisitorInterceptor invalidationInterceptor;
+   private VisitorInterceptor txInterceptor;
+   private VisitorInterceptor pessimisticInterceptor;
+   private VisitorInterceptor callInterceptor;
    private InterceptorChain chain;
 
    @BeforeMethod
@@ -40,14 +44,14 @@
       invalidationInterceptor.setNext(txInterceptor);
       txInterceptor.setNext(pessimisticInterceptor);
       pessimisticInterceptor.setNext(callInterceptor);
-      
+
       InterceptorChain chain = new InterceptorChain(invalidationInterceptor);
-      List<ChainedInterceptor> expectedList = new ArrayList<ChainedInterceptor>();
+      List<VisitorInterceptor> expectedList = new ArrayList<VisitorInterceptor>();
       expectedList.add(invalidationInterceptor);
       expectedList.add(txInterceptor);
       expectedList.add(pessimisticInterceptor);
       expectedList.add(callInterceptor);
-      
+
       assert chain.getInterceptorsAsList().equals(expectedList);
    }
 
@@ -56,7 +60,7 @@
       chain.addInterceptor(invalidationInterceptor, 1);
       assert invalidationInterceptor.equals(icInterceptor.getNext());
 
-      chain.addInterceptor(pessimisticInterceptor,1);
+      chain.addInterceptor(pessimisticInterceptor, 1);
       assert pessimisticInterceptor.equals(icInterceptor.getNext());
       assert invalidationInterceptor.equals(pessimisticInterceptor.getNext());
       assert invalidationInterceptor.getNext() == null;
@@ -67,10 +71,10 @@
 
    public void testAddAtPositionIncremented()
    {
-      chain.addInterceptor(txInterceptor,1);
-      chain.addInterceptor(invalidationInterceptor,2);
-      chain.addInterceptor(pessimisticInterceptor,3);
-      chain.addInterceptor(callInterceptor,4);
+      chain.addInterceptor(txInterceptor, 1);
+      chain.addInterceptor(invalidationInterceptor, 2);
+      chain.addInterceptor(pessimisticInterceptor, 3);
+      chain.addInterceptor(callInterceptor, 4);
       assert icInterceptor.getNext().equals(txInterceptor);
       assert txInterceptor.getNext().equals(invalidationInterceptor);
       assert invalidationInterceptor.getNext().equals(pessimisticInterceptor);
@@ -79,10 +83,10 @@
 
    public void testRemoveAtPostion() throws Throwable
    {
-      chain.addInterceptor(txInterceptor,1);
-      chain.addInterceptor(invalidationInterceptor,2);
-      chain.addInterceptor(pessimisticInterceptor,3);
-      chain.addInterceptor(callInterceptor,4);
+      chain.addInterceptor(txInterceptor, 1);
+      chain.addInterceptor(invalidationInterceptor, 2);
+      chain.addInterceptor(pessimisticInterceptor, 3);
+      chain.addInterceptor(callInterceptor, 4);
 
       chain.removeInterceptor(4);
       assert chain.size() == 4;
@@ -100,13 +104,13 @@
    public void testGetSize()
    {
       assert chain.size() == 1;
-      chain.addInterceptor(txInterceptor,1);
+      chain.addInterceptor(txInterceptor, 1);
       assert chain.size() == 2;
-      chain.addInterceptor(invalidationInterceptor,2);
+      chain.addInterceptor(invalidationInterceptor, 2);
       assert chain.size() == 3;
-      chain.addInterceptor(pessimisticInterceptor,3);
+      chain.addInterceptor(pessimisticInterceptor, 3);
       assert chain.size() == 4;
-      chain.addInterceptor(callInterceptor,4);
+      chain.addInterceptor(callInterceptor, 4);
       assert chain.size() == 5;
    }
 
@@ -123,10 +127,10 @@
 
    public void removeInterceptorWithtType()
    {
-      chain.addInterceptor(txInterceptor,1);
-      chain.addInterceptor(invalidationInterceptor,2);
-      chain.addInterceptor(pessimisticInterceptor,3);
-      chain.addInterceptor(callInterceptor,4);
+      chain.addInterceptor(txInterceptor, 1);
+      chain.addInterceptor(invalidationInterceptor, 2);
+      chain.addInterceptor(pessimisticInterceptor, 3);
+      chain.addInterceptor(callInterceptor, 4);
 
       chain.removeInterceptor(InvalidationInterceptor.class);
       assert chain.size() == 4;
@@ -151,12 +155,13 @@
       assert txInterceptor.getNext().equals(invalidationInterceptor);
    }
 
-   private ChainedInterceptor create(Class<? extends ChainedInterceptor> toInstantiate)
+   private VisitorInterceptor create(Class<? extends VisitorInterceptor> toInstantiate)
    {
       try
       {
          return toInstantiate.newInstance();
-      } catch (Throwable th)
+      }
+      catch (Throwable th)
       {
          throw new RuntimeException(th);
       }

Modified: core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/loader/SharedCacheLoaderTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -9,7 +9,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.interceptors.CacheStoreInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -56,7 +56,7 @@
       CacheStoreInterceptor csi = null;
       while (ints.hasNext())
       {
-         ChainedInterceptor i = (ChainedInterceptor) ints.next();
+         VisitorInterceptor i = (VisitorInterceptor) ints.next();
          if (i instanceof CacheStoreInterceptor)
          {
             csi = (CacheStoreInterceptor) i;

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,8 +1,8 @@
 package org.jboss.cache.marshall;
 
 import org.jboss.cache.RegionManager;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.ComponentRegistry;
 
 /**

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -12,7 +12,7 @@
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.interceptors.MarshalledValueInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.notifications.annotation.CacheListener;
@@ -320,7 +320,7 @@
       }
    }
 
-   class MarshalledValueListenerInterceptor extends ChainedInterceptor
+   class MarshalledValueListenerInterceptor extends VisitorInterceptor
    {
       int invocationCount = 0;
 

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -1,11 +1,11 @@
 package org.jboss.cache.marshall;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.ComponentRegistry;
 import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.BeforeMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -5,12 +5,12 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Region;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.commands.CommandsFactory;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.read.GetKeyValueCommand;
 import org.jboss.cache.commands.read.GravitateDataCommand;
 import org.jboss.cache.commands.remote.ClusteredGetCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/mgmt/MgmtCoreTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -5,7 +5,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.interceptors.CacheMgmtInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -231,13 +231,13 @@
 
    private CacheMgmtInterceptor getCacheMgmtInterceptor()
    {
-      List<ChainedInterceptor> interceptors = cache.getInterceptorChain();
+      List<VisitorInterceptor> interceptors = cache.getInterceptorChain();
       if (interceptors.isEmpty())
       {
          return null;
       }
 
-      for (ChainedInterceptor interceptor : interceptors)
+      for (VisitorInterceptor interceptor : interceptors)
       {
          if (interceptor instanceof CacheMgmtInterceptor)
          {

Modified: core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -11,12 +11,12 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.CacheStatus;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.LifecycleManager;
 import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
-import org.jboss.cache.invocation.CacheLifecycleManager;
 import org.jboss.cache.invocation.InterceptorChain;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
@@ -75,9 +75,9 @@
       }
    }
 
-   public static <T extends ChainedInterceptor> T findInterceptor(CacheSPI<?, ?> cache, Class<T> interceptorToFind)
+   public static <T extends VisitorInterceptor> T findInterceptor(CacheSPI<?, ?> cache, Class<T> interceptorToFind)
    {
-      for (ChainedInterceptor i : cache.getInterceptorChain())
+      for (VisitorInterceptor i : cache.getInterceptorChain())
       {
          if (interceptorToFind.isInstance(i)) return interceptorToFind.cast(i);
       }
@@ -93,7 +93,7 @@
     * @param interceptorToInject           interceptor instance to inject.
     * @param interceptorAfterWhichToInject class of interceptor to search for in the chain and after which to add your interceptor
     */
-   public static void injectInterceptor(CacheSPI<?, ?> cache, ChainedInterceptor interceptorToInject, Class<? extends ChainedInterceptor> interceptorAfterWhichToInject)
+   public static void injectInterceptor(CacheSPI<?, ?> cache, VisitorInterceptor interceptorToInject, Class<? extends VisitorInterceptor> interceptorAfterWhichToInject)
    {
       cache.addInterceptor(interceptorToInject, interceptorAfterWhichToInject);
    }
@@ -474,7 +474,7 @@
     */
    public static ComponentRegistry extractComponentRegistry(Cache cache)
    {
-      CacheLifecycleManager clm = (CacheLifecycleManager) extractField(cache, "lifecycleManager");
+      LifecycleManager clm = (LifecycleManager) extractField(cache, "lifecycleManager");
       return (ComponentRegistry) extractField(clm, "componentRegistry");
    }
 
@@ -498,11 +498,11 @@
     * @param cache       cache that needs to be altered
     * @param interceptor the first interceptor in the new chain.
     */
-   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, ChainedInterceptor interceptor)
+   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, VisitorInterceptor interceptor)
    {
       ComponentRegistry cr = extractComponentRegistry(cache);
       // make sure all interceptors here are wired.
-      ChainedInterceptor i = interceptor;
+      VisitorInterceptor i = interceptor;
       do
       {
          cr.wireDependencies(i);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -19,7 +19,7 @@
 import org.jboss.cache.interceptors.OptimisticLockingInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
 import org.jboss.cache.lock.IsolationLevel;
@@ -262,7 +262,7 @@
       }
    }
 
-   protected void setAlteredInterceptorChain(ChainedInterceptor newLast, CacheSPI<Object, Object> spi)
+   protected void setAlteredInterceptorChain(VisitorInterceptor newLast, CacheSPI<Object, Object> spi)
    {
       spi.removeInterceptor(CacheMgmtInterceptor.class);
       spi.removeInterceptor(NotificationInterceptor.class);

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -14,7 +14,7 @@
 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.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
@@ -256,7 +256,7 @@
    {
       final String slowThreadName = "SLOW";
       final String fastThreadName = "FAST";
-      ChainedInterceptor slowdownInterceptor = new ChainedInterceptor()
+      VisitorInterceptor slowdownInterceptor = new VisitorInterceptor()
       {
          public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
          {
@@ -292,7 +292,7 @@
    {
       final String slowThreadName = "SLOW";
       final String fastThreadName = "FAST";
-      ChainedInterceptor slowdownInterceptor = new ChainedInterceptor()
+      VisitorInterceptor slowdownInterceptor = new VisitorInterceptor()
       {
          public Object hanldeDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
          {

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -3,7 +3,7 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -16,7 +16,7 @@
  * @version $Id: CreateIfNotExistsInterceptor.java,v 1.7 2005/01/26 11:45:14
  *          belaban Exp $
  */
-public class MockFailureInterceptor extends ChainedInterceptor
+public class MockFailureInterceptor extends VisitorInterceptor
 {
    private List<Class<? extends ReplicableCommand>> allCalled = new ArrayList<Class<? extends ReplicableCommand>>();
    private List<Class<? extends ReplicableCommand>> failurelist = new ArrayList<Class<? extends ReplicableCommand>>();

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -3,7 +3,7 @@
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -16,7 +16,7 @@
  * @version $Id: CreateIfNotExistsInterceptor.java,v 1.7 2005/01/26 11:45:14
  *          belaban Exp $
  */
-public class MockInterceptor extends ChainedInterceptor
+public class MockInterceptor extends VisitorInterceptor
 {
    ReplicableCommand calledCommand;
    private List<Class<? extends ReplicableCommand>> calledlist = new ArrayList<Class<? extends ReplicableCommand>>();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetChildrenNamesTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -5,7 +5,7 @@
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -39,9 +39,9 @@
 
       ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
       cr.registerComponent(interceptor, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
+      VisitorInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
       cr.registerComponent(nodeInterceptor, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
       cr.registerComponent(dummy, MockInterceptor.class);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeyValTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -35,8 +35,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorGetKeysTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -35,8 +35,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorKeyValTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -35,8 +35,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutEraseTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -38,8 +38,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorPutMapTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -38,8 +38,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveDataTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -4,7 +4,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -38,8 +38,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveKeyValTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -10,7 +10,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -44,8 +44,8 @@
       listener = new TestListener();
       cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorTransactionTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -9,7 +9,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
@@ -27,8 +27,8 @@
       TestListener listener = new TestListener();
       final CacheSPI cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      ChainedInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
       MockInterceptor dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);
@@ -56,8 +56,8 @@
       TestListener listener = new TestListener();
       final CacheSPI cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      ChainedInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
       MockInterceptor dummy = new MockInterceptor();
 
       interceptor.setNext(nodeInterceptor);

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticCreateIfNotExistsInterceptorTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -10,7 +10,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
@@ -64,7 +64,7 @@
       TestListener listener = new TestListener();
       final CacheSPI cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
       MockInterceptor dummy = new MockInterceptor();
 
       interceptor.setNext(dummy);
@@ -96,7 +96,7 @@
       TestListener listener = new TestListener();
       final CacheSPI cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
       MockInterceptor dummy = new MockInterceptor();
 
       interceptor.setNext(dummy);
@@ -139,7 +139,7 @@
       TestListener listener = new TestListener();
       final CacheSPI cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
       MockInterceptor dummy = new MockInterceptor();
       interceptor.setNext(dummy);
       TestingUtil.replaceInterceptorChain(cache, interceptor);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java	2008-04-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ThreadedOptimisticCreateIfNotExistsInterceptorTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -9,7 +9,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManager;
@@ -48,8 +48,8 @@
       TestListener listener = new TestListener();
       final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      ChainedInterceptor dummy = new MockInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor dummy = new MockInterceptor();
       interceptor.setNext(dummy);
 
       TestingUtil.replaceInterceptorChain(cache, interceptor);
@@ -112,8 +112,8 @@
       TestListener listener = new TestListener();
       final CacheSPI<Object, Object> cache = createCacheWithListener(listener);
 
-      ChainedInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
-      ChainedInterceptor dummy = new MockInterceptor();
+      VisitorInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
+      VisitorInterceptor dummy = new MockInterceptor();
       interceptor.setNext(dummy);
 
       TestingUtil.replaceInterceptorChain(cache, interceptor);

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-28 09:18:41 UTC (rev 5711)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2008-04-28 10:08:55 UTC (rev 5712)
@@ -18,7 +18,7 @@
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
+import org.jboss.cache.interceptors.base.VisitorInterceptor;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -53,10 +53,10 @@
       cache = createCacheWithListener();
       mgr = cache.getTransactionManager();
 
-      ChainedInterceptor ici = TestingUtil.findInterceptor(cache, InvocationContextInterceptor.class);
-      ChainedInterceptor validateInterceptor = TestingUtil.findInterceptor(cache, OptimisticValidatorInterceptor.class);
-      ChainedInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
-      ChainedInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
+      VisitorInterceptor ici = TestingUtil.findInterceptor(cache, InvocationContextInterceptor.class);
+      VisitorInterceptor validateInterceptor = TestingUtil.findInterceptor(cache, OptimisticValidatorInterceptor.class);
+      VisitorInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
+      VisitorInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
       dummy = new MockInterceptor();
       ici.setNext(validateInterceptor);
       validateInterceptor.setNext(interceptor);
@@ -389,7 +389,7 @@
       mgr.commit();
    }
 
-   public static class ResetRemoteFlagInterceptor extends ChainedInterceptor
+   public static class ResetRemoteFlagInterceptor extends VisitorInterceptor
    {
       public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
       {




More information about the jbosscache-commits mailing list