[exo-jcr-commits] exo-jcr SVN: r548 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/storage/inmemory and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 10 09:53:54 EST 2009


Author: tolusha
Date: 2009-11-10 09:53:54 -0500 (Tue, 10 Nov 2009)
New Revision: 548

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
   jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
   jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
   jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
Log:
EXOJCR-201: implementation sessionId support

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -18,10 +18,14 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent;
 
+import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
+import org.exoplatform.services.jcr.dataflow.CompositeChangesLog;
 import org.exoplatform.services.jcr.dataflow.ItemState;
 import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
 import org.exoplatform.services.jcr.dataflow.PersistentDataManager;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
 import org.exoplatform.services.jcr.dataflow.ReadOnlyThroughChanges;
+import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
 import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
 import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
 import org.exoplatform.services.jcr.dataflow.persistent.MandatoryItemsPersistenceListener;
@@ -128,85 +132,103 @@
       WorkspaceStorageConnection thisConnection = null;
       WorkspaceStorageConnection systemConnection = null;
 
+      // prepare changes log list
+      List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
+      if (changesLog instanceof PlainChangesLog)
+      {
+         chengesLogList.add((PlainChangesLog)changesLog);
+      }
+      else if (changesLog instanceof CompositeChangesLog)
+      {
+         for (ChangesLogIterator iter = ((CompositeChangesLog)changesLog).getLogIterator(); iter.hasNextLog();)
+         {
+            chengesLogList.add(iter.nextLog());
+         }
+      }
+
       try
       {
-         for (Iterator<ItemState> iter = changesLog.getAllStates().iterator(); iter.hasNext();)
+         for (PlainChangesLog currChangesLog : chengesLogList)
          {
-            ItemState itemState = iter.next();
+            for (Iterator<ItemState> iter = currChangesLog.getAllStates().iterator(); iter.hasNext();)
+            {
+               ItemState itemState = iter.next();
 
-            if (!itemState.isPersisted())
-               continue;
+               if (!itemState.isPersisted())
+                  continue;
 
-            long start = System.currentTimeMillis();
+               long start = System.currentTimeMillis();
 
-            TransientItemData data = (TransientItemData)itemState.getData();
+               TransientItemData data = (TransientItemData)itemState.getData();
 
-            WorkspaceStorageConnection conn = null;
-            if (isSystemDescendant(data.getQPath()))
-            {
-               conn = systemConnection == null
-               // we need system connection but it's not exist
-                  ? systemConnection = (systemDataContainer != dataContainer
-                  // if it's different container instances
-                     ? systemDataContainer.equals(dataContainer) && thisConnection != null
-                     // but container confugrations are same and non-system connnection open
-                        // reuse this connection as system
-                        ? systemDataContainer.reuseConnection(thisConnection)
-                        // or open one new system
-                        : systemDataContainer.openConnection()
-                     // else if it's same container instances (system and this)
-                     : thisConnection == null
-                     // and non-system connection doens't exist - open it
-                        ? thisConnection = dataContainer.openConnection()
-                        // if already open - use it
-                        : thisConnection)
-                  // system connection opened - use it
-                  : systemConnection;
-            }
-            else
-            {
-               conn = thisConnection == null
-               // we need this conatiner conection
-                  ? thisConnection = (systemDataContainer != dataContainer
-                  // if it's different container instances
-                     ? dataContainer.equals(systemDataContainer) && systemConnection != null
-                     // but container confugrations are same and system connnection open
-                        // reuse system connection as this
-                        ? dataContainer.reuseConnection(systemConnection)
-                        // or open one new
-                        : dataContainer.openConnection()
-                     // else if it's same container instances (system and this)
-                     : systemConnection == null
-                     // and system connection doens't exist - open it
-                        ? systemConnection = dataContainer.openConnection()
-                        // if already open - use it
-                        : systemConnection)
-                  // this connection opened - use it
-                  : thisConnection;
-            }
+               WorkspaceStorageConnection conn = null;
+               if (isSystemDescendant(data.getQPath()))
+               {
+                  conn = systemConnection == null
+                  // we need system connection but it's not exist
+                     ? systemConnection = (systemDataContainer != dataContainer
+                     // if it's different container instances
+                        ? systemDataContainer.equals(dataContainer) && thisConnection != null
+                        // but container confugrations are same and non-system connnection open
+                           // reuse this connection as system
+                           ? systemDataContainer.reuseConnection(thisConnection)
+                           // or open one new system
+                           : systemDataContainer.openConnection()
+                        // else if it's same container instances (system and this)
+                        : thisConnection == null
+                        // and non-system connection doens't exist - open it
+                           ? thisConnection = dataContainer.openConnection()
+                           // if already open - use it
+                           : thisConnection)
+                     // system connection opened - use it
+                     : systemConnection;
+               }
+               else
+               {
+                  conn = thisConnection == null
+                  // we need this conatiner conection
+                     ? thisConnection = (systemDataContainer != dataContainer
+                     // if it's different container instances
+                        ? dataContainer.equals(systemDataContainer) && systemConnection != null
+                        // but container confugrations are same and system connnection open
+                           // reuse system connection as this
+                           ? dataContainer.reuseConnection(systemConnection)
+                           // or open one new
+                           : dataContainer.openConnection()
+                        // else if it's same container instances (system and this)
+                        : systemConnection == null
+                        // and system connection doens't exist - open it
+                           ? systemConnection = dataContainer.openConnection()
+                           // if already open - use it
+                           : systemConnection)
+                     // this connection opened - use it
+                     : thisConnection;
+               }
 
-            data.increasePersistedVersion();
+               data.increasePersistedVersion();
 
-            if (itemState.isAdded())
-            {
-               doAdd(data, conn, addedNodes);
+               if (itemState.isAdded())
+               {
+                  doAdd(data, conn, addedNodes);
+               }
+               else if (itemState.isUpdated())
+               {
+                  doUpdate(data, conn);
+               }
+               else if (itemState.isDeleted())
+               {
+                  doDelete(data, conn);
+               }
+               else if (itemState.isRenamed())
+               {
+                  doRename(data, conn, addedNodes);
+               }
+
+               if (LOG.isDebugEnabled())
+                  LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
+                     + "ms, " + data.getQPath().getAsString());
             }
-            else if (itemState.isUpdated())
-            {
-               doUpdate(data, conn);
-            }
-            else if (itemState.isDeleted())
-            {
-               doDelete(data, conn);
-            }
-            else if (itemState.isRenamed())
-            {
-               doRename(data, conn, addedNodes);
-            }
-
-            if (LOG.isDebugEnabled())
-               LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
-                  + "ms, " + data.getQPath().getAsString());
+            //            conn.removeSessionInfo();
          }
          if (thisConnection != null)
             thisConnection.commit();

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -211,6 +211,20 @@
    {
    }
 
+   /**
+    * {@inheritDoc}
+    */
+   public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void removeSessionInfo() throws RepositoryException
+   {
+   }
+
    public boolean isOpened()
    {
       return false;

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -56,11 +56,16 @@
 
    protected final Node<Serializable, Object> propsRoot;
 
-   protected JBossCacheStorage(Node<Serializable, Object> nodesRoot, Node<Serializable, Object> propsRoot)
+   protected final Node<Serializable, Object> sessionRoot;
+
+   protected JBossCacheStorage(Node<Serializable, Object> nodesRoot, Node<Serializable, Object> propsRoot,
+      Node<Serializable, Object> sessionRoot)
    {
       this.nodesRoot = nodesRoot;
 
       this.propsRoot = propsRoot;
+
+      this.sessionRoot = sessionRoot;
    }
 
    /**

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -70,9 +70,9 @@
     * @param cache Cache<Serializable, Object>
     */
    public JBossCacheStorageConnection(Cache<Serializable, Object> cache, Node<Serializable, Object> nodesRoot,
-      Node<Serializable, Object> propsRoot)
+      Node<Serializable, Object> propsRoot, Node<Serializable, Object> sessionRoot)
    {
-      super(nodesRoot, propsRoot);
+      super(nodesRoot, propsRoot, sessionRoot);
 
       this.cache = cache;
    }
@@ -257,7 +257,7 @@
          if (!key.equals(ITEM_DATA))
          {
             String propId = (String)parentNode.get(key);
-            if (propId == null)  
+            if (propId == null)
             {
                throw new RepositoryException("FATAL Child Property Id key is null. Parent "
                   + parent.getQPath().getAsString());
@@ -554,6 +554,39 @@
    }
 
    /**
+    * {@inheritDoc}
+    */
+   public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+   {
+      startBatch();
+
+      if (sessionRoot.getData().size() != 0)
+      {
+         throw new RepositoryException("Session attributes already exists in cache storage.");
+      }
+
+      // add attributes
+      sessionRoot.put(JBossCacheStorage.SESSION_ID, sessionId);
+      sessionRoot.put(JBossCacheStorage.USER_ID, userId);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void removeSessionInfo() throws InvalidItemStateException, RepositoryException
+   {
+      startBatch();
+
+      if (sessionRoot.getData().size() == 0)
+      {
+         throw new RepositoryException("Session attributes not exists in cache storage.");
+      }
+
+      // remove attributes
+      sessionRoot.clearData();
+   }
+
+   /**
     *  Start batching.
     */
    private void startBatch()

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -79,7 +79,7 @@
       Node<Serializable, Object> itemsRoot)
    {
       super(treeRoot.getFqn(), itemsRoot.getFqn());
-      
+
       this.cache = cache;
       //this.itemsRoot = itemsRoot;
       //this.treeRoot = treeRoot;
@@ -394,6 +394,20 @@
    }
 
    /**
+    * {@inheritDoc}
+    */
+   public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void removeSessionInfo() throws InvalidItemStateException, RepositoryException
+   {
+   }
+
+   /**
     *  Start batching.
     */
    private void startBatch()

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -71,6 +71,8 @@
 
    private Node<Serializable, Object> properties;
 
+   private Node<Serializable, Object> session;
+
    /**
     * JBossWorkspaceDataContainer  constructor.
     *
@@ -113,31 +115,32 @@
       // initializes configuration state, the root node, etc.
       this.cache.create();
       this.cache.start();
-      
+
       Node<Serializable, Object> cacheRoot = cache.getRoot();
       //Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
 
       // prepare cache structures
       this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
       this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
+      this.session = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.SESSION));
    }
 
    public void start()
    {
       // TODO started on init, due to RepositoryContainer logic
-//      if (persistentContainer instanceof Startable)
-//      {
-//         ((Startable)persistentContainer).start();
-//      }
-//
-//      this.cache.start();
-//      
-//      Node<Serializable, Object> cacheRoot = cache.getRoot();
-//      //Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
-//
-//      // prepare cache structures
-//      this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
-//      this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
+      //      if (persistentContainer instanceof Startable)
+      //      {
+      //         ((Startable)persistentContainer).start();
+      //      }
+      //
+      //      this.cache.start();
+      //      
+      //      Node<Serializable, Object> cacheRoot = cache.getRoot();
+      //      //Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
+      //
+      //      // prepare cache structures
+      //      this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
+      //      this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
    }
 
    public void stop()
@@ -162,12 +165,12 @@
    public WorkspaceStorageConnection openConnection() throws RepositoryException
    {
       // TODO
-//      if (nodes == null || properties == null)
-//      {
-//         throw new RepositoryException("Container is not started");
-//      }
+      //      if (nodes == null || properties == null)
+      //      {
+      //         throw new RepositoryException("Container is not started");
+      //      }
 
-      return new JBossCacheStorageConnection(cache, nodes, properties);
+      return new JBossCacheStorageConnection(cache, nodes, properties, session);
    }
 
    /**
@@ -176,12 +179,12 @@
    public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
    {
       // TODO
-//      if (nodes == null || properties == null)
-//      {
-//         throw new RepositoryException("Container is not started");
-//      }
-      
-      return new JBossCacheStorageConnection(cache, nodes, properties);
+      //      if (nodes == null || properties == null)
+      //      {
+      //         throw new RepositoryException("Container is not started");
+      //      }
+
+      return new JBossCacheStorageConnection(cache, nodes, properties, session);
    }
 
    /**

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -95,10 +95,6 @@
                   }
                   break;
                case REMOVE_DATA :
-                  break;
-               case REMOVE_KEY_VALUE :
-                  break;
-               case REMOVE_NODE :
                   // perform lock or unlock operation
                   if (lockChanges.size() == 2)
                   {
@@ -132,6 +128,10 @@
                   lockChanges = new ArrayList<Modification>();
                   sessionId = null;
                   break;
+               case REMOVE_KEY_VALUE :
+                  break;
+               case REMOVE_NODE :
+                  break;
                case MOVE :
                   break;
                default :
@@ -187,37 +187,30 @@
             {
                // this is a node and node is locked
                String nodeIdentifier = (String)m.getFqn().get(nodesPos + 1);
-
-               switch (m.getType())
+               if (lockManager.hasLockNode(nodeIdentifier))
                {
-                  case PUT_DATA_ERASE :
-                     break;
-                  case PUT_DATA :
-                     if (lockManager.hasLockNode(nodeIdentifier))
-                     {
+                  switch (m.getType())
+                  {
+                     case PUT_DATA_ERASE :
+                        break;
+                     case PUT_DATA :
                         removedLock.remove(nodeIdentifier);
-                     }
-                     break;
-                  case PUT_KEY_VALUE :
-                     break;
-                  case REMOVE_DATA :
-                     break;
-                  case REMOVE_KEY_VALUE :
-                     break;
-                  case REMOVE_NODE :
-                     if (lockManager.hasLockNode(nodeIdentifier))
-                     {
+                        break;
+                     case PUT_KEY_VALUE :
+                        break;
+                     case REMOVE_DATA :
+                        break;
+                     case REMOVE_KEY_VALUE :
+                        break;
+                     case REMOVE_NODE :
                         removedLock.add(nodeIdentifier);
-                     }
-                     break;
-                  case MOVE :
-                     if (lockManager.hasLockNode(nodeIdentifier))
-                     {
+                        break;
+                     case MOVE :
                         removedLock.remove(nodeIdentifier);
-                     }
-                     break;
-                  default :
-                     throw new CacheException("Unknown modification " + m.getType());
+                        break;
+                     default :
+                        throw new CacheException("Unknown modification " + m.getType());
+                  }
                }
             }
          }

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -697,6 +697,20 @@
       }
    }
 
+   /**
+    * {@inheritDoc}
+    */
+   public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void removeSessionInfo() throws RepositoryException
+   {
+   }
+
    // ------------------ Private methods ---------------
 
    /**

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -309,6 +309,28 @@
    void close() throws IllegalStateException, RepositoryException;
 
    /**
+    * Add session information to cache storage. 
+    *
+    * @param sessionId
+    *          the session identifier to be added 
+    * 
+    * @param userId
+    *          the user identifier to be added
+    * 
+    * @throws RepositoryException
+    *           if some exception occured
+    */
+   void addSessionInfo(String sessionId, String userId) throws RepositoryException;
+
+   /**
+    * Remove session information from cache storage. 
+    *
+    * @throws RepositoryException
+    *           if some exception occured
+    */
+   void removeSessionInfo() throws RepositoryException;
+
+   /**
     * Returns true if connection can be used.
     * 
     * @return boolean, true if connection is open and ready, false - otherwise

Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -219,7 +219,7 @@
    public List<Modification> removeSession()
    {
       List<Modification> list = new ArrayList<Modification>();
-      list.add(new Modification(ModificationType.REMOVE_NODE, Fqn.fromString("/" + JBossCacheStorage.SESSION)));
+      list.add(new Modification(ModificationType.REMOVE_DATA, Fqn.fromString("/" + JBossCacheStorage.SESSION)));
       return list;
    }
 }

Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -16,24 +16,6 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
-/*
- * 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.impl.storage.jbosscache;
 
 import junit.framework.TestCase;
@@ -78,6 +60,8 @@
 
    protected Node<Serializable, Object> props;
 
+   protected Node<Serializable, Object> session;
+
    protected String jbcConfig;
 
    /**
@@ -103,16 +87,17 @@
       // prepare cache structures
       nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
       props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
+      session = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.SESSION));
 
       // JCR connection
-      conn = new JBossCacheStorageConnection(cache, nodes, props);
+      conn = new JBossCacheStorageConnection(cache, nodes, props, session);
    }
 
    protected void initJBCConfig()
    {
       jbcConfig = "conf/standalone/test-jbosscache-config-jdbcloader.xml";
    }
-   
+
    protected void initJBC() throws Exception
    {
       // empty here
@@ -178,7 +163,7 @@
       Object propValue) throws UnsupportedEncodingException, IllegalStateException, IOException
    {
       String pid = (String)node.get(propName.getAsString());
-      
+
       assertNotNull("Property ID should exists", pid);
       assertEquals("Property ID wrong", propId, pid);
 
@@ -282,7 +267,7 @@
 
       checkChildProp(rootNode, Constants.JCR_PRIMARYTYPE, propId1, propPath1, propValue1);
       checkChildProp(rootNode, Constants.JCR_MIXINTYPES, propId2, propPath2, propValue2);
-      
+
       // TODO check order
       int index = 0;
       for (Serializable key : rootNode.getKeys())
@@ -505,11 +490,11 @@
 
       // check 
       treePrint(props);
-      
+
       Node<Serializable, Object> rootNode = nodes.getChild(Fqn.fromElements(Constants.ROOT_UUID));
 
       assertEquals("Attributes ammount wrong", 2, rootNode.getKeys().size());
-      
+
       checkChildProp(rootNode, Constants.JCR_PRIMARYTYPE, propId1, propPath1, propValueU);
    }
 
@@ -560,7 +545,7 @@
 
       // check 
       treePrint(props);
-      
+
       // check 
       ItemData propItem =
          conn.getItemData(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1, Constants.NT_UNSTRUCTURED,

Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java	2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java	2009-11-10 14:53:54 UTC (rev 548)
@@ -17,16 +17,13 @@
 package org.exoplatform.services.jcr.impl.storage.jbosscache;
 
 import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.datamodel.NodeData;
 import org.exoplatform.services.jcr.datamodel.QPath;
 import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
 import org.exoplatform.services.jcr.impl.core.lock.LockData;
 import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-import org.exoplatform.services.jcr.util.IdGenerator;
+
 import org.jboss.cache.Modification;
 
 import java.util.ArrayList;



More information about the exo-jcr-commits mailing list