Package org.jclouds.aws.s3.domain

Examples of org.jclouds.aws.s3.domain.DeleteResult$Error


                     .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

        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

TOP

Related Classes of org.jclouds.aws.s3.domain.DeleteResult$Error

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.