Package com.amazonaws.services.s3.model

Examples of com.amazonaws.services.s3.model.InitiateMultipartUploadResult


                metadata = new ObjectMetadata();
            // Store encryption info in metadata
            req.setObjectMetadata(updateMetadataWithContentCryptoMaterial(
                    metadata, null, cekMaterial));
        }
        InitiateMultipartUploadResult result = s3.initiateMultipartUpload(req);
        MultipartUploadCryptoContext uploadContext = new MultipartUploadCryptoContext(
                req.getBucketName(), req.getKey(), cekMaterial);
        multipartUploadContexts.put(result.getUploadId(), uploadContext);
        return result;
    }
View Full Code Here


          // Update the request's metadata to the updated metadata
          initiateMultipartUploadRequest.setObjectMetadata(metadata);
    }

    InitiateMultipartUploadResult result = super.initiateMultipartUpload(initiateMultipartUploadRequest);
    EncryptedUploadContext encryptedUploadContext = new EncryptedUploadContext(initiateMultipartUploadRequest.getBucketName(), initiateMultipartUploadRequest.getKey(), envelopeSymmetricKey);
    encryptedUploadContext.setNextInitializationVector(symmetricCipher.getIV());
    encryptedUploadContext.setFirstInitializationVector(symmetricCipher.getIV());
    currentMultipartUploadSecretKeys.put(result.getUploadId(), encryptedUploadContext);

    return result;
  }
View Full Code Here

            // Update the request's metadata to the updated metadata
            initiateMultipartUploadRequest.setObjectMetadata(metadata);
        }

        InitiateMultipartUploadResult result = super.initiateMultipartUpload(initiateMultipartUploadRequest);
        EncryptedUploadContext encryptedUploadContext = new EncryptedUploadContext(initiateMultipartUploadRequest.getBucketName(), initiateMultipartUploadRequest.getKey(), envelopeSymmetricKey);
        encryptedUploadContext.setNextInitializationVector(symmetricCipher.getIV());
        encryptedUploadContext.setFirstInitializationVector(symmetricCipher.getIV());
        currentMultipartUploadSecretKeys.put(result.getUploadId(), encryptedUploadContext);

        return result;
    }
View Full Code Here

      request.setStorageClass(StorageClass.Standard);
    }

    try {

      final InitiateMultipartUploadResult result = this.s3Client.initiateMultipartUpload(request);
      operationSuccessful = true;
      return result.getUploadId();

    } catch (AmazonServiceException e) {
      throw new IOException(StringUtils.stringifyException(e));
    } finally {
      if (!operationSuccessful) {
View Full Code Here

        String bucketName = getConfiguration().getBucketName();
        LOG.trace("Querying whether bucket [{}] already exists...", bucketName);
       
        try {
            s3Client.listObjects(new ListObjectsRequest(bucketName, null, null, null, 0));
            LOG.trace("Bucket [{}] already exists", bucketName);
            return;
        } catch (AmazonServiceException ase) {
            /* 404 means the bucket doesn't exist */
            if (ase.getStatusCode() != 404) {
View Full Code Here

        when(s3Client.listObjects(any(ListObjectsRequest.class))).thenAnswer(new Answer() {

            @Override
            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
                Object[] args=invocationOnMock.getArguments();
                ListObjectsRequest r=(ListObjectsRequest) args[0];
                if(!"foo-bar".equals(r.getBucketName()))
                    throw new Exception("Bucket name was not correctly specified");
                if(!(1==r.getMaxKeys()))
                    throw new Exception("More than one result was asked for");

                boolean ok=false;
                final List<S3ObjectSummary> out= Lists.newArrayList();

                if("pathoDromic".equals(r.getPrefix())) {
                    out.add(new S3ObjectSummary());
                    ok=true;
                }

                if("way-out/".equals(r.getPrefix())) {
                    ok=true;
                }
                if(ok) {
                    return new ObjectListing() {
                        @Override
                        public List<S3ObjectSummary> getObjectSummaries() {
                            return out;
                        }

                    };
                }
                throw new Exception("An unrecognized path ["+r.getPrefix()+"] was given");
            }
        });
    }
View Full Code Here

        String path=uri.getPath();
        return fileExistsinS3(bucketName, path);
    }

    private boolean fileExistsinS3(String bucketName, String path) {
        return s3Client.listObjects(new ListObjectsRequest()
                .withBucketName(bucketName)
                .withPrefix(path.substring(1))
                .withMaxKeys(1)).getObjectSummaries().isEmpty();
    }
View Full Code Here

       
        String bucketName = getConfiguration().getBucketName();
        LOG.trace("Quering whether bucket [{}] already exists...", bucketName);
       
        try {
            getS3Client().listObjects(new ListObjectsRequest(bucketName, null, null, null, 0));
            LOG.trace("Bucket [{}] already exists", bucketName);
            return;
        } catch (AmazonServiceException ase) {
            /* 404 means the bucket doesn't exist */
            if (ase.getStatusCode() != 404) {
View Full Code Here

        pendingExchanges = 0;
       
        String bucketName = getConfiguration().getBucketName();
        LOG.trace("Quering objects in bucket [{}]...", bucketName);
       
        ListObjectsRequest listObjectsRequest = new ListObjectsRequest();
        listObjectsRequest.setBucketName(bucketName);
        listObjectsRequest.setMaxKeys(getMaxMessagesPerPoll());
       
        ObjectListing listObjects = getAmazonS3Client().listObjects(listObjectsRequest);
       
        LOG.trace("Found {} objects in bucket [{}]...", listObjects.getObjectSummaries().size(), bucketName);
       
View Full Code Here

            AmazonServiceException ex = new AmazonServiceException("Unknow bucket");
            ex.setStatusCode(404);
            throw ex;
        }
       
        ObjectListing objectListing = new ObjectListing();
        int capacity = listObjectsRequest.getMaxKeys();
       
        for (int index = 0; index < objects.size() && index < capacity; index++) {
            S3ObjectSummary s3ObjectSummary = new S3ObjectSummary();
            s3ObjectSummary.setBucketName(objects.get(index).getBucketName());
            s3ObjectSummary.setKey(objects.get(index).getKey());
           
            objectListing.getObjectSummaries().add(s3ObjectSummary);
        }

        return objectListing;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.s3.model.InitiateMultipartUploadResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.