Example usage for com.amazonaws.services.s3.model MultipartUploadListing setUploadIdMarker

List of usage examples for com.amazonaws.services.s3.model MultipartUploadListing setUploadIdMarker

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model MultipartUploadListing setUploadIdMarker.

Prototype

public void setUploadIdMarker(String uploadIdMarker) 

Source Link

Document

Sets the optional upload ID marker specified in the original request to specify where in the results to begin listing multipart uploads.

Usage

From source file:org.finra.dm.dao.impl.MockS3OperationsImpl.java

License:Apache License

/**
 * <p>/*from   w ww .  ja  v a2  s .c om*/
 * Returns a mock list of multipart uploads. Since a multipart upload in progress does not exist when in-memory, this method simply returns a preconfigured
 * list.
 * </p>
 * <p>
 * Returns a mock {@link MultipartUploadListing} based on the parameters and hints provided. By default returns a mock listing as defiend by
 * {@link #getMultipartUploadListing()}.
 * </p>
 * <p>
 * This operation takes the following hints when suffixed in listMultipartUploadsRequest.bucketName:
 * <dl>
 * <p/>
 * <dt>MOCK_S3_BUCKET_NAME_SERVICE_EXCEPTION</dt>
 * <dd>Throws a AmazonServiceException</dd>
 * <p/>
 * <dt>MOCK_S3_BUCKET_NAME_TRUNCATED_MULTIPART_LISTING</dt>
 * <dd>Returns the listing as if it is truncated. See below for details.</dd>
 * <p/>
 * </dl>
 * </p>
 */
@Override
public MultipartUploadListing listMultipartUploads(ListMultipartUploadsRequest listMultipartUploadsRequest,
        AmazonS3Client s3Client) {
    if (listMultipartUploadsRequest.getBucketName().equals(MOCK_S3_BUCKET_NAME_SERVICE_EXCEPTION)) {
        throw new AmazonServiceException(null);
    } else if (listMultipartUploadsRequest.getBucketName()
            .equals(MOCK_S3_BUCKET_NAME_TRUNCATED_MULTIPART_LISTING)) {
        MultipartUploadListing multipartUploadListing = getMultipartUploadListing();

        // If listing request does not have upload ID marker set, mark the listing as truncated - this is done to truncate the multipart listing just once.
        if (listMultipartUploadsRequest.getUploadIdMarker() == null) {
            multipartUploadListing.setUploadIdMarker("TEST_UPLOAD_MARKER_ID");
            multipartUploadListing.setTruncated(true);
        }

        return multipartUploadListing;
    } else {
        return getMultipartUploadListing();
    }
}