commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav WebdavFileObject.java
Date Tue, 29 Apr 2003 01:34:04 GMT
adammurdoch    2003/04/28 18:34:04

  Modified:    vfs/src/java/org/apache/commons/vfs/provider/webdav
                        WebdavFileObject.java
  Log:
  Added support for file attributes to the WebDAV provider.
  
  Patch submitted by Mircea Toma.
  
  Revision  Changes    Path
  1.8       +29 -2     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
  
  Index: WebdavFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebdavFileObject.java	14 Apr 2003 01:09:25 -0000	1.7
  +++ WebdavFileObject.java	29 Apr 2003 01:34:04 -0000	1.8
  @@ -60,6 +60,8 @@
   import java.io.InputStream;
   import java.io.OutputStream;
   import java.util.Enumeration;
  +import java.util.Map;
  +import java.util.HashMap;
   import org.apache.commons.vfs.FileObject;
   import org.apache.commons.vfs.FileSystemException;
   import org.apache.commons.vfs.FileType;
  @@ -68,7 +70,10 @@
   import org.apache.commons.vfs.util.MonitorOutputStream;
   import org.apache.util.HttpURL;
   import org.apache.webdav.lib.WebdavResource;
  +import org.apache.webdav.lib.BaseProperty;
   import org.apache.webdav.lib.methods.OptionsMethod;
  +import org.apache.webdav.lib.methods.XMLResponseMethodBase;
  +import org.apache.webdav.lib.methods.DepthSupport;
   
   /**
    * A WebDAV file.
  @@ -253,7 +258,29 @@
        * Returns the last modified time of this file.  Is only called if
        * {@link #doGetType} does not return {@link FileType#IMAGINARY}.
        */
  -    protected long doGetLastModifiedTime() throws Exception {
  +    protected long doGetLastModifiedTime() throws Exception
  +    {
           return resource.getGetLastModified();
  +    }
  +
  +    /**
  +     * Returns the properties of the Webdav resource.
  +     */
  +    protected Map doGetAttributes() throws Exception
  +    {
  +        final Map attributes = new HashMap();
  +        final Enumeration e = resource.propfindMethod( DepthSupport.DEPTH_0 );
  +        while (e.hasMoreElements())
  +        {
  +            final XMLResponseMethodBase.Response response = (XMLResponseMethodBase.Response)e.nextElement();
  +            final Enumeration properties = response.getProperties();
  +            while ( properties.hasMoreElements() )
  +            {
  +                final BaseProperty property = (BaseProperty) properties.nextElement();
  +                attributes.put( property.getLocalName(), property.getPropertyAsString()
);
  +            }
  +        }
  +
  +        return attributes;
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message