Class BaseBlobStore

java.lang.Object
org.jclouds.blobstore.internal.BaseBlobStore
All Implemented Interfaces:
BlobStore
Direct Known Subclasses:
AtmosBlobStore, AzureBlobStore, B2BlobStore, GlacierBlobStore, GoogleCloudStorageBlobStore, S3BlobStore

public abstract class BaseBlobStore extends Object implements BlobStore
  • Field Details

    • 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
    • slicer

      protected final PayloadSlicer slicer
  • Constructor Details

  • Method Details

    • 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
      invalid reference
      BlobUtilsImpl#blobBuilder
      Specified by:
      blobBuilder in interface BlobStore
      Returns:
      builder for creating new Blobs
    • list

      public PageSet<? extends StorageMetadata> list(String container)
      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
      invalid reference
      BlobUtilsImpl#directoryExists
      Specified by:
      directoryExists in interface BlobStore
      Parameters:
      containerName - container where the directory resides
      directory - virtual path
      container - container name
    • createDirectory

      public void createDirectory(String containerName, String directory)
      This implementation invokes
      invalid reference
      BlobUtilsImpl#createDirectory
      Specified by:
      createDirectory in interface BlobStore
      Parameters:
      containerName - container to create the directory in
      directory - virtual path
      container - container name
    • removeBlobs

      public void removeBlobs(String container, Iterable<String> names)
      Description copied from interface: BlobStore
      Deletes multiple Blobs representing the data at location container/name
      Specified by:
      removeBlobs in interface BlobStore
      Parameters:
      container - container where this exists.
      names - fully qualified names relative to the container.
    • 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
      invalid reference
      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:
      containerName - what to clear
      container - container name
    • clearContainer

      public void clearContainer(String containerName, ListContainerOptions options)
      This implementation invokes
      invalid reference
      BlobUtilsImpl#clearContainer
      Specified by:
      clearContainer in interface BlobStore
      Parameters:
      containerName - what to clear
      options - recursion and path to clear
      container - container name
    • deleteDirectory

      public void deleteDirectory(String containerName, String directory)
      This implementation invokes
      invalid reference
      BlobUtilsImpl#deleteDirectory
      .
      Specified by:
      deleteDirectory in interface BlobStore
      Parameters:
      container - container name
    • getBlob

      public Blob getBlob(String container, String key)
      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
      invalid reference
      #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 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
    • copyBlob

      public String copyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options)
      Description copied from interface: BlobStore
      Copy blob from one container to another. Some providers implement this more efficiently than corresponding getBlob and putBlob operations. Note: options are currently ignored
      Specified by:
      copyBlob in interface BlobStore
      Returns:
      ETag of new blob
    • 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:
      downloadBlob in interface BlobStore
    • downloadBlob

      public void downloadBlob(String container, String name, File destination, ExecutorService executor)
      Specified by:
      downloadBlob in interface BlobStore
    • streamBlob

      public InputStream streamBlob(String container, String name)
      Specified by:
      streamBlob in interface BlobStore
    • streamBlob

      public InputStream streamBlob(String container, String name, ExecutorService executor)
      Specified by:
      streamBlob in interface BlobStore