Interface CloudClient


  • public interface CloudClient
    Wrapper interface abstracting cloud provider clients
    • Method Detail

      • bucket

        String bucket()
        The name of the bucket the OCFL repository is in.
        Returns:
        bucket name
      • prefix

        String prefix()
        The key prefix of all objects within the OCFL repository. This may be empty. Multiple different OCFL repositories may be stored in the same bucket if they use different key prefixes.
        Returns:
        the key prefix common to all objects in the repository
      • uploadFile

        CloudObjectKey uploadFile​(Path srcPath,
                                  String dstPath)
        Uploads a file to the destination, and returns the object key.
        Parameters:
        srcPath - src file
        dstPath - object path
        Returns:
        object key
      • uploadFile

        CloudObjectKey uploadFile​(Path srcPath,
                                  String dstPath,
                                  String contentType)
        Uploads a file to the destination, and returns the object key.
        Parameters:
        srcPath - src file
        dstPath - object path
        contentType - the content type of the data
        Returns:
        object key
      • uploadBytes

        CloudObjectKey uploadBytes​(String dstPath,
                                   byte[] bytes,
                                   String contentType)
        Uploads an object with byte content
        Parameters:
        dstPath - object path
        bytes - the object content
        contentType - the content type of the data
        Returns:
        object key
      • copyObject

        CloudObjectKey copyObject​(String srcPath,
                                  String dstPath)
        Copies an object from one location to another within the same bucket.
        Parameters:
        srcPath - source object key
        dstPath - destination object path
        Returns:
        the destination key
        Throws:
        KeyNotFoundException - when srcPath not found
      • downloadFile

        Path downloadFile​(String srcPath,
                          Path dstPath)
        Downloads an object to the local filesystem.
        Parameters:
        srcPath - object key
        dstPath - path to write the file to
        Returns:
        the destination path
        Throws:
        KeyNotFoundException - when srcPath not found
      • downloadStream

        InputStream downloadStream​(String srcPath)
        Downloads and object and performs a fixity check as it streams to disk.
        Parameters:
        srcPath - object key
        Returns:
        stream of object content
        Throws:
        KeyNotFoundException - when srcPath not found
      • downloadString

        String downloadString​(String srcPath)
        Downloads an object to a string. This assumes that the object is UTF-8 encoded.
        Parameters:
        srcPath - object key
        Returns:
        string content of the object
        Throws:
        KeyNotFoundException - when srcPath not found
      • head

        HeadResult head​(String path)
        Heads the object at the specified path.
        Parameters:
        path - object key
        Returns:
        head details
        Throws:
        KeyNotFoundException - when path not found
      • list

        ListResult list​(String prefix)
        Lists all of the keys under a prefix. No delimiter is used.
        Parameters:
        prefix - the key prefix
        Returns:
        list response
      • listDirectory

        ListResult listDirectory​(String path)
        Lists all of the keys within a virtual directory. Only keys that fall between the specified prefix and the next '/' are returned.
        Parameters:
        path - the key prefix to list, if it does not end in a '/' one is appended
        Returns:
        list response
      • directoryExists

        boolean directoryExists​(String path)
        Returns true if the specified virtual directory exists.
        Parameters:
        path - the key prefix to list, if it does not end in a '/' one is appended
        Returns:
        true if the directory exists
      • deletePath

        void deletePath​(String path)
        Deletes all of the objects under the specified path
        Parameters:
        path - the path prefix to delete
      • deleteObjects

        void deleteObjects​(Collection<String> objectKeys)
        Deletes all of the specified objects. If an object does not exist, nothing happens.
        Parameters:
        objectKeys - keys to delete
      • safeDeleteObjects

        void safeDeleteObjects​(String... objectKeys)
        Deletes all of the objects and does not throw an exception on failure
        Parameters:
        objectKeys - keys to delete
      • safeDeleteObjects

        void safeDeleteObjects​(Collection<String> objectKeys)
        Deletes all of the objects and does not throw an exception on failure
        Parameters:
        objectKeys - keys to delete
      • bucketExists

        boolean bucketExists()
        Returns true if the storage bucket exists
        Returns:
        if the bucket exists