Class LoopbackBlobStore

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

    public class LoopbackBlobStore
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.lang.String getBlobId​(@NotNull java.lang.String reference)  
      long getBlobLength​(java.lang.String blobId)  
      java.io.InputStream getInputStream​(java.lang.String blobId)  
      java.lang.String getReference​(@NotNull java.lang.String blobId)  
      int readBlob​(java.lang.String blobId, long pos, byte[] buff, int off, int length)  
      java.lang.String writeBlob​(java.io.InputStream in)  
      java.lang.String writeBlob​(java.io.InputStream in, org.apache.jackrabbit.oak.spi.blob.BlobOptions options)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoopbackBlobStore

        public LoopbackBlobStore()
    • Method Detail

      • writeBlob

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

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

        public int readBlob​(java.lang.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​(java.lang.String blobId)
                           throws java.io.IOException
        Specified by:
        getBlobLength in interface org.apache.jackrabbit.oak.spi.blob.BlobStore
        Throws:
        java.io.IOException
      • getInputStream

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

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

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

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception