jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1375012 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Mon, 20 Aug 2012 13:29:17 GMT
Author: mduerig
Date: Mon Aug 20 13:29:17 2012
New Revision: 1375012

URL: http://svn.apache.org/viewvc?rev=1375012&view=rev
Log:
OAK-258: Dummy implementation for session scoped locks
Thanks Chetan Mehrotra for the patch

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1375012&r1=1375011&r2=1375012&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Mon Aug 20 13:29:17 2012
@@ -71,6 +71,7 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.core.DefaultConflictHandler;
 import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
 import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
+import org.apache.jackrabbit.oak.util.TODO;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -1212,9 +1213,9 @@ public class NodeImpl extends ItemImpl<N
      */
     @Override
     @Nonnull
-    public Lock lock(boolean isDeep, boolean isSessionScoped)
+    public Lock lock(final boolean isDeep, boolean isSessionScoped)
             throws RepositoryException {
-        String userID = getSession().getUserID();
+        final String userID = getSession().getUserID();
 
         String lockOwner = sessionDelegate.getOakPathOrThrow(JCR_LOCK_OWNER);
         String lockIsDeep = sessionDelegate.getOakPathOrThrow(JCR_LOCK_IS_DEEP);
@@ -1234,6 +1235,55 @@ public class NodeImpl extends ItemImpl<N
         }
 
         getSession().refresh(true);
+
+        if (isSessionScoped) {
+            return TODO.dummyImplementation().returnValue(new Lock() {
+                @Override
+                public String getLockOwner() {
+                    return userID;
+                }
+
+                @Override
+                public boolean isDeep() {
+                    return isDeep;
+                }
+
+                @Override
+                public Node getNode() {
+                    return NodeImpl.this;
+                }
+
+                @Override
+                public String getLockToken() {
+                    return null;
+                }
+
+                @Override
+                public long getSecondsRemaining() {
+                    return Long.MAX_VALUE;
+                }
+
+                @Override
+                public boolean isLive() {
+                    return true;
+                }
+
+                @Override
+                public boolean isSessionScoped() {
+                    return true;
+                }
+
+                @Override
+                public boolean isLockOwningSession() {
+                    return true;
+                }
+
+                @Override
+                public void refresh() {
+                }
+            });
+        }
+
         return getLock();
     }
 



Mime
View raw message