Class DuracloudContentWriter

  • All Implemented Interfaces:
    ContentWriter

    public class DuracloudContentWriter
    extends Object
    implements ContentWriter
    This class implements the ContentWriter interface to write the provided content to the Duracloud storeclient interface. Warning: this class is NOT thread-safe.
    Author:
    Andrew Woods Date: Feb 5, 2010
    • Constructor Detail

      • DuracloudContentWriter

        public DuracloudContentWriter​(ContentStore contentStore,
                                      String username)
      • DuracloudContentWriter

        public DuracloudContentWriter​(ContentStore contentStore,
                                      String username,
                                      int maxRetries,
                                      int waitInMsBetweenRetries)
      • DuracloudContentWriter

        public DuracloudContentWriter​(ContentStore contentStore,
                                      String username,
                                      boolean throwOnError,
                                      boolean jumpStart)
      • DuracloudContentWriter

        public DuracloudContentWriter​(ContentStore contentStore,
                                      String username,
                                      boolean throwOnError,
                                      boolean jumpStart,
                                      int maxRetries,
                                      int waitInMsBetweenRetries)
    • Method Detail

      • getMaxRetries

        public int getMaxRetries()
      • ignore

        public void ignore​(String spaceId,
                           String contentId,
                           long contentSize)
        Description copied from interface: ContentWriter
        This method helps with the book-keeping of which files are ignored.
        Specified by:
        ignore in interface ContentWriter
        Parameters:
        spaceId - destination where arg content was assigned to be written
        contentId - of content
        contentSize - of content
      • write

        public ChunksManifest write​(String spaceId,
                                    ChunkableContent chunkable,
                                    Map<String,​String> contentProperties)
                             throws NotFoundException
        This method implements the ContentWriter interface for writing content to a DataStore. In this case, the DataStore is durastore.
        Specified by:
        write in interface ContentWriter
        Parameters:
        spaceId - destination space of arg chunkable content
        chunkable - content to be written
        contentProperties - user defined properties to be stored with chunkable content
        Returns:
        ChunksManifest of written content
        Throws:
        NotFoundException - if space is not found
      • errorsExist

        protected boolean errorsExist()
      • setChecksumUtil

        protected void setChecksumUtil​(ChecksumUtil checksumUtil)
      • writeSingle

        public String writeSingle​(String spaceId,
                                  String chunkChecksum,
                                  ChunkInputStream chunk,
                                  Map<String,​String> properties)
                           throws NotFoundException
        This method writes a single chunk to the DataStore.
        Specified by:
        writeSingle in interface ContentWriter
        Parameters:
        spaceId - destination where arg chunk content will be written
        chunkChecksum - md5 checksum of the chunk if known, null otherwise
        chunk - content to be written
        properties - user-defined properties for the content
        Returns:
        MD5 of written content
        Throws:
        NotFoundException - if space is not found
      • writeSingle

        public String writeSingle​(String spaceId,
                                  String chunkChecksum,
                                  ChunkInputStream chunk)
                           throws NotFoundException
        Description copied from interface: ContentWriter
        This method writes the arg Chunk to the arg space. It is intended for use when when the arg chunk is actually a complete piece of content
        Specified by:
        writeSingle in interface ContentWriter
        Parameters:
        spaceId - destination where arg chunk content will be written
        chunkChecksum - md5 checksum of the chunk if known, null otherwise
        chunk - content to be written
        Returns:
        MD5 of content
        Throws:
        NotFoundException - on error