Package com.amazonaws.services.s3.model

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


             */
            List<Bucket> buckets = s3.listBuckets();
            System.out.println("You have " + buckets.size() + " Amazon S3 bucket(s).");

            if (buckets.size() > 0) {
                Bucket bucket = buckets.get(0);

                long totalSize  = 0;
                long totalItems = 0;
                /*
                 * The S3Objects and S3Versions classes provide convenient APIs
                 * for iterating over the contents of your buckets, without
                 * having to manually deal with response pagination.
                 */
                for (S3ObjectSummary objectSummary : S3Objects.inBucket(s3, bucket.getName())) {
                    totalSize += objectSummary.getSize();
                    totalItems++;
                }

                System.out.println("The bucket '" + bucket.getName() + "' contains "+ totalItems + " objects "
                        + "with a total size of " + totalSize + " bytes.");
            }
        } catch (AmazonServiceException ase) {
            /*
             * AmazonServiceExceptions represent an error response from an AWS
View Full Code Here


            request.setContent(new ByteArrayInputStream(xml.getBytes()));
        }

        invoke(request, voidResponseHandler, bucketName, null);

        return new Bucket(bucketName);
    }
View Full Code Here

            request.setContent(new ByteArrayInputStream(xml.getBytes()));
        }

        invoke(request, voidResponseHandler, bucketName, null);

        return new Bucket(bucketName);
    }
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("Bucket")) {
                currentBucket = new Bucket();
            } else if (name.equals("Owner")) {
                bucketsOwner = new Owner();
            }
        }
View Full Code Here

            httpRequest.setContent(new ByteArrayInputStream(xml.getBytes()));
        }

        client.execute(httpRequest, voidResponseHandler, errorResponseHandler);

        return new Bucket(bucketName);
    }
View Full Code Here

    public Bucket createBucket(CreateBucketRequest createBucketRequest) throws AmazonClientException, AmazonServiceException {
        if ("nonExistingBucket".equals(createBucketRequest.getBucketName())) {
            nonExistingBucketCreated = true;
        }
       
        Bucket bucket = new Bucket();
        bucket.setName(createBucketRequest.getBucketName());
        bucket.setCreationDate(new Date());
        bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ", "Christian Mueller"));
        return bucket;
    }
View Full Code Here

        }

        ExecutionContext executionContext = new ExecutionContext(requestHandlers);
        client.execute(request, voidResponseHandler, errorResponseHandler, executionContext);

        return new Bucket(bucketName);
    }
View Full Code Here

            FileSystemOptions fileSystemOptions) throws FileSystemException {
        super(fileName, null, fileSystemOptions);
        String bucketId = fileName.getBucketId();
        try {
            this.service = service;
            bucket = new Bucket(bucketId);

            logger.info(String.format("Created new S3 FileSystem %s", bucketId));
        } catch (Exception e) {
            String s3message = e.getMessage();
View Full Code Here

            request.setContent(new ByteArrayInputStream(xml.getBytes()));
        }

        invoke(request, voidResponseHandler, bucketName, null);

        return new Bucket(bucketName);
    }
View Full Code Here

            request.setContent(new ByteArrayInputStream(xml.getBytes()));
        }

        invoke(request, voidResponseHandler, bucketName, null);

        return new Bucket(bucketName);
    }
View Full Code Here

TOP

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

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.