Package com.amazonaws.services.s3.model

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


    @Override
    protected void doUpload(S3BlobStore blobStore, String bucketName, String blobName, InputStream is, int length, boolean serverSideEncryption) throws AmazonS3Exception {
        try {
            long copied = Streams.copy(is, out);
            if (copied != length) {
                throw new AmazonS3Exception("Not all the bytes were copied");
            }
            numberOfUploadRequests++;
        } catch (IOException e) {
            throw new AmazonS3Exception(e.getMessage());
        }
    }
View Full Code Here


    @Override
    protected PartETag doUploadMultipart(S3BlobStore blobStore, String bucketName, String blobName, String uploadId, InputStream is, int length, boolean lastPart) throws AmazonS3Exception {
        try {
            long copied = Streams.copy(is, out);
            if (copied != length) {
                throw new AmazonS3Exception("Not all the bytes were copied");
            }
            return new PartETag(numberOfUploadRequests++, RandomizedTest.randomAsciiOfLength(50));
        } catch (IOException e) {
            throw new AmazonS3Exception(e.getMessage());
        }
    }
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

    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

            initRequest.setStorageClass(StorageClass.fromValue(storageClass));
        }

        String cannedAcl = exchange.getIn().getHeader(S3Constants.CANNED_ACL, String.class);
        if (cannedAcl != null) {
            CannedAccessControlList objectAcl = CannedAccessControlList.valueOf(cannedAcl);
            initRequest.setCannedACL(objectAcl);
        }

        AccessControlList acl = exchange.getIn().getHeader(S3Constants.ACL, AccessControlList.class);
        if (acl != null) {
View Full Code Here

            putObjectRequest.setStorageClass(storageClass);
        }

        String cannedAcl = exchange.getIn().getHeader(S3Constants.CANNED_ACL, String.class);
        if (cannedAcl != null) {
            CannedAccessControlList objectAcl = CannedAccessControlList.valueOf(cannedAcl);
            putObjectRequest.setCannedAcl(objectAcl);
        }

        AccessControlList acl = exchange.getIn().getHeader(S3Constants.ACL, AccessControlList.class);
        if (acl != null) {
View Full Code Here

      v = true;
    }

    AccessControlList acl = conn.getBucketAcl(cid);
    if(permission.equals("rw")){
      acl.grantPermission(new CanonicalGrantee(canonicalId), Permission.FullControl);
      f = true;
    }else if(permission.equals("r")){
      acl.grantPermission(new CanonicalGrantee(canonicalId), Permission.Read);
      f = true;
    }else if(permission.equals("w")){
      acl.grantPermission(new CanonicalGrantee(canonicalId), Permission.Write);
    }

    if(!v && f){
      ObjectListing objectListing = conn.listObjects(cid);
      AccessControlList aclKeys = null;
      for(S3ObjectSummary elem: objectListing.getObjectSummaries()) {
        aclKeys = conn.getObjectAcl(cid, elem.getKey());
        aclKeys.grantPermission(new CanonicalGrantee(canonicalId), Permission.Read);
        aclKeys.grantPermission(new CanonicalGrantee(canonicalId), Permission.ReadAcp);
        conn.setObjectAcl(cid, elem.getKey(), aclKeys);
      }
    }

    conn.setBucketAcl(cid, acl);
View Full Code Here

                insideACL = true;
            } else if (name.equals("Grantee")) {
                if ("AmazonCustomerByEmail".equals(attrs.getValue("xsi:type"))) {
                    currentGrantee = new EmailAddressGrantee(null);
                } else if ("CanonicalUser".equals(attrs.getValue("xsi:type"))) {
                    currentGrantee = new CanonicalGrantee(null);
                } else if ("Group".equals(attrs.getValue("xsi:type"))) {
                    /*
                     * Nothing to do for GroupGrantees here since we
                     * can't construct an empty enum value early.
                     */
 
View Full Code Here

            } else if (name.equals("Grantee")) {
                String type = XmlResponsesSaxParser.findAttributeValue( "xsi:type", attrs );
                if ("AmazonCustomerByEmail".equals(type)) {
                    currentGrantee = new EmailAddressGrantee(null);
                } else if ("CanonicalUser".equals(type)) {
                    currentGrantee = new CanonicalGrantee(null);
                } else if ("Group".equals(type)) {
                    /*
                     * Nothing to do for GroupGrantees here since we
                     * can't construct an empty enum value early.
                     */
 
View Full Code Here

            } else if (name.equals("Grantee")) {
                String type = XmlResponsesSaxParser.findAttributeValue( "xsi:type", attrs );
                if ("AmazonCustomerByEmail".equals(type)) {
                    currentGrantee = new EmailAddressGrantee(null);
                } else if ("CanonicalUser".equals(type)) {
                    currentGrantee = new CanonicalGrantee(null);
                } else if ("Group".equals(type)) {
                    /*
                     * Nothing to do for GroupGrantees here since we
                     * can't construct an empty enum value early.
                     */
 
View Full Code Here

TOP

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

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.