public abstract class Ds3ClientHelpers
extends java.lang.Object
Ds3Client
which automates common tasks.Modifier and Type | Class and Description |
---|---|
static interface |
Ds3ClientHelpers.Job
Represents a bulk job operation.
|
static interface |
Ds3ClientHelpers.MetadataAccess |
static interface |
Ds3ClientHelpers.ObjectChannelBuilder |
Constructor and Description |
---|
Ds3ClientHelpers() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Iterable<Ds3Object> |
addPrefixToDs3ObjectsList(java.lang.Iterable<Ds3Object> objectsList,
java.lang.String prefix)
Returns an Iterable of
Ds3Object that have a prefix added. |
abstract void |
ensureBucketExists(java.lang.String bucket)
Ensures that a bucket exists.
|
abstract void |
ensureBucketExists(java.lang.String bucket,
java.util.UUID dataPolicy)
Ensures that a bucket exists.
|
abstract java.lang.Iterable<Contents> |
listObjects(java.lang.String bucket)
Returns information about all of the objects in the bucket, regardless of how many objects the bucket contains.
|
abstract java.lang.Iterable<Contents> |
listObjects(java.lang.String bucket,
java.lang.String keyPrefix)
Returns information about objects in the bucket, filtered by names that start with keyPrefix.
|
abstract java.lang.Iterable<Contents> |
listObjects(java.lang.String bucket,
java.lang.String keyPrefix,
java.lang.String nextMarker)
Returns information about objects in the bucket in alphabetical order, starting with key after the next_marker in order,
regardless of how many objects the bucket contains.
|
abstract java.lang.Iterable<Contents> |
listObjects(java.lang.String bucket,
java.lang.String keyPrefix,
java.lang.String nextMarker,
int maxKeys)
Returns information about objects in the bucket in alphabetical order, starting with key after the next_marker in order,
regardless of how many objects the bucket contains.
|
abstract java.lang.Iterable<Contents> |
listObjects(java.lang.String bucket,
java.lang.String keyPrefix,
java.lang.String nextMarker,
int maxKeys,
int retries)
Returns information about objects in the bucket in alphabetical order, starting with key after the next_marker in order,
regardless of how many objects the bucket contains.
|
abstract java.lang.Iterable<Ds3Object> |
listObjectsForDirectory(java.nio.file.Path directory)
Returns an object list with which you can call
startWriteJobImpl based on the files in a directory . |
abstract Ds3ClientHelpers.Job |
recoverReadJob(java.util.UUID jobId)
Queries job information based on job id and returns a
WriteJobImpl that can resume the job. |
abstract Ds3ClientHelpers.Job |
recoverWriteJob(java.util.UUID jobId)
Queries job information based on job id and returns a
ReadJobImpl that can resume the job. |
abstract java.lang.Iterable<Ds3Object> |
removePrefixFromDs3ObjectsList(java.lang.Iterable<Ds3Object> objectsList,
java.lang.String prefix)
Returns an Iterable of
Ds3Object that have a prefix removed. |
abstract Ds3ClientHelpers.Job |
startReadAllJob(java.lang.String bucket)
Performs a bulk get job creation request for all of the objects in the given bucket and returns an
ReadJobImpl . |
abstract Ds3ClientHelpers.Job |
startReadAllJob(java.lang.String bucket,
ReadJobOptions options)
Performs a bulk get job creation request for all of the objects in the given bucket and returns an
ReadJobImpl . |
abstract Ds3ClientHelpers.Job |
startReadJob(java.lang.String bucket,
java.lang.Iterable<Ds3Object> objectsToRead)
Performs a bulk get job creation request and returns an
ReadJobImpl . |
abstract Ds3ClientHelpers.Job |
startReadJob(java.lang.String bucket,
java.lang.Iterable<Ds3Object> objectsToRead,
ReadJobOptions options)
Performs a bulk get job creation request and returns an
ReadJobImpl . |
abstract Ds3ClientHelpers.Job |
startWriteJob(java.lang.String bucket,
java.lang.Iterable<Ds3Object> objectsToWrite)
Performs a bulk put job creation request and returns an
WriteJobImpl . |
abstract Ds3ClientHelpers.Job |
startWriteJob(java.lang.String bucket,
java.lang.Iterable<Ds3Object> objectsToWrite,
WriteJobOptions options)
Performs a bulk put job creation request and returns an
WriteJobImpl . |
static java.lang.String |
stripLeadingPath(java.lang.String objectName,
java.lang.String prefix)
Strip prefix from the beginning of objectName.
|
java.lang.Iterable<Ds3Object> |
toDs3Iterable(java.lang.Iterable<Contents> objects,
Predicate<Contents>... filters)
|
static Ds3ClientHelpers |
wrap(Ds3Client client)
Wraps the given
Ds3ClientImpl with helper methods. |
static Ds3ClientHelpers |
wrap(Ds3Client client,
int retryAfter)
Wraps the given
Ds3ClientImpl with helper methods. |
static Ds3ClientHelpers |
wrap(Ds3Client client,
int retryAfter,
int objectTransferAttempts)
Wraps the given
Ds3ClientImpl with helper methods. |
public static Ds3ClientHelpers wrap(Ds3Client client)
Ds3ClientImpl
with helper methods.client
- An instance of Ds3Client
, usually gotten from a call to
Ds3ClientBuilder
Ds3Client
wrapped with helper methods.public static Ds3ClientHelpers wrap(Ds3Client client, int retryAfter)
Ds3ClientImpl
with helper methods.client
- An instance of Ds3Client
, usually gotten from a call to
Ds3ClientBuilder
retryAfter
- The number of times to attempt to allocate a chunk before giving up.Ds3Client
wrapped with helper methods.public static Ds3ClientHelpers wrap(Ds3Client client, int retryAfter, int objectTransferAttempts)
Ds3ClientImpl
with helper methods.client
- An instance of Ds3Client
, usually gotten from a call to
Ds3ClientBuilder
retryAfter
- The number of times to attempt to allocate a chunk before giving up.objectTransferAttempts
- The number of times to attempt to transfer an object before giving up.Ds3Client
wrapped with helper methods.public abstract Ds3ClientHelpers.Job startWriteJob(java.lang.String bucket, java.lang.Iterable<Ds3Object> objectsToWrite) throws java.io.IOException
WriteJobImpl
.
See WriteJobImpl
for information on how to write the objects for the job.java.io.IOException
public abstract Ds3ClientHelpers.Job startWriteJob(java.lang.String bucket, java.lang.Iterable<Ds3Object> objectsToWrite, WriteJobOptions options) throws java.io.IOException
WriteJobImpl
.
See WriteJobImpl
for information on how to write the objects for the job.java.io.IOException
public abstract Ds3ClientHelpers.Job startReadJob(java.lang.String bucket, java.lang.Iterable<Ds3Object> objectsToRead) throws java.io.IOException
ReadJobImpl
.
See ReadJobImpl
for information on how to read the objects for the job.java.io.IOException
public abstract Ds3ClientHelpers.Job startReadJob(java.lang.String bucket, java.lang.Iterable<Ds3Object> objectsToRead, ReadJobOptions options) throws java.io.IOException
ReadJobImpl
.
See ReadJobImpl
for information on how to read the objects for the job.java.io.IOException
public abstract Ds3ClientHelpers.Job startReadAllJob(java.lang.String bucket) throws java.io.IOException
ReadJobImpl
.java.io.IOException
public abstract Ds3ClientHelpers.Job startReadAllJob(java.lang.String bucket, ReadJobOptions options) throws java.io.IOException
ReadJobImpl
.java.io.IOException
public abstract Ds3ClientHelpers.Job recoverWriteJob(java.util.UUID jobId) throws java.io.IOException, JobRecoveryException
ReadJobImpl
that can resume the job.java.io.IOException
JobRecoveryException
public abstract Ds3ClientHelpers.Job recoverReadJob(java.util.UUID jobId) throws java.io.IOException, JobRecoveryException
WriteJobImpl
that can resume the job.java.io.IOException
JobRecoveryException
public abstract void ensureBucketExists(java.lang.String bucket) throws java.io.IOException
bucket
- The name of the bucket to check that it exists.java.io.IOException
public abstract void ensureBucketExists(java.lang.String bucket, java.util.UUID dataPolicy) throws java.io.IOException
bucket
- The name of the bucket to check that it exists.dataPolicy
- The data policy for the bucketjava.io.IOException
public abstract java.lang.Iterable<Contents> listObjects(java.lang.String bucket) throws java.io.IOException
java.io.IOException
public abstract java.lang.Iterable<Contents> listObjects(java.lang.String bucket, java.lang.String keyPrefix) throws java.io.IOException
keyPrefix
- Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a
bucket into different groupings of keys. (You can think of using prefix to make groups in the same
way you'd use a folder in a file system.)java.io.IOException
public abstract java.lang.Iterable<Contents> listObjects(java.lang.String bucket, java.lang.String keyPrefix, java.lang.String nextMarker) throws java.io.IOException
keyPrefix
- Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a
bucket into different groupings of keys. (You can think of using prefix to make groups in the same
way you'd use a folder in a file system.)
Set to null if unused but need to specify nextMarker.nextMarker
- Specifies the key to start with when listing objects in a bucket. Returns object keys in alphabetical
order, starting with key after the nextMarker in order.java.io.IOException
public abstract java.lang.Iterable<Contents> listObjects(java.lang.String bucket, java.lang.String keyPrefix, java.lang.String nextMarker, int maxKeys)
keyPrefix
- Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a
bucket into different groupings of keys. (You can think of using prefix to make groups in the same
way you'd use a folder in a file system.)
Set to null if unused but need to specify nextMarker or maxKeys.nextMarker
- Specifies the key to start with when listing objects in a bucket. Returns object keys in
alphabetical order, starting with key after the nextMarker in order.
Set to null if unused but need to specify maxKeys.maxKeys
- Sets the maximum number of keys returned in the response body. You can add this to your request
if you want to retrieve fewer than the default 1000 keys.
The response might contain fewer keys but will never contain more. If there are additional keys
that satisfy the search criteria but were not returned because max-keys was exceeded, the
response.isTruncated() is true. To return the additional keys, see nextMarker.public abstract java.lang.Iterable<Contents> listObjects(java.lang.String bucket, java.lang.String keyPrefix, java.lang.String nextMarker, int maxKeys, int retries)
keyPrefix
- Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a
bucket into different groupings of keys. (You can think of using prefix to make groups in the same
way you'd use a folder in a file system.)
Set to null if unused but need to specify nextMarker or maxKeys.nextMarker
- Specifies the key to start with when listing objects in a bucket. Returns object keys in
alphabetical order, starting with key after the nextMarker in order.
Set to null if unused but need to specify maxKeys.maxKeys
- Sets the maximum number of keys returned in the response body. You can add this to your request
if you want to retrieve fewer than the default 1000 keys.
The response might contain fewer keys but will never contain more. If there are additional keys
that satisfy the search criteria but were not returned because max-keys was exceeded, the
response.isTruncated() is true. To return the additional keys, see nextMarker.retries
- Specifies how many times the helper function will attempt to retry a request for failing. Default - 5public abstract java.lang.Iterable<Ds3Object> listObjectsForDirectory(java.nio.file.Path directory) throws java.io.IOException
startWriteJobImpl
based on the files in a directory
.
This method traverses the directory
recursively.java.io.IOException
public abstract java.lang.Iterable<Ds3Object> addPrefixToDs3ObjectsList(java.lang.Iterable<Ds3Object> objectsList, java.lang.String prefix)
Ds3Object
that have a prefix added.public abstract java.lang.Iterable<Ds3Object> removePrefixFromDs3ObjectsList(java.lang.Iterable<Ds3Object> objectsList, java.lang.String prefix)
Ds3Object
that have a prefix removed.@SafeVarargs public final java.lang.Iterable<Ds3Object> toDs3Iterable(java.lang.Iterable<Contents> objects, Predicate<Contents>... filters)
public static java.lang.String stripLeadingPath(java.lang.String objectName, java.lang.String prefix)
objectName
- prefix
-