Class S3StorageService
java.lang.Object
de.adorsys.datasafe.storage.impl.s3.S3StorageService
- All Implemented Interfaces:
StorageCheckService,StorageListService,StorageReadService,StorageRemoveService,StorageWriteService,StorageService
Amazon S3, minio and CEPH compatible default S3 interface adapter.
Note: It is using rawPath of URI that is url-encoded due to:
https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
-
Constructor Summary
ConstructorsConstructorDescriptionS3StorageService(com.amazonaws.services.s3.AmazonS3 s3, String bucketName, ExecutorService executorService) -
Method Summary
Modifier and TypeMethodDescriptionflushChunkSize(AbsoluteLocation location) list(AbsoluteLocation location) Lists all resources within bucket and returns absolute resource location for each entry without credentials.booleanobjectExists(AbsoluteLocation location) Checks if resource exists by its location (latest one if versioning enabled) or checks if resource with given version exists if version is available inlocationread(AbsoluteLocation location) Reads resource by its location and uses its version if available inlocationvoidremove(AbsoluteLocation location) Removes resource by its location (latest one if versioning enabled) or removes just one version of the resource if version if available inlocationwrite(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback) Writes data stream into resource and sends resource version into callback if S3 returns version id.
-
Constructor Details
-
S3StorageService
public S3StorageService(com.amazonaws.services.s3.AmazonS3 s3, String bucketName, ExecutorService executorService) - Parameters:
s3- Connection to S3bucketName- Bucket to useexecutorService- Multipart sending threadpool (file chunks are sent in parallel)
-
-
Method Details
-
list
Lists all resources within bucket and returns absolute resource location for each entry without credentials. Does not include object versions, only latest are shown.- Specified by:
listin interfaceStorageListService
-
read
Reads resource by its location and uses its version if available inlocation- Specified by:
readin interfaceStorageReadService
-
write
public OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback) Writes data stream into resource and sends resource version into callback if S3 returns version id.- Specified by:
writein interfaceStorageWriteService
-
remove
Removes resource by its location (latest one if versioning enabled) or removes just one version of the resource if version if available inlocation- Specified by:
removein interfaceStorageRemoveService
-
objectExists
Checks if resource exists by its location (latest one if versioning enabled) or checks if resource with given version exists if version is available inlocation- Specified by:
objectExistsin interfaceStorageCheckService
-
flushChunkSize
- Specified by:
flushChunkSizein interfaceStorageWriteService
-