当前位置: 首页>>代码示例>>Java>>正文


Java AbortMultipartUploadRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.AbortMultipartUploadRequest的典型用法代码示例。如果您正苦于以下问题:Java AbortMultipartUploadRequest类的具体用法?Java AbortMultipartUploadRequest怎么用?Java AbortMultipartUploadRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbortMultipartUploadRequest类属于com.amazonaws.services.s3.model包,在下文中一共展示了AbortMultipartUploadRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: abortMultipartUpload

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
@Override
public void abortMultipartUpload(AbortMultipartUploadRequest abortMultipartUploadRequest)
        throws SdkClientException, AmazonServiceException {
    abortMultipartUploadRequest = beforeClientExecution(abortMultipartUploadRequest);
    rejectNull(abortMultipartUploadRequest,
        "The request parameter must be specified when aborting a multipart upload");
    rejectNull(abortMultipartUploadRequest.getBucketName(),
        "The bucket name parameter must be specified when aborting a multipart upload");
    rejectNull(abortMultipartUploadRequest.getKey(),
        "The key parameter must be specified when aborting a multipart upload");
    rejectNull(abortMultipartUploadRequest.getUploadId(),
        "The upload ID parameter must be specified when aborting a multipart upload");

    String bucketName = abortMultipartUploadRequest.getBucketName();
    String key = abortMultipartUploadRequest.getKey();

    Request<AbortMultipartUploadRequest> request = createRequest(bucketName, key, abortMultipartUploadRequest, HttpMethodName.DELETE);
    request.addParameter("uploadId", abortMultipartUploadRequest.getUploadId());
    populateRequesterPaysHeader(request, abortMultipartUploadRequest.isRequesterPays());

    invoke(request, voidResponseHandler, bucketName, key);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:AmazonS3Client.java

示例2: abortMultipartUploads

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * <p>
 * Aborts any multipart uploads that were initiated before the specified date.
 * </p>
 * <p>
 * This method is useful for cleaning up any interrupted multipart uploads.
 * <code>TransferManager</code> attempts to abort any failed uploads,
 * but in some cases this may not be possible, such as if network connectivity
 * is completely lost.
 * </p>
 *
 * @param bucketName
 *            The name of the bucket containing the multipart uploads to
 *            abort.
 * @param date
 *            The date indicating which multipart uploads should be aborted.
 */
public void abortMultipartUploads(String bucketName, Date date)
        throws AmazonServiceException, AmazonClientException {
    MultipartUploadListing uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent(
            new ListMultipartUploadsRequest(bucketName)));
    do {
        for (MultipartUpload upload : uploadListing.getMultipartUploads()) {
            if (upload.getInitiated().compareTo(date) < 0) {
                s3.abortMultipartUpload(appendSingleObjectUserAgent(new AbortMultipartUploadRequest(
                        bucketName, upload.getKey(), upload.getUploadId())));
            }
        }

        ListMultipartUploadsRequest request = new ListMultipartUploadsRequest(bucketName)
            .withUploadIdMarker(uploadListing.getNextUploadIdMarker())
            .withKeyMarker(uploadListing.getNextKeyMarker());
        uploadListing = s3.listMultipartUploads(appendSingleObjectUserAgent(request));
    } while (uploadListing.isTruncated());
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:36,代码来源:TransferManager.java

示例3: performAbortMultipartUpload

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * Performs an
 * {@link AmazonS3#abortMultipartUpload(AbortMultipartUploadRequest)}
 * operation for the given multi-part upload.
 */
void performAbortMultipartUpload() {
    if (multipartUploadId == null) {
        return;
    }
    try {
        AbortMultipartUploadRequest abortRequest = new AbortMultipartUploadRequest(origReq.getBucketName(), origReq.getKey(),
                multipartUploadId)
                .withRequesterPays(origReq.isRequesterPays());
        s3.abortMultipartUpload(abortRequest);
    } catch (Exception e2) {
        log.info(
                "Unable to abort multipart upload, you may need to manually remove uploaded parts: "
                        + e2.getMessage(), e2);
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:21,代码来源:UploadCallable.java

示例4: cleanupFilestore

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * Deletes all existing buckets
 */
@After
public void cleanupFilestore() {
  for (final Bucket bucket : s3Client.listBuckets()) {
    if (!INITIAL_BUCKET_NAMES.contains(bucket.getName())) {
      s3Client.listMultipartUploads(new ListMultipartUploadsRequest(bucket.getName()))
          .getMultipartUploads()
          .forEach(upload ->
              s3Client.abortMultipartUpload(
                  new AbortMultipartUploadRequest(bucket.getName(), upload.getKey(),
                      upload.getUploadId()))
          );
      s3Client.deleteBucket(bucket.getName());
    }
  }
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:19,代码来源:AmazonClientUploadIT.java

示例5: shouldAbortMultipartUpload

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * Tests if a multipart upload can be aborted.
 *
 * @throws Exception not expected
 */
@Test
public void shouldAbortMultipartUpload() throws Exception {
  s3Client.createBucket(BUCKET_NAME);

  assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
      .getMultipartUploads(), is(empty()));

  final InitiateMultipartUploadResult initiateMultipartUploadResult = s3Client
      .initiateMultipartUpload(new InitiateMultipartUploadRequest(BUCKET_NAME, UPLOAD_FILE_NAME));
  final String uploadId = initiateMultipartUploadResult.getUploadId();

  assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
      .getMultipartUploads(), is(not(empty())));

  s3Client.abortMultipartUpload(
      new AbortMultipartUploadRequest(BUCKET_NAME, UPLOAD_FILE_NAME, uploadId));

  assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
      .getMultipartUploads(), is(empty()));
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:26,代码来源:AmazonClientUploadIT.java

示例6: testAtomicMpuAbort

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
@Test
public void testAtomicMpuAbort() throws Exception {
    String key = "testAtomicMpuAbort";
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setContentLength(BYTE_SOURCE.size());
    client.putObject(containerName, key, BYTE_SOURCE.openStream(),
            metadata);

    InitiateMultipartUploadRequest initRequest =
            new InitiateMultipartUploadRequest(containerName, key);
    InitiateMultipartUploadResult initResponse =
            client.initiateMultipartUpload(initRequest);
    String uploadId = initResponse.getUploadId();

    client.abortMultipartUpload(new AbortMultipartUploadRequest(
                containerName, key, uploadId));

    S3Object object = client.getObject(containerName, key);
    assertThat(object.getObjectMetadata().getContentLength()).isEqualTo(
            BYTE_SOURCE.size());
    try (InputStream actual = object.getObjectContent();
            InputStream expected = BYTE_SOURCE.openStream()) {
        assertThat(actual).hasContentEqualTo(expected);
    }
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:26,代码来源:AwsSdkTest.java

示例7: cancel

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
@Override
public CompletableFuture<Void> cancel() {
    if (cancellation == null) {
        cancellation = CompletableFuture.runAsync(() ->
                s3.abortMultipartUpload(new AbortMultipartUploadRequest(bucket, key, uploadId)));
    }
    return cancellation;
}
 
开发者ID:mentegy,项目名称:s3-channels,代码行数:9,代码来源:S3AppendableObjectChannel.java

示例8: abort

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
public void abort() {
  LOG.warn("Aborting multi-part upload with id '{}'", uploadId);
  try {
    client.abortMultipartUpload(new AbortMultipartUploadRequest(bucket,
        key, uploadId));
  } catch (Exception e2) {
    LOG.warn("Unable to abort multipart upload, you may need to purge  " +
        "uploaded parts: " + e2, e2);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:S3AFastOutputStream.java

示例9: abortMultipartCopy

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
private void abortMultipartCopy() {
    try {
        AbortMultipartUploadRequest abortRequest = new AbortMultipartUploadRequest(
                copyObjectRequest.getDestinationBucketName(),
                copyObjectRequest.getDestinationKey(), multipartUploadId)
                .withRequesterPays(copyObjectRequest.isRequesterPays());
        s3.abortMultipartUpload(abortRequest);
    } catch (Exception e) {
        log.info(
                "Unable to abort multipart upload, you may need to manually remove uploaded parts: "
                        + e.getMessage(), e);
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:14,代码来源:CopyCallable.java

示例10: abortMultipartUploadSecurely

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
@Override
public void abortMultipartUploadSecurely(AbortMultipartUploadRequest req) {
    if (defaultCryptoMode == EncryptionOnly)
        eo.abortMultipartUploadSecurely(req);
    else
        ae.abortMultipartUploadSecurely(req);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:8,代码来源:CryptoModuleDispatcher.java

示例11: onAbort

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * Notified from
 * {@link 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 void onAbort() {
    for (Future<?> future : getFutures()) {
        future.cancel(true);
    }
    if (uploadId != null) {
        try {
            s3.abortMultipartUpload(new AbortMultipartUploadRequest(
                req.getBucketName(), req.getKey(), uploadId));
        } catch (Exception e) {
            LogFactory.getLog(getClass())
                .debug("Failed to abort multi-part upload: " + uploadId, e);
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:21,代码来源:UploadObjectObserver.java

示例12: abortAllMultipartUploads

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
private void abortAllMultipartUploads() {
    ListMultipartUploadsRequest multipartUploadsRequest = new ListMultipartUploadsRequest(bucketName);
    amazonS3.listMultipartUploads(multipartUploadsRequest)
            .getMultipartUploads()
            .forEach(upload -> {
                AbortMultipartUploadRequest request = new AbortMultipartUploadRequest(bucketName, upload.getKey(), upload.getUploadId());
                amazonS3.abortMultipartUpload(request);
            });
}
 
开发者ID:julianghionoiu,项目名称:tdl-auth,代码行数:10,代码来源:RemoteTestBucket.java

示例13: abort

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
public void abort() {
  log.warn("Aborting multi-part upload with id '{}'", uploadId);
  try {
    s3.abortMultipartUpload(new AbortMultipartUploadRequest(bucket, key, uploadId));
  } catch (Exception e) {
    // ignoring failure on abort.
    log.warn("Unable to abort multipart upload, you may need to purge uploaded parts: ", e);
  }
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:10,代码来源:S3OutputStream.java

示例14: abortMultipartUpload

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
public void abortMultipartUpload(S3Upload upload) {
    try {
        runtimeCredentialsProvider.setAwsCredentials(upload.getAwsCredentials());
        amazonS3.setRegion(Region.getRegion(Regions.fromName(upload.getRegion())));
        amazonS3.abortMultipartUpload(new AbortMultipartUploadRequest(upload.getBucket(), upload.getKey(), upload.getUploadId()));
    } catch (AmazonClientException e) {
        throw new OmakaseRuntimeException(e);
    }
}
 
开发者ID:projectomakase,项目名称:omakase,代码行数:10,代码来源:S3Client.java

示例15: abortMultipartUpload

import com.amazonaws.services.s3.model.AbortMultipartUploadRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p/>
 * This implementation simulates abort multipart upload operation.
 */
@Override
public void abortMultipartUpload(AbortMultipartUploadRequest abortMultipartUploadRequest, AmazonS3 s3Client)
{
    // This method does nothing.
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:11,代码来源:MockS3OperationsImpl.java


注:本文中的com.amazonaws.services.s3.model.AbortMultipartUploadRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。