org.jclouds.s3.blobstore
Class S3BlobStore

java.lang.Object
  extended by org.jclouds.blobstore.internal.BaseBlobStore
      extended by org.jclouds.s3.blobstore.S3BlobStore
All Implemented Interfaces:
BlobStore
Direct Known Subclasses:
AWSS3BlobStore

@Singleton
public class S3BlobStore
extends BaseBlobStore

Author:
Adrian Cole

Field Summary
 
Fields inherited from class org.jclouds.blobstore.internal.BaseBlobStore
blobUtils, context, defaultLocation, locations
 
Constructor Summary
protected S3BlobStore(BlobStoreContext context, BlobUtils blobUtils, com.google.common.base.Supplier<Location> defaultLocation, com.google.common.base.Supplier<Set<? extends Location>> locations, S3Client sync, BucketToResourceMetadata bucket2ResourceMd, ContainerToBucketListOptions container2BucketListOptions, BucketToResourceList bucket2ResourceList, ObjectToBlob object2Blob, BlobToHttpGetOptions blob2ObjectGetOptions, BlobToObject blob2Object, ObjectToBlobMetadata object2BlobMd, javax.inject.Provider<FetchBlobMetadata> fetchBlobMetadataProvider, Map<String,AccessControlList> bucketAcls)
           
 
Method Summary
 boolean blobExists(String container, String key)
          This implementation invokes S3Client.objectExists(java.lang.String, java.lang.String)
 BlobMetadata blobMetadata(String container, String key)
          This implementation invokes S3Client.headObject(java.lang.String, java.lang.String)
 void clearAndDeleteContainer(String container)
          This implementation invokes BaseBlobStore.clearContainer(java.lang.String) then S3Client.deleteBucketIfEmpty(java.lang.String) until it is true.
 boolean containerExists(String container)
          This implementation invokes S3Client.bucketExists(java.lang.String)
 boolean createContainerInLocation(Location location, String container)
          This implementation invokes S3Client.putBucketInRegion(java.lang.String, java.lang.String, org.jclouds.s3.options.PutBucketOptions...)
 boolean createContainerInLocation(Location location, String container, CreateContainerOptions options)
           
protected  boolean deleteAndVerifyContainerGone(String container)
          This implementation invokes S3Utils.deleteAndVerifyContainerGone(org.jclouds.s3.S3Client, java.lang.String)
 void deleteContainer(String container)
          This implementation invokes #deleteAndEnsurePathGone
 Blob getBlob(String container, String key, GetOptions optionsList)
          This implementation invokes S3Client.getObject(java.lang.String, java.lang.String, org.jclouds.http.options.GetOptions...)
 PageSet<? extends StorageMetadata> list()
          This implementation invokes S3Client.listOwnedBuckets()
 PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options)
          This implementation invokes S3Client.listBucket(java.lang.String, org.jclouds.s3.options.ListBucketOptions...)
 String putBlob(String container, Blob blob)
          This implementation invokes S3Client.putObject(java.lang.String, org.jclouds.s3.domain.S3Object, org.jclouds.s3.options.PutObjectOptions...)
 String putBlob(String container, Blob blob, PutOptions options)
          This implementation invokes S3Client.putObject(java.lang.String, org.jclouds.s3.domain.S3Object, org.jclouds.s3.options.PutObjectOptions...)
 void removeBlob(String container, String key)
          This implementation invokes S3Client.deleteObject(java.lang.String, java.lang.String)
 
Methods inherited from class org.jclouds.blobstore.internal.BaseBlobStore
blobBuilder, clearContainer, clearContainer, countBlobs, countBlobs, createDirectory, deleteDirectory, directoryExists, getBlob, getContext, list, listAssignableLocations, newBlob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

S3BlobStore

@Inject
protected S3BlobStore(BlobStoreContext context,
                             BlobUtils blobUtils,
                             com.google.common.base.Supplier<Location> defaultLocation,
                             com.google.common.base.Supplier<Set<? extends Location>> locations,
                             S3Client sync,
                             BucketToResourceMetadata bucket2ResourceMd,
                             ContainerToBucketListOptions container2BucketListOptions,
                             BucketToResourceList bucket2ResourceList,
                             ObjectToBlob object2Blob,
                             BlobToHttpGetOptions blob2ObjectGetOptions,
                             BlobToObject blob2Object,
                             ObjectToBlobMetadata object2BlobMd,
                             javax.inject.Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
                             Map<String,AccessControlList> bucketAcls)
Method Detail

list

public PageSet<? extends StorageMetadata> list()
This implementation invokes S3Client.listOwnedBuckets()


containerExists

public boolean containerExists(String container)
This implementation invokes S3Client.bucketExists(java.lang.String)

Parameters:
container - bucket name

createContainerInLocation

public boolean createContainerInLocation(Location location,
                                         String container)
This implementation invokes S3Client.putBucketInRegion(java.lang.String, java.lang.String, org.jclouds.s3.options.PutBucketOptions...)

Parameters:
location - corresponds to a Region
container - bucket name
Returns:
true if the container was created, false if it already existed.

list

public PageSet<? extends StorageMetadata> list(String container,
                                               ListContainerOptions options)
This implementation invokes S3Client.listBucket(java.lang.String, org.jclouds.s3.options.ListBucketOptions...)

Parameters:
container - bucket name
options - size, recursion, and context of the list
Returns:
a list that may be incomplete, depending on whether PageSet#getNextMarker is set

deleteContainer

public void deleteContainer(String container)
This implementation invokes #deleteAndEnsurePathGone

Specified by:
deleteContainer in interface BlobStore
Overrides:
deleteContainer in class BaseBlobStore
Parameters:
container - bucket name

clearAndDeleteContainer

public void clearAndDeleteContainer(String container)
This implementation invokes BaseBlobStore.clearContainer(java.lang.String) then S3Client.deleteBucketIfEmpty(java.lang.String) until it is true.

Overrides:
clearAndDeleteContainer in class BaseBlobStore

blobExists

public boolean blobExists(String container,
                          String key)
This implementation invokes S3Client.objectExists(java.lang.String, java.lang.String)

Parameters:
container - bucket name
key - object key

blobMetadata

public BlobMetadata blobMetadata(String container,
                                 String key)
This implementation invokes S3Client.headObject(java.lang.String, java.lang.String)

Parameters:
container - bucket name
key - object key
Returns:
null if name isn't present or the blob you intended to receive.

getBlob

public Blob getBlob(String container,
                    String key,
                    GetOptions optionsList)
This implementation invokes S3Client.getObject(java.lang.String, java.lang.String, org.jclouds.http.options.GetOptions...)

Parameters:
container - bucket name
key - object key
optionsList - byte range or condition options
Returns:
the blob you intended to receive or null, if it doesn't exist.

putBlob

public String putBlob(String container,
                      Blob blob)
This implementation invokes S3Client.putObject(java.lang.String, org.jclouds.s3.domain.S3Object, org.jclouds.s3.options.PutObjectOptions...)

Parameters:
container - bucket name
blob - object
Returns:
etag of the blob you uploaded, possibly null where etags are unsupported

putBlob

public String putBlob(String container,
                      Blob blob,
                      PutOptions options)
This implementation invokes S3Client.putObject(java.lang.String, org.jclouds.s3.domain.S3Object, org.jclouds.s3.options.PutObjectOptions...)

Parameters:
container - bucket name
blob - object
options - byte range options
Returns:
etag of the blob you uploaded, possibly null where etags are unsupported

removeBlob

public void removeBlob(String container,
                       String key)
This implementation invokes S3Client.deleteObject(java.lang.String, java.lang.String)

Parameters:
container - bucket name
key - object key

deleteAndVerifyContainerGone

protected boolean deleteAndVerifyContainerGone(String container)
This implementation invokes S3Utils.deleteAndVerifyContainerGone(org.jclouds.s3.S3Client, java.lang.String)

Specified by:
deleteAndVerifyContainerGone in class BaseBlobStore

createContainerInLocation

public boolean createContainerInLocation(Location location,
                                         String container,
                                         CreateContainerOptions options)
options - controls default access control
See Also:
BlobStore.createContainerInLocation(Location,String)


Copyright © 2009-2011 jclouds. All Rights Reserved.