Class LocalFileSystemStore

  • All Implemented Interfaces:
    WebdavStore

    public class LocalFileSystemStore
    extends Object
    implements WebdavStore
    Reference Implementation of WebdavStore
    Author:
    joa, re
    • Constructor Detail

      • LocalFileSystemStore

        public LocalFileSystemStore​(File root)
    • Method Detail

      • destroy

        public void destroy()
        Description copied from interface: WebdavStore
        Life cycle method, called by WebdavServlet's destroy() method. Should be used to clean up resources.
        Specified by:
        destroy in interface WebdavStore
      • checkAuthentication

        public void checkAuthentication​(Transaction transaction)
        Description copied from interface: WebdavStore
        Checks if authentication information passed in is valid. If not throws an exception.
        Specified by:
        checkAuthentication in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
      • commit

        public void commit​(Transaction transaction)
        Description copied from interface: WebdavStore
        Indicates that all changes done inside this request shall be made permanent and any transactions, connections and other temporary resources shall be terminated.
        Specified by:
        commit in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
      • rollback

        public void rollback​(Transaction transaction)
        Description copied from interface: WebdavStore
        Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.
        Specified by:
        rollback in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
      • createFolder

        public void createFolder​(Transaction transaction,
                                 String uri)
        Description copied from interface: WebdavStore
        Creates a folder at the position specified by folderUri.
        Specified by:
        createFolder in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the folder
      • createResource

        public void createResource​(Transaction transaction,
                                   String uri)
        Description copied from interface: WebdavStore
        Creates a content resource at the position specified by resourceUri.
        Specified by:
        createResource in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the content resource
      • getResourceContent

        public InputStream getResourceContent​(Transaction transaction,
                                              String uri)
        Description copied from interface: WebdavStore
        Gets the content of the resource specified by resourceUri.
        Specified by:
        getResourceContent in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the content resource
        Returns:
        input stream you can read the content of the resource from
      • setResourceContent

        public long setResourceContent​(Transaction transaction,
                                       String uri,
                                       InputStream is,
                                       String contentType,
                                       String characterEncoding)
        Description copied from interface: WebdavStore
        Sets / stores the content of the resource specified by resourceUri.
        Specified by:
        setResourceContent in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the resource where the content will be stored
        is - input stream from which the content will be read from
        contentType - content type of the resource or null if unknown
        characterEncoding - character encoding of the resource or null if unknown or not applicable
        Returns:
        lenght of resource
      • getChildrenNames

        public String[] getChildrenNames​(Transaction transaction,
                                         String uri)
        Description copied from interface: WebdavStore
        Gets the names of the children of the folder specified by folderUri.
        Specified by:
        getChildrenNames in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the folder
        Returns:
        a (possibly empty) list of children, or null if the uri points to a file
      • removeObject

        public void removeObject​(Transaction transaction,
                                 String uri)
        Description copied from interface: WebdavStore
        Removes the object specified by uri.
        Specified by:
        removeObject in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the object, i.e. content resource or folder
      • getResourceLength

        public long getResourceLength​(Transaction transaction,
                                      String uri)
        Description copied from interface: WebdavStore
        Gets the length of the content resource specified by resourceUri.
        Specified by:
        getResourceLength in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI of the content resource
        Returns:
        length of the resource in bytes, -1 declares this value as invalid and asks the adapter to try to set it from the properties if possible
      • getStoredObject

        public StoredObject getStoredObject​(Transaction transaction,
                                            String uri)
        Description copied from interface: WebdavStore
        Gets the storedObject specified by uri
        Specified by:
        getStoredObject in interface WebdavStore
        Parameters:
        transaction - indicates that the method is within the scope of a WebDAV transaction
        uri - URI
        Returns:
        StoredObject