com.caucho.servlets.webdav
Class AbstractPath

java.lang.Object
  extended by com.caucho.servlets.webdav.AbstractPath
Direct Known Subclasses:
ApplicationPath

public abstract class AbstractPath
extends java.lang.Object

Represents a virtual filesystem.


Field Summary
protected static java.util.logging.Logger log
           
 
Constructor Summary
AbstractPath()
           
 
Method Summary
abstract  boolean canRead(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the file can be read.
 void destroy()
          Cleans up when no longer needed.
abstract  boolean exists(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the file exists.
 java.lang.String getAttribute(AttributeName name, java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns an attribute value.
 java.util.Iterator getAttributeNames(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns an iterator over the attribute names.
abstract  long getLastModified(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns the last modified time of the named file.
abstract  long getLength(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns the length of the named file.
abstract  boolean isDirectory(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the named file is a directory.
abstract  boolean isFile(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the named file is a file.
abstract  java.lang.String[] list(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns a list of the files in the directory.
abstract  boolean mkdir(java.lang.String path, HttpServletRequest request, ServletContext app)
          Creates the named directory.
abstract  java.io.InputStream openRead(java.lang.String path, HttpServletRequest request, ServletContext app)
          Opens an InputStream for reading
abstract  java.io.OutputStream openWrite(java.lang.String path, HttpServletRequest request, ServletContext app)
          Opens an OutputStream for writing.
abstract  boolean remove(java.lang.String path, HttpServletRequest request, ServletContext app)
          Deletes the file
 boolean removeAttribute(AttributeName name, java.lang.String path, HttpServletRequest request, ServletContext app)
          Removes an attribute value.
 boolean rename(java.lang.String path, java.lang.String destination, HttpServletRequest request, ServletContext app)
          Renames the file without forcing a copy.
abstract  boolean rmdir(java.lang.String path, HttpServletRequest request, ServletContext app)
          Removes the named directory.
 boolean setAttribute(AttributeName name, java.lang.String value, java.lang.String path, HttpServletRequest request, ServletContext app)
          Sets an attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log
Constructor Detail

AbstractPath

public AbstractPath()
Method Detail

isFile

public abstract boolean isFile(java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Returns true if the named file is a file.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

isDirectory

public abstract boolean isDirectory(java.lang.String path,
                                    HttpServletRequest request,
                                    ServletContext app)
                             throws java.io.IOException
Returns true if the named file is a directory.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

canRead

public abstract boolean canRead(java.lang.String path,
                                HttpServletRequest request,
                                ServletContext app)
                         throws java.io.IOException
Returns true if the file can be read.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

exists

public abstract boolean exists(java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Returns true if the file exists.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getLength

public abstract long getLength(java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Returns the length of the named file.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getLastModified

public abstract long getLastModified(java.lang.String path,
                                     HttpServletRequest request,
                                     ServletContext app)
                              throws java.io.IOException
Returns the last modified time of the named file.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getAttributeNames

public java.util.Iterator getAttributeNames(java.lang.String path,
                                            HttpServletRequest request,
                                            ServletContext app)
                                     throws java.io.IOException
Returns an iterator over the attribute names. Each attribute name is of the type AttributeName.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getAttribute

public java.lang.String getAttribute(AttributeName name,
                                     java.lang.String path,
                                     HttpServletRequest request,
                                     ServletContext app)
                              throws java.io.IOException
Returns an attribute value.

Parameters:
name - the attribute name
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

setAttribute

public boolean setAttribute(AttributeName name,
                            java.lang.String value,
                            java.lang.String path,
                            HttpServletRequest request,
                            ServletContext app)
                     throws java.io.IOException
Sets an attribute value.

Parameters:
name - the attribute name
value - the attribute value
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the setting was successful
Throws:
java.io.IOException

removeAttribute

public boolean removeAttribute(AttributeName name,
                               java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Removes an attribute value.

Parameters:
name - the attribute name
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

list

public abstract java.lang.String[] list(java.lang.String path,
                                        HttpServletRequest request,
                                        ServletContext app)
                                 throws java.io.IOException
Returns a list of the files in the directory.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

mkdir

public abstract boolean mkdir(java.lang.String path,
                              HttpServletRequest request,
                              ServletContext app)
                       throws java.io.IOException
Creates the named directory.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the creation succeeded.
Throws:
java.io.IOException

rmdir

public abstract boolean rmdir(java.lang.String path,
                              HttpServletRequest request,
                              ServletContext app)
                       throws java.io.IOException
Removes the named directory.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the remove succeeded.
Throws:
java.io.IOException

rename

public boolean rename(java.lang.String path,
                      java.lang.String destination,
                      HttpServletRequest request,
                      ServletContext app)
               throws java.io.IOException
Renames the file without forcing a copy. If rename returns true, use copy instead.

Parameters:
path - the requested relative path
destination - the new name
request - the servlet request
app - the servlet context
Returns:
true if the remove succeeded.
Throws:
java.io.IOException

remove

public abstract boolean remove(java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Deletes the file

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the remove succeeded.
Throws:
java.io.IOException

openWrite

public abstract java.io.OutputStream openWrite(java.lang.String path,
                                               HttpServletRequest request,
                                               ServletContext app)
                                        throws java.io.IOException
Opens an OutputStream for writing.

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
the output stream to the resource.
Throws:
java.io.IOException

openRead

public abstract java.io.InputStream openRead(java.lang.String path,
                                             HttpServletRequest request,
                                             ServletContext app)
                                      throws java.io.IOException
Opens an InputStream for reading

Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
the input stream to the resource.
Throws:
java.io.IOException

destroy

public void destroy()
Cleans up when no longer needed.