Package io.clonecloudstore.driver.api
Interface DriverApi
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
DriverAzure
,DriverGoogle
,DriverS3
,FakeDriver
Driver Java Interface for Object Storage. This shall be retrieved through the DriverApiFactory and closed when
usage is over.
-
Method Summary
Modifier and TypeMethodDescriptionbucketCreate
(StorageBucket bucket) Create one Bucket and returns itdefault void
bucketDelete
(StorageBucket bucket) Delete one Bucket if it exists and is emptyvoid
bucketDelete
(String bucket) Delete one Bucket if it exists and is emptydefault boolean
bucketExists
(StorageBucket bucket) Check existence of Bucketboolean
bucketExists
(String bucket) Check existence of BucketGet one Bucket and returns itbucketImport
(StorageBucket bucket) Import one Bucket and returns itlong
Count BucketsIterator on Buckets listStream Buckets listvoid
close()
Close with no exception.default StorageType
directoryOrObjectExistsInBucket
(StorageBucket bucket, String directoryOrObject) Check if Directory or Object exists in specified Bucket (based on prefix)directoryOrObjectExistsInBucket
(String bucket, String directoryOrObject) Check if Directory or Object exists in specified Bucket (based on prefix)objectCopy
(StorageObject objectSource, StorageObject objectTarget) Copy one object to another one, possibly in a different bucket.default StorageObject
objectCopy
(String bucketSource, String objectSource, String bucketTarget, String objectTarget, Map<String, String> targetMetadata, Instant expireDate) Copy one object to another one, possibly in a different bucket.default void
objectDeleteInBucket
(StorageObject object) Delete the Object from this Bucketvoid
objectDeleteInBucket
(String bucket, String object) Delete the Object from this Bucketdefault StorageObject
objectFinalizeCreateInBucket
(StorageObject object, long realLen, String sha256) Second step in creation of an object within a Bucket.objectFinalizeCreateInBucket
(String bucket, String object, long realLen, String sha256) Second step in creation of an object within a Bucket.default InputStream
Get the content of the specified Object within specified BucketobjectGetInputStreamInBucket
(String bucket, String object) Get the content of the specified Object within specified Bucketdefault StorageObject
Get the Object metadata from this Bucket (those available from Object Storage)objectGetMetadataInBucket
(String bucket, String object) Get the Object metadata from this Bucket (those available from Object Storage)void
objectPrepareCreateInBucket
(StorageObject object, InputStream inputStream) First step in creation of an object within a Bucket.default long
objectsCountInBucket
(StorageBucket bucket) Count Objects in specified Bucketdefault long
objectsCountInBucket
(StorageBucket bucket, String prefix, Instant from, Instant to) Count Objects in specified Bucket with filters (all optionals)long
objectsCountInBucket
(String bucket) Count Objects in specified Bucketlong
objectsCountInBucket
(String bucket, String prefix, Instant from, Instant to) Count Objects in specified Bucket with filters (all optionals)default Iterator
<StorageObject> objectsIteratorInBucket
(StorageBucket bucket) Iterator on Objects in specified Bucketdefault Iterator
<StorageObject> objectsIteratorInBucket
(StorageBucket bucket, String prefix, Instant from, Instant to) Iterator on Objects in specified Bucket with filters (all optionals)objectsIteratorInBucket
(String bucket) Iterator on Objects in specified BucketobjectsIteratorInBucket
(String bucket, String prefix, Instant from, Instant to) Iterator on Objects in specified Bucket with filters (all optionals)default Stream
<StorageObject> objectsStreamInBucket
(StorageBucket bucket) Stream Objects in specified Bucketdefault Stream
<StorageObject> objectsStreamInBucket
(StorageBucket bucket, String prefix, Instant from, Instant to) Stream Objects in specified Bucket with filters (all optionals)objectsStreamInBucket
(String bucket) Stream Objects in specified BucketobjectsStreamInBucket
(String bucket, String prefix, Instant from, Instant to) Stream Objects in specified Bucket with filters (all optionals)default void
validCopy
(StorageObject objectSource, StorageObject objectTarget)
-
Method Details
-
bucketsCount
Count Buckets- Throws:
DriverException
-
bucketsStream
Stream Buckets list- Throws:
DriverException
-
bucketsIterator
Iterator on Buckets list- Throws:
DriverException
-
bucketGet
Get one Bucket and returns it- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotFoundException
DriverException
-
bucketCreate
StorageBucket bucketCreate(StorageBucket bucket) throws DriverNotAcceptableException, DriverAlreadyExistException, DriverException Create one Bucket and returns it- Parameters:
bucket
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the client Id, nothing is mandatory- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotAcceptableException
DriverAlreadyExistException
DriverException
-
bucketImport
StorageBucket bucketImport(StorageBucket bucket) throws DriverNotAcceptableException, DriverAlreadyExistException, DriverException Import one Bucket and returns it- Parameters:
bucket
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the client Id, nothing is mandatory- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotAcceptableException
DriverAlreadyExistException
DriverException
-
bucketDelete
void bucketDelete(String bucket) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Delete one Bucket if it exists and is empty -
bucketDelete
default void bucketDelete(StorageBucket bucket) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Delete one Bucket if it exists and is empty -
bucketExists
Check existence of Bucket- Throws:
DriverException
-
bucketExists
Check existence of Bucket- Throws:
DriverException
-
objectsCountInBucket
Count Objects in specified Bucket -
objectsCountInBucket
default long objectsCountInBucket(StorageBucket bucket) throws DriverNotFoundException, DriverException Count Objects in specified Bucket -
objectsCountInBucket
long objectsCountInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Count Objects in specified Bucket with filters (all optionals) -
objectsCountInBucket
default long objectsCountInBucket(StorageBucket bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Count Objects in specified Bucket with filters (all optionals) -
objectsStreamInBucket
Stream<StorageObject> objectsStreamInBucket(String bucket) throws DriverNotFoundException, DriverException Stream Objects in specified Bucket -
objectsStreamInBucket
default Stream<StorageObject> objectsStreamInBucket(StorageBucket bucket) throws DriverNotFoundException, DriverException Stream Objects in specified Bucket -
objectsStreamInBucket
Stream<StorageObject> objectsStreamInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Stream Objects in specified Bucket with filters (all optionals) -
objectsStreamInBucket
default Stream<StorageObject> objectsStreamInBucket(StorageBucket bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Stream Objects in specified Bucket with filters (all optionals) -
objectsIteratorInBucket
Iterator<StorageObject> objectsIteratorInBucket(String bucket) throws DriverNotFoundException, DriverException Iterator on Objects in specified Bucket -
objectsIteratorInBucket
default Iterator<StorageObject> objectsIteratorInBucket(StorageBucket bucket) throws DriverNotFoundException, DriverException Iterator on Objects in specified Bucket -
objectsIteratorInBucket
Iterator<StorageObject> objectsIteratorInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Iterator on Objects in specified Bucket with filters (all optionals) -
objectsIteratorInBucket
default Iterator<StorageObject> objectsIteratorInBucket(StorageBucket bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Iterator on Objects in specified Bucket with filters (all optionals) -
directoryOrObjectExistsInBucket
StorageType directoryOrObjectExistsInBucket(String bucket, String directoryOrObject) throws DriverException Check if Directory or Object exists in specified Bucket (based on prefix)- Throws:
DriverException
-
directoryOrObjectExistsInBucket
default StorageType directoryOrObjectExistsInBucket(StorageBucket bucket, String directoryOrObject) throws DriverException Check if Directory or Object exists in specified Bucket (based on prefix)- Throws:
DriverException
-
objectPrepareCreateInBucket
void objectPrepareCreateInBucket(StorageObject object, InputStream inputStream) throws DriverNotFoundException, DriverAlreadyExistException, DriverException First step in creation of an object within a Bucket. The InputStream is ready to be read in a concurrent independent thread to be provided by the driver. Sha256 might be null or empty. Len might be 0, meaning unknown.- Parameters:
object
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the key of the object, nothing is mandatory- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectFinalizeCreateInBucket
StorageObject objectFinalizeCreateInBucket(String bucket, String object, long realLen, String sha256) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Second step in creation of an object within a Bucket. Sha256 might be null or empty. Reallen must not be 0. This method waits for the prepare method to end and returns the final result.- Returns:
- the StorageObject as instantiated within the Object Storage (real values)
- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectFinalizeCreateInBucket
default StorageObject objectFinalizeCreateInBucket(StorageObject object, long realLen, String sha256) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Second step in creation of an object within a Bucket. Sha256 might be null or empty. Reallen must not be 0. This method waits for the prepare method to end and returns the final result.- Returns:
- the StorageObject as instantiated within the Object Storage (real values)
- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectGetInputStreamInBucket
InputStream objectGetInputStreamInBucket(String bucket, String object) throws DriverNotFoundException, DriverException Get the content of the specified Object within specified Bucket -
objectGetInputStreamInBucket
default InputStream objectGetInputStreamInBucket(StorageObject object) throws DriverNotFoundException, DriverException Get the content of the specified Object within specified Bucket -
validCopy
default void validCopy(StorageObject objectSource, StorageObject objectTarget) throws DriverException - Throws:
DriverException
-
objectCopy
StorageObject objectCopy(StorageObject objectSource, StorageObject objectTarget) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Copy one object to another one, possibly in a different bucket. Hash and Size come from given source, while Metadata and expired date come from target- Parameters:
objectSource
- source objectobjectTarget
- target object- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectCopy
default StorageObject objectCopy(String bucketSource, String objectSource, String bucketTarget, String objectTarget, Map<String, String> targetMetadata, Instant expireDate) throws DriverNotFoundException, DriverAlreadyExistException, DriverExceptionCopy one object to another one, possibly in a different bucket. Hash and Size come from real source, while Metadata and expired date come from target -
objectGetMetadataInBucket
StorageObject objectGetMetadataInBucket(String bucket, String object) throws DriverNotFoundException, DriverException Get the Object metadata from this Bucket (those available from Object Storage) -
objectGetMetadataInBucket
default StorageObject objectGetMetadataInBucket(StorageObject object) throws DriverNotFoundException, DriverException Get the Object metadata from this Bucket (those available from Object Storage) -
objectDeleteInBucket
void objectDeleteInBucket(String bucket, String object) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Delete the Object from this Bucket -
objectDeleteInBucket
default void objectDeleteInBucket(StorageObject object) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Delete the Object from this Bucket -
close
void close()Close with no exception. Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-