org.apache.commons.vfs2.provider.webdav
Class WebdavFileObject

java.lang.Object
  extended by org.apache.commons.vfs2.provider.AbstractFileObject
      extended by org.apache.commons.vfs2.provider.http.HttpFileObject
          extended by org.apache.commons.vfs2.provider.webdav.WebdavFileObject
All Implemented Interfaces:
FileObject

public class WebdavFileObject
extends HttpFileObject
implements FileObject

A WebDAV file.

Since:
2.0
Author:
Commons VFS team

Field Summary
static DavPropertyName RESPONSE_CHARSET
          The character set property name.
 
Constructor Summary
protected WebdavFileObject(AbstractFileName name, WebdavFileSystem fileSystem)
           
 
Method Summary
protected  void configureMethod(HttpMethodBase httpMethod)
           
protected  void doCreateFolder()
          Creates this file as a folder.
protected  void doDelete()
          Deletes the file.
protected  java.util.Map<java.lang.String,java.lang.Object> doGetAttributes()
          Returns the properties of the Webdav resource.
protected  long doGetContentSize()
          Returns the size of the file content (in bytes).
protected  long doGetLastModifiedTime()
          Returns the last modified time of this file.
protected  java.io.OutputStream doGetOutputStream(boolean bAppend)
          Creates an output stream to write the file content to.
protected  FileType doGetType()
          Determines the type of this file.
protected  java.lang.String[] doListChildren()
          Lists the children of the file.
protected  FileObject[] doListChildrenResolved()
          Lists the children of the file.
protected  void doRename(FileObject newfile)
          Rename the file.
protected  void doSetAttribute(java.lang.String attrName, java.lang.Object value)
          Sets an attribute of this file.
protected  FileContentInfoFactory getFileContentInfoFactory()
          create the filecontentinfo implementation.
protected  void setupMethod(HttpMethod method)
          Prepares a Method object.
 
Methods inherited from class org.apache.commons.vfs2.provider.http.HttpFileObject
doDetach, doGetInputStream, doGetRandomAccessContent, encodePath
 
Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileObject
canRenameTo, childrenChanged, close, copyFrom, createFile, createFolder, delete, delete, doAttach, doCreateFileContent, doGetCertificates, doIsHidden, doIsReadable, doIsSameFile, doIsWriteable, doRemoveAttribute, doSetLastModifiedTime, endOutput, exists, finalize, findFiles, findFiles, getChild, getChildren, getContent, getFileOperations, getFileSystem, getInputStream, getName, getOutputStream, getOutputStream, getParent, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isHidden, isReadable, isSameFile, isWriteable, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.vfs2.FileObject
canRenameTo, close, copyFrom, createFile, createFolder, delete, delete, exists, findFiles, findFiles, getChild, getChildren, getContent, getFileOperations, getFileSystem, getName, getParent, getType, getURL, isAttached, isContentOpen, isHidden, isReadable, isWriteable, moveTo, refresh, resolveFile, resolveFile
 

Field Detail

RESPONSE_CHARSET

public static final DavPropertyName RESPONSE_CHARSET
The character set property name.

Constructor Detail

WebdavFileObject

protected WebdavFileObject(AbstractFileName name,
                           WebdavFileSystem fileSystem)
Method Detail

configureMethod

protected void configureMethod(HttpMethodBase httpMethod)

doGetType

protected FileType doGetType()
                      throws java.lang.Exception
Determines the type of this file. Must not return null. The return value of this method is cached, so the implementation can be expensive.

Overrides:
doGetType in class HttpFileObject
Returns:
the type of the file.
Throws:
java.lang.Exception - if an error occurs.

doListChildren

protected java.lang.String[] doListChildren()
                                     throws java.lang.Exception
Lists the children of the file.

Overrides:
doListChildren in class HttpFileObject
Returns:
a possible empty String array if the file is a directory or null or an exception if the file is not a directory or can't be read.
Throws:
java.lang.Exception - if an error occurs.

doListChildrenResolved

protected FileObject[] doListChildrenResolved()
                                       throws java.lang.Exception
Lists the children of the file.

Overrides:
doListChildrenResolved in class AbstractFileObject
Returns:
The children of this FileObject.
Throws:
java.lang.Exception - if an error occurs.

doCreateFolder

protected void doCreateFolder()
                       throws java.lang.Exception
Creates this file as a folder.

Overrides:
doCreateFolder in class AbstractFileObject
Throws:
java.lang.Exception - if an error occurs.

doDelete

protected void doDelete()
                 throws java.lang.Exception
Deletes the file.

Overrides:
doDelete in class AbstractFileObject
Throws:
java.lang.Exception - if an error occurs.

doRename

protected void doRename(FileObject newfile)
                 throws java.lang.Exception
Rename the file.

Overrides:
doRename in class AbstractFileObject
Parameters:
newfile - A FileObject with the new file name.
Throws:
java.lang.Exception - if an error occurs.

doGetContentSize

protected long doGetContentSize()
                         throws java.lang.Exception
Returns the size of the file content (in bytes).

Overrides:
doGetContentSize in class HttpFileObject
Returns:
The size of the file in bytes.
Throws:
java.lang.Exception - if an error occurs.

doGetLastModifiedTime

protected long doGetLastModifiedTime()
                              throws java.lang.Exception
Returns the last modified time of this file. Is only called if doGetType() does not return FileType.IMAGINARY.

Overrides:
doGetLastModifiedTime in class HttpFileObject
Returns:
The last modification time.
Throws:
java.lang.Exception - if an error occurs.

doGetAttributes

protected java.util.Map<java.lang.String,java.lang.Object> doGetAttributes()
                                                                    throws java.lang.Exception
Returns the properties of the Webdav resource.

Overrides:
doGetAttributes in class AbstractFileObject
Returns:
The attributes of the file.
Throws:
java.lang.Exception - if an error occurs.

doSetAttribute

protected void doSetAttribute(java.lang.String attrName,
                              java.lang.Object value)
                       throws java.lang.Exception
Sets an attribute of this file. Is only called if doGetType() does not return FileType.IMAGINARY.

This implementation throws an exception.

Overrides:
doSetAttribute in class AbstractFileObject
Parameters:
attrName - The attribute name.
value - The value to be associated with the attribute name.
Throws:
java.lang.Exception - if an error occurs.

doGetOutputStream

protected java.io.OutputStream doGetOutputStream(boolean bAppend)
                                          throws java.lang.Exception
Description copied from class: AbstractFileObject
Creates an output stream to write the file content to. Is only called if:

It is guaranteed that there are no open stream (input or output) for this file when this method is called.

The returned stream does not have to be buffered.

This implementation throws an exception.

Overrides:
doGetOutputStream in class AbstractFileObject
Parameters:
bAppend - true if the file should be appended to, false if it should be overwritten.
Returns:
An OutputStream to write to the file.
Throws:
java.lang.Exception - if an error occurs.

getFileContentInfoFactory

protected FileContentInfoFactory getFileContentInfoFactory()
Description copied from class: AbstractFileObject
create the filecontentinfo implementation.

Overrides:
getFileContentInfoFactory in class HttpFileObject
Returns:
The FileContentInfoFactory.

setupMethod

protected void setupMethod(HttpMethod method)
                    throws FileSystemException,
                           URIException
Prepares a Method object.

Overrides:
setupMethod in class HttpFileObject
Parameters:
method - the HttpMethod.
Throws:
FileSystemException - if an error occurs encoding the uri.
URIException - if the URI is in error.