jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r697767 - in /jackrabbit/trunk: jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/ jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/
Date Mon, 22 Sep 2008 10:01:49 GMT
Author: reschke
Date: Mon Sep 22 03:01:48 2008
New Revision: 697767

URL: http://svn.apache.org/viewvc?rev=697767&view=rev
Log:
JCR-1733: implement support for WebDAV BIND DAV:resource-id property (for now only if the
repository provides a true UUID).

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.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=697767&r1=697766&r2=697767&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
Mon Sep 22 03:01:48 2008
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.webdav.simple;
 
 import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.server.io.AbstractExportContext;
 import org.apache.jackrabbit.server.io.DefaultIOListener;
 import org.apache.jackrabbit.server.io.ExportContext;
@@ -96,6 +97,7 @@
     protected DavPropertySet properties = new DavPropertySet();
     protected boolean propsInitialized = false;
     private boolean isCollection = true;
+    private String rfc4122Uri;
 
     private ResourceConfig config;
     private long modificationTime = IOUtil.UNDEFINED_TIME;
@@ -123,6 +125,7 @@
                     node = (Node) item;
                     // define what is a collection in webdav
                     isCollection = config.isCollectionResource(node);
+                    this.initRfc4122Uri();
                 }
             } catch (PathNotFoundException e) {
                 // ignore: exists field evaluates to false
@@ -178,6 +181,7 @@
                 this.node = node;
                 // define what is a collection in webdav
                 isCollection = config.isCollectionResource(node);
+                this.initRfc4122Uri();
             }
         } else {
             throw new DavException(DavServletResponse.SC_NOT_FOUND);
@@ -185,6 +189,27 @@
     }
 
     /**
+     * If the Node associated with this DavResource has a UUID that allows for the creation
of a rfc4122 compliant
+     * URI, we use it as the value of the protected DAV property DAV:resource-id, which is
defined by the BIND
+     * specification.
+     */
+    private void initRfc4122Uri() {
+        try {
+            if (node.isNodeType("mix:referenceable")) {
+                String uuid = node.getUUID();
+                try {
+                    UUID.fromString(uuid);
+                    this.rfc4122Uri = "urn:uuid:" + uuid;
+                } catch (IllegalArgumentException e) {
+                    //no, this is not a UUID
+                }
+            }
+        } catch (RepositoryException e) {
+            log.warn("Error while detecting UUID", e);
+        }
+    }
+
+    /**
      * @return DavResource#COMPLIANCE_CLASS
      * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
      */
@@ -342,6 +367,10 @@
             properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
         }
 
+        if (rfc4122Uri != null) {
+            properties.add(new DefaultDavProperty(DavPropertyName.RESOURCEID, rfc4122Uri,
true));
+        }
+
         /* set current lock information. If no lock is set to this resource,
         an empty lockdiscovery will be returned in the response. */
         properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java?rev=697767&r1=697766&r2=697767&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java
Mon Sep 22 03:01:48 2008
@@ -122,6 +122,11 @@
     public static final String PROPERTY_SOURCE = "source";
     public static final String PROPERTY_SUPPORTEDLOCK = "supportedlock";
 
+    /*
+     * Webdav property names as defined by the BIND specification.
+     */
+    public static final String PROPERTY_RESOURCEID = "resource-id";
+
     //-------------------------------------------------< PropFind Constants >---
     public static final int PROPFIND_BY_PROPERTY = 0;
     public static final int PROPFIND_ALL_PROP = 1;

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java?rev=697767&r1=697766&r2=697767&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
Mon Sep 22 03:01:48 2008
@@ -49,6 +49,9 @@
     public static final DavPropertyName SOURCE = DavPropertyName.create(PROPERTY_SOURCE);
     public static final DavPropertyName SUPPORTEDLOCK = DavPropertyName.create(PROPERTY_SUPPORTEDLOCK);
 
+    /* webdav properties defined by the BIND specification */
+    public static final DavPropertyName RESOURCEID = DavPropertyName.create(PROPERTY_RESOURCEID);
+
     /* property use by microsoft that are not specified in the RFC 2518 */
     public static final DavPropertyName ISCOLLECTION = DavPropertyName.create("iscollection");
 



Mime
View raw message