Package org.jclouds.blobstore.internal
Class BaseBlobStore
- java.lang.Object
-
- org.jclouds.blobstore.internal.BaseBlobStore
-
- All Implemented Interfaces:
BlobStore
- Direct Known Subclasses:
AtmosBlobStore,AzureBlobStore,B2BlobStore,GoogleCloudStorageBlobStore,S3BlobStore
public abstract class BaseBlobStore extends Object implements BlobStore
-
-
Field Summary
Fields Modifier and Type Field Description protected BlobUtilsblobUtilsprotected BlobStoreContextcontextprotected com.google.common.base.Supplier<Location>defaultLocationprotected com.google.common.base.Supplier<Set<? extends Location>>locationsprotected PayloadSlicerslicer
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseBlobStore(BlobStoreContext context, BlobUtils blobUtils, com.google.common.base.Supplier<Location> defaultLocation, com.google.common.base.Supplier<Set<? extends Location>> locations, PayloadSlicer slicer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BlobBuilderblobBuilder(String name)invokesBlobUtilsImpl#blobBuildervoidclearContainer(String containerName)This implementation invokesclearContainer(java.lang.String)with theListContainerOptions.recursiveoption.voidclearContainer(String containerName, ListContainerOptions options)This implementation invokesBlobUtilsImpl#clearContainerStringcopyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options)Copy blob from one container to another.longcountBlobs(String container)This implementation invokescountBlobs(java.lang.String)with theListContainerOptions.recursiveoption.longcountBlobs(String containerName, ListContainerOptions options)This implementation invokesBlobUtilsImpl#countBlobsvoidcreateDirectory(String containerName, String directory)This implementation invokesBlobUtilsImpl#createDirectoryprotected abstract booleandeleteAndVerifyContainerGone(String container)Delete a container if it is empty.voiddeleteContainer(String container)This implementation invokes#deleteAndEnsurePathGonebooleandeleteContainerIfEmpty(String container)Deletes a container if it is empty.voiddeleteDirectory(String containerName, String directory)This implementation invokesBlobUtilsImpl#deleteDirectory.protected voiddeletePathAndEnsureGone(String path)booleandirectoryExists(String containerName, String directory)This implementation invokesBlobUtilsImpl#directoryExistsvoiddownloadBlob(String container, String name, File destination)voiddownloadBlob(String container, String name, File destination, ExecutorService executor)BlobgetBlob(String container, String key)This implementation invokesBlobStore.getBlob(String,String,org.jclouds.blobstore.options.GetOptions)BlobStoreContextgetContext()PageSet<? extends StorageMetadata>list(String container)This implementation invokesBlobStore.list(String,org.jclouds.blobstore.options.ListContainerOptions)Set<? extends Location>listAssignableLocations()The get locations command returns all the valid locations for containers.protected StringputMultipartBlob(String container, Blob blob, PutOptions overrides)Upload using a user-provided executor, or the jclouds userExecutorprotected StringputMultipartBlob(String container, Blob blob, PutOptions overrides, com.google.common.util.concurrent.ListeningExecutorService executor)voidremoveBlobs(String container, Iterable<String> names)Deletes multipleBlobs representing the data at locationcontainer/nameInputStreamstreamBlob(String container, String name)InputStreamstreamBlob(String container, String name, ExecutorService executor)-
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
abortMultipartUpload, blobExists, blobMetadata, completeMultipartUpload, containerExists, createContainerInLocation, createContainerInLocation, getBlob, getBlobAccess, getContainerAccess, getMaximumMultipartPartSize, getMaximumNumberOfParts, getMinimumMultipartPartSize, initiateMultipartUpload, list, list, listMultipartUpload, listMultipartUploads, putBlob, putBlob, removeBlob, setBlobAccess, setContainerAccess, uploadMultipartPart
-
-
-
-
Field Detail
-
context
protected final BlobStoreContext context
-
blobUtils
protected final BlobUtils blobUtils
-
defaultLocation
protected final com.google.common.base.Supplier<Location> defaultLocation
-
slicer
protected final PayloadSlicer slicer
-
-
Constructor Detail
-
BaseBlobStore
protected BaseBlobStore(BlobStoreContext context, BlobUtils blobUtils, com.google.common.base.Supplier<Location> defaultLocation, com.google.common.base.Supplier<Set<? extends Location>> locations, PayloadSlicer slicer)
-
-
Method Detail
-
getContext
public BlobStoreContext getContext()
- Specified by:
getContextin interfaceBlobStore- Returns:
- a reference to the context that created this BlobStore.
-
blobBuilder
public BlobBuilder blobBuilder(String name)
invokesBlobUtilsImpl#blobBuilder- Specified by:
blobBuilderin interfaceBlobStore- Returns:
- builder for creating new
Blobs
-
list
public PageSet<? extends StorageMetadata> list(String container)
This implementation invokesBlobStore.list(String,org.jclouds.blobstore.options.ListContainerOptions)
-
directoryExists
public boolean directoryExists(String containerName, String directory)
This implementation invokesBlobUtilsImpl#directoryExists- Specified by:
directoryExistsin interfaceBlobStore- Parameters:
container- container namedirectory- virtual path
-
createDirectory
public void createDirectory(String containerName, String directory)
This implementation invokesBlobUtilsImpl#createDirectory- Specified by:
createDirectoryin interfaceBlobStore- Parameters:
container- container namedirectory- virtual path
-
removeBlobs
public void removeBlobs(String container, Iterable<String> names)
Description copied from interface:BlobStoreDeletes multipleBlobs representing the data at locationcontainer/name- Specified by:
removeBlobsin interfaceBlobStore- Parameters:
container- container where this exists.names- fully qualified names relative to the container.
-
countBlobs
public long countBlobs(String container)
This implementation invokescountBlobs(java.lang.String)with theListContainerOptions.recursiveoption.- Specified by:
countBlobsin interfaceBlobStore- 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 invokesBlobUtilsImpl#countBlobs- Specified by:
countBlobsin interfaceBlobStore- 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 invokesclearContainer(java.lang.String)with theListContainerOptions.recursiveoption.- Specified by:
clearContainerin interfaceBlobStore- Parameters:
container- container name
-
clearContainer
public void clearContainer(String containerName, ListContainerOptions options)
This implementation invokesBlobUtilsImpl#clearContainer- Specified by:
clearContainerin interfaceBlobStore- Parameters:
container- container name
-
deleteDirectory
public void deleteDirectory(String containerName, String directory)
This implementation invokesBlobUtilsImpl#deleteDirectory.- Specified by:
deleteDirectoryin interfaceBlobStore- Parameters:
container- container name
-
getBlob
public Blob getBlob(String container, String key)
This implementation invokesBlobStore.getBlob(String,String,org.jclouds.blobstore.options.GetOptions)
-
deleteContainer
public void deleteContainer(String container)
This implementation invokes#deleteAndEnsurePathGone- Specified by:
deleteContainerin interfaceBlobStore- Parameters:
container- bucket name
-
deleteContainerIfEmpty
public boolean deleteContainerIfEmpty(String container)
Description copied from interface:BlobStoreDeletes a container if it is empty.- Specified by:
deleteContainerIfEmptyin interfaceBlobStore- 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 Location> listAssignableLocations()
Description copied from interface:BlobStoreThe 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:
listAssignableLocationsin interfaceBlobStore
-
deleteAndVerifyContainerGone
protected abstract boolean deleteAndVerifyContainerGone(String container)
Delete a container if it is empty.- Parameters:
container- what to delete- Returns:
- whether container was deleted
-
copyBlob
public String copyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options)
Description copied from interface:BlobStoreCopy blob from one container to another. Some providers implement this more efficiently than corresponding getBlob and putBlob operations. Note: options are currently ignored
-
putMultipartBlob
@Beta protected String putMultipartBlob(String container, Blob blob, PutOptions overrides)
Upload using a user-provided executor, or the jclouds userExecutor- Parameters:
container-blob-overrides-- Returns:
- the multipart blob etag
-
putMultipartBlob
@Beta protected String putMultipartBlob(String container, Blob blob, PutOptions overrides, com.google.common.util.concurrent.ListeningExecutorService executor)
-
downloadBlob
public void downloadBlob(String container, String name, File destination)
- Specified by:
downloadBlobin interfaceBlobStore
-
downloadBlob
public void downloadBlob(String container, String name, File destination, ExecutorService executor)
- Specified by:
downloadBlobin interfaceBlobStore
-
streamBlob
public InputStream streamBlob(String container, String name)
- Specified by:
streamBlobin interfaceBlobStore
-
streamBlob
public InputStream streamBlob(String container, String name, ExecutorService executor)
- Specified by:
streamBlobin interfaceBlobStore
-
-