jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r661624 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/state/ src/test/java/org/apache/jackrabbit/core/version/
Date Fri, 30 May 2008 09:59:37 GMT
Author: jukka
Date: Fri May 30 02:59:36 2008
New Revision: 661624

URL: http://svn.apache.org/viewvc?rev=661624&view=rev
Log:
1.4: Merged revision 656240 (JCR-1587)

Added:
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveAndAddVersionLabelXATest.java
      - copied unchanged from r656240, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveAndAddVersionLabelXATest.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/   (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java

Propchange: jackrabbit/branches/1.4/jackrabbit-core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 30 02:59:36 2008
@@ -1 +1 @@
-/jackrabbit/trunk/jackrabbit-core:658583
+/jackrabbit/trunk/jackrabbit-core:656240,658583

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java?rev=661624&r1=661623&r2=661624&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
Fri May 30 02:59:36 2008
@@ -126,6 +126,16 @@
         return state;
     }
 
+    /**
+     * Returns the change log that contains the current changes in this local
+     * item state manager.
+     *
+     * @return the change log with the current changes.
+     */
+    protected ChangeLog getChanges() {
+        return changeLog;
+    }
+
     //-----------------------------------------------------< ItemStateManager >
     /**
      * {@inheritDoc}

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java?rev=661624&r1=661623&r2=661624&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
Fri May 30 02:59:36 2008
@@ -203,6 +203,13 @@
         return changeLog;
     }
 
+    /**
+     * @throws UnsupportedOperationException always.
+     */
+    protected ChangeLog getChanges() {
+        throw new UnsupportedOperationException("getChanges");
+    }
+
     //-----------------------------------------------------< ItemStateManager >
     /**
      * {@inheritDoc}
@@ -218,13 +225,21 @@
         if (virtualProvider != null && virtualProvider.hasItemState(id)) {
             return virtualProvider.getItemState(id);
         }
-        ChangeLog changeLog = getChangeLog();
+        // 1) check local changes
+        ChangeLog changeLog = super.getChanges();
+        ItemState state = changeLog.get(id);
+        if (state != null) {
+            return state;
+        }
+        // 2) check tx log
+        changeLog = getChangeLog();
         if (changeLog != null) {
-            ItemState state = changeLog.get(id);
+            state = changeLog.get(id);
             if (state != null) {
                 return state;
             }
         }
+        // 3) fallback to base class
         return super.getItemState(id);
     }
 
@@ -240,7 +255,21 @@
         if (virtualProvider != null && virtualProvider.hasItemState(id)) {
             return true;
         }
-        ChangeLog changeLog = getChangeLog();
+        // 1) check local changes
+        ChangeLog changeLog = super.getChanges();
+        try {
+            ItemState state = changeLog.get(id);
+            if (state != null) {
+                return true;
+            }
+        } catch (NoSuchItemStateException e) {
+            // marked removed in local ism
+            return false;
+        }
+        // if we get here, then there is no item state with
+        // the given id known to the local ism
+        // 2) check tx log
+        changeLog = getChangeLog();
         if (changeLog != null) {
             try {
                 ItemState state = changeLog.get(id);
@@ -248,10 +277,12 @@
                     return true;
                 }
             } catch (NoSuchItemStateException e) {
+                // marked removed in tx log
                 return false;
             }
         }
-        return super.hasItemState(id);
+        // 3) fallback to shared ism
+        return sharedStateMgr.hasItemState(id);
     }
 
     /**



Mime
View raw message