[exo-jcr-commits] exo-jcr SVN: r2232 - in jcr/trunk/exo.jcr.component.core/src: main/resources/conf/portal and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Apr 8 11:25:15 EDT 2010


Author: nzamosenchuk
Date: 2010-04-08 11:25:14 -0400 (Thu, 08 Apr 2010)
New Revision: 2232

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
   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/resources/conf/portal/jbosscache-data.xml
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
Log:
EXOJCR-545: Reverting all changes made from 2219 to 2231 back. So actually repository's rev. is 2218.

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java	2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,14 +18,6 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
 
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.TransactionManager;
-
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.jboss.cache.Cache;
@@ -38,10 +30,17 @@
 import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.Region;
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
 import org.jgroups.Address;
 
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.TransactionManager;
+
 /**
  * Decorator over the JBossCache that stores changes in buffer, then sorts and applies to JBossCache.
  * 
@@ -52,6 +51,8 @@
 @SuppressWarnings("unchecked")
 public class BufferedJBossCache implements Cache<Serializable, Object>
 {
+   //   private final Log log = ExoLogger.getLogger("exo.jcr.component.core.BufferedJbossCache");
+
    /**
     * Parent cache.
     */
@@ -60,20 +61,14 @@
    private final ThreadLocal<CompressedChangesBuffer> changesList = new ThreadLocal<CompressedChangesBuffer>();
 
    private ThreadLocal<Boolean> local = new ThreadLocal<Boolean>();
-   
-   private final boolean useExpiration;
-   
-   private final long expirationTimeOut;
 
    protected static final Log LOG =
       ExoLogger.getLogger("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache");
 
-   public BufferedJBossCache(Cache<Serializable, Object> parentCache, boolean useExpiration, long expirationTimeOut)
+   public BufferedJBossCache(Cache<Serializable, Object> parentCache)
    {
       super();
       this.parentCache = parentCache;
-      this.useExpiration = useExpiration;
-      this.expirationTimeOut = expirationTimeOut;
    }
 
    /**
@@ -456,7 +451,7 @@
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
       changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.getHistoryIndex(), local
-         .get(), useExpiration, expirationTimeOut));
+         .get()));
    }
 
    /* (non-Javadoc)
@@ -466,7 +461,7 @@
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
       changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
-         local.get(), useExpiration, expirationTimeOut));
+         local.get()));
 
       return parentCache.get(fqn, key);
    }
@@ -479,7 +474,7 @@
       Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
 
       changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
-         local.get(), useExpiration, expirationTimeOut));
+         local.get()));
 
       if (prevObject != null)
       {
@@ -542,7 +537,7 @@
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
       changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.getHistoryIndex(), local
-         .get(), useExpiration, expirationTimeOut));
+         .get()));
       return parentCache.get(fqn, key);
    }
 
@@ -584,8 +579,7 @@
    public boolean removeNode(Fqn fqn)
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
-      changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(), 
-               useExpiration, expirationTimeOut));
+      changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get()));
       return true;
    }
 
@@ -654,7 +648,7 @@
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
       changesContainer.add(new AddToListContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
-         local.get(), useExpiration, expirationTimeOut));
+         local.get()));
    }
 
    /**
@@ -668,7 +662,7 @@
    {
       CompressedChangesBuffer changesContainer = getChangesBufferSafe();
       changesContainer.add(new RemoveFromListContainer(fqn, key, value, parentCache,
-         changesContainer.getHistoryIndex(), local.get(), useExpiration, expirationTimeOut));
+         changesContainer.getHistoryIndex(), local.get()));
    }
 
    public static enum ChangesType {
@@ -690,12 +684,8 @@
 
       protected final boolean localMode;
 
-      protected final boolean useExpiration;
-      
-      protected final long timeOut;
-      
       public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
-         boolean localMode, boolean useExpiration, long timeOut)
+         boolean localMode)
       {
          super();
          this.fqn = fqn;
@@ -703,8 +693,6 @@
          this.cache = cache;
          this.historicalIndex = historicalIndex;
          this.localMode = localMode;
-         this.useExpiration = useExpiration;
-         this.timeOut = timeOut;
       }
 
       /**
@@ -750,12 +738,6 @@
       {
          cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
       }
-      
-      public final void putExpiration(Fqn efqn)
-      {
-         setCacheLocalMode();
-         cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
-      }
 
       public abstract void apply();
    }
@@ -768,9 +750,9 @@
       private final Map<? extends Serializable, ? extends Object> data;
 
       public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
-         Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+         Cache<Serializable, Object> cache, int historicalIndex, boolean local)
       {
-         super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.PUT, cache, historicalIndex, local);
 
          this.data = data;
       }
@@ -780,11 +762,6 @@
       {
          setCacheLocalMode();
          cache.put(fqn, data);
-         
-         if (useExpiration)
-         {
-            putExpiration(fqn);
-         }
       }
    }
 
@@ -798,9 +775,9 @@
       private final Object value;
 
       public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+         int historicalIndex, boolean local)
       {
-         super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
          this.key = key;
          this.value = value;
       }
@@ -808,11 +785,6 @@
       @Override
       public void apply()
       {
-         if (useExpiration)
-         {
-            putExpiration(fqn);
-         }
-         
          setCacheLocalMode();
          cache.put(fqn, key, value);
       }
@@ -829,9 +801,9 @@
       private final Object value;
 
       public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+         int historicalIndex, boolean local)
       {
-         super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
          this.key = key;
          this.value = value;
       }
@@ -853,12 +825,6 @@
                newSet.addAll((Set<Object>)existingObject);
             }
             newSet.add(value);
-            
-            if (useExpiration)
-            {
-               putExpiration(fqn);
-            }
-            
             setCacheLocalMode();
             cache.put(fqn, key, newSet);
          }
@@ -880,9 +846,9 @@
       private final Object value;
 
       public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+         int historicalIndex, boolean local)
       {
-         super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
          this.key = key;
          this.value = value;
       }
@@ -900,12 +866,6 @@
          {
             Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
             newSet.remove(value);
-            
-            if (useExpiration)
-            {
-               putExpiration(fqn);
-            }
-            
             setCacheLocalMode();
             cache.put(fqn, key, newSet);
          }
@@ -920,9 +880,9 @@
       private final Serializable key;
 
       public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
-         boolean local, boolean useExpiration, long timeOut)
+         boolean local)
       {
-         super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
          this.key = key;
       }
 
@@ -941,10 +901,9 @@
    public static class RemoveNodeContainer extends ChangesContainer
    {
 
-      public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local, 
-               boolean useExpiration, long timeOut)
+      public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
       {
-         super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
+         super(fqn, ChangesType.REMOVE, cache, historicalIndex, local);
       }
 
       @Override

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java	2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,16 +18,16 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
 
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
+import org.jboss.cache.Fqn;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
-import org.jboss.cache.Fqn;
-
 /**
  * Sorting cache modification "as is" in {@link BufferedJBossCache} may harm data consistency. 
  * Here is a link, showing possible trouble:

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-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java	2010-04-08 15:25:14 UTC (rev 2232)
@@ -38,11 +38,8 @@
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.exoplatform.services.transaction.TransactionService;
-import org.jboss.cache.Cache;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -68,24 +65,24 @@
  *      <ul>
  *      <li>/$ITEMS - stores items by Id (i.e. /$ITEMS/itemId)</li>
  *      <li>/$CHILD_NODES, /$CHILD_PROPS - stores items by parentId and name (i.e. /$CHILD_NODES/parentId/childName.$ITEM_ID)</li>
- *      <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id
+ *      <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id 
  *      (i.e. /$CHILD_NODES_LIST/parentId.lists = serialized Set<Object>)</li>
  *      </ul>
- * </li>
+ * </li>     
  * <li>all child properties/nodes lists should be evicted from parent at same time
  *      i.e. for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST we need customized eviction policy (EvictionActionPolicy) to evict
  *      whole list on one of childs eviction
- * </li>
+ * </li>          
  * </ul>
  * 
- * <p/>
- * Current state notes (subject of change):
+ * <p/> 
+ * Current state notes (subject of change): 
  * <ul>
  * <li>cache implements WorkspaceStorageCache, without any stuff about references and locks</li>
  * <li>transaction style implemented via JBC barches, do with JTA (i.e. via exo's TransactionService + JBoss TM)</li>
  * <li>we need customized eviction policy (EvictionActionPolicy) for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST</li>
  * </ul>
- * 
+ *  
  * @author <a href="mailto:peter.nedonosko at exoplatform.com">Peter Nedonosko</a>
  * @version $Id: JBossCacheWorkspaceStorageCache.java 13869 2008-05-05 08:40:10Z pnedonosko $
  */
@@ -96,10 +93,6 @@
 
    public static final String JBOSSCACHE_CONFIG = "jbosscache-configuration";
 
-   public static final String JBOSSCACHE_EXPIRATION = "jbosscache-expiration-time";
-
-   public static final int JBOSSCACHE_EXPIRATION_DEFAULT = 900000; // 15 minutes
-
    public static final String ITEMS = "$ITEMS".intern();
 
    public static final String CHILD_NODES = "$CHILD_NODES".intern();
@@ -260,7 +253,7 @@
     */
    public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
       ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
-      {
+   {
       if (wsConfig.getCache() == null)
       {
          throw new RepositoryConfigurationException("Cache configuration not found");
@@ -278,37 +271,8 @@
          factory = new ExoJBossCacheFactory<Serializable, Object>(cfm);
       }
 
-      // create parent JBossCache instance
-      Cache<Serializable, Object> parentCache = factory.createCache(wsConfig.getCache());
-      // get all eviction configurations
-      List<EvictionRegionConfig> evictionConfigurations =
-         parentCache.getConfiguration().getEvictionConfig().getEvictionRegionConfigs();
-      // append and default eviction configuration, since it is not present in region configurations
-      evictionConfigurations.add(parentCache.getConfiguration().getEvictionConfig().getDefaultEvictionRegionConfig());
+      this.cache = new BufferedJBossCache(factory.createCache(wsConfig.getCache()));
 
-      boolean useExpiration = false;
-      // looking over all eviction configurations till the end or till some expiration algorithm subclass not found.
-      for (EvictionRegionConfig evictionRegionConfig : evictionConfigurations)
-      {
-         if (evictionRegionConfig.getEvictionAlgorithmConfig() instanceof ExpirationAlgorithmConfig)
-         {
-            // force set expiration key to default value in all Expiration configurations (if any)
-            ((ExpirationAlgorithmConfig)evictionRegionConfig.getEvictionAlgorithmConfig())
-            .setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
-            useExpiration = true;
-         }
-      }
-
-      if (useExpiration)
-      {
-         LOG.info("Using BufferedJBossCache compatible with Expiration algorithm.");
-      }
-
-      // if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
-      this.cache =
-         new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration,
-                  wsConfig.getCache().getParameterInteger(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
-
       this.itemsRoot = Fqn.fromElements(ITEMS);
       this.childNodes = Fqn.fromElements(CHILD_NODES);
       this.childProps = Fqn.fromElements(CHILD_PROPS);
@@ -323,17 +287,17 @@
       createResidentNode(childProps);
       createResidentNode(childPropsList);
       createResidentNode(itemsRoot);
-      }
+   }
 
    /**
     * Cache constructor with JBossCache JTA transaction support.
     * 
-    * @param wsConfig WorkspaceEntry workspace config
+    * @param wsConfig WorkspaceEntry workspace config 
     * @throws RepositoryException if error of initialization
     * @throws RepositoryConfigurationException if error of configuration
     */
    public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm)
-   throws RepositoryException, RepositoryConfigurationException
+      throws RepositoryException, RepositoryConfigurationException
    {
       this(wsConfig, null, cfm);
    }
@@ -372,7 +336,7 @@
    /**
     * Return TransactionManager used by JBossCache backing the JCR cache.
     * 
-    * @return TransactionManager
+    * @return TransactionManager 
     */
    public TransactionManager getTransactionManager()
    {
@@ -442,8 +406,8 @@
             {
                if (state.isPersisted())
                {
-                  // There was a problem with removing a list of samename siblings in on transaction,
-                  // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.
+                  // There was a problem with removing a list of samename siblings in on transaction, 
+                  // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.  
                   ItemData prevItem = putItemInBufferedCache(state.getData());
                   if (prevItem != null && state.isNode())
                   {
@@ -482,8 +446,8 @@
    }
 
    /**
-    * {@inheritDoc}
-    */
+   * {@inheritDoc}
+   */
    public void addChildNodes(NodeData parent, List<NodeData> childs)
    {
       boolean inTransaction = cache.isTransactionActive();
@@ -577,7 +541,7 @@
       //      {
       //         cache.beginTransaction();
       //         cache.setLocal(true);
-      //
+      //         
       //      }
       //      finally
       //      {
@@ -668,7 +632,7 @@
    /**
     * Internal get child properties.
     *
-    * @param parentId String
+    * @param parentId String 
     * @param withValue boolean, if true only "full" Propeties can be returned
     * @return List of PropertyData
     */
@@ -813,7 +777,7 @@
       {
          // add in CHILD_NODES
          cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
-                                                                                                     .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+            .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
          // if MODIFY and List present OR FORCE_MODIFY, then write
          if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
             .getParentIdentifier())) != null)
@@ -834,7 +798,7 @@
       {
          // add in CHILD_NODES
          cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
-                                                                                                     .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+            .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
          // if MODIFY and List present OR FORCE_MODIFY, then write
          if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
             .getParentIdentifier())) != null)
@@ -858,7 +822,7 @@
    {
       // add in CHILD_PROPS
       cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
-                                                                                                  .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
+         .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
       // if MODIFY and List present OR FORCE_MODIFY, then write
       if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childPropsList, prop
          .getParentIdentifier())) != null)
@@ -880,7 +844,7 @@
 
             // remove from CHILD_NODES of parent
             cache.removeNode(makeChildFqn(childNodes, item.getParentIdentifier(), item.getQPath().getEntries()[item
-                                                                                                               .getQPath().getEntries().length - 1]));
+               .getQPath().getEntries().length - 1]));
 
             // remove from CHILD_NODES_LIST of parent
             cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST, item
@@ -903,7 +867,7 @@
       {
          // remove from CHILD_PROPS
          cache.removeNode(makeChildFqn(childProps, item.getParentIdentifier(), item.getQPath().getEntries()[item
-                                                                                                            .getQPath().getEntries().length - 1]));
+            .getQPath().getEntries().length - 1]));
 
          // remove from CHILD_PROPS_LIST
          cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST, item
@@ -936,7 +900,7 @@
    }
 
    /**
-    * Update Node hierachy in case of same-name siblings reorder.
+    * Update Node hierachy in case of same-name siblings reorder. 
     * Assumes the new (updated) nodes already putted in the cache. Previous name of updated nodes will be calculated
     * and that node will be deleted (if has same id as the new node). Childs paths will be updated to a new node path.
     *
@@ -948,7 +912,7 @@
       // get previously cached NodeData and using its name remove child on the parent
       Fqn<String> prevFqn =
          makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
-                                                                                               .getEntries().length - 1]);
+            .getEntries().length - 1]);
       if (node.getIdentifier().equals(cache.get(prevFqn, ITEM_ID)))
       {
          // it's same-name siblings re-ordering, delete previous child
@@ -978,7 +942,7 @@
       // get previously cached NodeData and using its name remove child on the parent
       Fqn<String> prevFqn =
          makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
-                                                                                               .getEntries().length - 1]);
+            .getEntries().length - 1]);
       if (node.getIdentifier().equals(cache.getFromBuffer(prevFqn, ITEM_ID)))
       {
          // it's same-name siblings re-ordering, delete previous child
@@ -1014,15 +978,15 @@
          PropertyData prevProp = iter.next();
 
          if (inheritACL
-                  && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
-                           .equals(Constants.EXO_OWNER)))
+            && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
+               .equals(Constants.EXO_OWNER)))
          {
             inheritACL = false;
          }
          // recreate with new path for child Props only
          QPath newPath =
             QPath
-            .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
+               .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
          TransientPropertyData newProp =
             new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
                .getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
@@ -1036,7 +1000,7 @@
          // recreate with new path for child Nodes only
          QPath newPath =
             QPath
-            .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
+               .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
          TransientNodeData newNode =
             new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
                .getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
@@ -1071,7 +1035,7 @@
          TransientNodeData newNode =
             new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
                prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
-               .getParentIdentifier(), acl);
+                  .getParentIdentifier(), acl);
          // update this node
          cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
          // update childs recursive

Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml	2010-04-08 15:25:14 UTC (rev 2232)
@@ -12,11 +12,11 @@
 
    <!-- Eviction configuration -->
    <eviction wakeUpInterval="5000">
-      <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+      <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
          actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
          eventQueueSize="1000000">
          <property name="maxNodes" value="1000000" />
-         <property name="warnNoExpirationKey" value="false" />
+         <property name="timeToLive" value="120000" />
       </default>
    </eviction>
 </jbosscache>
\ No newline at end of file

Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java	2010-04-08 15:25:14 UTC (rev 2232)
@@ -19,7 +19,6 @@
 package org.exoplatform.services.jcr.api.writing;
 
 import org.exoplatform.services.jcr.JcrAPIBaseTest;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
 import org.exoplatform.services.jcr.impl.util.EntityCollection;
 
 import java.util.ArrayList;
@@ -976,14 +975,10 @@
 
       session = repository.login(credentials, "ws");
       Node a = session.getRootNode().getNode("a"); // We suppose it already exist
-      NodeImpl n1 = (NodeImpl)a.addNode("n");
-      NodeImpl n2 = (NodeImpl)a.addNode("n");
-      NodeImpl n3 = (NodeImpl)a.addNode("n");
-      NodeImpl n4 = (NodeImpl)a.addNode("n");
-      NodeImpl n5 = (NodeImpl)a.addNode("n");
-      NodeImpl n6 = (NodeImpl)a.addNode("n");
-      NodeImpl n7 = (NodeImpl)a.addNode("n");
-
+      a.addNode("n");
+      a.addNode("n");
+      a.addNode("n");
+      a.addNode("n");
       session.save();
       session.logout();
 
@@ -993,30 +988,14 @@
       i.nextNode().remove();
       i.nextNode().remove();
       i.nextNode().remove();
-      i.nextNode().remove();
-      i.nextNode().remove();
-      i.nextNode().remove();
       session.save();
       session.logout();
 
       session = repository.login(credentials, "ws");
-
-      NodeImpl n = (NodeImpl)a.getNode("n");
-      assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
-      n = (NodeImpl)a.getNode("n[1]");
-      assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
       a = session.getRootNode().getNode("a");
-      NodeImpl nOrd = (NodeImpl)a.addNode("n");
+      a.addNode("n");
       a.orderBefore("n", null); // NPE happens here
       session.save();
-
-      n = (NodeImpl)a.getNode("n[1]");
-      assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
-      n = (NodeImpl)a.getNode("n[2]");
-      assertEquals(nOrd.getData().getIdentifier(), n.getData().getIdentifier());
    }
 
    public void testDeleteOrderBefore_SNS() throws Exception

Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java	2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,8 +18,6 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
 
-import java.util.HashMap;
-
 import junit.framework.TestCase;
 
 import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
@@ -27,6 +25,8 @@
 import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
 import org.jboss.cache.Fqn;
 
+import java.util.HashMap;
+
 /**
  * @author <a href="mailto:foo at bar.org">Foo Bar</a>
  * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
@@ -40,13 +40,13 @@
       CompressedChangesBuffer buffer = new CompressedChangesBuffer();
       ChangesContainer put1 =
          new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
-            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
       ChangesContainer put2 =
          new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
-            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
       ChangesContainer rm1 =
          new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
-            .getHistoryIndex(), false, false, 0);
+            .getHistoryIndex(), false);
       buffer.add(put1);
       buffer.add(put2);
       assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -67,17 +67,17 @@
       CompressedChangesBuffer buffer = new CompressedChangesBuffer();
       ChangesContainer put1 =
          new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
-            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
 
       ChangesContainer put2 =
          new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
-            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
       ChangesContainer rm1 =
          new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
-            buffer.getHistoryIndex(), false, false, 0);
+            buffer.getHistoryIndex(), false);
       ChangesContainer rm2 =
          new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
-            .getHistoryIndex(), false, false, 0);
+            .getHistoryIndex(), false);
       buffer.add(put1);
       buffer.add(put2);
       assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -97,11 +97,11 @@
       CompressedChangesBuffer buffer = new CompressedChangesBuffer();
       ChangesContainer put1 =
          new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
-            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+            new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
 
       ChangesContainer rm1 =
          new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
-            buffer.getHistoryIndex(), false, false, 0);
+            buffer.getHistoryIndex(), false);
       buffer.add(put1);
       assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
       buffer.add(rm1);

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml	2010-04-08 15:25:14 UTC (rev 2232)
@@ -12,11 +12,11 @@
 
    <!-- Eviction configuration -->
    <eviction wakeUpInterval="5000">
-      <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+      <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
          actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
          eventQueueSize="1000000">
          <property name="maxNodes" value="1000000" />
-         <property name="warnNoExpirationKey" value="false" />
+         <property name="timeToLive" value="120000" />
       </default>
    </eviction>
 </jbosscache>
\ No newline at end of file

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml	2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml	2010-04-08 15:25:14 UTC (rev 2232)
@@ -11,11 +11,9 @@
 
    <!-- Eviction configuration -->
    <eviction wakeUpInterval="5000">
-      <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm" 
-      actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy" 
-      eventQueueSize="1000000">
-         <property name="maxNodes" value="50000" />
-	 <property name="warnNoExpirationKey" value="false" />
+      <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy" eventQueueSize="1000000">
+         <property name="maxNodes" value="5000" />
+         <property name="minTimeToLive" value="60000" />
       </default>
    </eviction>
 



More information about the exo-jcr-commits mailing list