Package com.amazonaws.s3.doc._2006_03_01

Examples of com.amazonaws.s3.doc._2006_03_01.Grantee


    {
      for (Grant grant: grants)
      {
        S3Grant engineGrant = new S3Grant();

        Grantee grantee = grant.getGrantee();
        if (grantee instanceof CanonicalUser)
        {
          engineGrant.setGrantee(SAcl.GRANTEE_USER);
          engineGrant.setCanonicalUserID(((CanonicalUser)grantee).getID());
        }
        else if (grantee instanceof Group)
        {
           Group temp = (Group)grantee;
           String uri = temp.getURI();
           if ( uri.equalsIgnoreCase( "http://acs.amazonaws.com/groups/global/AllUsers" )) {
              // -> this allows all public unauthenticated access based on permission given
              engineGrant.setGrantee(SAcl.GRANTEE_ALLUSERS);
              engineGrant.setCanonicalUserID( "*" );
           }
           else if (uri.equalsIgnoreCase( "http://acs.amazonaws.com/groups/global/Authenticated" )) {
              // -> this allows any authenticated user access based on permission given
              engineGrant.setGrantee(SAcl.GRANTEE_AUTHENTICATED);
              engineGrant.setCanonicalUserID( "A" );
           }
           else throw new UnsupportedOperationException("Unsupported grantee group URI: " + uri );

        }
        else throw new UnsupportedOperationException("Unsupported grantee type: " + grantee.getClass().getCanonicalName());
       
        Permission permission = grant.getPermission();
        String permissionValue = permission.getValue();
        if(permissionValue.equalsIgnoreCase("READ")) {
          engineGrant.setPermission(SAcl.PERMISSION_READ);
View Full Code Here


    }
    return engineAcl;
  }
 
  private static Grant[] toGrants(S3Grant[] engineGrants) {
    Grantee grantee = null;
    Grant[] grants  = null;

    if (engineGrants != null && 0 < engineGrants.length)
    {
      grants = new Grant[engineGrants.length];
View Full Code Here

        Grant[] grants = acl.getGrant();
        if (grants != null) {
            for (Grant grant : grants) {
                S3Grant engineGrant = new S3Grant();

                Grantee grantee = grant.getGrantee();
                if (grantee instanceof CanonicalUser) {
                    engineGrant.setGrantee(SAcl.GRANTEE_USER);
                    engineGrant.setCanonicalUserID(((CanonicalUser)grantee).getID());
                } else if (grantee instanceof Group) {
                    Group temp = (Group)grantee;
                    String uri = temp.getURI();
                    if (uri.equalsIgnoreCase("http://acs.amazonaws.com/groups/global/AllUsers")) {
                        // -> this allows all public unauthenticated access based on permission given
                        engineGrant.setGrantee(SAcl.GRANTEE_ALLUSERS);
                        engineGrant.setCanonicalUserID("*");
                    } else if (uri.equalsIgnoreCase("http://acs.amazonaws.com/groups/global/Authenticated")) {
                        // -> this allows any authenticated user access based on permission given
                        engineGrant.setGrantee(SAcl.GRANTEE_AUTHENTICATED);
                        engineGrant.setCanonicalUserID("A");
                    } else
                        throw new UnsupportedOperationException("Unsupported grantee group URI: " + uri);

                } else
                    throw new UnsupportedOperationException("Unsupported grantee type: " + grantee.getClass().getCanonicalName());

                Permission permission = grant.getPermission();
                String permissionValue = permission.getValue();
                if (permissionValue.equalsIgnoreCase("READ")) {
                    engineGrant.setPermission(SAcl.PERMISSION_READ);
View Full Code Here

        }
        return engineAcl;
    }

    private static Grant[] toGrants(S3Grant[] engineGrants) {
        Grantee grantee = null;
        Grant[] grants = null;

        if (engineGrants != null && 0 < engineGrants.length) {
            grants = new Grant[engineGrants.length];
            for (int i = 0; i < engineGrants.length; i++) {
View Full Code Here

    {
      for (Grant grant: grants)
      {
        S3Grant engineGrant = new S3Grant();

        Grantee grantee = grant.getGrantee();
        if (grantee instanceof CanonicalUser)
        {
          engineGrant.setGrantee(SAcl.GRANTEE_USER);
          engineGrant.setCanonicalUserID(((CanonicalUser)grantee).getID());
        }
        else if (grantee instanceof Group)
        {
           Group temp = (Group)grantee;
           String uri = temp.getURI();
           if ( uri.equalsIgnoreCase( "http://acs.amazonaws.com/groups/global/AllUsers" )) {
              // -> this allows all public unauthenticated access based on permission given
              engineGrant.setGrantee(SAcl.GRANTEE_ALLUSERS);
              engineGrant.setCanonicalUserID( "*" );
           }
           else if (uri.equalsIgnoreCase( "http://acs.amazonaws.com/groups/global/Authenticated" )) {
              // -> this allows any authenticated user access based on permission given
              engineGrant.setGrantee(SAcl.GRANTEE_AUTHENTICATED);
              engineGrant.setCanonicalUserID( "A" );
           }
           else throw new UnsupportedOperationException("Unsupported grantee group URI: " + uri );

        }
        else throw new UnsupportedOperationException("Unsupported grantee type: " + grantee.getClass().getCanonicalName());
       
        Permission permission = grant.getPermission();
        String permissionValue = permission.getValue();
        if(permissionValue.equalsIgnoreCase("READ")) {
          engineGrant.setPermission(SAcl.PERMISSION_READ);
View Full Code Here

    }
    return engineAcl;
  }
 
  private static Grant[] toGrants(S3Grant[] engineGrants) {
    Grantee grantee = null;
    Grant[] grants  = null;

    if (engineGrants != null && 0 < engineGrants.length)
    {
      grants = new Grant[engineGrants.length];
View Full Code Here

       
        long startTime = System.currentTimeMillis();
       
       
        AmazonS3_ServiceLocator locator = new AmazonS3_ServiceLocator();
        AmazonS3SoapBindingStub binding = new AmazonS3SoapBindingStub(new URL(locator.getAmazonS3Address()), locator);
       
        result = binding.getObject(getBucketName(),
                      key,
                      false,
                      true,
                      false,
                      access.getAccessKey(),
                      access.getAccessCalendar(),
                      access.generateSignature("GetObject"),
                      null);
       
       
        long endTime = System.currentTimeMillis();
       
               
        /* Get the attachments. Note, the getAttachments() method will ONLY return the object[] on the first call.  Subsiquent calls will return null */
        Object[] attachments = binding.getAttachments();
        if (attachments.length != 1)
        {
          throw new Exception("The S3 Object returned [" + attachments.length + "] when we expected exactly 1");
        }
       
View Full Code Here

   
      long startTime = System.currentTimeMillis();
     
     
      AmazonS3_ServiceLocator locator = new AmazonS3_ServiceLocator();
      AmazonS3SoapBindingStub binding = new AmazonS3SoapBindingStub(new URL(locator.getAmazonS3Address()), locator);
      DataHandler dataHandler = new DataHandler(new SourceDataSource(null, MIMETYPE_OCTET_STREAM, new StreamSource(is)));
            binding.addAttachment(dataHandler);
     
      PutObjectResult result = binding.putObject(getBucketName(),
                            key,
                            metaData ,
                            length,
                            null,
                            storageClass,
View Full Code Here

   *******************************************************/
  public AmazonS3_PortType getS3Port() throws Exception
  {
    if (this.s3Port_ == null)
    {
      this.s3Port_ = new AmazonS3_ServiceLocator().getAmazonS3();
    }
   
    return this.s3Port_;
  }
View Full Code Here

   * to obtain the already created port.
   * @return
   *******************************************************/
  public AmazonS3_PortType createS3Port(String endpoint) throws Exception
  {
    AmazonS3_ServiceLocator loc = new AmazonS3_ServiceLocator();
    loc.setAmazonS3EndpointAddress(endpoint);
    this.s3Port_ = loc.getAmazonS3();
    return this.s3Port_;
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.s3.doc._2006_03_01.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.