org.jclouds.blobstore.internal
Class BaseBlobStore

java.lang.Object
  extended by org.jclouds.blobstore.internal.BaseBlobStore
All Implemented Interfaces:
BlobStore
Direct Known Subclasses:
AtmosBlobStore, AzureBlobStore, S3BlobStore, SwiftBlobStore

public abstract class BaseBlobStore
extends Object
implements BlobStore

Author:
Adrian Cole

Field Summary
protected  BlobUtils blobUtils
           
protected  BlobStoreContext context
           
protected  com.google.common.base.Supplier<Location> defaultLocation
           
protected  com.google.common.base.Supplier<Set<? extends Location>> locations
           
 
Constructor Summary
protected BaseBlobStore(BlobStoreContext context, BlobUtils blobUtils, com.google.common.base.Supplier<Location> defaultLocation, com.google.common.base.Supplier<Set<? extends Location>> locations)
           
 
Method Summary
 BlobBuilder blobBuilder(String name)
          invokes BlobUtilsImpl.blobBuilder()
protected  void clearAndDeleteContainer(String container)
           
 void clearContainer(String containerName)
          This implementation invokes clearContainer(java.lang.String) with the ListContainerOptions.recursive option.
 void clearContainer(String containerName, ListContainerOptions options)
          This implementation invokes BlobUtilsImpl.clearContainer(java.lang.String, org.jclouds.blobstore.options.ListContainerOptions)
 long countBlobs(String container)
          This implementation invokes countBlobs(java.lang.String) with the ListContainerOptions.recursive option.
 long countBlobs(String containerName, ListContainerOptions options)
          This implementation invokes BlobUtilsImpl.countBlobs(java.lang.String, org.jclouds.blobstore.options.ListContainerOptions)
 void createDirectory(String containerName, String directory)
          This implementation invokes BlobUtilsImpl.createDirectory(java.lang.String, java.lang.String)
protected abstract  boolean deleteAndVerifyContainerGone(String container)
           
 void deleteContainer(String container)
          This implementation invokes #deleteAndEnsurePathGone
 void deleteDirectory(String containerName, String directory)
          This implementation invokes BlobUtilsImpl.deleteDirectory(java.lang.String, java.lang.String).
 boolean directoryExists(String containerName, String directory)
          This implementation invokes BlobUtilsImpl.directoryExists(java.lang.String, java.lang.String)
 Blob getBlob(String container, String key)
          This implementation invokes BlobStore.getBlob(String,String,org.jclouds.blobstore.options.GetOptions)
 BlobStoreContext getContext()
           
 PageSet<? extends StorageMetadata> list(String container)
          This implementation invokes BlobStore.list(String,org.jclouds.blobstore.options.ListContainerOptions)
 Set<? extends Location> listAssignableLocations()
          The get locations command returns all the valid locations for containers.
 Blob newBlob(String name)
          invokes BlobUtilsImpl.newBlob(java.lang.String)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jclouds.blobstore.BlobStore
blobExists, blobMetadata, containerExists, createContainerInLocation, createContainerInLocation, getBlob, list, list, putBlob, putBlob, removeBlob
 

Field Detail

context

protected final BlobStoreContext context

blobUtils

protected final BlobUtils blobUtils

defaultLocation

protected final com.google.common.base.Supplier<Location> defaultLocation

locations

protected final com.google.common.base.Supplier<Set<? extends Location>> locations
Constructor Detail

BaseBlobStore

@Inject
protected BaseBlobStore(BlobStoreContext context,
                               BlobUtils blobUtils,
                               com.google.common.base.Supplier<Location> defaultLocation,
                               com.google.common.base.Supplier<Set<? extends Location>> locations)
Method Detail

getContext

public BlobStoreContext getContext()
Specified by:
getContext in interface BlobStore
Returns:
a reference to the context that created this BlobStore.

newBlob

public Blob newBlob(String name)
invokes BlobUtilsImpl.newBlob(java.lang.String)

Specified by:
newBlob in interface BlobStore
See Also:
BlobStore.blobBuilder(java.lang.String)

blobBuilder

public BlobBuilder blobBuilder(String name)
invokes BlobUtilsImpl.blobBuilder()

Specified by:
blobBuilder in interface BlobStore
Returns:
builder for creating new Blobs

list

public PageSet<? extends StorageMetadata> list(String container)
This implementation invokes BlobStore.list(String,org.jclouds.blobstore.options.ListContainerOptions)

Specified by:
list in interface BlobStore
Parameters:
container - container name
Returns:
a list that may be incomplete, depending on whether PageSet#getNextMarker is set

directoryExists

public boolean directoryExists(String containerName,
                               String directory)
This implementation invokes BlobUtilsImpl.directoryExists(java.lang.String, java.lang.String)

Specified by:
directoryExists in interface BlobStore
Parameters:
container - container name
directory - virtual path

createDirectory

public void createDirectory(String containerName,
                            String directory)
This implementation invokes BlobUtilsImpl.createDirectory(java.lang.String, java.lang.String)

Specified by:
createDirectory in interface BlobStore
Parameters:
container - container name
directory - virtual path

countBlobs

public long countBlobs(String container)
This implementation invokes countBlobs(java.lang.String) with the ListContainerOptions.recursive option.

Specified by:
countBlobs in interface BlobStore
Parameters:
container - container name
Returns:
a count of all blobs in the container, excluding directory markers

countBlobs

public long countBlobs(String containerName,
                       ListContainerOptions options)
This implementation invokes BlobUtilsImpl.countBlobs(java.lang.String, org.jclouds.blobstore.options.ListContainerOptions)

Specified by:
countBlobs in interface BlobStore
Parameters:
container - container name
Returns:
a count of all blobs that are in a listing constrained by the options specified, excluding directory markers

clearContainer

public void clearContainer(String containerName)
This implementation invokes clearContainer(java.lang.String) with the ListContainerOptions.recursive option.

Specified by:
clearContainer in interface BlobStore
Parameters:
container - container name

clearContainer

public void clearContainer(String containerName,
                           ListContainerOptions options)
This implementation invokes BlobUtilsImpl.clearContainer(java.lang.String, org.jclouds.blobstore.options.ListContainerOptions)

Specified by:
clearContainer in interface BlobStore
Parameters:
container - container name

deleteDirectory

public void deleteDirectory(String containerName,
                            String directory)
This implementation invokes BlobUtilsImpl.deleteDirectory(java.lang.String, java.lang.String).

Specified by:
deleteDirectory in interface BlobStore
Parameters:
container - container name

getBlob

public Blob getBlob(String container,
                    String key)
This implementation invokes BlobStore.getBlob(String,String,org.jclouds.blobstore.options.GetOptions)

Specified by:
getBlob in interface BlobStore
Parameters:
container - container name
key - blob key
Returns:
the blob you intended to receive or null, if it doesn't exist.

deleteContainer

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

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

clearAndDeleteContainer

protected void clearAndDeleteContainer(String container)

listAssignableLocations

public Set<? extends Location> listAssignableLocations()
Description copied from interface: BlobStore
The get locations command returns all the valid locations for containers. A location has a scope, which is typically region or zone. A region is a general area, like eu-west, where a zone is similar to a datacenter. If a location has a parent, that implies it is within that location. For example a location can be a rack, whose parent is likely to be a zone.

Specified by:
listAssignableLocations in interface BlobStore

deleteAndVerifyContainerGone

protected abstract boolean deleteAndVerifyContainerGone(String container)


Copyright © 2009-2011 jclouds. All Rights Reserved.