jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1397512 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: kernel/ plugins/identifier/ plugins/memory/ plugins/nodetype/
Date Fri, 12 Oct 2012 11:03:00 GMT
Author: mduerig
Date: Fri Oct 12 11:02:59 2012
New Revision: 1397512

URL: http://svn.apache.org/viewvc?rev=1397512&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
Javadoc

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TypeCodes.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ArrayBasedBlob.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/StringBasedBlob.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ValueBasedBlob.java
    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/kernel/KernelBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
Fri Oct 12 11:02:59 2012
@@ -24,10 +24,19 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.util.MicroKernelInputStream;
 import org.apache.jackrabbit.oak.plugins.memory.AbstractBlob;
 
+/**
+ * This {@code Blob} implementation is backed by a binary stored in
+ * a {@code MicroKernel}.
+ */
 public class KernelBlob extends AbstractBlob {
     private final String binaryID;
     private final MicroKernel kernel;
 
+    /**
+     * Create a new instance for a binary id and a Microkernel.
+     * @param binaryID  id of the binary
+     * @param kernel
+     */
     public KernelBlob(String binaryID, MicroKernel kernel) {
         this.binaryID = binaryID;
         this.kernel = kernel;
@@ -39,12 +48,19 @@ public class KernelBlob extends Abstract
         return new MicroKernelInputStream(kernel, binaryID);
     }
 
+    /**
+     * This implementation delegates the calculation of the length back
+     * to the underlying {@code MicroKernel}.
+     */
     @Override
     public long length() {
         return kernel.getLength(binaryID);
     }
 
-
+    /**
+     * This implementation delegates back to the underlying {@code Microkernel}
+     * if other is also of type {@code KernelBlob}.
+     */
     @Override
     public boolean equals(Object other) {
         if (this == other) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TypeCodes.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TypeCodes.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TypeCodes.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TypeCodes.java
Fri Oct 12 11:02:59 2012
@@ -44,7 +44,7 @@ public class TypeCodes {
      * Returns {@code true} if the specified JSON String represents a value
      * serialization that is prefixed with a type code.
      *
-     * @param jsonString The JSON String representation of a {@code CoreValue}
+     * @param jsonString The JSON String representation of the value of a {@code PropertyState}
      * @return {@code true} if the {@code jsonString} starts with a type
      * code; {@code false} otherwise.
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
Fri Oct 12 11:02:59 2012
@@ -150,7 +150,7 @@ public class IdentifierManager {
 
     /**
      * Returns the path of the tree references by the specified (weak)
-     * reference {@code CoreValue value}.
+     * reference {@code PropertyState}.
      *
      * @param referenceValue A (weak) reference value.
      * @return The tree with the given {@code identifier} or {@code null} if no

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ArrayBasedBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ArrayBasedBlob.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ArrayBasedBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ArrayBasedBlob.java
Fri Oct 12 11:02:59 2012
@@ -24,6 +24,9 @@ import java.io.UnsupportedEncodingExcept
 
 import javax.annotation.Nonnull;
 
+/**
+ * This {@code Blob} implementations is based on an array of bytes.
+ */
 public class ArrayBasedBlob extends AbstractBlob {
     private final byte[] value;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/StringBasedBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/StringBasedBlob.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/StringBasedBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/StringBasedBlob.java
Fri Oct 12 11:02:59 2012
@@ -24,6 +24,9 @@ import java.io.UnsupportedEncodingExcept
 
 import javax.annotation.Nonnull;
 
+/**
+ * This {@code Blob} implementations is based on a string.
+ */
 public class StringBasedBlob extends AbstractBlob {
     private final String value;
 
@@ -36,6 +39,10 @@ public class StringBasedBlob extends Abs
         return value;
     }
 
+    /**
+     * This implementation returns the bytes of the UTF-8 encoding
+     * of the underlying string.
+     */
     @Nonnull
     @Override
     public InputStream getNewStream() {
@@ -47,6 +54,10 @@ public class StringBasedBlob extends Abs
         }
     }
 
+    /**
+     * This implementation returns the number of bytes in the UTF-8 encoding
+     * of the underlying string.
+     */
     @Override
     public long length() {
         try {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ValueBasedBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ValueBasedBlob.java?rev=1397512&r1=1397511&r2=1397512&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ValueBasedBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ValueBasedBlob.java
Fri Oct 12 11:02:59 2012
@@ -26,6 +26,9 @@ import javax.jcr.Binary;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 
+/**
+ * This {@code Blob} implementations is based on {@link Value}
+ */
 public class ValueBasedBlob extends AbstractBlob {
     private final Value value;
 
@@ -33,12 +36,19 @@ public class ValueBasedBlob extends Abst
         this.value = value;
     }
 
+    /**
+     * This implementation return the stream of the underlying {@code Value}.
+     */
     @Nonnull
     @Override
     public InputStream getNewStream() {
         return new ValueBasedInputStream(value);
     }
 
+    /**
+     * This implementation returns the size of the {@link Binary} of the underlying
+     * {@code Value}.
+     */
     @Override
     public long length() {
         try {

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=1397512&r1=1397511&r2=1397512&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
Fri Oct 12 11:02:59 2012
@@ -1,96 +1,96 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.oak.plugins.nodetype;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.Oak;
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.spi.lifecycle.DefaultMicroKernelTracker;
-import org.apache.jackrabbit.oak.spi.lifecycle.MicroKernelTracker;
-import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
-
-/**
- * {@code InitialContent} implements a {@link MicroKernelTracker} and
- * registers built-in node types when the micro kernel becomes available.
- */
-@Component
-@Service(MicroKernelTracker.class)
-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\"," +
-                    "\"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\"}}"
+
-                    "+\"rep:security\":{" +
-                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
-                    "\"rep:authorizables\":{" +
-                        "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
-                        "\"rep:users\":{" +
-                            "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
-                            "\"a\":{" +
-                                "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
-                                "\"ad\":{" +
-                                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\","
+
-                                    "\"admin\":{" +
-                                        "\"jcr:primaryType\":\"nam:rep:User\"," +
-                                        "\"jcr:uuid\":\"21232f29-7a57-35a7-8389-4a0e4a801fc3\","
+
-                                        "\"rep:principalName\":\"admin\"," +
-                                        "\"rep:authorizableId\":\"admin\"," +
-                                        "\"rep:password\":\"{SHA-256}9e515755e95513ce-1000-0696716f8baf8890a35eda1b9f2d5a4e727d1c7e1c062f03180dcc2a20f61f3b\"}},"
+
-                                "\"an\":{ " +
-                                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\","
+
-                                    "\"anonymous\":{" +
-                                        "\"jcr:primaryType\":\"nam:rep:User\"," +
-                                        "\"jcr:uuid\":\"294de355-7d9d-30b3-92d8-a1e6aab028cf\","
+
-                                        "\"rep:principalName\":\"anonymous\"," +
-                                        "\"rep:authorizableId\":\"anonymous\"}}" +
-                    "}}}}", null, null);
-        }
-        if (!root.hasChildNode("oak:index")) {
-            // FIXME: user-mgt related unique properties (rep:authorizableId, rep:principalName)
are implementation detail and not generic for repo
-            // FIXME: 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.
-            mk.commit("/", "+\"oak:index\":{\"jcr:uuid\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true},\"rep:authorizableId\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true},\"rep:principalName\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true}}",
null, null);
-        }
-
-        BuiltInNodeTypes.register(createRoot(mk));
-    }
-
-    private Root createRoot(MicroKernel mk) {
-        Oak oak = new Oak(mk);
-        oak.with(new OpenSecurityProvider()); // TODO: this shouldn't be needed
-        try {
-            return oak.createContentRepository().login(null, null).getLatestRoot();
-        } catch (Exception e) {
-            throw new IllegalStateException("Unable to create a Root", e);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.nodetype;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.lifecycle.DefaultMicroKernelTracker;
+import org.apache.jackrabbit.oak.spi.lifecycle.MicroKernelTracker;
+import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
+/**
+ * {@code InitialContent} implements a {@link MicroKernelTracker} and
+ * registers built-in node types when the micro kernel becomes available.
+ */
+@Component
+@Service(MicroKernelTracker.class)
+public class InitialContent extends DefaultMicroKernelTracker {
+
+    @Override
+    public void available(MicroKernel mk) {
+        NodeStore nodeStore = new Oak(mk).createNodeStore();
+        // FIXME: depends on 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\"," +
+                    "\"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\"}}"
+
+                    "+\"rep:security\":{" +
+                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
+                    "\"rep:authorizables\":{" +
+                        "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
+                        "\"rep:users\":{" +
+                            "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
+                            "\"a\":{" +
+                                "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\"," +
+                                "\"ad\":{" +
+                                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\","
+
+                                    "\"admin\":{" +
+                                        "\"jcr:primaryType\":\"nam:rep:User\"," +
+                                        "\"jcr:uuid\":\"21232f29-7a57-35a7-8389-4a0e4a801fc3\","
+
+                                        "\"rep:principalName\":\"admin\"," +
+                                        "\"rep:authorizableId\":\"admin\"," +
+                                        "\"rep:password\":\"{SHA-256}9e515755e95513ce-1000-0696716f8baf8890a35eda1b9f2d5a4e727d1c7e1c062f03180dcc2a20f61f3b\"}},"
+
+                                "\"an\":{ " +
+                                    "\"jcr:primaryType\":\"nam:rep:AuthorizableFolder\","
+
+                                    "\"anonymous\":{" +
+                                        "\"jcr:primaryType\":\"nam:rep:User\"," +
+                                        "\"jcr:uuid\":\"294de355-7d9d-30b3-92d8-a1e6aab028cf\","
+
+                                        "\"rep:principalName\":\"anonymous\"," +
+                                        "\"rep:authorizableId\":\"anonymous\"}}" +
+                    "}}}}", null, null);
+        }
+        if (!root.hasChildNode("oak:index")) {
+            // FIXME: user-mgt related unique properties (rep:authorizableId, rep:principalName)
are implementation detail and not generic for repo
+            // FIXME: 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.
+            mk.commit("/", "+\"oak:index\":{\"jcr:uuid\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true},\"rep:authorizableId\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true},\"rep:principalName\":{\"jcr:primaryType\":\"nam:oak:queryIndexDefinition\",\"unique\":true}}",
null, null);
+        }
+
+        BuiltInNodeTypes.register(createRoot(mk));
+    }
+
+    private Root createRoot(MicroKernel mk) {
+        Oak oak = new Oak(mk);
+        oak.with(new OpenSecurityProvider()); // TODO: this shouldn't be needed
+        try {
+            return oak.createContentRepository().login(null, null).getLatestRoot();
+        } catch (Exception e) {
+            throw new IllegalStateException("Unable to create a Root", e);
+        }
+    }
+}



Mime
View raw message