Class LoopbackBlobStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.upgrade.cli.blob.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: requestingblobId = e7c22b994c59d9
it will return thee7c22b994c59d9
text as a UTF-8 encoded binary file.
-
-
Constructor Summary
Constructors Constructor Description LoopbackBlobStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
String
getBlobId(@NotNull String reference)
long
getBlobLength(String blobId)
InputStream
getInputStream(String blobId)
String
getReference(@NotNull String blobId)
int
readBlob(String blobId, long pos, byte[] buff, int off, int length)
String
writeBlob(InputStream in)
String
writeBlob(InputStream in, org.apache.jackrabbit.oak.spi.blob.BlobOptions options)
-
-
-
Method Detail
-
writeBlob
public String writeBlob(InputStream in)
- Specified by:
writeBlob
in interfaceorg.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 interfaceorg.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 interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
-
getBlobLength
public long getBlobLength(String blobId) throws IOException
- Specified by:
getBlobLength
in interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
- Throws:
IOException
-
getInputStream
public InputStream getInputStream(String blobId) throws IOException
- Specified by:
getInputStream
in interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
- Throws:
IOException
-
getBlobId
public String getBlobId(@NotNull @NotNull String reference)
- Specified by:
getBlobId
in interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
-
getReference
public String getReference(@NotNull @NotNull String blobId)
- Specified by:
getReference
in interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-