Package com.google.walkaround.slob.client

Examples of com.google.walkaround.slob.client.ChannelTestUtil$Doc


    {
   
      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

  {
      throw new ProviderRequestException( e );
  }
  SortedSet<Metadata> contents = bucket.getContents( );
 
  ListBucketResult output = new ListBucketResult( );
  output.setIsTruncated( bucket.isTruncated( ) );
  output.setDelimiter( bucket.getDelimiter( ) );
  output.setMarker( bucket.getMarker( ) );
  output.setMaxKeys( (int) bucket.getMaxKeys( ) );
  output.setName( bucket.getName( ) );
  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( ) );
View Full Code Here

      // the delimiter out for now and will possibly add it later
      // if people complain.
      String dirPath = directory.getPath( ).getAbsolutePath( );
      String prefix = directory.isRoot( ) ? "" : dirPath.substring( 1 );
     
      ListBucketResult resp = executeListDirectoryRequest( prefix, marker );
     
      resultsWereTruncated = resp.isIsTruncated( );
      int numResults = resp.getContents( ).size( );
      marker = marker + numResults + 1;
     
      if ( output == null )
      {
    if ( resultsWereTruncated )
    {
        output = new ArrayList<CloudStoreObject>( 5 * numResults );
    }
    else
    {
        output = new ArrayList<CloudStoreObject>( numResults );
    }
      }
     
      for ( ListEntry entry : resp.getContents( ) )
      {
    CloudStoreObject obj;
    String path = entry.getKey( );
    if ( !filter.shouldInclude( path ) )
        continue;
View Full Code Here

  request.addQueryArg( "marker", String.valueOf( marker ) );
  request.addQueryArg( "prefix", prefix );
 
  request.setBucket( _bucket );
 
  ListBucketResult resp = null;
  InputStream is = request.execute( );
  try
  {
      StreamSource stream = new StreamSource( is );
      JAXBElement<ListBucketResult> root = LIST_BUCKET_RESPONSE_UNMARSHALLER
View Full Code Here

    ListOperation listOp = new ListOperation(getBucketName(), getPrefixName());
   
    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 = listOp.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();
          restoreS3Object(listEntry.getKey());
         
        }
       
      }
         
    }
    while(listResult.isIsTruncated());
   
   
    if (this.kBytesProcessed_ > 10000)
    {
      Log.info(String.format("%.2fM transfered\n", (this.kBytesProcessed_ / 1000.0)));
View Full Code Here

          return;
        }
        else
        {
          /* Look for our prefix.  If it exists, then throw an error */
          ListBucketResult bucketList = listOperation.getBucketObjectList(null, getBucketName(), getPrefixName(), 1);
         
          if ((bucketList.getContents() != null) && (bucketList.getContents().length > 0))
          {
            Log.error("Bucket: " + getBucketName() + " Prefix: " + getPrefixName() + " already exists.\nWe cannot send data to an existing bucket:prefix, please specify a new bucket:prefix name\n");
            return;
          }
         
View Full Code Here

    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

TOP

Related Classes of com.google.walkaround.slob.client.ChannelTestUtil$Doc

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.