Hi,

I'm quite new to Jackrabbit/OAK and trying to figure out how the direct binary 
access feature works.

I'm using MongoDB as nodestore and s3 as blobstore.
val ns = new MongoDocumentNodeStoreBuilder()
    .setMongoDB(uri, "oak", 16)
    .setBlobStore(s3blobstore)
   .build()
val repo = new Jcr(new Oak(ns)).createRepository()
My understanding so far is, I can set binary properties to nodes, and later, I 
should be able to get a direct download link (from S3).
First, I created a node and added a binary property with the contents of some 
file.
val ntFile = session.getRootNode.addNode(path, "nt:file")
val ntResource = ntFile.addNode("jcr:content", "nt:resource")

ntResource.setProperty("jcr:mimeType", "application/octet-stream")
ntResource.setProperty("jcr:lastModified", Calendar.getInstance())

val fStream = new FileInputStream("/home/evren/cast.webm")
val bin = 
session.getValueFactory.asInstanceOf[JackrabbitValueFactory].createBinary(fStream)
ntResource.setProperty("jcr:data", bin)

And I can see on the AWS Console, my binary is uploaded.
But, still, I cannot generate direct download URI, even following the 
documentation on the OAK website. (So the code continues)
session.save()
session.refresh(false)

val binary = session.getRootNode.getNode(path)
  .getNode("jcr:content").getProperty("jcr:data").getValue.getBinary

val uri = 
binary.asInstanceOf[BinaryDownload].getURI(BinaryDownloadOptions.DEFAULT)
It's always returning null.
Someone please could point me to what I am doing wrong or is my understanding.
Thanks in advance.


Reply via email to