Package org.jclouds.aws.s3.blobstore.strategy.internal

Examples of org.jclouds.aws.s3.blobstore.strategy.internal.ParallelMultipartUploadStrategy


   /**
    * {@inheritDoc}
    */
   @Override
   public DeleteResult getResult() {
      return new DeleteResult(deleted.build(), errors.build());
   }
View Full Code Here


   @Test
   public void test() {
      InputStream is = getClass().getResourceAsStream("/delete-result.xml");

      DeleteResult expected = expected();

      DeleteResultHandler handler = injector.getInstance(DeleteResultHandler.class);
      DeleteResult result = factory.create(handler).parse(is);

      assertEquals(result.toString(), expected.toString());
   }
View Full Code Here

           
            builder.add(key);
         }

         Set<String> keys = builder.build();
         DeleteResult result = getApi().deleteObjects(container, keys);

         assertTrue(result.getDeleted().containsAll(keys));
         assertEquals(result.getErrors().size(), 0);

         for (String key : keys) {
            assertConsistencyAwareBlobDoesntExist(container, key);
         }
        
View Full Code Here

                     .addHeader("Server", "AmazonS3")
                     .payload(responsePayload)
                     .build()
      );

      DeleteResult result = client.deleteObjects("test", ImmutableSet.of("key1", "key2"));
      assertNotNull(result, "result is null");
     
      assertEquals(result.getDeleted(), ImmutableSet.of("key1", "key1.1"));
      assertEquals(result.getErrors().size(), 1);
     
      assertEquals(result.getErrors().get("key2"), new DeleteResult.Error("AccessDenied", "Access Denied"));
   }
View Full Code Here

    public void copyBucket(String sourceBucket, String destinationBucket) throws S3ConnectionException {


        Set<String> sourceKeys = null;
        try {
            S3Bucket source = new S3Bucket();
            source.setName(sourceBucket);
            source = s3Service.getBucket(source).get();
            sourceKeys = keysInBucket(source);
            S3Bucket dest = new S3Bucket();
            dest.setName(destinationBucket);

            for (String key : sourceKeys) {
                try {
                    S3Object object = new S3Object();
                    object.setKey(key);
View Full Code Here

    */
   public void copyBucket(String sourceBucket, String destinationBucket)
         throws S3ConnectionException {
      Set<String> sourceKeys;
      try {
         S3Bucket source = new S3Bucket(sourceBucket);
         source = s3Service.listBucket(sourceBucket).get(
               config.getRequestTimeout(), TimeUnit.MILLISECONDS);
         sourceKeys = keysInBucket(source);

         for (String key : sourceKeys) {
View Full Code Here

  ListBucketOptions opts = new ListBucketOptions( );
  opts.withPrefix( prefix );
  opts.afterMarker( String.valueOf( marker ) );
 
  Future<S3Bucket> listResult = _connection.listBucket( _bucket, opts );
  S3Bucket bucket = null;
  try
  {
      bucket = listResult.get( );
  }
  catch ( Exception e )
  {
      throw new ProviderRequestException( e );
  }
  SortedSet<Metadata> contents = bucket.getContents( );
 
  ListBucketResult output = new ListBucketResult( );
  output.setIsTruncated( bucket.isTruncated( ) );
  output.setDelimiter( bucket.getDelimiter( ) );
  output.setMarker( bucket.getMarker( ) );
  output.setMaxKeys( (int) bucket.getMaxKeys( ) );
  output.setName( bucket.getName( ) );
  output.setPrefix( bucket.getPrefix( ) );
 
  List<ListEntry> outputContents = output.getContents( );
  for ( Metadata meta : contents )
  {
      ListEntry entry = new ListEntry( );
View Full Code Here

    */
   public void copyBucket(String sourceBucket, String destinationBucket)
         throws S3ConnectionException {
      Set<String> sourceKeys;
      try {
         S3Bucket source = new S3Bucket(sourceBucket);
         source = s3Service.listBucket(sourceBucket).get(
               config.getRequestTimeout(), TimeUnit.MILLISECONDS);
         sourceKeys = keysInBucket(source);

         for (String key : sourceKeys) {
View Full Code Here

            S3Bucket dest = new S3Bucket();
            dest.setName(destinationBucket);

            for (String key : sourceKeys) {
                try {
                    S3Object object = new S3Object();
                    object.setKey(key);
                    s3Service.copyObject(source, object, dest, object).get();
                } catch (Exception ex) {
                    throw convertToS3ConnectionException("Exception while copying key " + key + " from bucket " + sourceBucket, ex);
                }
            }
View Full Code Here

        Bucket bucket = null;
        InputStream is = null;
        ObjectInputStream ois = null;

        try {
            S3Object s3Object = connection.getConnection().getObject(rootS3Bucket, key).get();
            // it is possible that the object never existed. in this case, fall out.
            if (s3Object != null && s3Object.getContent() != null) {
                is = (InputStream) s3Object.getContent();
                bucket = (Bucket) connection.marshaller.objectFromStream(is);
                // TODO hack until we are sure the bucket has an immutable name
                bucket.setBucketName(key);
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.jclouds.aws.s3.blobstore.strategy.internal.ParallelMultipartUploadStrategy

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.