[exo-jcr-commits] exo-jcr SVN: r553 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 11 03:05:59 EST 2009


Author: tolusha
Date: 2009-11-11 03:05:59 -0500 (Wed, 11 Nov 2009)
New Revision: 553

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-201: 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 17:03:59 UTC (rev 552)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java	2009-11-11 08:05:59 UTC (rev 553)
@@ -164,45 +164,61 @@
                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)
+                  if (systemConnection == null)
+                  {
+                     conn =
+                     // 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);
+                     if (!systemConnection.equals(thisConnection))
+                        systemConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
+                  }
+                  else
+                  {
                      // system connection opened - use it
-                     : systemConnection;
+                     conn = 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)
+                  if (thisConnection == null)
+                  {
+                     conn =
+                     // 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);
+                     if (!thisConnection.equals(systemConnection))
+                        thisConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
+                  }
+                  else
+                  {
                      // this connection opened - use it
-                     : thisConnection;
+                     conn = thisConnection;
+                  }
                }
 
                data.increasePersistedVersion();
@@ -228,7 +244,10 @@
                   LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
                      + "ms, " + data.getQPath().getAsString());
             }
-            //            conn.removeSessionInfo();
+            if (thisConnection != null)
+               thisConnection.removeSessionInfo();
+            if (systemConnection != null && !systemConnection.equals(thisConnection))
+               systemConnection.removeSessionInfo();
          }
          if (thisConnection != null)
             thisConnection.commit();



More information about the exo-jcr-commits mailing list