public class S3StorageService extends Object implements StorageService
| Constructor and Description |
|---|
S3StorageService(com.amazonaws.services.s3.AmazonS3 s3,
String bucketName,
ExecutorService executorService) |
| Modifier and Type | Method and Description |
|---|---|
Stream<AbsoluteLocation<ResolvedResource>> |
list(AbsoluteLocation location)
Lists all resources within bucket and returns absolute resource location for each entry without credentials.
|
boolean |
objectExists(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 in
location |
InputStream |
read(AbsoluteLocation location)
Reads resource by its location and uses its version if available in
location |
void |
remove(AbsoluteLocation location)
Removes resource by its location (latest one if versioning enabled) or removes just one version of the
resource if version if available in
location |
OutputStream |
write(WithCallback<AbsoluteLocation,? extends ResourceWriteCallback> locationWithCallback)
Writes data stream into resource and sends resource version into callback if S3 returns version id.
|
public S3StorageService(com.amazonaws.services.s3.AmazonS3 s3,
String bucketName,
ExecutorService executorService)
s3 - Connection to S3bucketName - Bucket to useexecutorService - Multipart sending threadpool (file chunks are sent in parallel)public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location)
list in interface StorageListServicepublic InputStream read(AbsoluteLocation location)
locationread in interface StorageReadServicepublic OutputStream write(WithCallback<AbsoluteLocation,? extends ResourceWriteCallback> locationWithCallback)
write in interface StorageWriteServicepublic void remove(AbsoluteLocation location)
locationremove in interface StorageRemoveServicepublic boolean objectExists(AbsoluteLocation location)
locationobjectExists in interface StorageCheckServiceCopyright © 2019. All rights reserved.