Package com.jalios.jcms.webdav.file
Class FileWebdavResource
- java.lang.Object
-
- com.jalios.jcms.webdav.WebdavResource
-
- com.jalios.jcms.webdav.file.FileWebdavResource
-
- All Implemented Interfaces:
java.lang.Comparable<WebdavResource>
public class FileWebdavResource extends WebdavResource
A File Representation of a resource in the Webdav FileSystem- Since:
- jcms-5.5.0
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description java.io.File
resourceFile
-
Fields inherited from class com.jalios.jcms.webdav.WebdavResource
possibleFile, uri
-
-
Constructor Summary
Constructors Constructor Description FileWebdavResource(java.lang.String uri, WebdavContext ctxt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.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 contentjava.lang.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.java.io.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(java.io.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
-
-
-
-
Constructor Detail
-
FileWebdavResource
public FileWebdavResource(java.lang.String uri, WebdavContext ctxt)
-
-
Method Detail
-
getChildren
public java.util.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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- 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 classWebdavResource
- Parameters:
ctxt
- the Webdav Context- Returns:
- long the LastModified of the resource
- See Also:
WebdavResource.getLastModified(WebdavContext)
-
getContentType
public java.lang.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 classWebdavResource
- 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 java.io.InputStream getResourceStream(WebdavContext ctxt) throws java.io.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 classWebdavResource
- Parameters:
ctxt
- the Webdav Context- Returns:
- InputStream an open stream to the resource
- Throws:
java.io.IOException
- See Also:
WebdavResource.getResourceStream(WebdavContext)
-
setResourceStream
public boolean setResourceStream(java.io.InputStream in, WebdavContext ctxt) throws java.io.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 classWebdavResource
- Parameters:
in
- the Request InputStreamctxt
- the Webdav Context- Returns:
- boolean if the set has been correctly done
- Throws:
java.io.IOException
- See Also:
WebdavResource.setResourceStream(InputStream, WebdavContext)
-
-