org.jclouds.blobstore
Class TransientAsyncBlobStore

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

public class TransientAsyncBlobStore
extends BaseAsyncBlobStore

Implementation of BaseAsyncBlobStore which keeps all data in a local Map object.

Author:
Adrian Cole, James Murty

Nested Class Summary
protected static class TransientAsyncBlobStore.CommonPrefixes
           
protected static class TransientAsyncBlobStore.DelimiterFilter
           
 
Field Summary
protected  Blob.Factory blobFactory
           
protected  ConcurrentMap<String,ConcurrentMap<String,Blob>> containerToBlobs
           
protected  ConcurrentMap<String,Location> containerToLocation
           
protected  Crypto crypto
           
protected  DateService dateService
           
protected  HttpGetOptionsListToGetOptions httpGetOptionsConverter
           
protected  IfDirectoryReturnNameStrategy ifDirectoryReturnName
           
protected  javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilders
           
 
Fields inherited from class org.jclouds.blobstore.internal.BaseAsyncBlobStore
blobUtils, context, defaultLocation, locations, service
 
Constructor Summary
protected TransientAsyncBlobStore(BlobStoreContext context, DateService dateService, Crypto crypto, ConcurrentMap<String,ConcurrentMap<String,Blob>> containerToBlobs, javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilders, ConcurrentMap<String,Location> containerToLocation, HttpGetOptionsListToGetOptions httpGetOptionsConverter, IfDirectoryReturnNameStrategy ifDirectoryReturnName, Blob.Factory blobFactory, BlobUtils blobUtils, ExecutorService service, com.google.common.base.Supplier<Location> defaultLocation, com.google.common.base.Supplier<Set<? extends Location>> locations)
           
 
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 container)
          
static MutableBlobMetadata copy(MutableBlobMetadata in)
           
static MutableBlobMetadata copy(MutableBlobMetadata in, String newKey)
           
protected  MutableStorageMetadata create()
           
 com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(Location location, String name)
          
 com.google.common.util.concurrent.ListenableFuture<Boolean> createContainerInLocation(Location location, String container, CreateContainerOptions options)
           
 com.google.common.util.concurrent.ListenableFuture<Void> createContainerInLocationIfAbsent(Location location, String name)
          throws IllegalStateException if the container already exists
protected  Blob createUpdatedCopyOfBlobInContainer(String containerName, Blob in)
           
protected  boolean deleteAndVerifyContainerGone(String container)
           
 com.google.common.util.concurrent.ListenableFuture<Void> deleteContainer(String container)
          This implementation invokes BaseAsyncBlobStore.deleteAndEnsurePathGone(java.lang.String)
 com.google.common.util.concurrent.ListenableFuture<Boolean> deleteContainerImpl(String container)
           
static
<T extends Comparable<?>>
SortedSet<T>
firstSliceOfSize(Iterable<T> elements, int size)
           
 com.google.common.util.concurrent.ListenableFuture<Blob> getBlob(String containerName, String key, GetOptions options)
          
 ConcurrentMap<String,ConcurrentMap<String,Blob>> getContainerToBlobs()
           
 ConcurrentMap<String,Location> getContainerToLocation()
           
 String getFirstQueryOrNull(String string, HttpRequestOptions 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 in)
          
 com.google.common.util.concurrent.ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options)
           
 com.google.common.util.concurrent.ListenableFuture<Blob> putBlobAndReturnOld(String containerName, Blob in)
           
 com.google.common.util.concurrent.ListenableFuture<Void> removeBlob(String container, String key)
          
 com.google.common.util.concurrent.ListenableFuture<Blob> removeBlobAndReturnOld(String container, String key)
           
static 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, newBlob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateService

protected final DateService dateService

crypto

protected final Crypto crypto

containerToBlobs

protected final ConcurrentMap<String,ConcurrentMap<String,Blob>> containerToBlobs

uriBuilders

protected final javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilders

containerToLocation

protected final ConcurrentMap<String,Location> containerToLocation

httpGetOptionsConverter

protected final HttpGetOptionsListToGetOptions httpGetOptionsConverter

ifDirectoryReturnName

protected final IfDirectoryReturnNameStrategy ifDirectoryReturnName

blobFactory

protected final Blob.Factory blobFactory
Constructor Detail

TransientAsyncBlobStore

@Inject
protected TransientAsyncBlobStore(BlobStoreContext context,
                                         DateService dateService,
                                         Crypto crypto,
                                         ConcurrentMap<String,ConcurrentMap<String,Blob>> containerToBlobs,
                                         javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilders,
                                         ConcurrentMap<String,Location> containerToLocation,
                                         HttpGetOptionsListToGetOptions httpGetOptionsConverter,
                                         IfDirectoryReturnNameStrategy ifDirectoryReturnName,
                                         Blob.Factory blobFactory,
                                         BlobUtils blobUtils,
                                         @Named(value="jclouds.user-threads")
                                         ExecutorService service,
                                         com.google.common.base.Supplier<Location> defaultLocation,
                                         com.google.common.base.Supplier<Set<? extends Location>> locations)
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)

copy

public static MutableBlobMetadata copy(MutableBlobMetadata in)

copy

public static MutableBlobMetadata copy(MutableBlobMetadata in,
                                       String newKey)

removeBlob

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

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

removeBlobAndReturnOld

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

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)
This implementation invokes BaseAsyncBlobStore.deleteAndEnsurePathGone(java.lang.String)

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

deleteContainerImpl

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

containerExists

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

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(Location location,
                                                                                             String name)

See Also:
BlobStore.createContainerInLocation(Location, String)

createContainerInLocationIfAbsent

public com.google.common.util.concurrent.ListenableFuture<Void> createContainerInLocationIfAbsent(Location location,
                                                                                                  String name)
throws IllegalStateException if the container already exists


getFirstQueryOrNull

public String getFirstQueryOrNull(String string,
                                  @Nullable
                                  HttpRequestOptions options)

firstSliceOfSize

public static <T extends Comparable<?>> SortedSet<T> firstSliceOfSize(Iterable<T> elements,
                                                                      int size)

returnResponseException

public static HttpResponseException returnResponseException(int code)

putBlob

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

See Also:
BlobStore.putBlob(String,Blob)

putBlobAndReturnOld

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

createUpdatedCopyOfBlobInContainer

protected Blob createUpdatedCopyOfBlobInContainer(String containerName,
                                                  Blob in)

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)

getContainerToBlobs

public ConcurrentMap<String,ConcurrentMap<String,Blob>> getContainerToBlobs()

deleteAndVerifyContainerGone

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

getContainerToLocation

public ConcurrentMap<String,Location> getContainerToLocation()

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(Location location,
                                                                                             String container,
                                                                                             CreateContainerOptions options)
See Also:
BlobStore.createContainerInLocation(Location,String,CreateContainerOptions)


Copyright © 2009-2011 jclouds. All Rights Reserved.