[exo-jcr-commits] exo-jcr SVN: r3378 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent: jbosscache and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 2 07:13:28 EDT 2010


Author: tolusha
Date: 2010-11-02 07:13:27 -0400 (Tue, 02 Nov 2010)
New Revision: 3378

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/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-1029: Storing result of the method getReferencesData into the cache

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	2010-11-02 09:39:26 UTC (rev 3377)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2010-11-02 11:13:27 UTC (rev 3378)
@@ -35,6 +35,7 @@
 import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
 import org.exoplatform.services.transaction.TransactionService;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
@@ -469,7 +470,6 @@
       }
    }
 
-
    /**
     * {@inheritDoc}
     */
@@ -530,14 +530,19 @@
 
       if (skipVersionStorage)
       {
+         List<PropertyData> result = new ArrayList<PropertyData>();
+
          Iterator<PropertyData> iterator = props.iterator();
          while (iterator.hasNext())
          {
-            if (iterator.next().getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
+            PropertyData prop = iterator.next();
+            if (!prop.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
             {
-               iterator.remove();
+               result.add(prop);
             }
          }
+
+         return result;
       }
 
       return props;
@@ -672,11 +677,10 @@
     * @throws RepositoryException
     *           Repository error
     */
-   protected List<PropertyData> getReferencedPropertiesData(String identifier)
-      throws RepositoryException
+   protected List<PropertyData> getReferencedPropertiesData(String identifier) throws RepositoryException
    {
       List<PropertyData> refProps = null;
-      if (!cache.isEnabled())
+      if (cache.isEnabled())
       {
          refProps = cache.getReferencedProperties(identifier);
          if (refProps != null)

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java	2010-11-02 09:39:26 UTC (rev 3377)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java	2010-11-02 11:13:27 UTC (rev 3378)
@@ -761,7 +761,7 @@
             {
                try
                {
-                  if (new String(vdata.getAsByteArray()).equals(identifier))
+                  if (new String(vdata.getAsByteArray(), Constants.DEFAULT_ENCODING).equals(identifier))
                   {
                      props.add(prop);
                   }
@@ -1133,7 +1133,7 @@
             String nodeIdentifier = null;
             try
             {
-               nodeIdentifier = new String(vdata.getAsByteArray());
+               nodeIdentifier = new String(vdata.getAsByteArray(), Constants.DEFAULT_ENCODING);
             }
             catch (IllegalStateException e)
             {
@@ -1149,7 +1149,7 @@
             if (set != null)
             {
                set.add(prop.getIdentifier());
-               cache.put(refFqn, ITEM_LIST, set);
+               cache.addToList(refFqn, ITEM_LIST, prop.getIdentifier());
             }
          }
       }
@@ -1210,8 +1210,7 @@
                Set<String> set = (Set<String>)cache.get(refFqn, ITEM_LIST);
                if (set != null && set.contains(prop.getIdentifier()))
                {
-                  set.remove(prop.getIdentifier());
-                  cache.put(refFqn, ITEM_LIST, set);
+                  cache.removeFromList(refFqn, ITEM_LIST, prop.getIdentifier());
                }
             }
          }



More information about the exo-jcr-commits mailing list