[exo-jcr-commits] exo-jcr SVN: r1180 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Dec 25 06:00:45 EST 2009


Author: nzamosenchuk
Date: 2009-12-25 06:00:45 -0500 (Fri, 25 Dec 2009)
New Revision: 1180

Modified:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
Log:
EXOJCR-334: IndexerCacheLoader updated to handle transactions.

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java	2009-12-25 10:59:36 UTC (rev 1179)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java	2009-12-25 11:00:45 UTC (rev 1180)
@@ -26,6 +26,7 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Modification;
+import org.jboss.cache.Modification.ModificationType;
 
 import java.io.IOException;
 import java.util.List;
@@ -186,37 +187,16 @@
    @Override
    public void put(List<Modification> modifications) throws Exception
    {
-      // If transactions are used, then list of modifications will be sent to cache loader
-      // added code to handle list of modifications.
+   }
+
+   @Override
+   public void prepare(Object tx, List<Modification> modifications, boolean onePhase) throws Exception
+   {
       for (Modification m : modifications)
       {
-         switch (m.getType())
+         if (m.getType() == ModificationType.PUT_KEY_VALUE)
          {
-            case PUT_DATA :
-               put(m.getFqn(), m.getData());
-               break;
-            case PUT_DATA_ERASE :
-               removeData(m.getFqn());
-               put(m.getFqn(), m.getData());
-               break;
-            case PUT_KEY_VALUE :
-               put(m.getFqn(), m.getKey(), m.getValue());
-               break;
-            case REMOVE_DATA :
-               removeData(m.getFqn());
-               break;
-            case REMOVE_KEY_VALUE :
-               remove(m.getFqn(), m.getKey());
-               break;
-            case REMOVE_NODE :
-               remove(m.getFqn());
-               break;
-            case MOVE :
-               // involve moving all children too
-               move(m.getFqn(), m.getFqn2());
-               break;
-            default :
-               throw new CacheException("Unknown modification " + m.getType());
+            put(m.getFqn(), m.getKey(), m.getValue());
          }
       }
    }



More information about the exo-jcr-commits mailing list