Package com.amazon.s3

Examples of com.amazon.s3.Grantee


      System.out.println("Usage: bucket-list -prefix=<prefix> -delimiter=<delimiter> -marker=<Marker> -max=<max items to return> <bucket name>");
      System.exit(0);
    }
   
      try {
        ListBucket request = new ListBucket();
        Map<String, String> params = getNamedParameters(args);
       
        request.setBucket(args[args.length - 1]);
        request.setCredential("TODO");
        if(params.get("prefix") != null)
          request.setPrefix(params.get("prefix"));
        if(params.get("delimiter") != null)
          request.setDelimiter(params.get("delimiter"));
        if(params.get("marker") != null)
          request.setMarker(params.get("marker"));
        if(params.get("max") != null) {
          try {
            int maxKeys = Integer.parseInt(params.get("max"));
              request.setMaxKeys(maxKeys);
          } catch(Exception e){
            System.out.println("-max parameter should be a numeric value");
          }
        }
      request.setAWSAccessKeyId("TODO");
      request.setCredential("TODO");
      request.setSignature("TODO");
      request.setTimestamp(Calendar.getInstance());
     
      ListBucketResponse response = serviceStub.listBucket(request);
      ListBucketResult result = response.getListBucketResponse();
      System.out.println("\tContent of Bucket " + result.getName());
      System.out.println("\tListing with prefix: " + result.getPrefix() + ", delimiter: "
View Full Code Here


      request.setAWSAccessKeyId("TODO");
      request.setCredential("TODO");
      request.setSignature("TODO");
      request.setTimestamp(Calendar.getInstance());
     
      ListBucketResponse response = serviceStub.listBucket(request);
      ListBucketResult result = response.getListBucketResponse();
      System.out.println("\tContent of Bucket " + result.getName());
      System.out.println("\tListing with prefix: " + result.getPrefix() + ", delimiter: "
        + result.getDelimiter() + ", marker: " + result.getMarker() + ", max: " + result.getMaxKeys());
     
      ListEntry[] entries = result.getContents();
View Full Code Here

      request.setCredential("TODO");
      request.setSignature("TODO");
      request.setTimestamp(Calendar.getInstance());
     
      ListBucketResponse response = serviceStub.listBucket(request);
      ListBucketResult result = response.getListBucketResponse();
      System.out.println("\tContent of Bucket " + result.getName());
      System.out.println("\tListing with prefix: " + result.getPrefix() + ", delimiter: "
        + result.getDelimiter() + ", marker: " + result.getMarker() + ", max: " + result.getMaxKeys());
     
      ListEntry[] entries = result.getContents();
      if(entries != null) {
        for(int i = 0; i < entries.length; i++) {
          ListEntry entry = entries[i];
          System.out.print("\t");
          System.out.print(entry.getSize());
          System.out.print("\t");
          System.out.print(entry.getKey());
          System.out.print("\t");
          System.out.print(entry.getETag());
          System.out.print("\n");
        }
      }
     
      PrefixEntry[] prefixEntries = result.getCommonPrefixes();
      if(prefixEntries != null) {
        System.out.print("\n\n");
       
        for(int i = 0; i < prefixEntries.length; i++) {
          System.out.print("\t<Prefix>\t");
View Full Code Here

        + result.getDelimiter() + ", marker: " + result.getMarker() + ", max: " + result.getMaxKeys());
     
      ListEntry[] entries = result.getContents();
      if(entries != null) {
        for(int i = 0; i < entries.length; i++) {
          ListEntry entry = entries[i];
          System.out.print("\t");
          System.out.print(entry.getSize());
          System.out.print("\t");
          System.out.print(entry.getKey());
          System.out.print("\t");
          System.out.print(entry.getETag());
          System.out.print("\n");
        }
      }
     
      PrefixEntry[] prefixEntries = result.getCommonPrefixes();
View Full Code Here

      System.out.println("Unable to find file " + args[args.length -1]);
      System.exit(0);
    }
   
    try {
      PutObjectInline request = new PutObjectInline();
      request.setBucket(params.get("bucket"));
      request.setKey(params.get("name"));
      request.setContentLength(file.length());
      request.setAWSAccessKeyId("TODO");
      request.setCredential("TODO");
      request.setSignature("TODO");
      request.setTimestamp(Calendar.getInstance());
      request.setData(new DataHandler(file.toURL()));
     
      PutObjectInlineResponse response = serviceStub.putObjectInline(request);
        System.out.println("Object has been posted successfully. ETag: " + response.getPutObjectInlineResponse().getETag());
    } catch(Exception e) {
        System.out.println("Failed to execute object-put-inline due to " + e.getMessage());
View Full Code Here

      request.setCredential("TODO");
      request.setSignature("TODO");
      request.setTimestamp(Calendar.getInstance());
      request.setData(new DataHandler(file.toURL()));
     
      PutObjectInlineResponse response = serviceStub.putObjectInline(request);
        System.out.println("Object has been posted successfully. ETag: " + response.getPutObjectInlineResponse().getETag());
    } catch(Exception e) {
        System.out.println("Failed to execute object-put-inline due to " + e.getMessage());
    }
  }
View Full Code Here

        request.setBucket(args[1]);
        request.setSignature("TODO");
        request.setTimestamp(Calendar.getInstance());
       
        DeleteBucketResponse response = serviceStub.deleteBucket(request);
        Status status = response.getDeleteBucketResponse();
        if(status.getCode() == 200) {
          System.out.println("Bucket " + args[1] + " has been deleted successfully");
        } else {
          System.out.println("Unable to delete bucket " + args[1] + " - " + status.getDescription());
        }
      } catch(Exception e) {
        System.out.println("Failed to execute bucket-delete due to " + e.getMessage());
      }
  }
View Full Code Here

        for (int i = 0; i < grants.length; i++) {
            Grant grant = (Grant) grants[i];
            org.jets3t.service.acl.Permission permission =
                org.jets3t.service.acl.Permission.parsePermission(grant.getPermission().toString());           
           
            Grantee grantee = grant.getGrantee();
            if (grantee instanceof Group) {
                GroupGrantee jets3tGrantee = new GroupGrantee();
                jets3tGrantee.setIdentifier(((Group)grantee).getURI());               
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof CanonicalUser) {
                CanonicalUser canonicalUser = (CanonicalUser) grantee;
                CanonicalGrantee jets3tGrantee = new CanonicalGrantee();
                jets3tGrantee.setIdentifier(canonicalUser.getID());
                jets3tGrantee.setDisplayName(canonicalUser.getDisplayName());
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof AmazonCustomerByEmail) {
                AmazonCustomerByEmail customerByEmail = (AmazonCustomerByEmail) grantee;
                EmailAddressGrantee jets3tGrantee = new EmailAddressGrantee();
                jets3tGrantee.setIdentifier(customerByEmail.getEmailAddress());
                acl.grantPermission(jets3tGrantee, permission);               
            } else {
                throw new S3ServiceException("Unrecognised grantee type: " + grantee.getClass());
            }
        }
        return acl;
    }
View Full Code Here

        for (int i = 0; i < grants.length; i++) {
            Grant grant = (Grant) grants[i];
            org.jets3t.service.acl.Permission permission =
                org.jets3t.service.acl.Permission.parsePermission(grant.getPermission().toString());           
           
            Grantee grantee = grant.getGrantee();
            if (grantee instanceof Group) {
                GroupGrantee jets3tGrantee = new GroupGrantee();
                jets3tGrantee.setIdentifier(((Group)grantee).getURI());               
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof CanonicalUser) {
                CanonicalUser canonicalUser = (CanonicalUser) grantee;
                CanonicalGrantee jets3tGrantee = new CanonicalGrantee();
                jets3tGrantee.setIdentifier(canonicalUser.getID());
                jets3tGrantee.setDisplayName(canonicalUser.getDisplayName());
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof AmazonCustomerByEmail) {
                AmazonCustomerByEmail customerByEmail = (AmazonCustomerByEmail) grantee;
                EmailAddressGrantee jets3tGrantee = new EmailAddressGrantee();
                jets3tGrantee.setIdentifier(customerByEmail.getEmailAddress());
                acl.grantPermission(jets3tGrantee, permission);               
            } else {
                throw new S3ServiceException("Unrecognised grantee type: " + grantee.getClass());
            }
        }
        return acl;
    }
View Full Code Here

        for (int i = 0; i < grants.length; i++) {
            Grant grant = (Grant) grants[i];
            org.jets3t.service.acl.Permission permission =
                org.jets3t.service.acl.Permission.parsePermission(grant.getPermission().toString());           
           
            Grantee grantee = grant.getGrantee();
            if (grantee instanceof Group) {
                GroupGrantee jets3tGrantee = new GroupGrantee();
                jets3tGrantee.setIdentifier(((Group)grantee).getURI());               
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof CanonicalUser) {
                CanonicalUser canonicalUser = (CanonicalUser) grantee;
                CanonicalGrantee jets3tGrantee = new CanonicalGrantee();
                jets3tGrantee.setIdentifier(canonicalUser.getID());
                jets3tGrantee.setDisplayName(canonicalUser.getDisplayName());
                acl.grantPermission(jets3tGrantee, permission);               
            } else if (grantee instanceof AmazonCustomerByEmail) {
                AmazonCustomerByEmail customerByEmail = (AmazonCustomerByEmail) grantee;
                EmailAddressGrantee jets3tGrantee = new EmailAddressGrantee();
                jets3tGrantee.setIdentifier(customerByEmail.getEmailAddress());
                acl.grantPermission(jets3tGrantee, permission);               
            } else {
                throw new S3ServiceException("Unrecognised grantee type: " + grantee.getClass());
            }
        }
        return acl;
    }
View Full Code Here

TOP

Related Classes of com.amazon.s3.Grantee

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.