Package org.duracloud.chunk.writer
Class DuracloudContentWriter
java.lang.Object
org.duracloud.chunk.writer.DuracloudContentWriter
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionDuracloudContentWriter(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
Modifier and TypeMethodDescriptionprotected booleanintThis method returns an item-by-item list of results for the write requests.voidThis method helps with the book-keeping of which files are ignored.protected voidsetChecksumUtil(ChecksumUtil checksumUtil) write(String spaceId, ChunkableContent chunkable) This method writes the ChunkableContent to the arg space.This method implements the ContentWriter interface for writing content to a DataStore.writeSingle(String spaceId, String chunkChecksum, ChunkInputStream chunk) This method writes the arg Chunk to the arg space.writeSingle(String spaceId, String chunkChecksum, ChunkInputStream chunk, Map<String, String> properties) This method writes a single chunk to the DataStore.
-
Constructor Details
-
DuracloudContentWriter
-
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 Details
-
getMaxRetries
public int getMaxRetries() -
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
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 NotFoundExceptionThis 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
-
write
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 NotFoundExceptionThis 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
-