You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/11/12 04:56:37 UTC

svn commit: r835215 - in /commons/proper/vfs/branches/VFS281: core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java xdocs/changes.xml

Author: rgoers
Date: Thu Nov 12 03:56:36 2009
New Revision: 835215

URL: http://svn.apache.org/viewvc?rev=835215&view=rev
Log:
Apply patch for VFS-263

Modified:
    commons/proper/vfs/branches/VFS281/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
    commons/proper/vfs/branches/VFS281/xdocs/changes.xml

Modified: commons/proper/vfs/branches/VFS281/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/branches/VFS281/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java?rev=835215&r1=835214&r2=835215&view=diff
==============================================================================
--- commons/proper/vfs/branches/VFS281/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java (original)
+++ commons/proper/vfs/branches/VFS281/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java Thu Nov 12 03:56:36 2009
@@ -51,6 +51,7 @@
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.MultiStatus;
 import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.xml.Namespace;
 import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.apache.jackrabbit.webdav.version.VersionControlledResource;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
@@ -302,6 +303,49 @@
         }
     }
 
+    /**
+     * Sets an attribute of this file.  Is only called if {@link #doGetType}
+     * does not return {@link FileType#IMAGINARY}.
+     * <p/>
+     * This implementation throws an exception.
+     */
+    protected void doSetAttribute(final String attrName, final Object value)
+        throws Exception
+    {
+        try
+        {
+            URLFileName fileName = (URLFileName) getName();
+            String urlStr = urlString(fileName);
+            DavPropertySet properties = new DavPropertySet();
+            DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
+            DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
+            if (value != null)
+            {
+                properties.add(property);
+            }
+            else
+            {
+                propertyNameSet.add(property.getName()); // remove property
+            }
+
+            PropPatchMethod method = new PropPatchMethod(urlStr, properties, propertyNameSet);
+            setupMethod(method);
+            execute(method);
+            if (!method.succeeded())
+            {
+                throw new FileSystemException("Property '" + attrName + "' could not be set.");
+            }
+        }
+        catch (FileSystemException fse)
+        {
+            throw fse;
+        }
+        catch(Exception e)
+        {
+            throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e);
+        }
+    }    
+
     protected OutputStream doGetOutputStream(boolean bAppend) throws Exception
     {
         return new WebdavOutputStream(this);

Modified: commons/proper/vfs/branches/VFS281/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/branches/VFS281/xdocs/changes.xml?rev=835215&r1=835214&r2=835215&view=diff
==============================================================================
--- commons/proper/vfs/branches/VFS281/xdocs/changes.xml (original)
+++ commons/proper/vfs/branches/VFS281/xdocs/changes.xml Thu Nov 12 03:56:36 2009
@@ -23,9 +23,12 @@
 
   <body>
     <release version="2.0" date="in SVN" description="">
+      <action dev="rgoers" type="update" issue="VFS-263" due-to="Ingo Maas">
+        WebdavFileObject does not implement doSetAttribute()
+      </action>        
       <action dev="rgoers" type="fix" issue="VFS-259" due-to="Marek Zawirski">
         Http and Webdav FIleContentInfoFactory: undress to AbstractFileObject before casting
-      </action>      
+      </action>
       <action dev="rgoers" type="fix" issue="VFS-261" due-to="Simon Olofsson">
         WebDAV upload corrupts binary files
       </action>