Class LoopbackBlobStore

  • All Implemented Interfaces:
    AutoCloseable, org.apache.jackrabbit.oak.spi.blob.BlobStore

    public class LoopbackBlobStore
    extends Object
    implements org.apache.jackrabbit.oak.spi.blob.BlobStore
    Utility BlobStore implementation to be used in tooling that can work with a FileStore without the need of the DataStore being present locally. Additionally instead of failing it tries to mimic and return blob reference passed in by caller by passing it back as a binary. Example: requesting blobId = e7c22b994c59d9 it will return the e7c22b994c59d9 text as a UTF-8 encoded binary file.
    • Constructor Detail

      • LoopbackBlobStore

        public LoopbackBlobStore()
    • Method Detail

      • writeBlob

        public String writeBlob​(InputStream in)
        Specified by:
        writeBlob in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
      • writeBlob

        public String writeBlob​(InputStream in,
                                org.apache.jackrabbit.oak.spi.blob.BlobOptions options)
                         throws IOException
        Specified by:
        writeBlob in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
        Throws:
        IOException
      • readBlob

        public int readBlob​(String blobId,
                            long pos,
                            byte[] buff,
                            int off,
                            int length)
        Specified by:
        readBlob in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
      • getBlobLength

        public long getBlobLength​(String blobId)
                           throws IOException
        Specified by:
        getBlobLength in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
        Throws:
        IOException
      • getInputStream

        public InputStream getInputStream​(String blobId)
                                   throws IOException
        Specified by:
        getInputStream in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
        Throws:
        IOException
      • getBlobId

        public String getBlobId​(@NotNull
                                @NotNull String reference)
        Specified by:
        getBlobId in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
      • getReference

        public String getReference​(@NotNull
                                   @NotNull String blobId)
        Specified by:
        getReference in interface org.apache.jackrabbit.oak.spi.blob.BlobStore