Package com.jalios.jcms.webdav.cat
Class CatWebdavFileSystem
- java.lang.Object
-
- com.jalios.jcms.webdav.WebdavFileSystem
-
- com.jalios.jcms.webdav.cat.CatWebdavFileSystem
-
public class CatWebdavFileSystem extends WebdavFileSystem
A JCMS Representation of a Webdav FileSystem The root directory will be defined by servlet configuration parameter "RootPath"- Since:
- jcms-5.5.0
- Version:
- $Revision: 101955 $
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REVISION
protected Data
root
protected static org.apache.oro.text.regex.Pattern
silentFilterPattern
-
Fields inherited from class com.jalios.jcms.webdav.WebdavFileSystem
resourceLocks
-
-
Constructor Summary
Constructors Constructor Description CatWebdavFileSystem(WebdavContext ctxt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFileDocument(java.util.Set<Data> childrenSet, Member loggedMember, Workspace workspace, Category category)
boolean
canBeReadBy(Data data, Member loggedMember)
boolean
canReadData(Data data, boolean recursive, WebdavContext ctxt)
Check if the data can be read given the current contextprotected boolean
checkSetNewWorkspace(Workspace oldWS, Workspace newWS, java.util.Set<Category> pubCatSet)
boolean
copyFolder(WebdavResource src, WebdavResource tgt, boolean overwrite, boolean recursive, WebdavContext ctxt)
boolean
copyMoveFile(WebdavResource src, WebdavResource tgt, boolean move, WebdavContext ctxt)
This method Copy/Move a resource to a given target locationboolean
createFile(WebdavResource res, WebdavContext ctxt)
Create a resource child of a given folder with the given name If child already exists in JCMS then recaterize itboolean
createFolder(WebdavResource res, WebdavContext ctxt)
Create a given target folderboolean
deleteFile(WebdavResource res, WebdavContext ctxt)
Delete a given target fileboolean
deleteFolder(WebdavResource res, WebdavContext ctxt)
Delete a given target folderboolean
doCopy(WebdavResource source, WebdavResource target, boolean overwrite, boolean recursive, WebdavContext ctxt)
This method perform copy from one Webdav Resource to an Otherboolean
doCreate(WebdavResource resource, boolean overwrite, boolean isFolder, WebdavContext ctxt)
This method perform create from one Webdav Resourceboolean
doDelete(WebdavResource resource, boolean recursive, WebdavContext ctxt)
This method perform delete from one Webdav Resourceboolean
doMove(WebdavResource source, WebdavResource target, boolean overwrite, boolean recursive, WebdavContext ctxt)
This method perform move from one Webdav Resource to an Otherlong
getContentLength(Data data, WebdavContext ctxt)
This method return the length of the ressourcejava.lang.String
getContentType(Data data, WebdavContext ctxt)
This method return the content type of the ressourcejava.util.Collection<Data>
getDataChildrenSet(Data parent, WebdavContext ctxt)
Data
getDataFromName(java.lang.String name, Data parent, boolean onlyFolders, WebdavContext ctxt)
Return the Data represented by the given short uriData
getDataFromUri(java.lang.String uri, WebdavContext ctxt)
Retrieve the Data from the given URI Starting from the given root.java.lang.String
getNameFromData(Data data, WebdavContext ctxt)
This method return the short name of the given data (Category or FileDocument) for this implementationWebdavResource
getResource(java.lang.String uri, WebdavContext ctxt)
Lookup the resource represented by the given URI.java.io.InputStream
getResourceStream(Data data, WebdavContext ctxt)
This method return the resource input streamWorkspace
getWorkspaceFromURI(java.lang.String uri, WebdavContext ctxt)
This method return the Workspace bind to the given URI.void
init()
Called after authentication for each request.boolean
isExisting(Data data, WebdavContext ctxt)
This method return true if the Data is existingboolean
isFile(Data data, WebdavContext ctxt)
This method return true if the Data is a Fileboolean
isFolder(Data data, WebdavContext ctxt)
This method return true if the Data is a Folderboolean
isReadable(WebdavResource res, boolean recursive, WebdavContext ctxt)
Check if the resource is Readableboolean
isReadOnly(WebdavContext ctxt)
Check if the FileSystem is ReadOnly.boolean
isWritable(WebdavResource res, boolean recursive, boolean overwrite, WebdavContext ctxt)
Check if the resource is Writableboolean
moveFolder(WebdavResource src, WebdavResource tgt, boolean overwrite, boolean recursive, WebdavContext ctxt)
This method will move a given source to target location If target folder already exists then: - Copy all children of the target under source - Then copy all children of source under target - Then remove sourceWebdavLock
newLock(WebdavResource resource, WebdavContext ctxt)
This method will return a new WebdavLock implementationboolean
renameFile(WebdavResource src, WebdavResource tgt, WebdavContext ctxt)
Rename the given WebdavResource file to the given target resourceboolean
renameFolder(WebdavResource src, WebdavResource tgt, WebdavContext ctxt)
Rename the given WebdavResource folder to the given target resourceboolean
setResourceStream(Data data, java.io.File tmp, WebdavContext ctxt)
Update/Override the FileDocumentprotected boolean
silentFilterResource(WebdavResource resource, WebdavContext ctxt)
Return true if the resource should be silently ignored.-
Methods inherited from class com.jalios.jcms.webdav.WebdavFileSystem
afterDoDelete, afterDoMove, doLock, doPut, doUnlock, getAbsoluteUri, getDescendantLocks, getLocks, getRelativeUri, hasInternalLock, isInternallyLocked, isListing, matchesIfHeaderCondition, normalize, putLock, putLocks, refreshLock, removeLock, removeLocks
-
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
root
protected Data root
-
silentFilterPattern
protected static final org.apache.oro.text.regex.Pattern silentFilterPattern
-
-
Constructor Detail
-
CatWebdavFileSystem
public CatWebdavFileSystem(WebdavContext ctxt)
-
-
Method Detail
-
init
public void init()
Description copied from class:WebdavFileSystem
Called after authentication for each request. Used to initialized cached data.- Overrides:
init
in classWebdavFileSystem
- See Also:
WebdavFileSystem.init()
-
getResource
public WebdavResource getResource(java.lang.String uri, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
Lookup the resource represented by the given URI. The resource must be a relative URI to the path folders starting and ending by '/'. ie /my/path/resource.ext -> /my/path/resource.ext
ie /my/path/ -> /my/path/- Specified by:
getResource
in classWebdavFileSystem
- Parameters:
uri
- the resource URIctxt
- the Webdav Context- Returns:
- WebdavResource the resource representing the given URI
- See Also:
WebdavFileSystem.getResource(String, WebdavContext)
-
doCopy
public boolean doCopy(WebdavResource source, WebdavResource target, boolean overwrite, boolean recursive, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
This method perform copy from one Webdav Resource to an Other- Overrides:
doCopy
in classWebdavFileSystem
- Parameters:
source
- a Webdav Resourcetarget
- a Webdav Resourceoverwrite
- a boolean indicate to overite or not the resourcerecursive
- is it a recursive copyctxt
- the Webdav Context- Returns:
- boolean true if the copy has been done otherwise false
- See Also:
WebdavFileSystem.doCopy(WebdavResource, WebdavResource, boolean, boolean, WebdavContext)
-
doMove
public boolean doMove(WebdavResource source, WebdavResource target, boolean overwrite, boolean recursive, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
This method perform move from one Webdav Resource to an Other- Overrides:
doMove
in classWebdavFileSystem
- Parameters:
source
- a Webdav Resourcetarget
- a Webdav Resourceoverwrite
- a boolean indicate to overite or not the resourcerecursive
- is it a recursive copyctxt
- the Webdav Context- Returns:
- boolean true if the move has been done otherwise false
- See Also:
WebdavFileSystem.doMove(WebdavResource, WebdavResource, boolean, boolean, WebdavContext)
-
doCreate
public boolean doCreate(WebdavResource resource, boolean overwrite, boolean isFolder, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
This method perform create from one Webdav Resource- Specified by:
doCreate
in classWebdavFileSystem
- Parameters:
resource
- the Webdav Resourceoverwrite
- a boolean indicate to ovewrite the resourceisFolder
- create a File or a Folder- Returns:
- boolean true if the create has been done otherwise false
- See Also:
WebdavFileSystem.doCreate(WebdavResource, boolean, boolean, WebdavContext)
-
doDelete
public boolean doDelete(WebdavResource resource, boolean recursive, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
This method perform delete from one Webdav Resource- Overrides:
doDelete
in classWebdavFileSystem
- Parameters:
resource
- the Webdav Resourcerecursive
- is it a recursive delete- Returns:
- boolean true if the delete has been done otherwise false
- See Also:
WebdavFileSystem.doDelete(WebdavResource, boolean, WebdavContext)
-
isReadOnly
public boolean isReadOnly(WebdavContext ctxt)
Description copied from class:WebdavFileSystem
Check if the FileSystem is ReadOnly. Default implementation always return false- Overrides:
isReadOnly
in classWebdavFileSystem
- Parameters:
ctxt
- the Webdav Context- Returns:
- true if the FileSystem is Read Only
-
getDataFromUri
public Data getDataFromUri(java.lang.String uri, WebdavContext ctxt)
Retrieve the Data from the given URI Starting from the given root.- Parameters:
uri
- the relative urictxt
- the Webdav Context- Returns:
- Data the Data for the given URI
-
getDataFromName
public Data getDataFromName(java.lang.String name, Data parent, boolean onlyFolders, WebdavContext ctxt)
Return the Data represented by the given short uri- Parameters:
name
- the short uri nameparent
- the Parent DataonlyFolders
- if true only folders data are returnedctxt
- the Webdav Context- Returns:
- Data the Data targeted by the given name
-
getNameFromData
public java.lang.String getNameFromData(Data data, WebdavContext ctxt)
This method return the short name of the given data (Category or FileDocument) for this implementation- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- String the name of the Data
-
canReadData
public boolean canReadData(Data data, boolean recursive, WebdavContext ctxt)
Check if the data can be read given the current context- Parameters:
data
- the given Datarecursive
- check parent and childrenctxt
- the Webdav Context- Returns:
- true if resource can be read
-
isExisting
public boolean isExisting(Data data, WebdavContext ctxt)
This method return true if the Data is existing- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- boolean true if it exists
-
isFolder
public boolean isFolder(Data data, WebdavContext ctxt)
This method return true if the Data is a Folder- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- boolean true if it is a folder
-
isFile
public boolean isFile(Data data, WebdavContext ctxt)
This method return true if the Data is a File- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- boolean true if it is a file
-
getContentLength
public long getContentLength(Data data, WebdavContext ctxt)
This method return the length of the ressource- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- long the length of the resource
-
getContentType
public java.lang.String getContentType(Data data, WebdavContext ctxt)
This method return the content type of the ressource- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- String the content type of the resource
-
getDataChildrenSet
public java.util.Collection<Data> getDataChildrenSet(Data parent, WebdavContext ctxt)
-
addFileDocument
public void addFileDocument(java.util.Set<Data> childrenSet, Member loggedMember, Workspace workspace, Category category)
-
getWorkspaceFromURI
public Workspace getWorkspaceFromURI(java.lang.String uri, WebdavContext ctxt)
This method return the Workspace bind to the given URI.- Parameters:
uri
- the resource URIctxt
- the WebdavContext- Returns:
- Workspace
-
getResourceStream
public java.io.InputStream getResourceStream(Data data, WebdavContext ctxt) throws java.io.IOException
This method return the resource input stream- Parameters:
data
- the given Datactxt
- the Webdav Context- Returns:
- InputStream the InputStream content of the resource
- Throws:
java.io.IOException
-
setResourceStream
public boolean setResourceStream(Data data, java.io.File tmp, WebdavContext ctxt) throws java.io.FileNotFoundException
Update/Override the FileDocument- Parameters:
data
- the given Datatmp
- the temporary downloaded filectxt
- the Webdav Context- Returns:
- boolean true if resource stream has been correctly set
- Throws:
java.io.FileNotFoundException
-
silentFilterResource
protected boolean silentFilterResource(WebdavResource resource, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
Return true if the resource should be silently ignored.- Overrides:
silentFilterResource
in classWebdavFileSystem
- Parameters:
resource
- the WebdavResourcectxt
- the WebdavContext- Returns:
- boolean true to ignore resource
-
createFolder
public boolean createFolder(WebdavResource res, WebdavContext ctxt)
Create a given target folder- Parameters:
res
- the Webdav Resourcectxt
- the Webdav Context- Returns:
- true if folder has been created
-
createFile
public boolean createFile(WebdavResource res, WebdavContext ctxt)
Create a resource child of a given folder with the given name If child already exists in JCMS then recaterize it- Parameters:
res
- the Webdav Resourcectxt
- the Webdav Context- Returns:
- true if file has been created
-
deleteFolder
public boolean deleteFolder(WebdavResource res, WebdavContext ctxt)
Delete a given target folder- Parameters:
res
- the Webdav Resourcectxt
- the Webdav Context- Returns:
- true if flder has been deleted
-
deleteFile
public boolean deleteFile(WebdavResource res, WebdavContext ctxt)
Delete a given target file- Parameters:
res
- the Webdav Resourcectxt
- the WebdavContext- Returns:
- true if flder has been deleted
-
renameFile
public boolean renameFile(WebdavResource src, WebdavResource tgt, WebdavContext ctxt)
Rename the given WebdavResource file to the given target resource- Parameters:
src
- a Webdav Resourcetgt
- a Webdav Resourcectxt
- a Webdav Context- Returns:
- true if renaming is done
-
renameFolder
public boolean renameFolder(WebdavResource src, WebdavResource tgt, WebdavContext ctxt)
Rename the given WebdavResource folder to the given target resource- Parameters:
src
- a Webdav Resourcetgt
- a Webdav Resourcectxt
- a Webdav Context- Returns:
- true if renaming is done
-
copyFolder
public boolean copyFolder(WebdavResource src, WebdavResource tgt, boolean overwrite, boolean recursive, WebdavContext ctxt)
- Parameters:
src
- Source Foldertgt
- Target Folderoverwrite
- boolean to overwrite targetrecursive
- boolean to do a recursive movectxt
- the Webdav Context- Returns:
- true if move has been done
-
moveFolder
public boolean moveFolder(WebdavResource src, WebdavResource tgt, boolean overwrite, boolean recursive, WebdavContext ctxt)
This method will move a given source to target location If target folder already exists then: - Copy all children of the target under source - Then copy all children of source under target - Then remove source- Parameters:
src
- Source Foldertgt
- Target Folderoverwrite
- boolean to overwrite targetrecursive
- boolean to do a recursive movectxt
- the Webdav Context- Returns:
- true if move has been done
-
copyMoveFile
public boolean copyMoveFile(WebdavResource src, WebdavResource tgt, boolean move, WebdavContext ctxt)
This method Copy/Move a resource to a given target location- Parameters:
src
- the webdav sourcetgt
- the webdav targetmove
- the action to doctxt
- the Webdav Context- Returns:
- true if action has been done correctly
-
checkSetNewWorkspace
protected boolean checkSetNewWorkspace(Workspace oldWS, Workspace newWS, java.util.Set<Category> pubCatSet)
-
isReadable
public boolean isReadable(WebdavResource res, boolean recursive, WebdavContext ctxt)
Check if the resource is Readable- Parameters:
res
- the Webdav Resourcerecursive
- recursive checkctxt
- the Webdav Context- Returns:
- true if the WebdavResource is Writable
-
isWritable
public boolean isWritable(WebdavResource res, boolean recursive, boolean overwrite, WebdavContext ctxt)
Check if the resource is Writable- Parameters:
res
- the Webdav Resourcerecursive
- recursive checkoverwrite
- overwrite flagctxt
- the Webdav Context- Returns:
- true if the WebdavResource is Writable
-
newLock
public WebdavLock newLock(WebdavResource resource, WebdavContext ctxt)
Description copied from class:WebdavFileSystem
This method will return a new WebdavLock implementation- Specified by:
newLock
in classWebdavFileSystem
- Parameters:
resource
- the Webdav Resourcectxt
- the Webdav Context- Returns:
- a new WebdavLock
- See Also:
WebdavFileSystem.newLock(WebdavResource, WebdavContext)
-
-