Examples of SBucket


Examples of com.cloud.bridge.model.SBucket

    String policy = streamToString( request.getInputStream());
           
    // [A] Is there an owner of an existing policy or bucket?
        BucketPolicyDao policyDao = new BucketPolicyDao();
    SBucketDao bucketDao = new SBucketDao();
    SBucket bucket = bucketDao.getByName( bucketName );
        String owner = null;
       
        if ( null != bucket )
        {
           owner = bucket.getOwnerCanonicalId();
        }
        else
        {    try {
               owner = policyDao.getPolicyOwner( bucketName );
             }
View Full Code Here

Examples of com.cloud.bridge.model.SBucket

    String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);

    // [A] Is there an owner of an existing policy or bucket?
        BucketPolicyDao policyDao = new BucketPolicyDao();
    SBucketDao bucketDao = new SBucketDao();
    SBucket bucket = bucketDao.getByName( bucketName );
        String owner = null;
       
        if ( null != bucket )
        {
           owner = bucket.getOwnerCanonicalId();
        }
        else
        {    try {
               owner = policyDao.getPolicyOwner( bucketName );
             }
View Full Code Here

Examples of com.cloud.bridge.model.SBucket

  private void executeDeleteBucketPolicy(HttpServletRequest request, HttpServletResponse response)
  {
    String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
   
    SBucketDao bucketDao = new SBucketDao();
    SBucket bucket = bucketDao.getByName( bucketName );
    if (bucket != null)
    {
        String client = UserContext.current().getCanonicalUserId();
        if (!client.equals( bucket.getOwnerCanonicalId())) {
            response.setStatus(405);
            return;
        }
    }
View Full Code Here

Examples of com.cloud.bridge.model.SBucket

      response.setStatus( 400 );
      return;
    }
   
    SBucketDao bucketDao = new SBucketDao();
    SBucket sbucket = bucketDao.getByName( bucketName );
    if (sbucket == null) {
      response.setStatus( 404 );
      return;
    }
   
    // [B] The owner may want to restrict the IP address at which this can be performed
    String client = UserContext.current().getCanonicalUserId();
    if (!client.equals( sbucket.getOwnerCanonicalId()))
        throw new PermissionDeniedException( "Access Denied - only the owner can read bucket versioning" );

    S3PolicyContext context = new S3PolicyContext( PolicyActions.GetBucketVersioning, bucketName );
      if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
             response.setStatus(403);
             return;
      }


      // [C]
    switch( sbucket.getVersioningStatus()) {
    default:
    case 0: versioningStatus = "";           break;
    case 1: versioningStatus = "Enabled";    break;
    case 2: versioningStatus = "Suspended"break;
    }
View Full Code Here

Examples of com.cloud.bridge.model.SBucket

      
      try {
      // -> does not matter what the ACLs say only the owner can turn on versioning on a bucket
          // -> the bucket owner may want to restrict the IP address from which this can occur
      SBucketDao bucketDao = new SBucketDao();
      SBucket sbucket = bucketDao.getByName( bucketName );
   
      String client = UserContext.current().getCanonicalUserId();
      if (!client.equals( sbucket.getOwnerCanonicalId()))
          throw new PermissionDeniedException( "Access Denied - only the owner can turn on versioing on a bucket" );
   
      S3PolicyContext context = new S3PolicyContext( PolicyActions.PutBucketVersioning, bucketName );
        if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
               response.setStatus(403);
               return;
        }

     
           if (versioningStatus.equalsIgnoreCase( "Enabled"  )) sbucket.setVersioningStatus( 1 );
      else if (versioningStatus.equalsIgnoreCase( "Suspended")) sbucket.setVersioningStatus( 2 );
      else {
         logger.error( "executePutBucketVersioning - unknown state: [" + versioningStatus + "]" );
         response.setStatus( 400 );
         return;
        }
View Full Code Here

Examples of com.cloud.bridge.model.SBucket

    String uploadIdMarker = request.getParameter("upload-id-marker");
        if (null == keyMarker) uploadIdMarker = null;
     
    // -> does the bucket exist, we may need it to verify access permissions
    SBucketDao bucketDao = new SBucketDao();
    SBucket bucket = bucketDao.getByName(bucketName);
    if (bucket == null) {
      logger.error( "listMultipartUpload failed since " + bucketName + " does not exist" );
        response.setStatus(404);
        return;
    }
   
    S3PolicyContext context = new S3PolicyContext( PolicyActions.ListBucketMultipartUploads, bucketName );
    context.setEvalParam( ConditionKeys.Prefix, prefix );
    context.setEvalParam( ConditionKeys.Delimiter, delimiter );
    S3Engine.verifyAccess( context, "SBucket", bucket.getId(), SAcl.PERMISSION_READ );

       
    // [B] Query the multipart table to get the list of current uploads
      try {
          MultipartLoadDao uploadDao = new MultipartLoadDao();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.