Hello,

I've been testing Oak 1.0.5, and changed Main.java under oak-run to enable
a MicroKernel to run at startup with the standalone service at the bottom
of the addServlets() method:

        private void addServlets(Oak oak, String path) {

            Jcr jcr = new Jcr(oak);

            // 1 - OakServer

            ContentRepository repository = oak.createContentRepository();

.............

org.apache.jackrabbit.oak.core.ContentRepositoryImpl repoImpl =
(org.apache.jackrabbit.oak.core.ContentRepositoryImpl)repository;

org.apache.jackrabbit.oak.kernel.NodeStoreKernel nodeStoreK = new
org.apache.jackrabbit.oak.kernel.NodeStoreKernel(repoImpl.getNodeStore());

org.apache.jackrabbit.mk.server.Server mkserver = new
org.apache.jackrabbit.mk.server.Server(nodeStoreK);

mkserver.setPort(28080);

mkserver.setBindAddress(java.net.InetAddress.getByName("localhost"));

mkserver.start();
}

I then used an org.apache.jackrabbit.mk.client.Client to connect to it, and
everything seemed to work fine, including writing / reading blobs, however,
the blobs are not being retained, and it appears to be impossible to set a
":blobId:" prefix for a property value without it forcing an additional
'str:' prefix.

Here are a couple of examples using curl to create a node with a single
property to hold the blobId. The first uses the proper ":blobId:" prefix,
the other doesn't:

curl -X POST --data 'path=/&message=' --data-urlencode
'json_diff=+"testFile1.jpg" :
{"testFileRef":":blobId:93e6002eb8f3c4128b2ce18351e16b0d72b870f6e1ee507b5221579f0dd31a33"}'
http://localhost:28080/commit.html

RETURNED:

curl -X POST --data
'path=/testFile1.jpg&depth=2&offset=0&count=-1&filter={"nodes":["*"],"properties":["*"]}'
http://localhost:28080/getNodes.html

{

  "testFileRef": "*str::blobId:*
93e6002eb8f3c4128b2ce18351e16b0d72b870f6e1ee507b5221579f0dd31a33",

  ":childNodeCount": 0

}

I then tried without the blobId prefix, and it did not add a prefix:

curl -X POST --data 'path=/&message=' --data-urlencode
'json_diff=+"testFile2.jpg" :
{"testFileRef":"93e6002eb8f3c4128b2ce18351e16b0d72b870f6e1ee507b5221579f0dd31a33"}'
http://localhost:28080/commit.html

RETURNED:

curl -X POST --data
'path=/testFile2.jpg&depth=2&offset=0&count=-1&filter={"nodes":["*"],"properties":["*"]}'
http://localhost:28080/getNodes.html

{

  "testFileRef":
"93e6002eb8f3c4128b2ce18351e16b0d72b870f6e1ee507b5221579f0dd31a33",

  ":childNodeCount": 0

}

The blob itself was later removed/deleted, presumably by some sort of
cleanup mechanism. I'm assuming that it couldn't find the reference to the
blob.

For sanity check, I tried saving a different one line text file at the Java
Content Repository level of abstraction, and this is the result:

curl -X POST --data
'path=/testFile&depth=2&offset=0&count=-2&filter={"nodes":["*"],"properties":["*"]}'
http://localhost:28080/getNodes.html

{

  "jcr:created": "dat:2014-09-16T13:41:38.084-07:00",

  "jcr:createdBy": "admin",

  "jcr:primaryType": "nam:nt:file",

  ":childNodeCount": 1,

  "jcr:content": {

    ":childOrder": "[0]:Name",

    "jcr:encoding": "UTF-8",

    "jcr:lastModified": "dat:2014-09-16T13:41:38.094-07:00",

    "jcr:mimeType": "text/plain",

    "jcr:data":
":blobId:428ed7545cd993bf6add8cd74cd6ad70f517341bbc1b31615f9286c652cd214a",

    "jcr:primaryType": "nam:nt:unstructured",

    ":childNodeCount": 0

  }

}

The ":blobId:" prefix appears intact in this case..

Any help would be greatly appreciated, as I would like to start using the
MicroKernel for remote access, and file retention is critical.

Thanks,

Adrien

Reply via email to