jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1510463 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeImpl.java lock/LockImpl.java
Date Mon, 05 Aug 2013 13:00:04 GMT
Author: jukka
Date: Mon Aug  5 13:00:04 2013
New Revision: 1510463

URL: http://svn.apache.org/r1510463
Log:
OAK-150: Basic JCR LockManager support

Extract dummy LockImpl to a separate file

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java
  (with props)
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=1510463&r1=1510462&r2=1510463&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  5 13:00:04 2013
@@ -70,6 +70,7 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.core.IdentifierManager;
 import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.PropertyDelegate;
+import org.apache.jackrabbit.oak.jcr.lock.LockImpl;
 import org.apache.jackrabbit.oak.jcr.operation.NodeOperation;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeType;
@@ -1169,51 +1170,8 @@ public class NodeImpl<T extends NodeDele
         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 TODO.dummyImplementation().returnValue(
+                    new LockImpl(this, userID, isDeep));
         }
 
         return getLock();

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java?rev=1510463&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java
Mon Aug  5 13:00:04 2013
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.lock;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.jcr.Node;
+import javax.jcr.lock.Lock;
+
+public final class LockImpl implements Lock {
+
+    private final Node node;
+
+    private final String userID;
+
+    private final boolean isDeep;
+
+    public LockImpl(Node node, String userID, boolean isDeep) {
+        this.node = checkNotNull(node);
+        this.userID = userID;
+        this.isDeep = isDeep;
+    }
+
+    @Override
+    public Node getNode() {
+        return node;
+    }
+
+    @Override
+    public String getLockOwner() {
+        return userID;
+    }
+
+    @Override
+    public boolean isDeep() {
+        return isDeep;
+    }
+
+    @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() {
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message