Package com.amazonaws.s3.doc._2006_03_01

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


    Log.info("Deleting...\n");
   
    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 = getBucketKeyList(marker);
     
      if (listResult.getContents() != null)
      {
     
        /* Get the marker in case there are more pages of keys */
        marker = listResult.getMarker();
           
       
        /* Process this list of keys */
        for (ListEntry listEntry : listResult.getContents())
        {
          deleteS3Object(listEntry.getKey());
          count++;
        }
       
        Log.info(count + " blocks deleted from archive so far\n");
         
      }
     
    }
    while(listResult.isIsTruncated());


    /* Delete the bucket, only if the user did not specify a prefix */
    if (getPrefixName() == null)
    {
View Full Code Here


  public ListBucketResult getBucketKeyList(String marker) throws Exception
  {
    Access access = new Access();
   
    /* Get the list of files from S3 */
    ListBucketResult listResult = null;
   
    String prefix = null;
   
    if (getPrefixName() != null)
    {
View Full Code Here

     
      /* 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 ListBucketResult getBucketObjectList(String marker, String bucket, String prefix, int size) throws Exception
  {
    Access access = new Access();
   
    /* Get the list of files from S3 */
    ListBucketResult listResult = null;
   
    if (prefix != null)
    {
      prefix += OBJECT_PREFIX_SEPARATOR;
    }
View Full Code Here

  output.setPrefix( bucket.getPrefix( ) );
 
  List<ListEntry> outputContents = output.getContents( );
  for ( Metadata meta : contents )
  {
      ListEntry entry = new ListEntry( );
      entry.setETag( String.valueOf( meta.getMd5( ) ) );
      entry.setKey( meta.getKey( ) );
      try
      {
    entry.setLastModified( DatatypeFactory.newInstance( )
      .newXMLGregorianCalendar(
              meta
      .getLastModified( ).toGregorianCalendar( ) ) );
      }
      catch ( DatatypeConfigurationException e )
      {
    throw new CloudStoreException( e );
      }
      entry.setSize( meta.getSize( ) );
      entry.setStorageClass( StorageClass
        .valueOf( meta.getStorageClass( ) ) );
      outputContents.add( entry );
  }
  return output;
    }
View Full Code Here

    /* Setup the optional meta data */
    if (this.tag_ != null)
    {
      metaData = new MetadataEntry[1];
      metaData[0] = new MetadataEntry(META_DATA_TAG, this.tag_);
    }
   
   
      long startTime = System.currentTimeMillis();
     
View Full Code Here

      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,
                            access.getAccessKey(),
                            access.getAccessCalendar(),
                            access.generateSignature("PutObject"),
                            null);
     
             
      long endTime = System.currentTimeMillis();
     
      Log.info(String.format("%6.02f Kb/s\n", (((double)((double)length * (double)Byte.SIZE)) / 1000D) / ((endTime - startTime) / 1000)));

      /* compare md5 hashes */
      if (md5.equals(result.getETag().replaceAll("\"", "")) == false)
      {
        throw new Exception("After putting the S3 object [" + key + "], we compared the md5 hash codes. They did not match\n" + "original: [" + md5 + "]\nS3: [" + result.getETag() + "]");
      }
       
   
  }
View Full Code Here

      return;
    }
   

    MetadataEntry[] metaData = null;
    StorageClass storageClass = StorageClass.STANDARD;
    Access access = new Access();

    /* Setup the optional meta data */
    if (this.tag_ != null)
    {
View Full Code Here

        try {
            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "GetObjectAccessControlPolicy" + convertDateToString(timestamp));
            AccessControlPolicy result = s3SoapBinding.getObjectAccessControlPolicy(
                bucketName, objectKey, getAWSAccessKey(),
                timestamp, signature, null);
            return convertAccessControlTypes(result);
        } catch (RuntimeException e) {
            throw e;
View Full Code Here

        try {
            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "GetBucketAccessControlPolicy" + convertDateToString(timestamp));
            AccessControlPolicy result = s3SoapBinding.getBucketAccessControlPolicy(bucketName,
                getAWSAccessKey(), timestamp, signature, null);
            return convertAccessControlTypes(result);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.amazonaws.s3.doc._2006_03_01.PutObjectResult

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.