org.jclouds.blobstore
Class LocalAsyncBlobStore

java.lang.Object
  extended by org.jclouds.blobstore.internal.BaseAsyncBlobStore
      extended by org.jclouds.blobstore.LocalAsyncBlobStore
All Implemented Interfaces:
AsyncBlobStore

public class LocalAsyncBlobStore
extends BaseAsyncBlobStore

Implementation of BaseAsyncBlobStore which uses a pluggable LocalStorageStrategy.

Author:
Adrian Cole, Alfredo "Rainbowbreeze" Morresi, Andrew Gaul, James Murty

Nested Class Summary
protected static class LocalAsyncBlobStore.CommonPrefixes
           
protected static class LocalAsyncBlobStore.DelimiterFilter
           
 
Field Summary
protected  Blob.Factory blobFactory
           
protected  org.jclouds.io.ContentMetadataCodec contentMetadataCodec
           
protected  IfDirectoryReturnNameStrategy ifDirectoryReturnName
           
protected  org.jclouds.logging.Logger logger
           
protected  LocalStorageStrategy storageStrategy
           
 
Fields inherited from class org.jclouds.blobstore.internal.BaseAsyncBlobStore
blobUtils, context, defaultLocation, locations, service
 
Constructor Summary
protected LocalAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils, ExecutorService service, com.google.common.base.Supplier<org.jclouds.domain.Location> defaultLocation, com.google.common.base.Supplier<Set<? extends org.jclouds.domain.Location>> locations, org.jclouds.io.ContentMetadataCodec contentMetadataCodec, IfDirectoryReturnNameStrategy ifDirectoryReturnName, Blob.Factory blobFactory, LocalStorageStrategy storageStrategy)
           
 
Method Summary
 com.google.common.util.concurrent.ListenableFuture<Boolean> blobExists(String containerName, String key)
          
 com.google.common.util.concurrent.ListenableFuture<BlobMetadata> blobMetadata(String container, String key)
          
 com.google.common.util.concurrent.ListenableFuture<Void> clearContainer(String container)
          This implementation invokes BaseAsyncBlobStore.clearContainer(java.lang.String) with the ListContainerOptions.recursive option.
 com.google.common.util.concurrent.ListenableFuture<Boolean> containerExists(String containerName)
          
protected  MutableStorageMetadata create()
           
 com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(org.jclouds.domain.Location location, String name)
          
 com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(org.jclouds.domain.Location location, String container, CreateContainerOptions options)
           
protected  boolean deleteAndVerifyContainerGone(String container)
           
 com.google.common.util.concurrent.ListenableFuture<Void> deleteContainer(String container)
          Override parent method because it uses strange futures and listenables that creates problem in the test if more than one test that deletes the container is executed
 com.google.common.util.concurrent.ListenableFuture<Boolean> deleteContainerIfEmpty(String container)
           
 com.google.common.util.concurrent.ListenableFuture<Blob> getBlob(String containerName, String key, GetOptions options)
          
 com.google.common.util.concurrent.ListenableFuture<PageSet<? extends StorageMetadata>> list()
          
 com.google.common.util.concurrent.ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options)
          default maxResults is 1000
 com.google.common.util.concurrent.ListenableFuture<String> putBlob(String containerName, Blob blob)
          
 com.google.common.util.concurrent.ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options)
           
 com.google.common.util.concurrent.ListenableFuture<Void> removeBlob(String container, String key)
          
static org.jclouds.http.HttpResponseException returnResponseException(int code)
           
 
Methods inherited from class org.jclouds.blobstore.internal.BaseAsyncBlobStore
blobBuilder, clearContainer, countBlobs, countBlobs, createDirectory, deleteAndEnsurePathGone, deleteDirectory, directoryExists, getBlob, getContext, list, listAssignableLocations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.jclouds.logging.Logger logger

contentMetadataCodec

protected final org.jclouds.io.ContentMetadataCodec contentMetadataCodec

ifDirectoryReturnName

protected final IfDirectoryReturnNameStrategy ifDirectoryReturnName

blobFactory

protected final Blob.Factory blobFactory

storageStrategy

protected final LocalStorageStrategy storageStrategy
Constructor Detail

LocalAsyncBlobStore

@Inject
protected LocalAsyncBlobStore(BlobStoreContext context,
                                     BlobUtils blobUtils,
                                     @Named(value="jclouds.user-threads")
                                     ExecutorService service,
                                     com.google.common.base.Supplier<org.jclouds.domain.Location> defaultLocation,
                                     com.google.common.base.Supplier<Set<? extends org.jclouds.domain.Location>> locations,
                                     org.jclouds.io.ContentMetadataCodec contentMetadataCodec,
                                     IfDirectoryReturnNameStrategy ifDirectoryReturnName,
                                     Blob.Factory blobFactory,
                                     LocalStorageStrategy storageStrategy)
Method Detail

list

public com.google.common.util.concurrent.ListenableFuture<PageSet<? extends StorageMetadata>> list(String container,
                                                                                                   ListContainerOptions options)
default maxResults is 1000

See Also:
BlobStore.list(String, ListContainerOptions)

removeBlob

public com.google.common.util.concurrent.ListenableFuture<Void> removeBlob(String container,
                                                                           String key)

See Also:
BlobStore.removeBlob(java.lang.String, java.lang.String)

clearContainer

public com.google.common.util.concurrent.ListenableFuture<Void> clearContainer(String container)
This implementation invokes BaseAsyncBlobStore.clearContainer(java.lang.String) with the ListContainerOptions.recursive option.

Specified by:
clearContainer in interface AsyncBlobStore
Overrides:
clearContainer in class BaseAsyncBlobStore
Parameters:
container - container name
See Also:
BlobStore.clearContainer(String)

deleteContainer

public com.google.common.util.concurrent.ListenableFuture<Void> deleteContainer(String container)
Override parent method because it uses strange futures and listenables that creates problem in the test if more than one test that deletes the container is executed

Specified by:
deleteContainer in interface AsyncBlobStore
Overrides:
deleteContainer in class BaseAsyncBlobStore
Parameters:
container -
Returns:
See Also:
BlobStore.deleteContainer(java.lang.String)

deleteContainerIfEmpty

public com.google.common.util.concurrent.ListenableFuture<Boolean> deleteContainerIfEmpty(String container)

containerExists

public com.google.common.util.concurrent.ListenableFuture<Boolean> containerExists(String containerName)

See Also:
BlobStore.containerExists(java.lang.String)

list

public com.google.common.util.concurrent.ListenableFuture<PageSet<? extends StorageMetadata>> list()

See Also:
BlobStore.list()

create

protected MutableStorageMetadata create()

createContainerInLocation

public com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(org.jclouds.domain.Location location,
                                                                                             String name)

See Also:
BlobStore.createContainerInLocation(Location, String)

returnResponseException

public static org.jclouds.http.HttpResponseException returnResponseException(int code)

putBlob

public com.google.common.util.concurrent.ListenableFuture<String> putBlob(String containerName,
                                                                          Blob blob)

See Also:
BlobStore.putBlob(String,Blob)

blobExists

public com.google.common.util.concurrent.ListenableFuture<Boolean> blobExists(String containerName,
                                                                              String key)

See Also:
BlobStore.blobExists(java.lang.String, java.lang.String)

getBlob

public com.google.common.util.concurrent.ListenableFuture<Blob> getBlob(String containerName,
                                                                        String key,
                                                                        GetOptions options)

See Also:
BlobStore.getBlob(String, String, GetOptions)

blobMetadata

public com.google.common.util.concurrent.ListenableFuture<BlobMetadata> blobMetadata(String container,
                                                                                     String key)

See Also:
BlobStore.blobMetadata(java.lang.String, java.lang.String)

deleteAndVerifyContainerGone

protected boolean deleteAndVerifyContainerGone(String container)
Specified by:
deleteAndVerifyContainerGone in class BaseAsyncBlobStore

putBlob

public com.google.common.util.concurrent.ListenableFuture<String> putBlob(String container,
                                                                          Blob blob,
                                                                          PutOptions options)
See Also:
BlobStore.putBlob(String,Blob,PutOptions)

createContainerInLocation

public com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(org.jclouds.domain.Location location,
                                                                                             String container,
                                                                                             CreateContainerOptions options)
See Also:
BlobStore.createContainerInLocation(Location,String,CreateContainerOptions)


Copyright © 2009-2012 jclouds. All Rights Reserved.