Package org.duracloud.chunk.writer
Class DuracloudContentWriter
- java.lang.Object
-
- org.duracloud.chunk.writer.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 Summary
Constructors Constructor Description DuracloudContentWriter(ContentStore contentStore, String username)DuracloudContentWriter(ContentStore contentStore, String username, boolean throwOnError, boolean jumpStart)DuracloudContentWriter(ContentStore contentStore, String username, boolean throwOnError, boolean jumpStart, int maxRetries, int waitInMsBetweenRetries)DuracloudContentWriter(ContentStore contentStore, String username, int maxRetries, int waitInMsBetweenRetries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanerrorsExist()intgetMaxRetries()List<AddContentResult>getResults()This method returns an item-by-item list of results for the write requests.voidignore(String spaceId, String contentId, long contentSize)This method helps with the book-keeping of which files are ignored.protected voidsetChecksumUtil(ChecksumUtil checksumUtil)ChunksManifestwrite(String spaceId, ChunkableContent chunkable)This method writes the ChunkableContent to the arg space.ChunksManifestwrite(String spaceId, ChunkableContent chunkable, Map<String,String> contentProperties)This method implements the ContentWriter interface for writing content to a DataStore.StringwriteSingle(String spaceId, String chunkChecksum, ChunkInputStream chunk)This method writes the arg Chunk to the arg space.StringwriteSingle(String spaceId, String chunkChecksum, ChunkInputStream chunk, Map<String,String> properties)This method writes a single chunk to the DataStore.
-
-
-
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()
-
getResults
public List<AddContentResult> getResults()
Description copied from interface:ContentWriterThis method returns an item-by-item list of results for the write requests.- Specified by:
getResultsin interfaceContentWriter- Returns:
- List of results
-
ignore
public void ignore(String spaceId, String contentId, long contentSize)
Description copied from interface:ContentWriterThis method helps with the book-keeping of which files are ignored.- Specified by:
ignorein interfaceContentWriter- Parameters:
spaceId- destination where arg content was assigned to be writtencontentId- of contentcontentSize- 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:
writein interfaceContentWriter- Parameters:
spaceId- destination space of arg chunkable contentchunkable- content to be writtencontentProperties- 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)
-
write
public ChunksManifest write(String spaceId, ChunkableContent chunkable) throws NotFoundException
Description copied from interface:ContentWriterThis method writes the ChunkableContent to the arg space.- Specified by:
writein interfaceContentWriter- Parameters:
spaceId- destination where arg chunkable content will be writtenchunkable- content to be written- Returns:
- ChunksManifest of written content
- Throws:
NotFoundException- on error
-
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:
writeSinglein interfaceContentWriter- Parameters:
spaceId- destination where arg chunk content will be writtenchunkChecksum- md5 checksum of the chunk if known, null otherwisechunk- content to be writtenproperties- 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:ContentWriterThis 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:
writeSinglein interfaceContentWriter- Parameters:
spaceId- destination where arg chunk content will be writtenchunkChecksum- md5 checksum of the chunk if known, null otherwisechunk- content to be written- Returns:
- MD5 of content
- Throws:
NotFoundException- on error
-
-