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

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

Introduction

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

Prototype

public void setNextKeyMarker(String nextKeyMarker) 

Source Link

Document

Sets the next key marker that should be used in the next request to get the next page of results.

Usage

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

License:Apache License

/**
 * {@inheritDoc} <p/> <p> 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>
 *///from  w w w. j  av a  2 s.c o m
@Override
public MultipartUploadListing listMultipartUploads(ListMultipartUploadsRequest listMultipartUploadsRequest,
        AmazonS3 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.setNextUploadIdMarker("TEST_UPLOAD_MARKER_ID");
            multipartUploadListing.setNextKeyMarker("TEST_KEY_MARKER_ID");
            multipartUploadListing.setTruncated(true);
        }

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