Class BrokeredStorageProvider

    • Constructor Detail

    • Method Detail

      • getTargetType

        public org.duracloud.storage.domain.StorageProviderType getTargetType()
      • getStorageProviderType

        public org.duracloud.storage.domain.StorageProviderType getStorageProviderType()
        Description copied from interface: StorageProvider
        Provides the type of storage provider being used.
        Specified by:
        getStorageProviderType in interface StorageProvider
        Returns:
        StorageProviderType type of provider
      • addContent

        public String addContent​(String spaceId,
                                 String contentId,
                                 String contentMimeType,
                                 Map<String,​String> userProperties,
                                 long contentSize,
                                 String contentChecksum,
                                 InputStream content)
                          throws StorageException
        Description copied from interface: StorageProvider
        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.
        Specified by:
        addContent in interface StorageProvider
        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

        public String copyContent​(String sourceSpaceId,
                                  String sourceContentId,
                                  String destSpaceId,
                                  String destContentId)
        Description copied from interface: StorageProvider
        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.
        Specified by:
        copyContent in interface StorageProvider
        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
      • createSpace

        public void createSpace​(String spaceId)
                         throws StorageException
        Description copied from interface: StorageProvider
        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.
        Specified by:
        createSpace in interface StorageProvider
        Parameters:
        spaceId - - ID of the space
        Throws:
        StorageException - if space with ID spaceId already exists
      • getContent

        public RetrievedContent getContent​(String spaceId,
                                           String contentId,
                                           String range)
                                    throws StorageException
        Description copied from interface: StorageProvider
        Gets a range of bytes from a content item in a space.
        Specified by:
        getContent in interface StorageProvider
        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
        StorageException - if errors occur
      • getContentProperties

        public Map<String,​String> getContentProperties​(String spaceId,
                                                             String contentId)
                                                      throws StorageException
        Description copied from interface: StorageProvider
        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.
        Specified by:
        getContentProperties in interface StorageProvider
        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
      • getSpaceContents

        public Iterator<String> getSpaceContents​(String spaceId,
                                                 String prefix)
                                          throws StorageException
        Description copied from interface: StorageProvider
        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.
        Specified by:
        getSpaceContents in interface StorageProvider
        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

        public List<String> getSpaceContentsChunked​(String spaceId,
                                                    String prefix,
                                                    long maxResults,
                                                    String marker)
                                             throws StorageException
        Description copied from interface: StorageProvider
        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.
        Specified by:
        getSpaceContentsChunked in interface StorageProvider
        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
      • setContentProperties

        public void setContentProperties​(String spaceId,
                                         String contentId,
                                         Map<String,​String> contentProperties)
                                  throws StorageException
        Description copied from interface: StorageProvider
        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
        Specified by:
        setContentProperties in interface StorageProvider
        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
      • getSpaceACLs

        public Map<String,​AclType> getSpaceACLs​(String spaceId)
        Description copied from interface: StorageProvider
        Retrieves the ACLs associated with a space.
        Specified by:
        getSpaceACLs in interface StorageProvider
        Parameters:
        spaceId - - ID of the space
        Returns:
        Map of space ACLs or empty map if none exists
      • setSpaceACLs

        public void setSpaceACLs​(String spaceId,
                                 Map<String,​AclType> spaceACLs)
        Description copied from interface: StorageProvider
        Sets the ACLs associated with a space.
        Specified by:
        setSpaceACLs in interface StorageProvider
        Parameters:
        spaceId - - ID of the space
        spaceACLs - - Updated space ACL. Note, null or empty arg spaceACLs will 'clear' the space ACLs.