Interface StorageProvider

    • Method Detail

      • getStorageProviderType

        org.duracloud.storage.domain.StorageProviderType getStorageProviderType()
        Provides the type of storage provider being used.
        Returns:
        StorageProviderType type of provider
      • getSpaces

        Iterator<String> getSpaces()
        Provides a listing of all spaces owned by a customer.
        Returns:
        Iterator listing spaceIds
      • getSpaceContents

        Iterator<String> getSpaceContents​(String spaceId,
                                          String prefix)
        Provides access to the content files within a space. Chunking of the list is handled internally. Prefix can be set to return only content IDs starting with the prefix value.
        Parameters:
        spaceId - - ID of the space
        prefix - - The prefix of the content id (null for no constraints)
        Returns:
        Iterator of contentIds
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • getSpaceContentsChunked

        List<String> getSpaceContentsChunked​(String spaceId,
                                             String prefix,
                                             long maxResults,
                                             String marker)
        Provides a listing of the content files within a space. The number of items returned is limited to maxResults (default is 1000). Retrieve further results by including the last content ID in the previous list as the marker. Set prefix to return only content IDs starting with the prefix value.
        Parameters:
        spaceId - - ID of the space
        prefix - - Only retrieve content IDs with this prefix (null for all content ids)
        maxResults - - The maximum number of content IDs to return in the list (0 indicates default (1000))
        marker - - The content ID marking the last item in the previous set (null indicates the first set of ids)
        Returns:
        List of contentIds
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • createSpace

        void createSpace​(String spaceId)
        Creates a new space. Depending on the storage implementation, the spaceId may be changed somewhat to comply with the naming rules of the underlying storage provider. The same spaceId value used here can be used in all other methods, as the conversion will be applied internally, however a call to getSpaces() may not include a space with exactly this same name.
        Parameters:
        spaceId - - ID of the space
        Throws:
        StorageException - if space with ID spaceId already exists
      • deleteSpace

        void deleteSpace​(String spaceId)
        Deletes a space.
        Parameters:
        spaceId - - ID of the space
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • getSpaceProperties

        Map<String,​String> getSpaceProperties​(String spaceId)
        Retrieves the properties associated with a space.
        Parameters:
        spaceId - - ID of the space
        Returns:
        Map of space properties or empty map if no properties exists
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • getSpaceACLs

        Map<String,​AclType> getSpaceACLs​(String spaceId)
        Retrieves the ACLs associated with a space.
        Parameters:
        spaceId - - ID of the space
        Returns:
        Map of space ACLs or empty map if none exists
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • setSpaceACLs

        void setSpaceACLs​(String spaceId,
                          Map<String,​AclType> spaceACLs)
        Sets the ACLs associated with a space.
        Parameters:
        spaceId - - ID of the space
        spaceACLs - - Updated space ACL. Note, null or empty arg spaceACLs will 'clear' the space ACLs.
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • addContent

        String addContent​(String spaceId,
                          String contentId,
                          String contentMimeType,
                          Map<String,​String> userProperties,
                          long contentSize,
                          String contentChecksum,
                          InputStream content)
        Adds content to a space. Computes the checksum of the provided content and checks this against the checksum of the uploaded content to protect against loss or corruption during transfer.
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        contentMimeType - - the MIME type of the content being added
        userProperties - - the metadata associated with the content
        contentSize - - the file size (in bytes) of the content being added
        contentChecksum - - the MD5 checksum of the content being added (null if no checksum is known)
        content - - content to add
        Returns:
        The checksum of the provided content
        Throws:
        NotFoundException - if space with ID spaceId does not exist
        StorageException - if errors occur
      • copyContent

        String copyContent​(String sourceSpaceId,
                           String sourceContentId,
                           String destSpaceId,
                           String destContentId)
        This method copies the content item found in source-space with the id of source-content-id into the dest-space, naming it to dest-content-id.
        Parameters:
        sourceSpaceId - of content to copy
        sourceContentId - of content to copy
        destSpaceId - where copied content will end up
        destContentId - given to copied content
        Returns:
        MD5 checksum of destination content item
      • getContent

        RetrievedContent getContent​(String spaceId,
                                    String contentId)
        Gets content from a space.
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        Returns:
        object containing metadata and the content stream
        Throws:
        NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
        StorageException - if errors occur
      • getContent

        RetrievedContent getContent​(String spaceId,
                                    String contentId,
                                    String range)
        Gets a range of bytes from a content item in a space.
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        range - - Range of bytes to retrieve, as defined in: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35, only one range is supported per request
        Returns:
        object containing metadata and the specified bytes of the content stream
        Throws:
        NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
        IllegalArgumentException - if format of the range parameter is invalid
        StorageException - if errors occur
      • deleteContent

        void deleteContent​(String spaceId,
                           String contentId)
        Removes content from a space.
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        Throws:
        NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
        StorageException - if errors occur
      • setContentProperties

        void setContentProperties​(String spaceId,
                                  String contentId,
                                  Map<String,​String> contentProperties)
        Sets the properties associated with content. This effectively removes all of the current content properties and adds a new set of properties. Some properties, such as system properties provided by the underlying storage system, cannot be updated or removed. Some of the values which cannot be updated or removed: Content-MD5 ETag Last-Modified Content-Type cannot be removed, but it can be updated
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        contentProperties - - new content properties
        Throws:
        NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
        StorageException - if errors occur
      • getContentProperties

        Map<String,​String> getContentProperties​(String spaceId,
                                                      String contentId)
        Retrieves the properties associated with content. This includes both properties generated by the underlying storage system as well as custom properties. Use the PROPERTIES_CONTENT_* constants to retrieve standard properties values.
        Parameters:
        spaceId - - ID of the space
        contentId - - ID of the content in the space
        Returns:
        content properties
        Throws:
        NotFoundException - if space with ID spaceId does not exist or the content item with ID contentId does not exist
        StorageException - if errors occur