jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1497531 - in /jackrabbit/branches/2.4: ./ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/ jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit...
Date Thu, 27 Jun 2013 19:49:09 GMT
Author: reschke
Date: Thu Jun 27 19:49:08 2013
New Revision: 1497531

URL: http://svn.apache.org/r1497531
Log:
JCR-2029: JCR Remoting: Use DAV:lockroot to expose the lock-holding node (ported to 2.4)

Modified:
    jackrabbit/branches/2.4/   (props changed)
    jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
    jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
    jackrabbit/branches/2.4/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
    jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
    jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
    jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java

Propchange: jackrabbit/branches/2.4/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1497492

Modified: jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
Thu Jun 27 19:49:08 2013
@@ -54,6 +54,7 @@ import org.apache.jackrabbit.server.io.I
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.webdav.DavCompliance;
 import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavLocatorFactory;
 import org.apache.jackrabbit.webdav.DavResource;
 import org.apache.jackrabbit.webdav.DavResourceFactory;
 import org.apache.jackrabbit.webdav.DavResourceIterator;
@@ -626,6 +627,12 @@ public class DefaultItemCollection exten
                 } else if (((Node) item).isLocked()) {
                     Lock jcrLock = ((Node) item).getLock();
                     lock = new JcrActiveLock(jcrLock);
+                    DavResourceLocator locator = super.getLocator();
+                    String lockroot = locator
+                            .getFactory()
+                            .createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(),
jcrLock.getNode().getPath(),
+                                    false).getHref(false);
+                    lock.setLockroot(lockroot);
                 }
             } catch (AccessDeniedException e) {
                 log.error("Error while accessing resource lock: "+e.getMessage());

Modified: jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Thu Jun 27 19:49:08 2013
@@ -653,6 +653,11 @@ public class DavResourceImpl implements 
                     Lock jcrLock = node.getLock();
                     if (jcrLock != null && jcrLock.isLive()) {
                         lock = new JcrActiveLock(jcrLock);
+                        String lockroot = locator
+                                .getFactory()
+                                .createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(),
+                                        jcrLock.getNode().getPath(), false).getHref(false);
+                        lock.setLockroot(lockroot);
                     }
                 }
             } catch (RepositoryException e) {

Modified: jackrabbit/branches/2.4/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Thu Jun 27 19:49:08 2013
@@ -1645,16 +1645,21 @@ public class RepositoryServiceImpl imple
             log.debug("No lock present on node " + saveGetIdString(nodeId, sessionInfo));
             return null;
         }
-        if (activeLock.isDeep() && parentId != null) {
-            // try if lock is inherited
+
+        NodeId holder = null;
+        String lockroot = activeLock.getLockroot();
+        if (activeLock.getLockroot() != null) {
+            holder = uriResolver.getNodeId(lockroot, sessionInfo);
+        }
+
+        if (activeLock.isDeep() && holder == null && parentId != null) {
+            // deep lock, parent known, but holder is not
             LockInfo pLockInfo = getLockInfo(sessionInfo, parentId);
             if (pLockInfo != null) {
                 return pLockInfo;
             }
         }
-        // no deep lock or parentID == null or lock is not present on parent
-        // -> nodeID is lockHolding Id.
-        return new LockInfoImpl(activeLock, nodeId, ((SessionInfoImpl)sessionInfo).getAllLockTokens());
+        return new LockInfoImpl(activeLock, holder == null ? nodeId : holder, ((SessionInfoImpl)sessionInfo).getAllLockTokens());
     }
 
     /**

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
Thu Jun 27 19:49:08 2013
@@ -104,7 +104,7 @@ public interface DavConstants {
     public static final String XML_OWNER = "owner";
     /**
      * The <code>lockroot</code> XML element
-     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4818</a>
+     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4918</a>
      */
     public static final String XML_LOCKROOT = "lockroot";
 

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
Thu Jun 27 19:49:08 2013
@@ -27,7 +27,7 @@ import org.w3c.dom.Element;
 public abstract class AbstractActiveLock implements ActiveLock, DavConstants {
 
     private String lockroot;
-    
+
     /**
      * @see ActiveLock#getLockroot()
      */
@@ -44,7 +44,7 @@ public abstract class AbstractActiveLock
 
     /**
      * Returns the default Xml representation of the 'activelock' element
-     * as defined by RFC 2518.
+     * as defined by RFC 4918.
      *
      * @return Xml representation
      * @param document

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java?rev=1497531&r1=1497530&r2=1497531&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java
Thu Jun 27 19:49:08 2013
@@ -96,7 +96,7 @@ public interface ActiveLock extends XmlS
      * Returns the lockroot.
      *
      * @return lockroot
-     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4818</a>
+     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4918</a>
      */
     public String getLockroot();
 
@@ -104,7 +104,7 @@ public interface ActiveLock extends XmlS
      * Set the lockroot.
      *
      * @param lockroot
-     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4818</a>
+     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC
4918</a>
      */
     public void setLockroot(String lockroot);
 



Mime
View raw message