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() |
| Modifier and Type | Method and Description |
|---|---|
List<Future<UploadPartResult>> |
getFutures() |
UploadObjectObserver |
init(UploadObjectRequest req,
S3DirectSpi s3direct,
AmazonS3 s3,
ExecutorService es)
Used to initialized this observer.
|
void |
onAbort()
Notified from
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest) when
failed to upload any part. |
CompleteMultipartUploadResult |
onCompletion(List<PartETag> partETags)
Notified from
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest) when
all parts have been successfully uploaded to S3. |
void |
onPartCreate(PartCreationEvent event)
Notified from
MultiFileOutputStream.fos() when a part ready for
upload has been successfully created on disk. |
String |
onUploadInitiation(UploadObjectRequest req)
Notified from
AmazonS3EncryptionClient.uploadObject(UploadObjectRequest) to
initiate a multi-part upload. |
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 uploadspublic 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.public List<Future<UploadPartResult>> getFutures()