Package org.jclouds.aws.s3

Examples of org.jclouds.aws.s3.AWSS3Client


         return super.putBlob(container, blob, options);
      }
   }

   private ListenableFuture<String> putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);

      } catch (CacheLoader.InvalidCacheLoadException e) {
         // nulls not permitted from cache loader
      }
      return getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi().putObject(container,
View Full Code Here


         return super.putBlob(container, blob, options);
      }
   }

   private ListenableFuture<String> putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);

      } catch (CacheLoader.InvalidCacheLoadException e) {
         // nulls not permitted from cache loader
      }
      return getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi().putObject(container,
View Full Code Here

         return super.putBlob(container, blob, options);
      }
   }

   private String putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);

      } catch (CacheLoader.InvalidCacheLoadException e) {
         // nulls not permitted from cache loader
      }
      return getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi().putObject(container, blob2Object.apply(blob),
View Full Code Here

         return super.putBlob(container, blob, options);
      }
   }

   private String putBlobWithReducedRedundancy(String container, Blob blob) {
      AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
      try {
         AccessControlList acl = bucketAcls.getUnchecked(container);
         if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
                                              AccessControlList.Permission.READ)) {
            options.withAcl(CannedAccessPolicy.PUBLIC_READ);
         }
         options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);

      } catch (CacheLoader.InvalidCacheLoadException e) {
         // nulls not permitted from cache loader
      }
      return getContext().unwrapApi(AWSS3Client.class).putObject(container, blob2Object.apply(blob), options);
View Full Code Here

    protected void sendIntraStoreCopyRequest(
                CloudStorePath fromPath,
                CloudStorePath toPath,
                CloudStoreObjectMetadata newMetadata )
    {
  CopyObjectOptions opts = new CopyObjectOptions( );
  opts.overrideMetadataWith( convertMetadataToMap( newMetadata ) );
  _connection.copyObject( _bucket, fromPath.getAbsolutePath( ), _bucket,
        toPath.getAbsolutePath( ), opts );
    }
View Full Code Here

   
    private S3Object getS3Object( CloudStoreObject object )
    {
  try
  {
      GetObjectOptions opts = new GetObjectOptions( );
      opts.range( 0, 0 );
      return _connection.getObject( _bucket, object.getPath( )
        .getAbsolutePath( ) ).get( );
  }
  catch ( Exception e )
  {
View Full Code Here

    @Override
    protected ListBucketResult executeListDirectoryRequest(
                  String prefix,
                  int marker )
    {
  ListBucketOptions opts = new ListBucketOptions( );
  opts.withPrefix( prefix );
  opts.afterMarker( String.valueOf( marker ) );
 
  Future<S3Bucket> listResult = _connection.listBucket( _bucket, opts );
  S3Bucket bucket = null;
  try
  {
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

   @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

TOP

Related Classes of org.jclouds.aws.s3.AWSS3Client

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.