Package com.cloud.bridge.service.core.s3

Examples of com.cloud.bridge.service.core.s3.S3CanonicalUser


        request.setAttribute(S3Constants.PLAIN_POST_SIGNATURE, signatureString);

        // -> authenticated calls
        try {
            // S3AuthParams params = extractRequestHeaders( request );
            S3AuthParams params = new S3AuthParams();
            HeaderParam headerParam1 = new HeaderParam("accessKey", accessKeyString);
            params.addHeader(headerParam1);
            HeaderParam headerParam2 = new HeaderParam("secretKey", signatureString);
            params.addHeader(headerParam2);
            authenticateRequest( request, params );
        }
        catch (Exception e)
        { logger.warn("Authentication details insufficient"); }
View Full Code Here


     *         even if it is set at null.
     */
    public OrderedPair<S3BucketPolicy,Integer> getBucketPolicy(String bucketName) {

        if (policyMap.containsKey( bucketName )) {
            S3BucketPolicy policy = policyMap.get( bucketName );
            return new OrderedPair<S3BucketPolicy,Integer>( policy, 0 );
        }
        else return new OrderedPair<S3BucketPolicy,Integer>( null, -1 );           // For case (1) where the map has no entry for bucketName
    }
View Full Code Here

        Transaction txn = Transaction.open(Transaction.AWSAPI_DB);
        // [B] Place the policy into the database over writting an existing policy
        try {
            // -> first make sure that the policy is valid by parsing it
            PolicyParser parser = new PolicyParser();
            S3BucketPolicy sbp = parser.parse( policy, bucketName );
            bPolicyDao.deletePolicy(bucketName);

            if (null != policy && !policy.isEmpty()) {
                BucketPolicyVO bpolicy = new BucketPolicyVO(bucketName, client, policy);
                bpolicy = bPolicyDao.persist(bpolicy);
View Full Code Here

  };         

 
  public S3BucketPolicy parse( String policy, String bucketName ) throws ParseException, PermissionDeniedException
 
    bucketPolicy = new S3BucketPolicy();
    bucketPolicy.setBucketName( bucketName );
      jparser.parse(policy, myHandler);
      return bucketPolicy;
  }
View Full Code Here

  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++) {
View Full Code Here

        xml.append( "<IsTruncated>" ).append( engineResponse.isTruncated()).append( "</IsTruncated>" );

        S3ListBucketObjectEntry[] versions = engineResponse.getContents();
        for( int i=0; null != versions && i < versions.length; i++ )
        {
            S3CanonicalUser owner    = versions[i].getOwner();
            boolean isDeletionMarker = versions[i].getIsDeletionMarker();
            String displayName       = owner.getDisplayName();
            String id                = owner.getID();

            if ( isDeletionMarker )
            {    
                xml.append( "<DeleteMarker>" );    
                xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
                xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
                xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
                xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
            }
            else
            {     xml.append( "<Version>" );    
            xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
            xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
            xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
            xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
            xml.append( "<ETag>" ).append( versions[i].getETag()).append( "</ETag>" );
            xml.append( "<Size>" ).append( versions[i].getSize()).append( "</Size>" );
            xml.append( "<StorageClass>" ).append( versions[i].getStorageClass()).append( "</StorageClass>" );
            }

            xml.append( "<Owner>" );
            xml.append( "<ID>" ).append( id ).append( "</ID>" );
            if ( null == displayName )
                xml.append( "<DisplayName/>" );
            else xml.append( "<DisplayName>" ).append( owner.getDisplayName()).append( "</DisplayName>" );
            xml.append( "</Owner>" );

            if ( isDeletionMarker )
                xml.append( "</DeleteMarker>" );
            else xml.append( "</Version>" );
View Full Code Here

        xml.append("<MaxKeys>").append(engineResponse.getMaxKeys()).append("</MaxKeys>");
        xml.append("<IsTruncated>").append(engineResponse.isTruncated()).append("</IsTruncated>");

        S3ListBucketObjectEntry[] versions = engineResponse.getContents();
        for (int i = 0; null != versions && i < versions.length; i++) {
            S3CanonicalUser owner = versions[i].getOwner();
            boolean isDeletionMarker = versions[i].getIsDeletionMarker();
            String displayName = owner.getDisplayName();
            String id = owner.getID();

            if (isDeletionMarker) {
                xml.append("<DeleteMarker>");
                xml.append("<Key>").append(versions[i].getKey()).append("</Key>");
                xml.append("<VersionId>").append(versions[i].getVersion()).append("</VersionId>");
                xml.append("<IsLatest>").append(versions[i].getIsLatest()).append("</IsLatest>");
                xml.append("<LastModified>").append(DatatypeConverter.printDateTime(versions[i].getLastModified())).append("</LastModified>");
            } else {
                xml.append("<Version>");
                xml.append("<Key>").append(versions[i].getKey()).append("</Key>");
                xml.append("<VersionId>").append(versions[i].getVersion()).append("</VersionId>");
                xml.append("<IsLatest>").append(versions[i].getIsLatest()).append("</IsLatest>");
                xml.append("<LastModified>").append(DatatypeConverter.printDateTime(versions[i].getLastModified())).append("</LastModified>");
                xml.append("<ETag>").append(versions[i].getETag()).append("</ETag>");
                xml.append("<Size>").append(versions[i].getSize()).append("</Size>");
                xml.append("<StorageClass>").append(versions[i].getStorageClass()).append("</StorageClass>");
            }

            xml.append("<Owner>");
            xml.append("<ID>").append(id).append("</ID>");
            if (null == displayName)
                xml.append("<DisplayName/>");
            else
                xml.append("<DisplayName>").append(owner.getDisplayName()).append("</DisplayName>");
            xml.append("</Owner>");

            if (isDeletionMarker)
                xml.append("</DeleteMarker>");
            else
View Full Code Here

    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++) {
View Full Code Here

  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++) {
View Full Code Here

        xml.append( "<IsTruncated>" ).append( engineResponse.isTruncated()).append( "</IsTruncated>" );
       
        S3ListBucketObjectEntry[] versions = engineResponse.getContents();
        for( int i=0; null != versions && i < versions.length; i++ )
        {
           S3CanonicalUser owner    = versions[i].getOwner();
           boolean isDeletionMarker = versions[i].getIsDeletionMarker();
           String displayName       = owner.getDisplayName();
           String id                = owner.getID();
          
           if ( isDeletionMarker )
           {    
              xml.append( "<DeleteMarker>" );    
                  xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
                  xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
                  xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
                  xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
           }
           else
           {     xml.append( "<Version>" );    
                  xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
                  xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
                  xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
                  xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
                  xml.append( "<ETag>" ).append( versions[i].getETag()).append( "</ETag>" );
                  xml.append( "<Size>" ).append( versions[i].getSize()).append( "</Size>" );
                  xml.append( "<StorageClass>" ).append( versions[i].getStorageClass()).append( "</StorageClass>" );
           }
          
             xml.append( "<Owner>" );
             xml.append( "<ID>" ).append( id ).append( "</ID>" );
             if ( null == displayName )
                  xml.append( "<DisplayName/>" );
             else xml.append( "<DisplayName>" ).append( owner.getDisplayName()).append( "</DisplayName>" );
             xml.append( "</Owner>" );
          
             if ( isDeletionMarker )
                xml.append( "</DeleteMarker>" );
             else xml.append( "</Version>" );
View Full Code Here

TOP

Related Classes of com.cloud.bridge.service.core.s3.S3CanonicalUser

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.