com.jalios.jcms.webdav.file
Class FileWebdavResource

java.lang.Object
  extended by com.jalios.jcms.webdav.WebdavResource
      extended by com.jalios.jcms.webdav.file.FileWebdavResource
All Implemented Interfaces:
Comparable<WebdavResource>

public class FileWebdavResource
extends WebdavResource

A File Representation of a resource in the Webdav FileSystem

Since:
jcms-5.5.0
Version:
$Revision: 27753 $
Author:
Jean-Philippe Encausse

Field Summary
 File resourceFile
           
static String REVISION
           
 
Fields inherited from class com.jalios.jcms.webdav.WebdavResource
possibleFile, uri
 
Constructor Summary
FileWebdavResource(String uri, WebdavContext ctxt)
           
 
Method Summary
 Collection<WebdavResource> getChildren(WebdavContext ctxt)
          Return all the Children of the resource.
 long getContentLength(WebdavContext ctxt)
          Return the size of the resource or 0 if there is no content
 String getContentType(WebdavContext ctxt)
          This method have to return the Content Type of the resource with the Content Encoding ie "text/html; charset=UTF-8" It is the media type defined in section 3.7 of [RFC2068] If no content type then return ""
 long getCreationDate(WebdavContext ctxt)
          Return long representing the Creation of the resource It contains a timestamp of the moment when the resource was created (i.e., the moment it had non-null state).
 long getLastModified(WebdavContext ctxt)
          Return long representing the LastModified of the resource Note that the last-modified date on a resource may reflect changes in any part of the state of the resource, not necessarily just a change to the response to the GET method.
 InputStream getResourceStream(WebdavContext ctxt)
          This method have to return an InputStream on the resource.
 boolean isExisting(WebdavContext ctxt)
          Check if the resource exists in the UserFileSystem This method is abstract and must be implemented by the UserFileSystem.
 boolean isFile(WebdavContext ctxt)
          This method will check if the resource is a File or a Folder.
 boolean isFolder(WebdavContext ctxt)
          This method will check if the resource is a File or a Folder.
 boolean isHidden(WebdavContext ctxt)
          This method will return true if the resource isHidden.
 boolean setResourceStream(InputStream in, WebdavContext ctxt)
          This method have to return an InputStream on the resource.
 
Methods inherited from class com.jalios.jcms.webdav.WebdavResource
checkUnlockAccess, compareTo, equals, getContentLanguage, getDescendantLocks, getETag, getLastAccessed, getLocks, getName, getParent, getPath, hasExclusiveLockAccess, hasLockAccess, isPossibleFile, isReadable, isWritable, putLock, putLocks, setPath, setPossibleContent, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

resourceFile

public File resourceFile
Constructor Detail

FileWebdavResource

public FileWebdavResource(String uri,
                          WebdavContext ctxt)
Method Detail

getChildren

public Collection<WebdavResource> getChildren(WebdavContext ctxt)
Description copied from class: WebdavResource
Return all the Children of the resource. This method is abstract and must be implemented by the UserFileSystem.

Specified by:
getChildren in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
Collection a Collection of WebdavResource
See Also:
WebdavResource.getChildren(WebdavContext)

isExisting

public boolean isExisting(WebdavContext ctxt)
Description copied from class: WebdavResource
Check if the resource exists in the UserFileSystem This method is abstract and must be implemented by the UserFileSystem.

Specified by:
isExisting in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
true if the resource exists
See Also:
WebdavResource.isExisting(WebdavContext)

isFile

public boolean isFile(WebdavContext ctxt)
Description copied from class: WebdavResource
This method will check if the resource is a File or a Folder. Default implementation assume a File is a Collection without children.

Overrides:
isFile in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
true if the resource is a File (ie Collection without children)
See Also:
WebdavResource.isFile(WebdavContext)

isFolder

public boolean isFolder(WebdavContext ctxt)
Description copied from class: WebdavResource
This method will check if the resource is a File or a Folder. Default implementation return !isFile()

Overrides:
isFolder in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
true if the resource is a Folder (ie Collection)
See Also:
WebdavResource.isFolder(WebdavContext)

isHidden

public boolean isHidden(WebdavContext ctxt)
Description copied from class: WebdavResource
This method will return true if the resource isHidden. Default implementation always return false to ignore this behavior. Warning! Hidden doesn't mean not readable but only hide from default user interface.

Overrides:
isHidden in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
true if the resource is hidden
See Also:
WebdavResource.isHidden(WebdavContext)

getContentLength

public long getContentLength(WebdavContext ctxt)
Description copied from class: WebdavResource
Return the size of the resource or 0 if there is no content

Specified by:
getContentLength in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
long the size of the file or 0 if it is a folder
See Also:
WebdavResource.getContentLength(WebdavContext)

getCreationDate

public long getCreationDate(WebdavContext ctxt)
Description copied from class: WebdavResource
Return long representing the Creation of the resource It contains a timestamp of the moment when the resource was created (i.e., the moment it had non-null state).

Specified by:
getCreationDate in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
long the LastModified of the resource
See Also:
WebdavResource.getCreationDate(WebdavContext)

getLastModified

public long getLastModified(WebdavContext ctxt)
Description copied from class: WebdavResource
Return long representing the LastModified of the resource Note that the last-modified date on a resource may reflect changes in any part of the state of the resource, not necessarily just a change to the response to the GET method. For example, a change in a property may cause the last-modified date to change.

Specified by:
getLastModified in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
long the LastModified of the resource
See Also:
WebdavResource.getLastModified(WebdavContext)

getContentType

public String getContentType(WebdavContext ctxt)
Description copied from class: WebdavResource
This method have to return the Content Type of the resource with the Content Encoding ie "text/html; charset=UTF-8" It is the media type defined in section 3.7 of [RFC2068] If no content type then return ""

Specified by:
getContentType in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
String a String that describe the resource ContentType or "application/octet-stream"
See Also:
WebdavResource.getContentType(WebdavContext)

getResourceStream

public InputStream getResourceStream(WebdavContext ctxt)
                              throws IOException
Description copied from class: WebdavResource
This method have to return an InputStream on the resource. The Stream will be Buffered and Closed by the caller.

Specified by:
getResourceStream in class WebdavResource
Parameters:
ctxt - the Webdav Context
Returns:
InputStream an open stream to the resource
Throws:
IOException
See Also:
WebdavResource.getResourceStream(WebdavContext)

setResourceStream

public boolean setResourceStream(InputStream in,
                                 WebdavContext ctxt)
                          throws IOException
Description copied from class: WebdavResource
This method have to return an InputStream on the resource. The Stream will be Buffered and Closed by the caller. But this method may close the Stream.

Specified by:
setResourceStream in class WebdavResource
Parameters:
in - the Request InputStream
ctxt - the Webdav Context
Returns:
boolean if the set has been correctly done
Throws:
IOException
See Also:
WebdavResource.setResourceStream(InputStream, WebdavContext)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.