com.jalios.jcms.webdav.cat
Class CatWebdavResource

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

public class CatWebdavResource
extends WebdavResource

A File Representation of a resource in the Webdav FileSystem

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

Field Summary
 Data resourceData
           
static String REVISION
           
 
Fields inherited from class com.jalios.jcms.webdav.WebdavResource
possibleFile, uri
 
Constructor Summary
CatWebdavResource(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 isReadable(boolean recursive, WebdavContext ctxt)
          This method will return true if the resource can be read by the context.
 boolean isWritable(boolean recursive, boolean overwrite, WebdavContext ctxt)
          This method will return true if the resource can be write by the context.
 void setPath(String uri, WebdavContext ctxt)
           
 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, isHidden, isPossibleFile, putLock, putLocks, 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

resourceData

public Data resourceData
Constructor Detail

CatWebdavResource

public CatWebdavResource(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)

setPath

public void setPath(String uri,
                    WebdavContext ctxt)
Overrides:
setPath in class WebdavResource
See Also:
WebdavResource.setPath(String, 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)

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)

isReadable

public boolean isReadable(boolean recursive,
                          WebdavContext ctxt)
Description copied from class: WebdavResource
This method will return true if the resource can be read by the context. Default implementation always return true to avoid security purpose.

Overrides:
isReadable in class WebdavResource
Parameters:
recursive - Check if children are also readable
ctxt - the Webdav Context
Returns:
true if the resource can be read
See Also:
WebdavResource.isReadable(boolean, WebdavContext)

isWritable

public boolean isWritable(boolean recursive,
                          boolean overwrite,
                          WebdavContext ctxt)
Description copied from class: WebdavResource
This method will return true if the resource can be write by the context. Default implementation always return true to avoid security purpose. Warning! Write also mean update or delete.

Overrides:
isWritable in class WebdavResource
Parameters:
recursive - Check if children are also writable
overwrite - Inform that resources will be overwrited if exists
ctxt - the Webdav Context
Returns:
true if the resource can be write
See Also:
WebdavResource.isWritable(boolean, boolean, WebdavContext)


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