org.jclouds.blobstore.internal
Class BaseBlobStore

java.lang.Object
  extended by org.jclouds.blobstore.internal.BaseBlobStore
All Implemented Interfaces:
BlobStore

public abstract class BaseBlobStore
extends Object
implements BlobStore


Field Summary
protected  BlobUtils blobUtils
           
protected  BlobStoreContext context
           
protected  com.google.common.base.Supplier<org.jclouds.domain.Location> defaultLocation
           
protected  com.google.common.base.Supplier<Set<? extends org.jclouds.domain.Location>> locations
           
 
Constructor Summary
protected BaseBlobStore(BlobStoreContext context, BlobUtils blobUtils, com.google.common.base.Supplier<org.jclouds.domain.Location> defaultLocation, com.google.common.base.Supplier<Set<? extends org.jclouds.domain.Location>> locations)
           
 
Method Summary
 BlobBuilder blobBuilder(String name)
          invokes BlobUtilsImpl#blobBuilder
 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
 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
 void createDirectory(String containerName, String directory)
          This implementation invokes BlobUtilsImpl#createDirectory
protected abstract  boolean deleteAndVerifyContainerGone(String container)
          Delete a container if it is empty.
 void deleteContainer(String container)
          This implementation invokes #deleteAndEnsurePathGone
 boolean deleteContainerIfEmpty(String container)
          Deletes a container if it is empty.
 void deleteDirectory(String containerName, String directory)
          This implementation invokes BlobUtilsImpl#deleteDirectory.
protected  void deletePathAndEnsureGone(String path)
           
 boolean directoryExists(String containerName, String directory)
          This implementation invokes BlobUtilsImpl#directoryExists
 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 org.jclouds.domain.Location> listAssignableLocations()
          The get locations command returns all the valid locations for containers.
 
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<org.jclouds.domain.Location> defaultLocation

locations

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

BaseBlobStore

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

getContext

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

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

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

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

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

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

deleteDirectory

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

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

deleteContainerIfEmpty

public boolean deleteContainerIfEmpty(String container)
Description copied from interface: BlobStore
Deletes a container if it is empty.

Specified by:
deleteContainerIfEmpty in interface BlobStore
Parameters:
container - name of the container to delete
Returns:
true if the container was deleted or does not exist

deletePathAndEnsureGone

protected void deletePathAndEnsureGone(String path)

listAssignableLocations

public Set<? extends org.jclouds.domain.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)
Delete a container if it is empty.

Parameters:
container - what to delete
Returns:
whether container was deleted


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.