Package com.amazon.s3

Examples of com.amazon.s3.ListAllMyBucketsResult


        + 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

      /* Create the bucket if it doesn't yet exist */
      boolean bucketFound = false;

      /* First, create the bucket if it doesn't yet exist */
      ListOperation listOperation = new ListOperation(null, null);
      ListAllMyBucketsResult list = listOperation.getBucketList();

      for (ListAllMyBucketsEntry bucket : list.getBuckets())
      {
        if (getBucketName().equals(bucket.getName()))
        {
          bucketFound = true;
          break;
View Full Code Here

    {
   
      Log.info("Bucket List\n");
     
      /* Get the list of files from S3 */
      ListAllMyBucketsResult listResult = null;
 
      /* Get a page of results */
      listResult = getBucketList();
     
      long bucketCount = 0;
     
      /* Process this list of keys */
      for (ListAllMyBucketsEntry listEntry : listResult.getBuckets())
      {
        String bucket = listEntry.getName();
        Log.info(this.df_.format(listEntry.getCreationDate().getTime()) + " - " + bucket + "\n");       
        bucketCount++;
      }
     
     
      Log.info(String.format("total: %d\n", bucketCount));
     
    }
    else
    {
     
      /* If a bucket is specified, then list the files in the bucket */
      String marker = null;
     
      /* Get the list of files from S3 */
      ListBucketResult listResult = null;
     
      /* This do while loop deals with the paging of s3 lists */
      do
      {
        /* Get a page of results */
        listResult = getBucketObjectList(marker, getBucketName(), getPrefixName(), MAX_KEYS_PER_LIST);
       
        if (listResult.getContents() != null)
        {
          /* Process this list of keys */
          for (ListEntry listEntry : listResult.getContents())
          {
            marker = listEntry.getKey();
            processListEntry(listEntry);
           
          }
         
        }
           
      }
      while(listResult.isIsTruncated());
     
     
      /* Now that each object has been processed, dump the results to the screen */
      Iterator keyIterator = this.archives_.keySet().iterator();
      while (keyIterator.hasNext())
View Full Code Here

  public ListAllMyBucketsResult getBucketList() throws Exception
  {
    Access access = new Access();
   
    /* Get the list of files from S3 */
    ListAllMyBucketsResult listResult = null;
   
    /* Get a page of results */
    listResult = getS3Port().listAllMyBuckets(
                      access.getAccessKey(),
                      access.getAccessCalendar(),
View Full Code Here

        try {
            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );           
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "ListAllMyBuckets" + convertDateToString(timestamp));
            ListAllMyBucketsResult result = s3SoapBinding.listAllMyBuckets(
                getAWSAccessKey(), timestamp, signature);

            ListAllMyBucketsEntry[] entries = result.getBuckets();           
            buckets = new S3Bucket[entries.length];
            int index = 0;
            for (int i = 0; i < entries.length; i++) {
                ListAllMyBucketsEntry entry = (ListAllMyBucketsEntry) entries[i];
                S3Bucket bucket = new S3Bucket();
View Full Code Here

        try {
            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );           
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "ListAllMyBuckets" + convertDateToString(timestamp));
            ListAllMyBucketsResult result = s3SoapBinding.listAllMyBuckets(
                getAWSAccessKey(), timestamp, signature);

            ListAllMyBucketsEntry[] entries = result.getBuckets();           
            buckets = new S3Bucket[entries.length];
            int index = 0;
            for (int i = 0; i < entries.length; i++) {
                ListAllMyBucketsEntry entry = (ListAllMyBucketsEntry) entries[i];
                S3Bucket bucket = new S3Bucket();
View Full Code Here

        try {
            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );           
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "ListAllMyBuckets" + convertDateToString(timestamp));
            ListAllMyBucketsResult result = s3SoapBinding.listAllMyBuckets(
                getAWSAccessKey(), timestamp, signature);

            ListAllMyBucketsEntry[] entries = result.getBuckets();           
            buckets = new S3Bucket[entries.length];
            int index = 0;
            for (int i = 0; i < entries.length; i++) {
                ListAllMyBucketsEntry entry = (ListAllMyBucketsEntry) entries[i];
                S3Bucket bucket = new S3Bucket();
View Full Code Here

TOP

Related Classes of com.amazon.s3.ListAllMyBucketsResult

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.