On 2.10.12 9:42, Marcel Reutegger wrote:
Hi,

I didn't change it because I don't understand why it is currently
done that way. my first impression was also that one could use
the NodeStore and NodeStates to manipulate content.

anyone know why it's currently done on the MK directly?

AFAIR because that code was added before we even had other means like NodeBuilder or Tree. So its probably just a legacy.

Michael


Regards
  Marcel

-----Original Message-----
From: Michael Dürig [mailto:[email protected]]
Sent: Montag, 1. Oktober 2012 18:23
To: [email protected]
Subject: Re: svn commit: r1392352 - in /jackrabbit/oak/trunk: oak-
core/src/main/java/org/apache/jackrabbit/oak/ oak-
core/src/main/java/org/apache/jackrabbit/oak/core/ oak-
core/src/main/java/org/apache/jackrabbit/oak/osgi/ oak-
core/src/main/java/org/apache/jackr...



On 1.10.12 15:36, [email protected] wrote:
Author: mreutegg
Date: Mon Oct  1 14:36:57 2012
New Revision: 1392352

URL: http://svn.apache.org/viewvc?rev=1392352&view=rev
Log:
OAK-41: Initial repository setup

[...]
+public class InitialContent extends DefaultMicroKernelTracker {
+
+    @Override
+    public void available(MicroKernel mk) {
+        NodeStore nodeStore = new Oak(mk).createNodeStore();
+        // FIXME: depends on CoreValue's name mangling
+        NodeState root = nodeStore.getRoot();
+        if (root.hasChildNode("jcr:system")) {
+            mk.commit("/", "^\"jcr:primaryType\":\"nam:rep:root\" ", null,
null);
+        } else {
+            mk.commit("/", "^\"jcr:primaryType\":\"nam:rep:root\"" +
+                    "+\"jcr:system\":{" +
+                    "\"jcr:primaryType\"    :\"nam:rep:system\"," +
+                    "\":unique\"
:{\"jcr:uuid\":{},\"rep:authorizableId\":{},\"rep:principalName\":{}}," +
+                    "\"jcr:versionStorage\"
:{\"jcr:primaryType\":\"nam:rep:versionStorage\"}," +
+                    "\"jcr:nodeTypes\"
:{\"jcr:primaryType\":\"nam:rep:nodeTypes\"}," +
+                    "\"jcr:activities\"
:{\"jcr:primaryType\":\"nam:rep:Activities\"}," +
+                    "\"rep:privileges\"
:{\"jcr:primaryType\":\"nam:rep:Privileges\"}}", null, null);
+        }
+
+        BuiltInNodeTypes.register(new Oak(mk).createRoot());
+    }
+}

Shouldn't it be pretty easy to resolve this FIXME now? I.e. either use a
Root instance or a NodeStore and NodeBuilders for adding this initial
structure?

Michael

Reply via email to