[exo-jcr-commits] exo-jcr SVN: r5923 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel and 11 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 20 10:01:41 EDT 2012


Author: dkuleshov
Date: 2012-03-20 10:01:39 -0400 (Tue, 20 Mar 2012)
New Revision: 5923

Added:
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java
Modified:
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration-ijdbc-ispn.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config-ijdbc-ispn.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml
   jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
   jcr/trunk/pom.xml
Log:
EXOJCR-1739: ported EXOJCR-1682

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -17,7 +17,13 @@
 package org.exoplatform.services.jcr.datamodel;
 
 import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
+import org.exoplatform.services.jcr.impl.Constants;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 import javax.jcr.RepositoryException;
 
 /**
@@ -28,18 +34,18 @@
  * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a> 
  * @version $Id: NullItemData.java 111 2008-11-11 11:11:11Z serg $
  */
-public abstract class NullItemData implements ItemData
+public abstract class NullItemData implements ItemData, Externalizable
 {
 
    public static final String NULL_ID = "_null_id";
 
-   private final String id;
+   private String id;
 
-   private final String parentId;
+   private String parentId;
 
-   private final QPathEntry name;
+   private QPathEntry name;
 
-   private final QPath path;
+   private QPath path;
 
    public NullItemData(NodeData parent, QPathEntry name)
    {
@@ -51,18 +57,12 @@
 
    public NullItemData(String id)
    {
-      this.parentId = null;
-      this.path = null;
-      this.name = null;
       this.id = id;
    }
 
    public NullItemData()
    {
-      this.parentId = null;
-      this.path = null;
-      this.name = null;
-      this.id = NULL_ID;
+      this(NULL_ID);
    }
 
    public void accept(ItemDataVisitor visitor) throws RepositoryException
@@ -94,5 +94,95 @@
    {
       return name;
    }
+   /**
+    * {@inheritDoc}
+    * 
+    * We need to make it serializable mostly for distributed cache in case we
+    * don't allow local caching
+    */
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      byte[] buf = new byte[in.readInt()];
+      in.readFully(buf);
+      id = new String(buf, Constants.DEFAULT_ENCODING);
+      int length = in.readInt();
+      if (length > 0)
+      {
+         buf = new byte[length];
+         in.readFully(buf);
+         parentId = new String(buf, Constants.DEFAULT_ENCODING);
+      }
+      length = in.readInt();
+      if (length > 0)
+      {
+         buf = new byte[length];
+         in.readFully(buf);
+         try
+         {
+            name = QPathEntry.parse(new String(buf, Constants.DEFAULT_ENCODING));
+         }
+         catch (Exception e)
+         {
+            throw new IOException("Deserialization error, could not parse the name. ", e);
+         }
+      }
+      length = in.readInt();
+      if (length > 0)
+      {
+         buf = new byte[length];
+         in.readFully(buf);
+         try
+         {
+            path = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING));
+         }
+         catch (Exception e)
+         {
+            throw new IOException("Deserialization error, could not parse the path. ", e);
+         }
+      }
+   }
 
+   /**
+    * {@inheritDoc}
+    * 
+    * We need to make it serializable mostly for distributed cache in case we
+    * don't allow local caching
+    */
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      byte[] buf = id.getBytes(Constants.DEFAULT_ENCODING);
+      out.writeInt(buf.length);
+      out.write(buf);
+      
+      if (parentId == null)
+      {
+         out.writeInt(-1);
+      }
+      else
+      {
+         buf = parentId.getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+      }
+      if (name == null)
+      {
+         out.writeInt(-1);
+      }
+      else
+      {
+         buf = name.getAsString(true).getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+      }
+      if (path == null)
+      {
+         out.writeInt(-1);
+      }
+      else
+      {
+         buf = path.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+      }
+   }
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -169,7 +169,7 @@
       orderNumber = in.readInt();
       
       data = new byte[in.readInt()];
-      in.readFully(data);
+      if (data.length > 0) in.readFully(data);
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -1360,6 +1360,7 @@
                            while (patternIterator.hasNext())
                            {
                               QPathEntryFilter pattern = patternIterator.next();
+                              @SuppressWarnings("unchecked")
                               List<NodeData> persistedNodeData = (List<NodeData>)pattern.accept(persistedItemList);
                               if (pattern.isExactName())
                               {
@@ -1658,6 +1659,7 @@
                            while (patternIterator.hasNext())
                            {
                               QPathEntryFilter pattern = patternIterator.next();
+                              @SuppressWarnings("unchecked")
                               List<PropertyData> persistedPropData =
                                  (List<PropertyData>)pattern.accept(persistedItemList);
                               if (pattern.isExactName())
@@ -2449,6 +2451,10 @@
     */
    public void stop()
    {
+      if (filtersEnabled.get())
+      {
+         cache.removeListener(this);
+      }
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -34,6 +34,7 @@
       <cache.enabled>true</cache.enabled>
       <value.storage.enabled>true</value.storage.enabled>
       <statistics.enabled>false</statistics.enabled>
+      <use.distributed.cache>false</use.distributed.cache>
       <properties.url.suffix>-sjdbc.properties</properties.url.suffix>
       <properties.url.prefix>classpath:/conf/standalone/default</properties.url.prefix>
       <test.cache.all>**/persistent/cache/**</test.cache.all>
@@ -58,8 +59,12 @@
       <dependency>
          <groupId>org.exoplatform.kernel</groupId>
          <artifactId>exo.kernel.component.ext.rpc.impl.jgroups.v3</artifactId>
-      </dependency>     
+      </dependency>
       <dependency>
+         <groupId>org.exoplatform.kernel</groupId>
+         <artifactId>exo.kernel.component.ext.cache.impl.infinispan.v5</artifactId>
+      </dependency>
+      <dependency>
          <groupId>org.exoplatform.jcr</groupId>
          <artifactId>exo.jcr.component.core</artifactId>
          <exclusions>
@@ -72,7 +77,7 @@
       <dependency>
          <groupId>org.exoplatform.jcr</groupId>
          <artifactId>exo.jcr.component.core</artifactId>
-         <classifier>sources</classifier>
+         <classifier>test-sources</classifier>
          <scope>test</scope>
          <version>${project.version}</version>
          <exclusions>
@@ -111,11 +116,6 @@
         <artifactId>ow2-jta-1.1-spec</artifactId>
       </dependency>
       <dependency>
-        <groupId>org.jgroups</groupId>
-        <artifactId>jgroups</artifactId>
-         <version>3.0.0.Final</version>
-      </dependency>
-      <dependency>
         <groupId>org.exoplatform.kernel</groupId>
         <artifactId>exo.kernel.component.common</artifactId>
       </dependency>
@@ -141,6 +141,10 @@
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging-spi</artifactId>
             </exclusion>
+            <exclusion>
+               <groupId>jgroups</groupId>
+               <artifactId>jgroups</artifactId>
+            </exclusion>
          </exclusions>
       </dependency>         
       <!-- TCK binaries and deps for repo stub, some eXo API test -->
@@ -218,8 +222,12 @@
                   <property>
                      <name>value-storage-enabled</name>
                      <value>${value.storage.enabled}</value>
-                  </property>                  
+                  </property>
                   <property>
+                     <name>use-distributed-cache</name>
+                     <value>${use.distributed.cache}</value>
+                  </property>
+                  <property>
                       <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
                       <value>${statistics.enabled}</value>
                   </property>
@@ -398,7 +406,11 @@
                         <property>
                            <name>value-storage-enabled</name>
                            <value>${value.storage.enabled}</value>
-                        </property>                  
+                        </property>
+                        <property>
+                           <name>use-distributed-cache</name>
+                           <value>${use.distributed.cache}</value>
+                        </property>
                          <property>
                            <name>known.issues</name>
                            <value>org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
@@ -483,6 +495,10 @@
                             <value>${value.storage.enabled}</value>
                         </property>                  
                         <property>
+                           <name>use-distributed-cache</name>
+                           <value>${use.distributed.cache}</value>
+                        </property>
+                        <property>
                            <name>known.issues</name>
                            <value>org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
                               org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -39,7 +39,6 @@
 import org.exoplatform.services.naming.InitialContextInitializer;
 import org.exoplatform.services.transaction.TransactionService;
 import org.infinispan.Cache;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.lifecycle.ComponentStatus;
 
 import java.io.Serializable;
@@ -114,7 +113,7 @@
       if (config.getLockManager() != null)
       {
          // create cache using custom factory
-         ISPNCacheFactory<Serializable, Object> factory = new ISPNCacheFactory<Serializable, Object>(cfm);
+         ISPNCacheFactory<Serializable, Object> factory = new ISPNCacheFactory<Serializable, Object>(cfm, transactionManager);
 
          // configure cache loader parameters with correct DB data-types
          configureJDBCCacheLoader(config.getLockManager());
@@ -434,8 +433,7 @@
    @Override
    protected boolean isAloneInCluster()
    {
-      return cache.getConfiguration().getCacheMode() == CacheMode.LOCAL
-         || cache.getCacheManager().getMembers().size() == 1;
+      return cache.getAdvancedCache().getRpcManager() == null || cache.getCacheManager().getMembers().size() == 1;
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -19,7 +19,7 @@
 package org.exoplatform.services.jcr.impl.core.query.ispn;
 
 import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -44,7 +44,7 @@
 
    ChangesKey(String wsId, String id)
    {
-      super(id);
+      super(null, id);
       this.wsId = wsId;
    }
 
@@ -79,21 +79,4 @@
       in.readFully(buf);
       wsId = new String(buf, Constants.DEFAULT_ENCODING);
    }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof ChangesKey)
-      {
-         ChangesKey key = (ChangesKey)obj;
-         return (key.hash == hash && key.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -206,8 +206,9 @@
     * @param event
     *          CacheEntryModifiedEvent
     */
+   @SuppressWarnings("unchecked")
    @CacheEntryModified
-   public void cacheEntryModified(CacheEntryModifiedEvent event)
+   public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
    {
       if (!event.isPre() && event.getKey().equals(namesKey))
       {

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -215,7 +215,7 @@
     *          CacheEntryModifiedEvent
     */
    @CacheEntryModified
-   public void cacheEntryModified(CacheEntryModifiedEvent event)
+   public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
    {
       if (!event.isPre() && event.getKey().equals(updateKey))
       {

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,7 +18,7 @@
  */
 package org.exoplatform.services.jcr.impl.core.query.ispn;
 
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 
 /**
  * Created by The eXo Platform SAS.
@@ -37,23 +37,6 @@
 
    IndexInfosKey(String id)
    {
-      super(id);
+      super(null, id);
    }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof IndexInfosKey)
-      {
-         IndexInfosKey key = (IndexInfosKey)obj;
-         return (key.hash == hash && key.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,7 +18,7 @@
  */
 package org.exoplatform.services.jcr.impl.core.query.ispn;
 
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 
 /**
  * Created by The eXo Platform SAS.
@@ -38,23 +38,6 @@
 
    IndexUpdateKey(String id)
    {
-      super(id);
+      super(null, id);
    }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof IndexUpdateKey)
-      {
-         IndexUpdateKey key = (IndexUpdateKey)obj;
-         return (key.hash == hash && key.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -23,7 +23,6 @@
 import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
 import org.exoplatform.services.jcr.util.IdGenerator;
 import org.infinispan.Cache;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.container.DataContainer;
 import org.infinispan.container.entries.InternalCacheEntry;
 import org.infinispan.lifecycle.ComponentStatus;
@@ -43,8 +42,8 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
-import java.util.Map.Entry;
 
 /**
  * Implements Cache Store for clustered environment. It gives control of Index for coordinator and
@@ -102,7 +101,7 @@
             {
                this.modeHandler =
                   new IndexerIoModeHandler(cacheManager.isCoordinator()
-                     || cache.getConfiguration().getCacheMode() == CacheMode.LOCAL ? IndexerIoMode.READ_WRITE
+                     || cache.getAdvancedCache().getRpcManager() == null ? IndexerIoMode.READ_WRITE
                      : IndexerIoMode.READ_ONLY);
             }
          }
@@ -166,6 +165,7 @@
    /**
     *  Flushes all cache content to underlying CacheStore
     */
+   @SuppressWarnings({"rawtypes", "unchecked"})
    protected void doPushState()
    {
       final boolean debugEnabled = LOG.isDebugEnabled();

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,21 +18,23 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.commons.utils.SecurityHelper;
 import org.exoplatform.services.jcr.datamodel.ItemData;
 import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 import org.exoplatform.services.jcr.infinispan.PrivilegedISPNCacheHelper;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.infinispan.AdvancedCache;
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.context.Flag;
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.util.concurrent.NotifyingFuture;
 import org.infinispan.util.concurrent.locks.LockManager;
 
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -57,7 +59,7 @@
  * @version $Id: BufferedISPNCache.java 3514 2010-11-22 16:14:36Z nzamosenchuk $
  * 
  */
- at SuppressWarnings("unchecked")
+ at SuppressWarnings({"unchecked", "deprecation"})
 public class BufferedISPNCache implements Cache<CacheKey, Object>
 {
    /**
@@ -155,20 +157,9 @@
 
       protected AdvancedCache<CacheKey, Object> setCacheLocalMode()
       {
-         if (localMode)
+         if (localMode && allowLocalChanges)
          {
-            if (allowLocalChanges == null)
-            {
-               CacheMode cacheMode = cache.getConfiguration().getCacheMode();
-               if (cacheMode != CacheMode.DIST_ASYNC && cacheMode != CacheMode.DIST_SYNC)
-               {
-                  return cache.withFlags(Flag.CACHE_MODE_LOCAL);
-               }
-            }
-            else if (allowLocalChanges)
-            {
-               return cache.withFlags(Flag.CACHE_MODE_LOCAL);
-            }
+            return cache.withFlags(Flag.CACHE_MODE_LOCAL);
          }
          return cache;
       }
@@ -268,8 +259,7 @@
             LOG.error("Unexpected object found by key " + key.toString() + ". Expected Set, but found:"
                + existingObject.getClass().getName());
          }
-         else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL
-            && cache.getCacheManager().getMembers().size() > 1)
+         else if (!localMode && cache.getRpcManager() != null && cache.getCacheManager().getMembers().size() > 1)
          {
             // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
             // and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
@@ -331,8 +321,7 @@
             LOG.error("Unexpected object found by key " + key.toString() + ". Expected Map, but found:"
                + existingObject.getClass().getName());
          }
-         else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL
-            && cache.getCacheManager().getMembers().size() > 1)
+         else if (!localMode && cache.getRpcManager() != null && cache.getCacheManager().getMembers().size() > 1)
          {
             // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
             // and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes 
@@ -870,9 +859,15 @@
    /**
     * {@inheritDoc}
     */
-   public Object get(Object key)
+   public Object get(final Object key)
    {
-      return parentCache.get(key);
+      return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+      {
+         public Object run()
+         {
+            return parentCache.get(key);
+         }
+      });
    }
 
    /**
@@ -899,6 +894,14 @@
    }
 
    /**
+    * {@inheritDoc}
+    */
+   public org.infinispan.configuration.cache.Configuration getCacheConfiguration()
+   {
+      return parentCache.getCacheConfiguration();
+   }
+
+   /**
     * Put object in cache.
     * @param key
     *          cache key

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,7 +18,9 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 
+
 /**
  * 
  * @author <a href="anatoliy.bazko at exoplatform.org">Anatoliy Bazko</a>
@@ -32,25 +34,8 @@
       super();
    }
 
-   CacheId(String id)
+   CacheId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CacheId)
-      {
-         CacheId cacheId = (CacheId)obj;
-         return (cacheId.hash == hash && cacheId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * @author <a href="abazko at exoplatform.com">Anatoliy Bazko</a>
  * @version $Id: CachePagedNodes.java 34360 2009-07-22 23:58:59Z tolusha $
@@ -30,23 +32,8 @@
       super();
    }
 
-   CacheNodesByPageId(String id)
+   CacheNodesByPageId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CacheNodesByPageId)
-      {
-         CacheNodesByPageId cacheNodesByPageId = (CacheNodesByPageId)obj;
-         return (cacheNodesByPageId.hash == hash && cacheNodesByPageId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
-
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * Created by The eXo Platform SAS
  * 
@@ -36,22 +38,8 @@
       super();
    }
 
-   CacheNodesId(String id)
+   CacheNodesId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CacheNodesId)
-      {
-         CacheNodesId cacheNodesId = (CacheNodesId)obj;
-         return (cacheNodesId.hash == hash && cacheNodesId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -16,6 +16,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * Created by The eXo Platform SAS.
  * 
@@ -32,22 +34,8 @@
       super();
    }
 
-   CachePatternNodesId(String id)
+   CachePatternNodesId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CachePatternNodesId)
-      {
-         CachePatternNodesId cacheNodesId = (CachePatternNodesId)obj;
-         return (cacheNodesId.hash == hash && cacheNodesId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -16,13 +16,15 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * Created by The eXo Platform SAS.
  * 
  * <br/>Date: 
  *
  * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a> 
- * @version $Id: CachePatternPropsId.java 111 28 êâ³ò. 2011 serg $
+ * @version $Id: CachePatternPropsId.java 111 28 ���. 2011 serg $
  */
 public class CachePatternPropsId extends CacheKey
 {
@@ -32,22 +34,8 @@
       super();
    }
 
-   CachePatternPropsId(String parentId)
+   CachePatternPropsId(String ownerId, String parentId)
    {
-      super(parentId);
+      super(ownerId, parentId);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CachePatternPropsId)
-      {
-         CachePatternPropsId cachePatternPropsId = (CachePatternPropsId)obj;
-         return (cachePatternPropsId.hash == hash && cachePatternPropsId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * Created by The eXo Platform SAS
  * 
@@ -36,22 +38,8 @@
       super();
    }
 
-   CachePropsId(String id)
+   CachePropsId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CachePropsId)
-      {
-         CachePropsId cachePropsId = (CachePropsId)obj;
-         return (cachePropsId.hash == hash && cachePropsId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -22,6 +22,7 @@
 import org.exoplatform.services.jcr.datamodel.QPath;
 import org.exoplatform.services.jcr.datamodel.QPathEntry;
 import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 
 /**
  * Created by The eXo Platform SAS. <br/>
@@ -40,28 +41,14 @@
       super();
    }
 
-   CacheQPath(String parentId, QPath path, ItemType itemType)
+   CacheQPath(String ownerId, String parentId, QPath path, ItemType itemType)
    {
-      this(parentId, path.getEntries()[path.getEntries().length - 1], itemType);
+      this(ownerId, parentId, path.getEntries()[path.getEntries().length - 1], itemType);
    }
 
-   CacheQPath(String parentId, QPathEntry name, ItemType itemType)
+   CacheQPath(String ownerId, String parentId, QPathEntry name, ItemType itemType)
    {
-      super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
+      super(ownerId, new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
          .append(name.getAsString(true)).append(itemType.toString()).toString(), parentId);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CacheQPath)
-      {
-         CacheQPath cacheQPath = (CacheQPath)obj;
-         return (cacheQPath.hash == hash && cacheQPath.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
 /**
  * Created by The eXo Platform SAS
  * 
@@ -35,22 +37,8 @@
       super();
    }
 
-   CacheRefsId(String id)
+   CacheRefsId(String ownerId, String id)
    {
-      super(id);
+      super(ownerId, id);
    }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj instanceof CacheRefsId)
-      {
-         CacheRefsId cachePropsId = (CacheRefsId)obj;
-         return (cachePropsId.hash == hash && cachePropsId.id.equals(id));
-      }
-      else
-      {
-         return false;
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -18,17 +18,19 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
 
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.services.ispn.DistributedCacheManager;
 import org.exoplatform.services.jcr.access.AccessControlList;
 import org.exoplatform.services.jcr.config.CacheEntry;
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
 import org.exoplatform.services.jcr.config.WorkspaceEntry;
 import org.exoplatform.services.jcr.dataflow.ItemState;
 import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
 import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
 import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCacheListener;
 import org.exoplatform.services.jcr.datamodel.IllegalPathException;
@@ -51,11 +53,20 @@
 import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
 import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
+import org.exoplatform.services.jcr.infinispan.AbstractMapper;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
 import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.exoplatform.services.transaction.ActionNonTxAware;
+import org.exoplatform.services.transaction.TransactionService;
 import org.infinispan.Cache;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.context.Flag;
+import org.infinispan.distexec.mapreduce.Collector;
+import org.infinispan.distexec.mapreduce.MapReduceTask;
+import org.infinispan.distexec.mapreduce.Reducer;
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
@@ -64,6 +75,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -78,6 +92,9 @@
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
 import javax.transaction.TransactionManager;
 
 /**
@@ -103,21 +120,39 @@
  */
 public class ISPNCacheWorkspaceStorageCache implements WorkspaceStorageCache, Backupable, Startable
 {
-   private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.impl.infinispan.v5.ISPNCacheWorkspaceStorageCache");
+   private static final Log LOG = ExoLogger
+      .getLogger("exo.jcr.component.core.impl.infinispan.v5.ISPNCacheWorkspaceStorageCache");
 
+   /**
+    * Name of the cache in case of the distributed cache
+    */
+   private static final String CACHE_NAME = "JCRCache";
+
+   /**
+    * This id will be the unique identifier of the workspace in case the
+    * distributed mode is enabled as the cache will be then shared so we
+    * need this id to prevent mixing data of different workspace. In case
+    * the workspace is not distributed the value of this variable will be
+    * null to avoid consuming more memory for nothing 
+    */
+   protected final String ownerId;
+
    private final boolean enabled;
    
    protected final BufferedISPNCache cache;
    
+   private final GlobalOperationCaller caller;
+
    /**
     * The list of all the listeners
     */
-   private final List<WorkspaceStorageCacheListener> listeners = new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
+   private final List<WorkspaceStorageCacheListener> listeners =
+      new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
 
    private final CacheActionNonTxAware<Void, Void> commitTransaction = new CacheActionNonTxAware<Void, Void>()
    {
       @Override
-      protected Void execute(Void arg) throws RuntimeException
+      protected Void execute(Void arg)
       {
          cache.commitTransaction();
          return null;
@@ -128,9 +163,9 @@
       new CacheActionNonTxAware<ItemData, String>()
       {
          @Override
-         protected ItemData execute(String id) throws RuntimeException
+         protected ItemData execute(String id)
          {
-            return id == null ? null : (ItemData)cache.get(new CacheId(id));
+            return id == null ? null : (ItemData)cache.get(new CacheId(getOwnerId(), id));
          }
       };
 
@@ -138,10 +173,10 @@
       new CacheActionNonTxAware<List<NodeData>, NodeData>()
       {
          @Override
-         protected List<NodeData> execute(NodeData parent) throws RuntimeException
+         protected List<NodeData> execute(NodeData parent)
          {
             // get list of children uuids
-            final Set<String> set = (Set<String>)cache.get(new CacheNodesId(parent.getIdentifier()));
+            final Set<String> set = (Set<String>)cache.get(new CacheNodesId(getOwnerId(), parent.getIdentifier()));
 
             if (set != null)
             {
@@ -149,7 +184,7 @@
 
                for (String childId : set)
                {
-                  NodeData child = (NodeData)cache.get(new CacheId(childId));
+                  NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
                   if (child == null)
                   {
                      return null;
@@ -173,7 +208,7 @@
       new CacheActionNonTxAware<ItemData, Object>()
       {
          @Override
-         protected ItemData execute(Object... args) throws RuntimeException
+         protected ItemData execute(Object... args)
          {
             String parentIdentifier = (String)args[0];
             QPathEntry name = (QPathEntry)args[1];
@@ -183,12 +218,13 @@
             if (itemType == ItemType.UNKNOWN)
             {
                // Try as node first.
-               itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.NODE));
+               itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.NODE));
 
                if (itemId == null || itemId.equals(NullItemData.NULL_ID))
                {
                   // node with such a name is not found or marked as not-exist, so check the properties
-                  String propId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.PROPERTY));
+                  String propId =
+                     (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.PROPERTY));
                   if (propId != null)
                   {
                      itemId = propId;
@@ -197,11 +233,11 @@
             }
             else if (itemType == ItemType.NODE)
             {
-               itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.NODE));;
+               itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.NODE));;
             }
             else
             {
-               itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.PROPERTY));;
+               itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.PROPERTY));;
             }
 
             if (itemId != null)
@@ -230,9 +266,9 @@
       new CacheActionNonTxAware<Integer, NodeData>()
       {
          @Override
-         protected Integer execute(NodeData parent) throws RuntimeException
+         protected Integer execute(NodeData parent)
          {
-            Set<String> list = (Set<String>)cache.get(new CacheNodesId(parent.getIdentifier()));
+            Set<String> list = (Set<String>)cache.get(new CacheNodesId(getOwnerId(), parent.getIdentifier()));
             return list != null ? list.size() : -1;
          }
       };
@@ -241,19 +277,19 @@
       new CacheActionNonTxAware<List<PropertyData>, Object>()
       {
          @Override
-         protected List<PropertyData> execute(Object... args) throws RuntimeException
+         protected List<PropertyData> execute(Object... args)
          {
             String parentId = (String)args[0];
             boolean withValue = (Boolean)args[1];
             // get list of children uuids
-            final Set<String> set = (Set<String>)cache.get(new CachePropsId(parentId));
+            final Set<String> set = (Set<String>)cache.get(new CachePropsId(getOwnerId(), parentId));
             if (set != null)
             {
                final List<PropertyData> childs = new ArrayList<PropertyData>();
 
                for (String childId : set)
                {
-                  PropertyData child = (PropertyData)cache.get(new CacheId(childId));
+                  PropertyData child = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
 
                   if (child == null)
                   {
@@ -278,17 +314,17 @@
       new CacheActionNonTxAware<List<PropertyData>, String>()
       {
          @Override
-         protected List<PropertyData> execute(String identifier) throws RuntimeException
+         protected List<PropertyData> execute(String identifier)
          {
             // get list of children uuids
-            final Set<String> set = (Set<String>)cache.get(new CacheRefsId(identifier));
+            final Set<String> set = (Set<String>)cache.get(new CacheRefsId(getOwnerId(), identifier));
             if (set != null)
             {
                final List<PropertyData> props = new ArrayList<PropertyData>();
 
                for (String childId : set)
                {
-                  PropertyData prop = (PropertyData)cache.get(new CacheId(childId));
+                  PropertyData prop = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
 
                   if (prop == null || prop instanceof NullItemData)
                   {
@@ -330,9 +366,9 @@
    private final CacheActionNonTxAware<Long, Void> getSize = new CacheActionNonTxAware<Long, Void>()
    {
       @Override
-      protected Long execute(Void arg) throws RuntimeException
+      protected Long execute(Void arg)
       {
-         return (long)cache.size();
+         return (long)caller.getCacheSize();
       }
    };
 
@@ -380,7 +416,7 @@
             T n = null;
             do
             {
-               n = (T)cache.get(new CacheId(childs.next()));
+               n = (T)cache.get(new CacheId(getOwnerId(), childs.next()));
             }
             while (n == null && childs.hasNext());
             next = n;
@@ -418,7 +454,7 @@
    {
       ChildNodesIterator(String parentId)
       {
-         super(new CacheNodesId(parentId));
+         super(new CacheNodesId(getOwnerId(), parentId));
       }
 
       @Override
@@ -433,7 +469,7 @@
 
       ChildPropertiesIterator(String parentId)
       {
-         super(new CachePropsId(parentId));
+         super(new CachePropsId(getOwnerId(), parentId));
       }
 
       @Override
@@ -444,15 +480,65 @@
    }
 
    /**
-    * Cache constructor with eXo TransactionService support.
+    * Cache constructor.
     * 
-    * @param wsConfig WorkspaceEntry workspace config
+    * @param wsConfig WorkspaceEntry workspace configuration
+    * @param cfm The configuration manager
     * @throws RepositoryException if error of initialization
     * @throws RepositoryConfigurationException if error of configuration
     */
    public ISPNCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm) throws RepositoryException,
       RepositoryConfigurationException
    {
+      this(null, wsConfig, cfm, null, null);
+   }
+
+   /**
+    * Cache constructor.
+    * 
+    * @param ctx The {@link ExoContainerContext} that owns the current component
+    * @param wsConfig WorkspaceEntry workspace configuration
+    * @param cfm The configuration manager
+    * @param ts TransactionService external transaction service
+    * @throws RepositoryException if error of initialization
+    * @throws RepositoryConfigurationException if error of configuration
+    */
+   public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+      TransactionService ts) throws RepositoryException, RepositoryConfigurationException
+   {
+      this(ctx, wsConfig, cfm, null, ts);
+   }
+
+   /**
+    * Cache constructor.
+    * 
+    * @param ctx The {@link ExoContainerContext} that owns the current component
+    * @param wsConfig WorkspaceEntry workspace configuration
+    * @param cfm The configuration manager
+    * @param dcm The distributed cache manager
+    * @throws RepositoryException if error of initialization
+    * @throws RepositoryConfigurationException if error of configuration
+    */
+   public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+      DistributedCacheManager dcm) throws RepositoryException, RepositoryConfigurationException
+   {
+      this(ctx, wsConfig, cfm, dcm, null);
+   }
+
+   /**
+    * Cache constructor.
+    * 
+    * @param ctx The {@link ExoContainerContext} that owns the current component
+    * @param wsConfig WorkspaceEntry workspace configuration
+    * @param cfm The configuration manager
+    * @param dcm The distributed cache manager
+    * @param ts TransactionService external transaction service
+    * @throws RepositoryException if error of initialization
+    * @throws RepositoryConfigurationException if error of configuration
+    */
+   public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+      DistributedCacheManager dcm, TransactionService ts) throws RepositoryException, RepositoryConfigurationException
+   {
       if (wsConfig.getCache() == null)
       {
          throw new RepositoryConfigurationException("Cache configuration not found");
@@ -460,30 +546,66 @@
       this.enabled = wsConfig.getCache().isEnabled();
       
       // create cache using custom factory
-      ISPNCacheFactory<CacheKey, Object> factory = new ISPNCacheFactory<CacheKey, Object>(cfm);
+      ISPNCacheFactory<CacheKey, Object> factory =
+         new ISPNCacheFactory<CacheKey, Object>(cfm, ts == null ? null : ts.getTransactionManager());
 
       // create parent Infinispan instance
       CacheEntry cacheEntry = wsConfig.getCache();
-      Cache<CacheKey, Object> parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
-
-      Boolean allowLocalChanges = null;
-      try
+      boolean useDistributedCache = cacheEntry.getParameterBoolean("use-distributed-cache", false);
+      Cache<CacheKey, Object> parentCache;
+      if (useDistributedCache)
       {
-         allowLocalChanges = cacheEntry.getParameterBoolean("allow-local-changes");
+                  // We expect a distributed cache
+                 if (dcm == null)
+                 {
+                     throw new IllegalArgumentException("The DistributedCacheManager has not been defined in the configuration,"
+                        + " please configure it at root container level if you want to use a distributed cache.");
+                  }
+                  parentCache = dcm.getCache(CACHE_NAME);
+                  this.ownerId = ctx.getName();
+                  if (LOG.isDebugEnabled())
+                  {
+                     LOG.debug("The distributed cache has been enabled for the workspace whose unique id is " + ownerId);
+                  }
       }
-      catch (RepositoryConfigurationException e)
+      else
       {
-         if (LOG.isTraceEnabled())
+         parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
+         Configuration config = parentCache.getCacheConfiguration();
+         if (config.clustering().cacheMode() == CacheMode.DIST_SYNC
+            || config.clustering().cacheMode() == CacheMode.DIST_ASYNC)
          {
-            LOG.trace("An exception occurred: " + e.getMessage());
+            throw new IllegalArgumentException("Cache configuration not allowed, if you want to use the distributed "
+               + "cache please enable the parameter 'use-distributed-cache' and configure the DistributedCacheManager.");
          }
+         this.ownerId = null;
       }
+      Boolean allowLocalChanges =
+         useDistributedCache ? cacheEntry.getParameterBoolean("allow-local-changes", Boolean.TRUE) : Boolean.TRUE;
       this.cache = new BufferedISPNCache(parentCache, allowLocalChanges);
-      cache.addListener(new CacheEventListener());
+      if (useDistributedCache)
+      {
+         this.caller = new DistributedOperationCaller();
+      }
+      else
+      {
+         this.caller = new GlobalOperationCaller();
+         cache.addListener(new CacheEventListener());
+      }
 
       this.cache.start();
    }
 
+   private boolean isDistributedMode()
+   {
+      return ownerId != null;
+   }
+
+   private String getOwnerId()
+   {
+      return ownerId;
+   }
+
    /**
     * Return TransactionManager used by ISPN backing the JCR cache.
     * 
@@ -623,7 +745,7 @@
 
          cache.setLocal(true);
 
-         CacheNodesByPageId cacheId = new CacheNodesByPageId(parent.getIdentifier());
+         CacheNodesByPageId cacheId = new CacheNodesByPageId(getOwnerId(), parent.getIdentifier());
          Map<Integer, Set<String>> pages = (Map<Integer, Set<String>>)cache.get(cacheId);
          if (pages == null)
          {
@@ -681,12 +803,12 @@
                putNode(child, ModifyChildOption.NOT_MODIFY);
                set.add(child.getIdentifier());
             }
-            cache.putIfAbsent(new CacheNodesId(parent.getIdentifier()), set);
+            cache.putIfAbsent(new CacheNodesId(getOwnerId(), parent.getIdentifier()), set);
          }
          else
          {
             // cache fact of empty childs list
-            cache.putIfAbsent(new CacheNodesId(parent.getIdentifier()), new HashSet<Object>());
+            cache.putIfAbsent(new CacheNodesId(getOwnerId(), parent.getIdentifier()), new HashSet<Object>());
          }
       }
       finally
@@ -721,7 +843,7 @@
             set.add(child.getIdentifier());
          }
 
-         CachePatternNodesId cacheId = new CachePatternNodesId(parent.getIdentifier());
+         CachePatternNodesId cacheId = new CachePatternNodesId(getOwnerId(), parent.getIdentifier());
          Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
          if (patterns == null)
          {
@@ -762,7 +884,7 @@
                putProperty(child, ModifyChildOption.NOT_MODIFY);
                set.add(child.getIdentifier());
             }
-            cache.putIfAbsent(new CachePropsId(parent.getIdentifier()), set);
+            cache.putIfAbsent(new CachePropsId(getOwnerId(), parent.getIdentifier()), set);
 
          }
          else
@@ -803,7 +925,7 @@
                set.add(child.getIdentifier());
             }
 
-            CachePatternPropsId cacheId = new CachePatternPropsId(parent.getIdentifier());
+            CachePatternPropsId cacheId = new CachePatternPropsId(getOwnerId(), parent.getIdentifier());
             Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
             if (patterns == null)
             {
@@ -862,7 +984,7 @@
    {
       // get list of children uuids
       final Map<Integer, Set<String>> pages =
-         (Map<Integer, Set<String>>)cache.get(new CacheNodesByPageId(parent.getIdentifier()));
+         (Map<Integer, Set<String>>)cache.get(new CacheNodesByPageId(getOwnerId(), parent.getIdentifier()));
 
       if (pages == null)
       {
@@ -878,7 +1000,7 @@
       final List<NodeData> childs = new ArrayList<NodeData>();
       for (String childId : set)
       {
-         NodeData child = (NodeData)cache.get(new CacheId(childId));
+         NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
          if (child == null)
          {
             return null;
@@ -899,7 +1021,7 @@
    {
       // get list of children uuids
       final Map<QPathEntryFilter, Set<String>> patterns =
-         (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternNodesId(parent.getIdentifier()));
+         (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternNodesId(getOwnerId(), parent.getIdentifier()));
 
       if (patterns == null)
       {
@@ -916,7 +1038,7 @@
 
       for (String childId : set)
       {
-         NodeData child = (NodeData)cache.get(new CacheId(childId));
+         NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
          if (child == null)
          {
             return null;
@@ -951,7 +1073,7 @@
    {
       // get list of children uuids
       final Map<QPathEntryFilter, Set<String>> patterns =
-         (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternPropsId(parent.getIdentifier()));
+         (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternPropsId(getOwnerId(), parent.getIdentifier()));
 
       if (patterns == null)
       {
@@ -968,7 +1090,7 @@
 
       for (String childId : set)
       {
-         PropertyData child = (PropertyData)cache.get(new CacheId(childId));
+         PropertyData child = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
 
          if (child == null)
          {
@@ -1027,7 +1149,7 @@
    {
       return true;
    }
-  
+
    /**
     * {@inheritDoc}
     */
@@ -1079,32 +1201,33 @@
       {
          if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
          {
-            cache.putIfAbsent(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node
-                     .getIdentifier());
+            cache.putIfAbsent(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+               node.getIdentifier());
          }
          else
          {
-            cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
+            cache.put(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+               node.getIdentifier());
          }
 
          // if MODIFY and List present OR FORCE_MODIFY, then write
          if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
          {
-            cache.addToPatternList(new CachePatternNodesId(node.getParentIdentifier()), node);
-            cache.addToList(new CacheNodesId(node.getParentIdentifier()), node.getIdentifier(),
+            cache.addToPatternList(new CachePatternNodesId(getOwnerId(), node.getParentIdentifier()), node);
+            cache.addToList(new CacheNodesId(getOwnerId(), node.getParentIdentifier()), node.getIdentifier(),
                modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
 
-            cache.remove(new CacheNodesByPageId(node.getParentIdentifier()));
+            cache.remove(new CacheNodesByPageId(getOwnerId(), node.getParentIdentifier()));
          }
       }
 
       if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
       {
-         return (ItemData)cache.putIfAbsent(new CacheId(node.getIdentifier()), node);
+         return (ItemData)cache.putIfAbsent(new CacheId(getOwnerId(), node.getIdentifier()), node);
       }
       else
       {
-         return (ItemData)cache.put(new CacheId(node.getIdentifier()), node, true);
+         return (ItemData)cache.put(new CacheId(getOwnerId(), node.getIdentifier()), node, true);
       }
    }
 
@@ -1112,18 +1235,19 @@
    {
       if (node.getParentIdentifier() != null)
       {
-         cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
+         cache.put(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+            node.getIdentifier());
 
          // if MODIFY and List present OR FORCE_MODIFY, then write
          if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
          {
-            cache.addToList(new CacheNodesId(node.getParentIdentifier()), node.getIdentifier(),
+            cache.addToList(new CacheNodesId(getOwnerId(), node.getParentIdentifier()), node.getIdentifier(),
                modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
          }
       }
 
       // NullNodeData must never be returned inside internal cache operations. 
-      ItemData itemData = (ItemData)cache.putInBuffer(new CacheId(node.getIdentifier()), node);
+      ItemData itemData = (ItemData)cache.putInBuffer(new CacheId(getOwnerId(), node.getIdentifier()), node);
       return (itemData instanceof NullItemData) ? null : itemData;
    }
 
@@ -1145,11 +1269,12 @@
 
          if (!item.getIdentifier().equals(NullItemData.NULL_ID))
          {
-            cache.putIfAbsent(new CacheId(item.getIdentifier()), item);
+            cache.putIfAbsent(new CacheId(getOwnerId(), item.getIdentifier()), item);
          }
          else if (item.getName() != null && item.getParentIdentifier() != null)
          {
-            cache.putIfAbsent(new CacheQPath(item.getParentIdentifier(), item.getName(), ItemType.getItemType(item)),
+            cache.putIfAbsent(
+               new CacheQPath(getOwnerId(), item.getParentIdentifier(), item.getName(), ItemType.getItemType(item)),
                NullItemData.NULL_ID);
          }
       }
@@ -1174,20 +1299,22 @@
       // if MODIFY and List present OR FORCE_MODIFY, then write
       if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
       {
-         cache.addToPatternList(new CachePatternPropsId(prop.getParentIdentifier()), prop);
-         cache.addToList(new CachePropsId(prop.getParentIdentifier()), prop.getIdentifier(),
+         cache.addToPatternList(new CachePatternPropsId(getOwnerId(), prop.getParentIdentifier()), prop);
+         cache.addToList(new CachePropsId(getOwnerId(), prop.getParentIdentifier()), prop.getIdentifier(),
             modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
       }
       if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
       {
-         cache.putIfAbsent(new CacheQPath(prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY), prop.getIdentifier());
+         cache.putIfAbsent(
+            new CacheQPath(getOwnerId(), prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY),
+            prop.getIdentifier());
       }
       else
       {
-         cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY), prop.getIdentifier());
+         cache.put(new CacheQPath(getOwnerId(), prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY),
+            prop.getIdentifier());
       }
 
-
       // add referenced property
       if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY && prop.getType() == PropertyType.REFERENCE)
       {
@@ -1214,7 +1341,7 @@
                   LOG.trace("An exception occurred: " + e.getMessage());
                }
             }
-            cache.addToList(new CacheRefsId(nodeIdentifier), prop.getIdentifier(),
+            cache.addToList(new CacheRefsId(getOwnerId(), nodeIdentifier), prop.getIdentifier(),
                modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
          }
       }
@@ -1222,41 +1349,42 @@
       PropertyData propData;
       if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
       {
-         propData = (PropertyData)cache.putIfAbsent(new CacheId(prop.getIdentifier()), prop);
+         propData = (PropertyData)cache.putIfAbsent(new CacheId(getOwnerId(), prop.getIdentifier()), prop);
       }
       else
       {
-         propData = (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop, true);
+         propData = (PropertyData)cache.put(new CacheId(getOwnerId(), prop.getIdentifier()), prop, true);
       }
-      
+
       return (propData instanceof NullPropertyData) ? null : propData;
    }
 
    protected void removeItem(ItemData item)
    {
-      cache.remove(new CacheId(item.getIdentifier()));
-      cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
+      cache.remove(new CacheId(getOwnerId(), item.getIdentifier()));
+      cache
+         .remove(new CacheQPath(getOwnerId(), item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
 
       if (item.isNode())
       {
          if (item.getParentIdentifier() != null)
          {
-            cache.removeFromPatternList(new CachePatternNodesId(item.getParentIdentifier()), item);
-            cache.removeFromList(new CacheNodesId(item.getParentIdentifier()), item.getIdentifier());
-            cache.remove(new CacheNodesByPageId(item.getParentIdentifier()));
+            cache.removeFromPatternList(new CachePatternNodesId(getOwnerId(), item.getParentIdentifier()), item);
+            cache.removeFromList(new CacheNodesId(getOwnerId(), item.getParentIdentifier()), item.getIdentifier());
+            cache.remove(new CacheNodesByPageId(getOwnerId(), item.getParentIdentifier()));
          }
 
-         cache.remove(new CacheNodesId(item.getIdentifier()));
-         cache.remove(new CachePropsId(item.getIdentifier()));
-         cache.remove(new CacheNodesByPageId(item.getIdentifier()));
-         cache.remove(new CachePatternNodesId(item.getIdentifier()));
-         cache.remove(new CachePatternPropsId(item.getIdentifier()));
-         cache.remove(new CacheRefsId(item.getIdentifier()));
+         cache.remove(new CacheNodesId(getOwnerId(), item.getIdentifier()));
+         cache.remove(new CachePropsId(getOwnerId(), item.getIdentifier()));
+         cache.remove(new CacheNodesByPageId(getOwnerId(), item.getIdentifier()));
+         cache.remove(new CachePatternNodesId(getOwnerId(), item.getIdentifier()));
+         cache.remove(new CachePatternPropsId(getOwnerId(), item.getIdentifier()));
+         cache.remove(new CacheRefsId(getOwnerId(), item.getIdentifier()));
       }
       else
       {
-         cache.removeFromPatternList(new CachePatternPropsId(item.getParentIdentifier()), item);
-         cache.removeFromList(new CachePropsId(item.getParentIdentifier()), item.getIdentifier());
+         cache.removeFromPatternList(new CachePatternPropsId(getOwnerId(), item.getParentIdentifier()), item);
+         cache.removeFromList(new CachePropsId(getOwnerId(), item.getParentIdentifier()), item.getIdentifier());
       }
    }
 
@@ -1267,7 +1395,7 @@
     */
    protected void updateMixin(NodeData node)
    {
-      NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node, true);
+      NodeData prevData = (NodeData)cache.put(new CacheId(getOwnerId(), node.getIdentifier()), node, true);
       // prevent update NullNodeData
       if (!(prevData instanceof NullNodeData))
       {
@@ -1297,7 +1425,7 @@
    protected void updateInBuffer(final NodeData node, final NodeData prevNode)
    {
       // I expect that NullNodeData will never update existing NodeData.
-      CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath(), ItemType.NODE);
+      CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevNode.getQPath(), ItemType.NODE);
       if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
       {
          cache.remove(prevKey);
@@ -1322,78 +1450,7 @@
     */
    protected void updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
    {
-      boolean inheritACL = acl != null;
-
-      // check all ITEMS in cache 
-      Iterator<CacheKey> keys = cache.keySet().iterator();
-
-      while (keys.hasNext())
-      {
-         CacheKey key = keys.next();
-         if (key instanceof CacheId)
-         {
-            ItemData data = (ItemData)cache.get(key);
-
-            if (data != null)
-            {
-               // check is this descendant of prevRootPath
-               QPath nodeQPath = data.getQPath();
-               if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
-               {
-                  //make relative path
-                  QPathEntry[] relativePath = null;
-                  try
-                  {
-                     relativePath = nodeQPath.getRelPath(nodeQPath.getDepth() - prevRootPath.getDepth());
-                  }
-                  catch (IllegalPathException e)
-                  {
-                     if (LOG.isTraceEnabled())
-                     {
-                        LOG.trace("An exception occurred: " + e.getMessage());
-                     }
-                  }
-
-                  // make new path - no matter  node or property
-                  QPath newPath = QPath.makeChildPath(newRootPath, relativePath);
-
-                  if (data.isNode())
-                  {
-                     // update node
-                     NodeData prevNode = (NodeData)data;
-
-                     TransientNodeData newNode =
-                        new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
-                           prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
-                           prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL());
-
-                     // update this node
-                     cache.put(new CacheId(newNode.getIdentifier()), newNode);
-                  }
-                  else
-                  {
-                     //update property
-                     PropertyData prevProp = (PropertyData)data;
-
-                     if (inheritACL
-                        && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath()
-                           .getName().equals(Constants.EXO_OWNER)))
-                     {
-                        inheritACL = false;
-                     }
-
-                     TransientPropertyData newProp =
-                        new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
-                           prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp
-                              .getValues());
-
-                     // update this property
-                     cache.put(new CacheId(newProp.getIdentifier()), newProp);
-                  }
-               }
-            }
-         }
-      }
+      caller.updateTreePath(prevRootPath, newRootPath, acl);
    }
 
    /**
@@ -1402,33 +1459,9 @@
     * @param parentId String - root node id of JCR subtree.
     * @param acl AccessControlList
     */
-   protected void updateChildsACL(final String parentId, final AccessControlList acl)
+   protected void updateChildsACL(String parentId, AccessControlList acl)
    {
-      loop: for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
-      {
-         NodeData prevNode = iter.next();
-
-         // is ACL changes on this node (i.e. ACL inheritance brokes)
-         for (InternalQName mixin : prevNode.getMixinTypeNames())
-         {
-            if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
-            {
-               continue loop;
-            }
-         }
-
-         // recreate with new path for child Nodes only
-         TransientNodeData newNode =
-            new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
-               prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
-                  .getParentIdentifier(), acl);
-
-         // update this node
-         cache.put(new CacheId(newNode.getIdentifier()), newNode);
-
-         // update childs recursive
-         updateChildsACL(newNode.getIdentifier(), acl);
-      }
+      caller.updateChildsACL(parentId, acl);
    }
 
    public void beginTransaction()
@@ -1494,7 +1527,7 @@
             putProperty(prop, ModifyChildOption.NOT_MODIFY);
             set.add(prop.getIdentifier());
          }
-         cache.putIfAbsent(new CacheRefsId(identifier), set);
+         cache.putIfAbsent(new CacheRefsId(getOwnerId(), identifier), set);
       }
       finally
       {
@@ -1513,7 +1546,7 @@
    {
       return getReferencedProperties.run(identifier);
    }
-   
+
    /**
     * {@inheritDoc}
     */
@@ -1525,12 +1558,12 @@
     * {@inheritDoc}
     */
    @Managed
-   @ManagedDescription("Remove all the existing items from the cache")   
+   @ManagedDescription("Remove all the existing items from the cache")
    public void clean() throws BackupException
    {
       if (cache.getStatus() == ComponentStatus.RUNNING)
       {
-         cache.clear();
+         caller.clearCache();
       }
    }
 
@@ -1546,7 +1579,7 @@
           */
          public void clean() throws BackupException
          {
-            cache.clear();
+            caller.clearCache();
          }
 
          /**
@@ -1585,6 +1618,11 @@
     */
    public void addListener(WorkspaceStorageCacheListener listener)
    {
+      if (isDistributedMode())
+      {
+         throw new UnsupportedOperationException("The cache listeners are not supported by the "
+            + "ISPNCacheWorkspaceStorageCache in case of the distributed mode");
+      }
       listeners.add(listener);
    }
 
@@ -1593,9 +1631,14 @@
     */
    public void removeListener(WorkspaceStorageCacheListener listener)
    {
+      if (isDistributedMode())
+      {
+         throw new UnsupportedOperationException("The cache listeners are not supported by the "
+            + "ISPNCacheWorkspaceStorageCache in case of the distributed mode");
+      }
       listeners.remove(listener);
    }
-   
+
    /**
     * Called when a cache entry corresponding to the given node has item updated
     * @param data the item corresponding to the updated cache entry
@@ -1605,7 +1648,7 @@
       if (data == null || data instanceof NullItemData)
       {
          return;
-      }      
+      }
       for (WorkspaceStorageCacheListener listener : listeners)
       {
          try
@@ -1616,9 +1659,71 @@
          {
             LOG.warn("The method onCacheEntryUpdated fails for the listener " + listener.getClass(), e);
          }
-      }      
+      }
    }
-   
+
+   private static void updateTreePath(Cache<CacheKey, Object> cache, String ownerId, ItemData data, QPath prevRootPath,
+      QPath newRootPath, AccessControlList acl)
+   {
+      if (data == null)
+      {
+         return;
+      }
+
+      boolean inheritACL = acl != null;
+      // check is this descendant of prevRootPath
+      QPath nodeQPath = data.getQPath();
+      if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
+      {
+         //make relative path
+         QPathEntry[] relativePath = null;
+         try
+         {
+            relativePath = nodeQPath.getRelPath(nodeQPath.getDepth() - prevRootPath.getDepth());
+         }
+         catch (IllegalPathException e)
+         {
+            // Do nothing. Never happens.
+         }
+
+         // make new path - no matter  node or property
+         QPath newPath = QPath.makeChildPath(newRootPath, relativePath);
+
+         if (data.isNode())
+         {
+            // update node
+            NodeData prevNode = (NodeData)data;
+
+            TransientNodeData newNode =
+               new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+                  prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+                  prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL());
+
+            // update this node
+            cache.put(new CacheId(ownerId, newNode.getIdentifier()), newNode);
+         }
+         else
+         {
+            //update property
+            PropertyData prevProp = (PropertyData)data;
+
+            if (inheritACL
+               && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
+                  .equals(Constants.EXO_OWNER)))
+            {
+               inheritACL = false;
+            }
+
+            TransientPropertyData newProp =
+               new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
+                  prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+
+            // update this property
+            cache.put(new CacheId(ownerId, newProp.getIdentifier()), newProp);
+         }
+      }
+   }
+
    /**
     * Actions that are not supposed to be called within a transaction
     * 
@@ -1637,7 +1742,7 @@
          return ISPNCacheWorkspaceStorageCache.this.getTransactionManager();
       }
    }
-   
+
    @SuppressWarnings("rawtypes")
    @Listener
    public class CacheEventListener
@@ -1655,6 +1760,548 @@
    }
 
    /**
+    * This class defines all the methods that could change between the replicated and the distributed mode.
+    * By default it implements the methods for the local and replicated mode.
+    *
+    */
+   private class GlobalOperationCaller
+   {
+      protected int getCacheSize()
+      {
+         return cache.size();
+      }
+
+      protected void clearCache()
+      {
+         cache.clear();
+      }
+
+      /**
+       * Update child Nodes ACLs.
+       *
+       * @param parentId String - root node id of JCR subtree.
+       * @param acl AccessControlList
+       */
+      protected void updateChildsACL(String parentId, AccessControlList acl)
+      {
+         loop : for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
+         {
+            NodeData prevNode = iter.next();
+
+            // is ACL changes on this node (i.e. ACL inheritance brokes)
+            for (InternalQName mixin : prevNode.getMixinTypeNames())
+            {
+               if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
+               {
+                  continue loop;
+               }
+            }
+
+            // recreate with new path for child Nodes only
+            TransientNodeData newNode =
+               new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+                  prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+                  prevNode.getParentIdentifier(), acl);
+
+            // update this node
+            cache.put(new CacheId(getOwnerId(), newNode.getIdentifier()), newNode);
+
+            // update childs recursive
+            updateChildsACL(newNode.getIdentifier(), acl);
+         }
+      }
+
+      /**
+       * Check all items in cache - is it descendant of prevRootPath, and update path according newRootPath.
+       * 
+       * @param prevRootPath
+       * @param newRootPath
+       * @param acl
+       */
+      protected void updateTreePath(QPath prevRootPath, QPath newRootPath, AccessControlList acl)
+      {
+
+         // check all ITEMS in cache 
+         Iterator<CacheKey> keys = cache.keySet().iterator();
+
+         while (keys.hasNext())
+         {
+            CacheKey key = keys.next();
+            if (key instanceof CacheId)
+            {
+               ItemData data = (ItemData)cache.get(key);
+               ISPNCacheWorkspaceStorageCache.updateTreePath(cache, getOwnerId(), data, prevRootPath, newRootPath, acl);
+            }
+         }
+      }
+   }
+
+   /**
+    * This class implements all the global operations for the distributed mode
+    *
+    */
+   private class DistributedOperationCaller extends GlobalOperationCaller
+   {
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected int getCacheSize()
+      {
+         Map<String, Integer> map = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Map<String, Integer>>()
+         {
+            public Map<String, Integer> run()
+            {
+               MapReduceTask<CacheKey, Object, String, Integer> task =
+                  new MapReduceTask<CacheKey, Object, String, Integer>(cache);
+               task.mappedWith(new GetSizeMapper(getOwnerId())).reducedWith(new GetSizeReducer<String>());
+               return task.execute();
+            }
+
+         });
+         int sum = 0;
+         for (Integer i : map.values())
+         {
+            sum += i;
+         }
+         return sum;
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void clearCache()
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               MapReduceTask<CacheKey, Object, Void, Void> task =
+                  new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+               task.mappedWith(new ClearCacheMapper(getOwnerId())).reducedWith(new IdentityReducer());
+               task.execute();
+               return null;
+            }
+         });
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
+      {
+         final TransactionManager tm = getTransactionManager();
+         if (tm != null)
+         {
+            try
+            {
+               // Add the action out of the current transaction to avoid deadlocks
+               tm.getTransaction().registerSynchronization(new Synchronization()
+               {
+
+                  public void beforeCompletion()
+                  {
+                  }
+
+                  public void afterCompletion(int status)
+                  {
+                     if (status == Status.STATUS_COMMITTED)
+                     {
+                        try
+                        {
+                           // Since the tx is successfully committed we can call components non tx aware
+
+                           // The listeners will need to be executed outside the current tx so we suspend
+                           // the current tx we can face enlistment issues on product like ISPN
+                           tm.suspend();
+                           _updateTreePath(prevRootPath, newRootPath, acl);
+                        }
+                        catch (SystemException e)
+                        {
+                           LOG.warn("Cannot suspend the transaction", e);
+                        }
+                     }
+                  }
+               });
+               return;
+            }
+            catch (Exception e)
+            {
+               if (LOG.isDebugEnabled())
+               {
+                  LOG.debug("Cannot register the synchronization to the current transaction in order to update"
+                     + " the path out of the transaction", e);
+               }
+            }
+         }
+         _updateTreePath(prevRootPath, newRootPath, acl);
+      }
+
+      private void _updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               MapReduceTask<CacheKey, Object, Void, Void> task =
+                  new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+               task.mappedWith(new UpdateTreePathMapper(getOwnerId(), prevRootPath, newRootPath, acl)).reducedWith(
+                  new IdentityReducer());
+               task.execute();
+               return null;
+            }
+         });
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void updateChildsACL(String parentId, final AccessControlList acl)
+      {
+         ItemData parentItem = get(parentId);
+         if (!(parentItem instanceof NodeData))
+         {
+            return;
+         }
+         final QPath parentPath = ((NodeData)parentItem).getQPath();
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               MapReduceTask<CacheKey, Object, Void, Void> task =
+                  new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+               task.mappedWith(new UpdateChildsACLMapper(getOwnerId(), parentPath, acl)).reducedWith(
+                  new IdentityReducer());
+               task.execute();
+               return null;
+            }
+         });
+      }
+   }
+
+   public static class GetSizeMapper extends AbstractMapper<String, Integer>
+   {
+
+      public GetSizeMapper()
+      {
+      }
+
+      public GetSizeMapper(String ownerId)
+      {
+         super(ownerId);
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void _map(CacheKey key, Object value, Collector<String, Integer> collector)
+      {
+         collector.emit("total", Integer.valueOf(1));
+      }
+   }
+
+   public static class GetSizeReducer<K> implements Reducer<K, Integer>
+   {
+
+      /**
+       * The serial version UID
+       */
+      private static final long serialVersionUID = 7877781449514234007L;
+
+      /**
+       * @see org.infinispan.distexec.mapreduce.Reducer#reduce(java.lang.Object, java.util.Iterator)
+       */
+      public Integer reduce(K reducedKey, Iterator<Integer> iter)
+      {
+         int sum = 0;
+         while (iter.hasNext())
+         {
+            Integer i = iter.next();
+            sum += i;
+         }
+         return sum;
+      }
+   }
+
+   public static class ClearCacheMapper extends AbstractMapper<Void, Void>
+   {
+      public ClearCacheMapper()
+      {
+      }
+
+      public ClearCacheMapper(String ownerId)
+      {
+         super(ownerId);
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+      {
+         ExoContainer container = ExoContainerContext.getTopContainer();
+         if (container == null)
+         {
+            LOG.error("The top container could not be found");
+            return;
+         }
+         DistributedCacheManager dcm =
+            (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+         if (dcm == null)
+         {
+            LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+            return;
+         }
+         Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+         cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP, Flag.FAIL_SILENTLY).remove(key);
+      }
+   }
+
+   public static class IdentityReducer implements Reducer<Void, Void>
+   {
+
+      /**
+       * The serial version UID
+       */
+      private static final long serialVersionUID = -6193360351201912040L;
+
+      /**
+       * @see org.infinispan.distexec.mapreduce.Reducer#reduce(java.lang.Object, java.util.Iterator)
+       */
+      public Void reduce(Void reducedKey, Iterator<Void> iter)
+      {
+         return null;
+      }
+   }
+
+   public static class UpdateTreePathMapper extends AbstractMapper<Void, Void>
+   {
+      private QPath prevRootPath, newRootPath;
+
+      private AccessControlList acl;
+
+      public UpdateTreePathMapper()
+      {
+      }
+
+      public UpdateTreePathMapper(String ownerId, QPath prevRootPath, QPath newRootPath, AccessControlList acl)
+      {
+         super(ownerId);
+         this.prevRootPath = prevRootPath;
+         this.newRootPath = newRootPath;
+         this.acl = acl;
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected boolean isValid(CacheKey key)
+      {
+         return super.isValid(key) && key instanceof CacheId;
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      public void writeExternal(ObjectOutput out) throws IOException
+      {
+         super.writeExternal(out);
+         byte[] buf = prevRootPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+
+         buf = newRootPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+
+         out.writeBoolean(acl != null);
+         if (acl != null)
+         {
+            acl.writeExternal(out);
+         }
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+      {
+         super.readExternal(in);
+         byte[] buf;
+
+         try
+         {
+            buf = new byte[in.readInt()];
+            in.readFully(buf);
+            String sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+            prevRootPath = QPath.parse(sQPath);
+            buf = new byte[in.readInt()];
+            in.readFully(buf);
+            sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+            newRootPath = QPath.parse(sQPath);
+         }
+         catch (IllegalPathException e)
+         {
+            throw new IOException("Deserialization error. ", e);
+         }
+         if (in.readBoolean())
+         {
+            this.acl = new AccessControlList();
+            acl.readExternal(in);
+         }
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+      {
+         ExoContainer container = ExoContainerContext.getTopContainer();
+         if (container == null)
+         {
+            LOG.error("The top container could not be found");
+            return;
+         }
+         DistributedCacheManager dcm =
+            (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+         if (dcm == null)
+         {
+            LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+            return;
+         }
+         Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+         ISPNCacheWorkspaceStorageCache.updateTreePath(cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP),
+            ownerId, (ItemData)value, prevRootPath, newRootPath, acl);
+      }
+   }
+
+   public static class UpdateChildsACLMapper extends AbstractMapper<Void, Void>
+   {
+      private QPath parentPath;
+
+      private AccessControlList acl;
+
+      public UpdateChildsACLMapper()
+      {
+      }
+
+      public UpdateChildsACLMapper(String ownerId, QPath parentPath, AccessControlList acl)
+      {
+         super(ownerId);
+         this.parentPath = parentPath;
+         this.acl = acl;
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected boolean isValid(CacheKey key)
+      {
+         return super.isValid(key) && key instanceof CacheId;
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      public void writeExternal(ObjectOutput out) throws IOException
+      {
+         super.writeExternal(out);
+         byte[] buf = parentPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+
+         out.writeBoolean(acl != null);
+         if (acl != null)
+         {
+            acl.writeExternal(out);
+         }
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+      {
+         super.readExternal(in);
+         byte[] buf;
+
+         try
+         {
+            buf = new byte[in.readInt()];
+            in.readFully(buf);
+            String sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+            parentPath = QPath.parse(sQPath);
+         }
+         catch (IllegalPathException e)
+         {
+            throw new IOException("Deserialization error. ", e);
+         }
+         if (in.readBoolean())
+         {
+            this.acl = new AccessControlList();
+            acl.readExternal(in);
+         }
+      }
+
+      /**
+       * {@inheritDoc}
+       */
+      @Override
+      protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+      {
+         if (!(value instanceof NodeData))
+         {
+            return;
+         }
+         NodeData prevNode = (NodeData)value;
+         // check is this descendant of parentPath
+         QPath nodeQPath = prevNode.getQPath();
+         if (nodeQPath == null || !nodeQPath.isDescendantOf(parentPath))
+         {
+            return;
+         }
+
+         // is ACL changes on this node (i.e. ACL inheritance brokes)
+         for (InternalQName mixin : prevNode.getMixinTypeNames())
+         {
+            if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
+            {
+               return;
+            }
+         }
+         ExoContainer container = ExoContainerContext.getTopContainer();
+         if (container == null)
+         {
+            LOG.error("The top container could not be found");
+            return;
+         }
+         DistributedCacheManager dcm =
+            (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+         if (dcm == null)
+         {
+            LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+            return;
+         }
+         Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+         // we force the reloading
+         cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP, Flag.FAIL_SILENTLY).remove(key);
+      }
+   }
+
+   /**
     * {@inheritDoc}
     */
    public void start()

Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * This is the main class of all the mapper used in jcr
+ * 
+ * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public abstract class AbstractMapper<KOut, VOut> extends
+   org.exoplatform.services.ispn.AbstractMapper<CacheKey, Object, KOut, VOut> implements Externalizable
+{
+   /**
+    * This id will be the unique identifier of the workspace in case the
+    * distributed mode is enabled as the cache will be then shared so we
+    * need this id to prevent mixing data of different workspace. In case
+    * the workspace is not distributed the value of this variable will be
+    * null to avoid consuming more memory for nothing 
+    */
+   protected String ownerId;
+
+   public AbstractMapper()
+   {
+   }
+
+   public AbstractMapper(String ownerId)
+   {
+      this.ownerId = ownerId;
+   }
+
+   /**
+    * @see org.exoplatform.services.ispn.AbstractMapper#isValid(java.lang.Object)
+    */
+   @Override
+   protected boolean isValid(CacheKey key)
+   {
+      return ownerId.equals(key.getOwnerId());
+   }
+
+   /**
+    * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+    */
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      byte[] buf = ownerId.getBytes("UTF-8");
+      out.writeInt(buf.length);
+      out.write(buf);
+   }
+
+   /**
+    * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+    */
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      byte[] buf = new byte[in.readInt()];
+      in.readFully(buf);
+      ownerId = new String(buf, "UTF-8");
+   }
+}
\ No newline at end of file

Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import org.exoplatform.services.jcr.impl.Constants;
+import org.infinispan.distribution.group.Group;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * Created by The eXo Platform SAS. <br/>
+ * Base class for WorkspaceCache keys.<br/>
+ * 
+ * Date: 10.06.2008<br/>
+ * 
+ * @author <a href="mailto:anatoliy.bazko at exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: CacheKey.java 2845 2010-07-30 13:29:37Z tolusha $
+ */
+public abstract class CacheKey implements Externalizable, Comparable<CacheKey>
+{
+
+   /**
+    * This id will be the unique identifier of the workspace in case the
+    * distributed mode is enabled as the cache will be then shared so we
+    * need this id to prevent mixing data of different workspace. In case
+    * the workspace is not distributed the value of this variable will be
+    * null to avoid consuming more memory for nothing 
+    */
+   protected String ownerId;
+   
+   protected String id;
+
+   protected int hash;
+
+   /**
+    * The value used in case, the grouping is enabled
+    */
+   protected String group;
+   
+   /**
+    * The full name of the group
+    */
+   protected String fullGroupName;
+   
+   public CacheKey()
+   {
+   }
+
+   public CacheKey(String ownerId, String id)
+   {
+      this(ownerId, id, null);
+   }
+
+   public CacheKey(String ownerId, String id, String group)
+   {
+      this.ownerId = ownerId;
+      this.id = id;
+      this.hash = id.hashCode();
+      this.group = group;
+   }
+   
+   /**
+    * @return the ownerId
+    */
+   public String getOwnerId()
+   {
+      return ownerId;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public int hashCode()
+   {
+      return this.hash;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public String toString()
+   {
+      return getClass().getSimpleName() + "-" + (ownerId == null ? "" : (ownerId + "-")) + id + "-" + group;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public int compareTo(CacheKey o)
+   {
+      int result = getClass().getName().compareTo(o.getClass().getName());
+      if (result == 0 && ownerId != null)
+      {
+         // The key is of the same type and we assume that the distributed mode is enabled
+         result = ownerId.compareTo(o.ownerId);
+      }
+      return result == 0 ? id.compareTo(o.id) : result;
+   }
+   
+   /**
+    * This method is used for the grouping when its enabled. It will return
+    * the value of the group if it has been explicitly set otherwise it will
+    * return the value of the fullId 
+    * @return the group
+    */
+   @Group
+   public String getGroup()
+   {
+      if (fullGroupName != null)
+      {
+         return fullGroupName;
+      }
+      StringBuilder sb = new StringBuilder();
+      if (ownerId != null)
+      {
+         sb.append(ownerId).append('-');
+      }
+      return fullGroupName = sb.append(group == null ? id : group).toString();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      byte[] buf;
+      if (ownerId == null)
+      {
+         out.writeInt(-1);
+      }
+      else
+      {
+         buf = ownerId.getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+      }
+      if (group == null)
+      {
+         out.writeInt(-1);
+      }
+      else
+      {
+         buf = group.getBytes(Constants.DEFAULT_ENCODING);
+         out.writeInt(buf.length);
+         out.write(buf);
+      }
+
+      buf = id.getBytes(Constants.DEFAULT_ENCODING);
+      out.writeInt(buf.length);
+      out.write(buf);
+
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      byte[] buf;
+      int length = in.readInt();
+      if (length >= 0)
+      {
+         buf = new byte[length];
+         in.readFully(buf);
+         ownerId = new String(buf, Constants.DEFAULT_ENCODING);         
+      }
+      length = in.readInt();
+      if (length >= 0)
+      {
+         buf = new byte[length];
+         in.readFully(buf);
+         group = new String(buf, Constants.DEFAULT_ENCODING);         
+      }
+      buf = new byte[in.readInt()];
+      in.readFully(buf);
+      id = new String(buf, Constants.DEFAULT_ENCODING);
+      hash = id.hashCode();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null)
+         return false;
+      if (getClass() != obj.getClass())
+         return false;
+      CacheKey cacheKey = (CacheKey)obj;
+      if (cacheKey.hash == hash && cacheKey.id.equals(id))
+      {
+         return ownerId != null ? ownerId.equals(cacheKey.ownerId) : true;
+      }
+      return false;
+   }
+}
\ No newline at end of file

Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import org.exoplatform.container.StandaloneContainer;
+
+import java.net.URL;
+
+/**
+ * This class is used to be able to launch a cache instance as a JVM in standalone mode, it
+ * will then be able to join an existing cluster of distributed caches.
+ * It will be launched using the standalone container initialized thanks to the configuration
+ * file whose path is expected as the first argument, by default it will
+ * use <i>/conf/cache-server-configuration.xml</i> that is bundled into the current jar file.
+ * 
+ * The expected path is an absolute path or a relative path from the user directory
+ * or from the {@link ClassLoader}.
+ * 
+ * Please note that this cache server should be used only for a distributed cache.
+ * 
+ * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class CacheServer
+{
+
+   private static final String DEFAULT_CONFIG_FILE_PATH = "/conf/cache-server-configuration.xml";
+
+   /**
+    * @param args
+    */
+   public static void main(String[] args) throws Exception
+   {
+      String configPath;
+      if (args == null || args.length == 0)
+      {
+         configPath = DEFAULT_CONFIG_FILE_PATH;
+         System.out.println("The configuration file will be loaded from '" + DEFAULT_CONFIG_FILE_PATH + "'");//NOSONAR
+      }
+      else if (args.length == 1)
+      {
+         configPath = args[0];
+         System.out.println("The configuration file will be loaded from '" + args[0] + "'");//NOSONAR         
+      }
+      else
+      {
+         System.err.println("Too many arguments, the expected syntax is: java CacheServer <configuration-file-path>");//NOSONAR
+         return;
+      }
+
+      URL configUrl = CacheServer.class.getResource(configPath);
+      if (configUrl != null)
+      {
+         StandaloneContainer.addConfigurationURL(configUrl.toString());
+      }
+      else
+      {
+         StandaloneContainer.addConfigurationPath(configPath);
+      }
+      StandaloneContainer.getInstance();
+   }
+
+}

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -22,30 +22,38 @@
 import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.services.ispn.Utils;
 import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
 import org.exoplatform.services.jcr.config.TemplateConfigurationHelper;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.Parser;
+import org.infinispan.distribution.ch.ConsistentHash;
+import org.infinispan.distribution.ch.DefaultConsistentHash;
 import org.infinispan.jmx.MBeanServerLookup;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.transaction.lookup.TransactionManagerLookup;
+import org.infinispan.util.Util;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.net.URL;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
 import javax.management.MBeanServer;
+import javax.transaction.TransactionManager;
 
 /**
  * Factory that creates and starts pre-configured instances of Infinispan.
@@ -63,17 +71,18 @@
    public static final String INFINISPAN_CONFIG = "infinispan-configuration";
 
    private final ConfigurationManager configurationManager;
+   
+   private final TransactionManager transactionManager;
 
    private final TemplateConfigurationHelper configurationHelper;
 
-   private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.impl.infinispan.v5.InfinispanCacheFactory");
+   private static final Log LOG = ExoLogger
+      .getLogger("exo.jcr.component.core.impl.infinispan.v5.InfinispanCacheFactory");
 
    /**
-    * A Map that contains all the registered CacheManager order by {@link ExoContainer} 
-    * instances and {@link GlobalConfiguration}.
+    * A Map that contains all the registered CacheManager order by cluster name.    
     */
-   private static Map<GlobalConfiguration, EmbeddedCacheManager> CACHE_MANAGERS =
-      new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
+   private static Map<String, EmbeddedCacheManager> CACHE_MANAGERS = new HashMap<String, EmbeddedCacheManager>();
 
    private static final MBeanServerLookup MBEAN_SERVER_LOOKUP = new MBeanServerLookup()
    {
@@ -88,14 +97,26 @@
     * Transaction manager will later be injected to cache instance. 
     * 
     * @param configurationManager
+    * @param transactionManager
     */
-   public ISPNCacheFactory(ConfigurationManager configurationManager)
+   public ISPNCacheFactory(ConfigurationManager configurationManager, TransactionManager transactionManager)
    {
       this.configurationManager = configurationManager;
       this.configurationHelper = new ISPNCacheHelper(configurationManager);
+      this.transactionManager = transactionManager;
    }
 
    /**
+    * Creates InfinispanCacheFactory with provided configuration transaction managers.
+    * 
+    * @param configurationManager
+    */
+   public ISPNCacheFactory(ConfigurationManager configurationManager)
+   {
+      this(configurationManager, null);
+   }
+
+   /**
    * Factory that creates and starts pre-configured instances of Infinispan.
    * Path to Infinispan configuration or template should be provided as 
    * "infinispan-configuration" property in parameterEntry instance. 
@@ -132,20 +153,24 @@
       {
          // creating new CacheManager using SecurityHelper
 
-         manager = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>()
+         manager = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>()
          {
-            public EmbeddedCacheManager run() throws IOException
+            public EmbeddedCacheManager run() throws Exception
             {
-               DefaultCacheManager manager = new DefaultCacheManager(configStream, false);
-               loadJGroupsConfig(manager);
-               return getUniqueInstance(regionIdEscaped, manager);
+               Parser parser = new Parser(Thread.currentThread().getContextClassLoader());
+               // Loads the configuration from the input stream
+               ConfigurationBuilderHolder holder = parser.parse(configStream);
+               GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
+               Utils.loadJGroupsConfig(configurationManager, configBuilder.build(), configBuilder);
+               return getUniqueInstance(regionIdEscaped, holder, transactionManager);
             }
          });
 
       }
-      catch (IOException e)
+      catch (PrivilegedActionException pae)
       {
-         throw new RepositoryConfigurationException(e);
+         Throwable cause = pae.getCause();
+         throw new RepositoryConfigurationException(cause);
       }
 
       PrivilegedAction<Cache<K, V>> action = new PrivilegedAction<Cache<K, V>>()
@@ -161,98 +186,69 @@
    }
 
    /**
-    * This method is used to load the file corresponding to the path set on the property 
-    * <tt>configurationFile</tt> using the configuration manager, then set the XML content
-    *  as value of the property <tt>configurationXml</tt>.
-    * @param manager the manager from which we extract the transport properties in which
-    * we will find the path of the JGroups configuration
-    * @throws IOException if the configuration file cannot be read
-    */
-   private void loadJGroupsConfig(DefaultCacheManager manager) throws IOException
-   {
-      Properties p = manager.getGlobalConfiguration().getTransportProperties();
-      if (p != null && p.containsKey("configurationFile"))
-      {
-         URL jgroupsConfigURL = null;
-         InputStream jgroupsConfigInputStream = null;
-         try
-         {
-            // Trying to get the configuration from the configuration manager
-            String configurationFile = p.getProperty("configurationFile");
-            jgroupsConfigInputStream = configurationManager.getInputStream(configurationFile);
-            jgroupsConfigURL = configurationManager.getResource(configurationFile);
-         }
-         catch (Exception e)
-         {
-            if (LOG.isTraceEnabled())
-            {
-               LOG.trace("An exception occurred: " + e.getMessage());
-            }
-         }
-         if (jgroupsConfigInputStream != null)
-         {
-            try
-            {
-               LOG.info("Custom JGroups configuration set: " + jgroupsConfigURL);
-
-               // Read stream content into StringWriter
-               StringWriter sw = new StringWriter();
-               InputStreamReader in = new InputStreamReader(jgroupsConfigInputStream);
-
-               char[] buffer = new char[1024];
-               int n = 0;
-               while (-1 != (n = in.read(buffer)))
-               {
-                  sw.write(buffer, 0, n);
-               }
-
-               p.setProperty("configurationXml", sw.toString());
-               p.remove("configurationFile");
-            }
-            finally
-            {
-               jgroupsConfigInputStream.close();
-            }
-         }
-      }
-   }
-
-   /**
-    * Try to find if a {@link EmbeddedCacheManager} of the same type (i.e. their {@link GlobalConfiguration} are equals)
+    * Try to find if a {@link EmbeddedCacheManager} of the same type (i.e. the cluster names are equal)
     * has already been registered for the same current container.
     * If no cache manager has been registered, we register the given cache manager otherwise we
     * use the previously registered cache manager and we define a dedicated region for the related cache.
-    * @param regionId the unique id of the cache region to create
+    * @param holder the configuration holder of the the cache to create
+    * @param tm the transaction manager to put into the configuration of the cache
     * @param manager the current cache manager of the cache to create
     * @return the given cache manager if it has not been registered otherwise the cache manager of the same
     * type that has already been registered..
     */
-   private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId, EmbeddedCacheManager manager)
+   private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId,
+      ConfigurationBuilderHolder holder, final TransactionManager tm)
    {
-      GlobalConfiguration gc = manager.getGlobalConfiguration();
+      GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
+      GlobalConfiguration gc = configBuilder.build();
       ExoContainer container = ExoContainerContext.getCurrentContainer();
       // Ensure that the cluster name won't be used between 2 ExoContainers
-      gc.fluent().transport().clusterName(gc.getClusterName() + "_" + container.getContext().getName())
-         .globalJmxStatistics().cacheManagerName(gc.getCacheManagerName() + "_" + container.getContext().getName()).
+      configBuilder.transport().clusterName(gc.transport().clusterName() + "_" + container.getContext().getName())
+         .globalJmxStatistics()
+         .cacheManagerName(gc.globalJmxStatistics().cacheManagerName() + "_" + container.getContext().getName()).
          // Configure the MBeanServerLookup
          mBeanServerLookup(MBEAN_SERVER_LOOKUP);
-      Configuration conf = manager.getDefaultConfiguration();
-      if (CACHE_MANAGERS.containsKey(gc))
+      EmbeddedCacheManager manager;
+      gc = configBuilder.build();
+      String clusterName = gc.transport().clusterName();
+      if (CACHE_MANAGERS.containsKey(clusterName))
       {
-         manager = CACHE_MANAGERS.get(gc);
+         manager = CACHE_MANAGERS.get(clusterName);
       }
       else
       {
          // Reset the manager before storing it into the map since the default config is used as
          // template to define a new configuration
          manager = new DefaultCacheManager(gc);
-         CACHE_MANAGERS.put(gc, manager);
+         CACHE_MANAGERS.put(clusterName, manager);
          if (LOG.isInfoEnabled())
          {
             LOG.info("A new ISPN Cache Manager instance has been registered for the region " + regionId
                + " and the container " + container.getContext().getName());
          }
       }
+      ConfigurationBuilder confBuilder = holder.getDefaultConfigurationBuilder();
+      if (tm != null)
+      {
+         TransactionManagerLookup tml = new TransactionManagerLookup()
+         {
+            public TransactionManager getTransactionManager() throws Exception
+            {
+               return tm;
+            }
+         };
+         confBuilder.transaction().transactionManagerLookup(tml);
+      }
+      //TODO remove it once ISPN-1687 will be fixed
+      confBuilder.storeAsBinary().enabled(false);
+      //TODO remove it once ISPN-1689 will be fixed
+      confBuilder
+         .clustering()
+         .hash()
+         .consistentHash(
+            Util.<ConsistentHash> getInstance(DefaultConsistentHash.class.getName(), Thread.currentThread()
+               .getContextClassLoader()));
+      Configuration conf = holder.getDefaultConfigurationBuilder().build();
       // Define the configuration of the cache
       manager.defineConfiguration(regionId, conf);
       if (LOG.isInfoEnabled())

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -47,7 +47,7 @@
       </clustering>
 
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
-      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
       <jmxStatistics enabled="true"/>
       <eviction strategy="LRU" threadPolicy="DEFAULT" maxEntries="1000000"/>
       <expiration wakeUpInterval="5000"/>

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -47,7 +47,7 @@
       </clustering>
 
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
-      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
       <jmxStatistics enabled="true"/>
       <eviction strategy="NONE"/>
 

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -47,7 +47,7 @@
       </clustering>
 
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
-      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
       <jmxStatistics enabled="true"/>
       <eviction strategy="NONE"/>
 

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -23,8 +23,8 @@
 import org.exoplatform.services.jcr.config.SimpleParameterEntry;
 import org.exoplatform.services.jcr.config.WorkspaceEntry;
 import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
 import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.TesterISPNCacheWorkspaceStorageCache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
 import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
 
 import java.lang.reflect.Field;

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java	2012-03-20 14:01:39 UTC (rev 5923)
@@ -21,8 +21,10 @@
 import junit.framework.TestCase;
 
 import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 
@@ -62,13 +64,13 @@
    public void testGetCache() throws Exception
    {
       // Create cache manager
-      GlobalConfiguration myGlobalConfig = new GlobalConfiguration();
+      GlobalConfiguration myGlobalConfig = new GlobalConfigurationBuilder().build();
       EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);
 
       // Create a cache
-      Configuration config = new Configuration();
+      Configuration config = new ConfigurationBuilder().build();
       manager.defineConfiguration("cache", config);
-      Cache cache = manager.getCache("cache");
+      Cache<String, String> cache = manager.getCache("cache");
 
       cache.put("key", "value");
       assertTrue(cache.size() == 1);
@@ -98,11 +100,12 @@
     */
    public void testGetClusterCache() throws Exception
    {
+      GlobalConfiguration myGlobalConfig = new GlobalConfigurationBuilder().clusteredDefault().build();
       // Create cache manager
-      EmbeddedCacheManager manager = new DefaultCacheManager(GlobalConfiguration.getClusteredDefault());
+      EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);
 
       // Create a cache
-      Cache cache = manager.getCache();
+      Cache<String, String> cache = manager.getCache();
 
       cache.put("key", "value");
       assertTrue(cache.size() == 1);

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration-ijdbc-ispn.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration-ijdbc-ispn.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration-ijdbc-ispn.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -139,7 +139,7 @@
             <value>jar:/conf/test/nodetypes-publication-config.xml</value>
             <value>jar:/conf/test/publication-plugins-nodetypes-config.xml</value>          
           </values-param>
-
+
           <values-param>
             <name>testInitNodeTypesRepository</name>
             <description>
@@ -215,6 +215,16 @@
     </init-params>   
   </component>
   
+   <component>
+      <type>org.exoplatform.services.ispn.DistributedCacheManager</type>
+      <init-params>
+         <value-param>
+            <name>infinispan-configuration</name>
+            <value>jar:/conf/standalone/cluster/distributed-cache-configuration.xml</value>
+         </value-param>
+      </init-params>
+   </component>
+           
   <component>
     <key>org.exoplatform.services.rpc.RPCService</key>
     <type>org.exoplatform.services.rpc.jgv3.RPCServiceImpl</type>
@@ -298,7 +308,7 @@
           <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
           <property name="username" value="sa"/>
           <property name="password" value=""/>
-          <property name="maxActive" value="100" />
+          <property name="maxActive" value="100" />
         </properties-param>
       </init-params>
     </component-plugin>
@@ -461,7 +471,7 @@
           <property name="url" value="${testdbcleaner.url:jdbc:hsqldb:file:target/temp/data/testdbcleaner}"/>
           <property name="username" value="${testdbcleaner.username:sa}"/>
           <property name="password" value="${testdbcleaner.password:}"/>
-          <property name="maxActive" value="20" />
+          <property name="maxActive" value="20" />
         </properties-param>
       </init-params>
     </component-plugin>

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config-ijdbc-ispn.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config-ijdbc-ispn.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config-ijdbc-ispn.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -57,6 +57,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -115,6 +116,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -181,6 +183,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -271,6 +274,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -354,6 +358,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -418,6 +423,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -493,6 +499,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -567,6 +574,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -640,6 +648,7 @@
                      <property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
                      <property name="jgroups-configuration" value="udp-mux.xml" />
                      <property name="infinispan-cluster-name" value="JCR-cluster" />
+                     <property name="use-distributed-cache" value="${use-distributed-cache}" />
                   </properties>
                </cache>
                <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -36,7 +36,7 @@
 
     <default>
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
-      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
       <jmxStatistics enabled="true"/>
       <eviction strategy="LRU" threadPolicy="DEFAULT" maxEntries="1000000"/>
       <expiration wakeUpInterval="5000"/>

Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -36,7 +36,7 @@
 
     <default>
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
-      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+      <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
       <jmxStatistics enabled="true"/>
       <eviction strategy="NONE"/>
 

Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml	2012-03-20 13:45:55 UTC (rev 5922)
+++ jcr/trunk/pom.xml	2012-03-20 14:01:39 UTC (rev 5923)
@@ -85,8 +85,13 @@
         <groupId>org.exoplatform.kernel</groupId>
         <artifactId>exo.kernel.component.ext.rpc.impl.jgroups.v3</artifactId>
         <version>${org.exoplatform.kernel.version}</version>
-      </dependency>           
+      </dependency>
       <dependency>
+        <groupId>org.exoplatform.kernel</groupId>
+        <artifactId>exo.kernel.component.ext.cache.impl.infinispan.v5</artifactId>
+        <version>${org.exoplatform.kernel.version}</version>
+      </dependency>                 
+      <dependency>
         <groupId>org.exoplatform.core</groupId>
         <artifactId>exo.core.component.database</artifactId>
         <version>${org.exoplatform.core.version}</version>
@@ -397,12 +402,12 @@
       <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
-        <version>5.1.0.CR1</version>
+        <version>5.1.0.CR3</version>
       </dependency>
       <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jdbc</artifactId>
-        <version>5.1.0.CR1</version>
+        <version>5.1.0.CR3</version>
       </dependency>
       <dependency>
         <groupId>commons-io</groupId>



More information about the exo-jcr-commits mailing list