Package com.amazon.s3

Examples of com.amazon.s3.Response


    if (engineGrants != null && 0 < engineGrants.length)
    {
      grants = new Grant[engineGrants.length];
      for(int i = 0; i < engineGrants.length; i++)
      {
        grants[i] = new Grant();
       
        switch( engineGrants[i].getGrantee()) {
        case SAcl.GRANTEE_USER :
           grantee = new CanonicalUser();
           ((CanonicalUser)grantee).setID(engineGrants[i].getCanonicalUserID());
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

           ((CanonicalUser)grantee).setDisplayName("TODO");
           grants[i].setGrantee(grantee);
           break;
         
        case SAcl.GRANTEE_ALLUSERS:
           grantee = new Group();
           ((Group)grantee).setURI( "http://acs.amazonaws.com/groups/global/AllUsers" );
           grants[i].setGrantee(grantee);
             break;
            
        case SAcl.GRANTEE_AUTHENTICATED:       
           grantee = new Group();
           ((Group)grantee).setURI( "http://acs.amazonaws.com/groups/global/Authenticated" );
           grants[i].setGrantee(grantee);
           break;
         
        default :
View Full Code Here

          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( "*" );
           }
View Full Code Here

    result.setOwner(owner);
    S3ListAllMyBucketsEntry[] engineEntries = engineResponse.getBuckets();
    if (engineEntries != null) {
      entries = new ListAllMyBucketsEntry[engineEntries.length];
      for(int i = 0; i < engineEntries.length; i++) {
        entries[i] = new ListAllMyBucketsEntry();
        entries[i].setName(engineEntries[i].getName());
        entries[i].setCreationDate(engineEntries[i].getCreationDate());   //setTimeZone(TimeZone.getTimeZone("Z"));
      }

      ListAllMyBucketsList list = new ListAllMyBucketsList();
View Full Code Here

        entries[i] = new ListAllMyBucketsEntry();
        entries[i].setName(engineEntries[i].getName());
        entries[i].setCreationDate(engineEntries[i].getCreationDate());   //setTimeZone(TimeZone.getTimeZone("Z"));
      }

      ListAllMyBucketsList list = new ListAllMyBucketsList();
        list.setBucket(entries);
        result.setBuckets(list);
    }
    response.setListAllMyBucketsResponse(result);
    return response;
  }
View Full Code Here

    request.setSignature(listAllMyBuckets.getSignature());
    return request;
  }
 
  public static ListAllMyBucketsResponse toListAllMyBucketsResponse(S3ListAllMyBucketsResponse engineResponse) {
    ListAllMyBucketsResponse response = new ListAllMyBucketsResponse();
    ListAllMyBucketsResult result = new ListAllMyBucketsResult();
    ListAllMyBucketsEntry[] entries = null;
   
    S3CanonicalUser ownerEngine = engineResponse.getOwner();
    CanonicalUser owner = new CanonicalUser();
    owner.setID(ownerEngine.getID());
    owner.setDisplayName(ownerEngine.getDisplayName());
    result.setOwner(owner);
    S3ListAllMyBucketsEntry[] engineEntries = engineResponse.getBuckets();
    if (engineEntries != null) {
      entries = new ListAllMyBucketsEntry[engineEntries.length];
      for(int i = 0; i < engineEntries.length; i++) {
        entries[i] = new ListAllMyBucketsEntry();
        entries[i].setName(engineEntries[i].getName());
        entries[i].setCreationDate(engineEntries[i].getCreationDate());   //setTimeZone(TimeZone.getTimeZone("Z"));
      }

      ListAllMyBucketsList list = new ListAllMyBucketsList();
        list.setBucket(entries);
        result.setBuckets(list);
    }
    response.setListAllMyBucketsResponse(result);
    return response;
  }
View Full Code Here

        S3ListAllMyBucketsResponse engineResponse = ServiceProvider
                .getInstance().getS3Engine().handleRequest(engineRequest);

        // To allow the all buckets list to be serialized via Axiom classes
        ListAllMyBucketsResponse allBuckets = S3SerializableServiceImplementation
                .toListAllMyBucketsResponse(engineResponse);

        OutputStream outputStream = response.getOutputStream();
        response.setStatus(200);
        response.setContentType("application/xml");
View Full Code Here

        engineRequest.setSignature("");

        S3ListAllMyBucketsResponse engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);

        // To allow the all buckets list to be serialized via Axiom classes
        ListAllMyBucketsResponse allBuckets = S3SerializableServiceImplementation.toListAllMyBucketsResponse(engineResponse);

        OutputStream outputStream = response.getOutputStream();
        response.setStatus(200);
        response.setContentType("application/xml");
        // The content-type literally should be "application/xml; charset=UTF-8"
View Full Code Here

TOP

Related Classes of com.amazon.s3.Response

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.