Class AzureBlobStore

java.lang.Object
org.mockserver.blob.azure.AzureBlobStore
All Implemented Interfaces:
AutoCloseable, BlobStore

public class AzureBlobStore extends Object implements BlobStore
BlobStore implementation backed by Azure Blob Storage. Blob keys are mapped to Azure blob names with an optional configurable prefix.

Metadata is stored as Azure blob metadata (custom key-value pairs on the blob itself).

Thread-safety: BlobServiceClient is thread-safe; this class adds no mutable state beyond the injected client and configuration.

  • Constructor Details

    • AzureBlobStore

      public AzureBlobStore(com.azure.storage.blob.BlobContainerClient containerClient, String keyPrefix)
      Creates an Azure blob store.
      Parameters:
      containerClient - the Azure container client (caller owns lifecycle)
      keyPrefix - optional key prefix; empty string for no prefix
  • Method Details

    • put

      public void put(String key, byte[] data, Map<String,String> metadata)
      Description copied from interface: BlobStore
      Stores a blob, overwriting any existing blob with the same key.
      Specified by:
      put in interface BlobStore
      Parameters:
      key - the blob key (e.g. a path-like string)
      data - the binary data
      metadata - optional metadata (may be empty, must not be null)
    • get

      public Optional<Blob> get(String key)
      Description copied from interface: BlobStore
      Retrieves a blob by key.
      Specified by:
      get in interface BlobStore
      Parameters:
      key - the blob key
      Returns:
      the blob, or empty if not present
    • list

      public List<String> list(String prefix)
      Description copied from interface: BlobStore
      Lists all blob keys that start with the given prefix.
      Specified by:
      list in interface BlobStore
      Parameters:
      prefix - the key prefix (e.g. "expectations/")
      Returns:
      list of matching keys
    • delete

      public boolean delete(String key)
      Description copied from interface: BlobStore
      Deletes a blob by key.
      Specified by:
      delete in interface BlobStore
      Parameters:
      key - the blob key
      Returns:
      true if the key was present
    • close

      public void close()
      Closes the Azure blob store. The Azure BlobServiceClient and BlobContainerClient do not implement AutoCloseable -- the underlying Netty/Reactor HTTP client is managed by the SDK and does not expose an explicit close. This is a documented no-op.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BlobStore