public class UploadObjectObserver extends Object
This observer is designed for extension so that custom behavior can be
provided. A customer observer can be configured via
UploadObjectRequest.withUploadObjectObserver(UploadObjectObserver)
.
UploadObjectRequest
Constructor and Description |
---|
UploadObjectObserver() |
public UploadObjectObserver init(UploadObjectRequest req, S3DirectSpi s3direct, AmazonS3 s3, ExecutorService es)
AmazonS3EncryptionClient
.
Implementation of this method should never block.
req
- the upload object requests3direct
- used to perform non-encrypting s3 operation via the current
instance of s3 (encryption) clients3
- the current instance of s3 (encryption) clientes
- the executor service to be used for concurrent uploadsprotected InitiateMultipartUploadRequest newInitiateMultipartUploadRequest(UploadObjectRequest req)
public String onUploadInitiation(UploadObjectRequest req)
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest)
to
initiate a multi-part upload.req
- the upload object requestpublic void onPartCreate(PartCreationEvent event)
MultiFileOutputStream.fos()
when a part ready for
upload has been successfully created on disk. By default, this method
performs the following:
newUploadPartRequest(PartCreationEvent, File)
to
create an upload-part request for the newly created ciphertext fileappendUserAgent(AmazonWebServiceRequest, String)
to
append the necessary user agent string to the requestuploadPart(UploadPartRequest)
, to be performedTo enable parallel uploads, implementation of this method should never block.
event
- to represent the completion of a ciphertext file creation
which is ready for multipart upload to S3.public CompleteMultipartUploadResult onCompletion(List<PartETag> partETags)
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest)
when
all parts have been successfully uploaded to S3. This method is
responsible for finishing off the upload by making a complete multi-part
upload request to S3 with the given list of etags.partETags
- all the etags returned from S3 for the previous part uploads.public void onAbort()
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest)
when
failed to upload any part. This method is responsible for cancelling
ongoing uploads and aborting the multi-part upload request.protected UploadPartRequest newUploadPartRequest(PartCreationEvent event, File part)
event
- the part-creation event of the ciphertxt file.part
- the created ciphertext file corresponding to the upload-partprotected UploadPartResult uploadPart(UploadPartRequest reqUploadPart)
reqUploadPart
- part upload requestprotected <X extends AmazonWebServiceRequest> X appendUserAgent(X request, String userAgent)
public List<Future<UploadPartResult>> getFutures()
protected UploadObjectRequest getRequest()
init(UploadObjectRequest, S3DirectSpi, AmazonS3, ExecutorService)
protected String getUploadId()
onUploadInitiation(UploadObjectRequest)
protected S3DirectSpi getS3DirectSpi()
S3DirectSpi
instance initialized via
init(UploadObjectRequest, S3DirectSpi, AmazonS3, ExecutorService)
protected AmazonS3 getAmazonS3()
AmazonS3
instance initialized via
init(UploadObjectRequest, S3DirectSpi, AmazonS3, ExecutorService)
protected ExecutorService getExecutorService()
ExecutorService
instance initialized via
init(UploadObjectRequest, S3DirectSpi, AmazonS3, ExecutorService)
Copyright © 2021. All rights reserved.