jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1417462 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
Date Wed, 05 Dec 2012 14:58:16 GMT
Author: angela
Date: Wed Dec  5 14:58:15 2012
New Revision: 1417462

URL: http://svn.apache.org/viewvc?rev=1417462&view=rev
Log:
minor improvement (use constants)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java?rev=1417462&r1=1417461&r2=1417462&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
Wed Dec  5 14:58:15 2012
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.plugin
 
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.core.RootImpl;
@@ -31,6 +30,12 @@ import org.apache.jackrabbit.oak.spi.sta
 
 import com.google.common.collect.ImmutableList;
 
+import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
+import static org.apache.jackrabbit.JcrConstants.JCR_VERSIONSTORAGE;
+import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
+
 /**
  * {@code InitialContent} implements a {@link RepositoryInitializer} and
  * registers built-in node types when the micro kernel becomes available.
@@ -44,53 +49,53 @@ public class InitialContent implements R
         NodeStoreBranch branch = store.branch();
 
         NodeBuilder root = branch.getRoot().builder();
-        root.setProperty("jcr:primaryType", "rep:root", Type.NAME);
+        root.setProperty(JCR_PRIMARYTYPE, "rep:root", Type.NAME);
 
-        if (!root.hasChildNode("jcr:system")) {
-            NodeBuilder system = root.child("jcr:system");
-            system.setProperty("jcr:primaryType", "rep:system", Type.NAME);
+        if (!root.hasChildNode(JCR_SYSTEM)) {
+            NodeBuilder system = root.child(JCR_SYSTEM);
+            system.setProperty(JCR_PRIMARYTYPE, "rep:system", Type.NAME);
 
-            system.child("jcr:versionStorage")
-                .setProperty("jcr:primaryType", "rep:versionStorage", Type.NAME);
+            system.child(JCR_VERSIONSTORAGE)
+                .setProperty(JCR_PRIMARYTYPE, "rep:versionStorage", Type.NAME);
             system.child("jcr:nodeTypes")
-                .setProperty("jcr:primaryType", "rep:nodeTypes", Type.NAME);
+                .setProperty(JCR_PRIMARYTYPE, "rep:nodeTypes", Type.NAME);
             system.child("jcr:activities")
-                .setProperty("jcr:primaryType", "rep:Activities", Type.NAME);
+                .setProperty(JCR_PRIMARYTYPE, "rep:Activities", Type.NAME);
         }
 
         if (!root.hasChildNode("oak:index")) {
             NodeBuilder index = root.child("oak:index");
-            index.setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
// TODO: use proper node type
+            index.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED); // TODO: use proper node
type
             index.child("uuid")
-                .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME)
+                .setProperty(JCR_PRIMARYTYPE, "oak:queryIndexDefinition", Type.NAME)
                 .setProperty("type", "property")
                 .setProperty("propertyNames", "jcr:uuid")
                 .setProperty("reindex", true)
                 .setProperty("unique", true);
             index.child("nodetype")
-                .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME)
+                .setProperty(JCR_PRIMARYTYPE, "oak:queryIndexDefinition", Type.NAME)
                 .setProperty("type", "property")
                 .setProperty("reindex", true)
                 .setProperty(PropertyStates.createProperty(
                         "propertyNames",
-                        ImmutableList.of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.JCR_MIXINTYPES),
+                        ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES),
                         Type.STRINGS));
             // FIXME: user-mgt related unique properties (rep:authorizableId, rep:principalName)
are implementation detail and not generic for repo
             // FIXME OAK-396: rep:principalName only needs to be unique if defined with user/group
nodes -> add defining nt-info to uniqueness constraint otherwise ac-editing will fail.
             index.child("authorizableId")
-                .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME)
+                .setProperty(JCR_PRIMARYTYPE, "oak:queryIndexDefinition", Type.NAME)
                 .setProperty("type", "property")
                 .setProperty("propertyNames", UserConstants.REP_AUTHORIZABLE_ID)
                 .setProperty("reindex", true)
                 .setProperty("unique", true);
             index.child("principalName")
-                .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME)
+                .setProperty(JCR_PRIMARYTYPE, "oak:queryIndexDefinition", Type.NAME)
                 .setProperty("type", "property")
                 .setProperty("propertyNames", UserConstants.REP_PRINCIPAL_NAME)
                 .setProperty("reindex", true)
                 .setProperty("unique", true);
             index.child("members")
-                .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME)
+                .setProperty(JCR_PRIMARYTYPE, "oak:queryIndexDefinition", Type.NAME)
                 .setProperty("type", "property")
                 .setProperty("propertyNames", UserConstants.REP_MEMBERS)
                 .setProperty("reindex", true);



Mime
View raw message