Interface DocumentWebDavService


public interface DocumentWebDavService
  • Method Details

    • getNamespaceContext

      NamespaceContext getNamespaceContext()
      Returns:
      NamespaceContext ,which will be used to write XML namespaces in resulted responses
    • getDaslValue

      String getDaslValue()
      Returns:
      HTTP 1.1 "Allow" header. See WebDAV/DASL Request and Response Syntax for more information.
    • toWebDavException

      WebDavException toWebDavException(Throwable throwable)
      Translates a failure raised by the storage implementation into the HTTP status it means, so that the transport layer does not have to know the storage's exception types. A repository that refuses an operation the user has no right to, for instance, means 403 and not 500.
      Parameters:
      throwable - the failure a WebDAV operation raised
      Returns:
      the exception to answer with, or null when the failure is not one the contract covers — which really is a 500
    • isFile

      boolean isFile(String resourcePath, String username)
      Parameters:
      resourcePath - File or Folder Path
      username - the user asking, whose own rights decide the answer: this reports on a resource they may have no right to see, so it is resolved against their session and not a system one
      Returns:
      true if the resource designated by the path is a file, else false. Note that on a path this user cannot resolve the implementation raises a WebDavException rather than returning false — it comes from the path resolution the authoritative lookup goes through, and escapes this signature because the implementation sneaky-throws it.
    • isFile

      @Deprecated(since="7.3.x") boolean isFile(String resourcePath)
      Deprecated.
      kept for binary compatibility only. It resolves the path with a system session, so it answers for any caller whatever their rights, and must not be used where the answer concerns a resource the caller may not be allowed to see. Use isFile(String, String), which resolves against the caller's own session. Since 7.3.x; not scheduled for removal.
      Parameters:
      resourcePath - File or Folder Path
      Returns:
      true if the resource designated by the path is a file, else false
    • download

      WebDavFileDownload download(String resourcePath, String version, String baseUri, String username) throws WebDavException
      Webdav GET of a given resource
      Parameters:
      resourcePath - File or Folder Path
      version - Resource Version
      baseUri - Base Request URI
      username - user login accessing the resource
      Returns:
      WebDavFileDownload containing the content of the file
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
    • get

      WebDavItem get(String resourcePath, String propRequestType, Set<QName> requestedPropertyNames, boolean requestPropertyNamesOnly, int depth, String baseUri, String username) throws WebDavException
      Parameters:
      resourcePath - File or Folder Path
      propRequestType - Requested properties retrieval type
      requestedPropertyNames - Requested property names
      requestPropertyNamesOnly - whether to get property names only or with the associated value(s)
      depth - resources retireval depth
      baseUri - Base Request URI
      username - user login accessing the resource
      Returns:
      WebDavItem corresponding to the requested resource
      Throws:
      WebDavException
    • createFolder

      void createFolder(String resourcePath, String folderType, String contentNodeType, String mixinTypes, List<String> lockTokens, String username) throws WebDavException
      Creates a new folder in the designated location
      Parameters:
      resourcePath - Folder Path to create
      folderType - Folder Type
      contentNodeType - Content Node Type
      mixinTypes - Folder Mixin Types
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The designated resource is locked
    • saveFile

      void saveFile(String resourcePath, String fileType, String contentNodeType, String mediaType, String mixinTypes, InputStream inputStream, List<String> lockTokens, String username) throws WebDavException
      Creates or Updates a designated resource
      Parameters:
      resourcePath - File or Folder Path
      fileType - File Type
      contentNodeType - Content Node Type
      mediaType - File Media Type
      mixinTypes - Mixin Types
      inputStream - File content
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated parent of the resource isn't found
      • - The designated resource is locked
    • saveProperties

      Map<String,Collection<WebDavItemProperty>> saveProperties(String resourcePath, List<WebDavItemProperty> propertiesToSave, List<WebDavItemProperty> propertiesToRemove, List<String> lockTokens, String username) throws WebDavException
      Create, update and delete properties of a designated resource
      Parameters:
      resourcePath - File or Folder Path
      propertiesToSave - List of properties to save
      propertiesToRemove - List of properties to remove
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Returns:
      Map of result of changes by type of result (Http Status) and list of properties
      Throws:
      WebDavException
    • delete

      void delete(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Webdav DELETE of a given resource
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
    • copy

      void copy(String resourcePath, String destinationPath, int depth, boolean overwrite, boolean removeDestination, WebDavItemProperty webDavItemProperty, List<String> lockTokens, String username) throws WebDavException
      Webdav COPY of a given resource into a designated resource path
      Parameters:
      resourcePath - File or Folder Path
      destinationPath - File destination Path
      depth - resources copy depth
      overwrite - whether to overwrite existing file if exists or not
      removeDestination - whether to remove destination if exists or not
      webDavItemProperty - WebDavItemProperty
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The destination designated resource path already exists and overwrite = false
    • move

      boolean move(String resourcePath, String destinationPath, boolean overwrite, List<String> lockTokens, String username) throws WebDavException
      Parameters:
      resourcePath - File or Folder Path
      destinationPath - File destination Path
      overwrite - whether to overwrite existing file if exists or not
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Returns:
      true if item already exists and was replaced else false
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resources
      • - The designated source resource isn't found
      • - The destination designated resource path already exists and overwrite = false
    • order

      boolean order(String resourcePath, List<WebDavItemOrder> members, List<String> lockTokens, String username) throws WebDavException
      Parameters:
      resourcePath - File or Folder Path
      members - List of WebDavItemOrder as identified members from WebDav client
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Returns:
      true if order change applied else false
      Throws:
      WebDavException
    • search

      List<WebDavItem> search(String resourcePath, String queryLanguage, String query, String baseUri, String username)
      Parameters:
      resourcePath - File or Folder Path
      queryLanguage - Query language (XPath or SQL)
      query - Query
      baseUri - Base Request URI
      username - user login making the changes
      Returns:
      List of WebDavItem
    • enableVersioning

      void enableVersioning(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Enables Versioning on the designated resource
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The designated resource is locked
    • getVersions

      List<WebDavItem> getVersions(String resourcePath, Set<QName> requestedPropertyNames, String baseUri, String username)
      Parameters:
      resourcePath - File or Folder Path
      requestedPropertyNames - Requested property names
      baseUri - Base Request URI
      username - user login making the changes
      Returns:
      List of WebDavItem representing the item versions
    • checkin

      void checkin(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Webdav CheckIn of a given resource in order to prepare generation of a version
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The designated resource is already checked in
      • - The designated resource is locked
    • checkout

      void checkout(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Webdav CheckOut of a given resource in order to generate a version
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The designated resource is already checked out
    • uncheckout

      void uncheckout(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The user doesn't have access to designated resource
      • - The designated resource isn't found
      • - The designated resource is not checked out
    • getLastModifiedDate

      long getLastModifiedDate(String resourcePath, String version, String username) throws WebDavException
      Parameters:
      resourcePath - File or Folder Path
      version - File version
      Returns:
      last Modified Date of a resource designated by its path
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The designated resource isn't found
    • getLastModifiedDate

      @Deprecated(since="7.3.x") long getLastModifiedDate(String resourcePath, String version) throws WebDavException
      Deprecated.
      kept for binary compatibility only. It resolves the path with a system session, so it answers for any caller whatever their rights — a conditional request answered from it discloses a resource's existence and its exact modification date. Use getLastModifiedDate(String, String, String), which resolves against the caller's own session. Since 7.3.x; not scheduled for removal.
      Parameters:
      resourcePath - File or Folder Path
      version - version name, null for the head
      Returns:
      the last modification date in milliseconds, 0 when there is none
      Throws:
      WebDavException - when the resource cannot be resolved
    • lock

      WebDavLockResponse lock(String resourcePath, int depth, int lockTimeout, boolean bodyIsEmpty, List<String> lockTokens, String username) throws WebDavException
      Add a lock on a designated resource
      Parameters:
      resourcePath - File or Folder Path
      depth - resources copy depth
      lockTimeout - Lock timeout
      bodyIsEmpty - whether the body doesn't exists or not
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Returns:
      WebDavLockResponse
      Throws:
      WebDavException - when:
      • - Parameters aren't compliant to expected method inputs
      • - The designated resource is locked
    • unlock

      void unlock(String resourcePath, List<String> lockTokens, String username) throws WebDavException
      Removes a previously added lock from a designated resource
      Parameters:
      resourcePath - File or Folder Path
      lockTokens - Already Hold Lock Tokens by the WebDav Session
      username - user login making the changes
      Throws:
      WebDavException
    • getWebDavPath

      String getWebDavPath(String jcrPath, String username) throws WebDavException
      Returns the WebDav Path of a given JCR Path
      Parameters:
      jcrPath - JCR Full Path
      username - user login accessing the file
      Returns:
      WebDav Path
      Throws:
      WebDavException - when not permitted or not found