jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1235423 - /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Date Tue, 24 Jan 2012 19:19:16 GMT
Author: reschke
Date: Tue Jan 24 19:19:16 2012
New Revision: 1235423

URL: http://svn.apache.org/viewvc?rev=1235423&view=rev
Log:
JCR-3220: add lock timeout support for simple webdav server 

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?rev=1235423&r1=1235422&r2=1235423&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Tue Jan 24 19:19:16 2012
@@ -569,7 +569,7 @@ public class DavResourceImpl implements 
 
             // make sure, non-jcr locks are removed, once the removal is completed
             try {
-                if (!isJsrLockable()) {
+                if (!isJcrLockable()) {
                     ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
                     if (lock != null) {
                         lockManager.releaseLock(lock.getToken(), member);
@@ -683,10 +683,17 @@ public class DavResourceImpl implements 
         ActiveLock lock = null;
         if (isLockable(lockInfo.getType(), lockInfo.getScope())) {
             // TODO: deal with existing locks, that may have been created, before the node
was jcr-lockable...
-            if (isJsrLockable()) {
+            if (isJcrLockable()) {
                 try {
+                    javax.jcr.lock.LockManager lockMgr = node.getSession().getWorkspace().getLockManager();
+                    long timeout = lockInfo.getTimeout();
+                    if (timeout == LockInfo.INFINITE_TIMEOUT) {
+                        timeout = Long.MAX_VALUE;
+                    } else {
+                        timeout = timeout / 1000;
+                    }
                     // try to execute the lock operation
-                    Lock jcrLock = node.lock(lockInfo.isDeep(), false);
+                    Lock jcrLock = lockMgr.lock(node.getPath(), lockInfo.isDeep(), false,
timeout, lockInfo.getOwner());
                     if (jcrLock != null) {
                         lock = new JcrActiveLock(jcrLock);
                     }
@@ -922,7 +929,7 @@ public class DavResourceImpl implements 
      *
      * @return true if this resource is lockable.
      */
-    private boolean isJsrLockable() {
+    private boolean isJcrLockable() {
         boolean lockable = false;
         if (exists()) {
             try {



Mime
View raw message