Class 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
    • Constructor Detail

      • CatWebdavFileSystem

        public CatWebdavFileSystem​(WebdavContext ctxt)
    • Method Detail

      • 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 class WebdavFileSystem
        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 uri
        ctxt - 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 name
        parent - the Parent Data
        onlyFolders - if true only folders data are returned
        ctxt - 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 Data
        ctxt - 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 Data
        recursive - check parent and children
        ctxt - the Webdav Context
        Returns:
        true if resource can be read
      • canBeReadBy

        public boolean canBeReadBy​(Data data,
                                   Member loggedMember)
      • isExisting

        public boolean isExisting​(Data data,
                                  WebdavContext ctxt)
        This method return true if the Data is existing
        Parameters:
        data - the given Data
        ctxt - 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 Data
        ctxt - 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 Data
        ctxt - 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 Data
        ctxt - 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 Data
        ctxt - 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 URI
        ctxt - 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 Data
        ctxt - 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 Data
        tmp - the temporary downloaded file
        ctxt - the Webdav Context
        Returns:
        boolean true if resource stream has been correctly set
        Throws:
        java.io.FileNotFoundException
      • createFolder

        public boolean createFolder​(WebdavResource res,
                                    WebdavContext ctxt)
        Create a given target folder
        Parameters:
        res - the Webdav Resource
        ctxt - 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 Resource
        ctxt - 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 Resource
        ctxt - 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 Resource
        ctxt - 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 Resource
        tgt - a Webdav Resource
        ctxt - 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 Resource
        tgt - a Webdav Resource
        ctxt - 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 Folder
        tgt - Target Folder
        overwrite - boolean to overwrite target
        recursive - boolean to do a recursive move
        ctxt - 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 Folder
        tgt - Target Folder
        overwrite - boolean to overwrite target
        recursive - boolean to do a recursive move
        ctxt - 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 source
        tgt - the webdav target
        move - the action to do
        ctxt - 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 Resource
        recursive - recursive check
        ctxt - 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 Resource
        recursive - recursive check
        overwrite - overwrite flag
        ctxt - the Webdav Context
        Returns:
        true if the WebdavResource is Writable