Package org.jclouds.aws.s3

Examples of org.jclouds.aws.s3.AWSS3Client


        try {
            if (b.getEntries().isEmpty()) {
                if (!connection.getConnection().deleteObject(rootS3Bucket, b.getBucketName()).get())
                    throw new S3ConnectionException(String.format("Could not delete object [%2s] in s3bucket [%1s] ", rootS3Bucket.getName(), b.getBucketName()));
            } else {
                S3Object s3Object = new S3Object();
                s3Object.setKey(b.getBucketName());
                s3Object.setContent(connection.marshaller.objectToByteBuffer(b));
                s3Object.setContentType("application/octet-string");
                String id = connection.getConnection().addObject(rootS3Bucket, s3Object).get();
                assert id != null : String.format("Should have received an id for entry %1s:%2s ", rootS3Bucket.getName(), b.getBucketName());
            }
        } catch (Exception ex) {
            throw connection.convertToS3ConnectionException("Exception while saving bucket " + b, ex);
View Full Code Here


   
    @Override
    public CloudStoreObjectMetadata sendRefreshMetadataRequest(
                CloudStoreObject obj )
    {
  S3Object jObj = getS3Object( obj );
  return convertToCloopMetadata( jObj.getMetadata( ) );
    }
View Full Code Here

    }
   
    @Override
    public void sendUploadRequest( CloudStoreFile file )
    {
  S3Object obj = new S3Object( file.getPath( ).getAbsolutePath( ), file
    .getStreamToStore( ) );
  if ( file.hasDirtyMetadata( ) )
  {
      obj
        .setMetadata( convertToJCloudMetadata( file.getPath( )
        .getAbsolutePath( ),
                 file
        .getDirtyMetadata( ) ) );
      file.setMetadata( file.getDirtyMetadata( ) );
View Full Code Here

    }
   
    private Metadata convertToJCloudMetadata( String key,
                CloudStoreObjectMetadata metadata )
    {
  Metadata jMeta = new Metadata( key );
  jMeta.setUserMetadata( convertMetadataToMap( metadata ) );
  return jMeta;
    }
View Full Code Here

            }
            if (!properties.containsKey("jclouds.aws.accesskeyid"))
                properties.put("jclouds.aws.accesskeyid", config.getAwsAccessKey());
            if (!properties.containsKey("jclouds.aws.secretaccesskey"))
                properties.put("jclouds.aws.secretaccesskey", config.getAwsSecretKey());
            this.s3Service = S3ConnectionFactory.getConnection(properties, new S3HttpNioConnectionPoolClientModule());
            if (this.s3Service == null) {
                throw new S3ConnectionException("Could not connect");
            }

        } catch (Exception ex) {
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.