You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2011/03/23 16:49:04 UTC

svn commit: r1084619 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java

Author: stefan
Date: Wed Mar 23 15:49:04 2011
New Revision: 1084619

URL: http://svn.apache.org/viewvc?rev=1084619&view=rev
Log:
drafting MicroKernel api (WIP)

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java?rev=1084619&r1=1084618&r2=1084619&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java (original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java Wed Mar 23 15:49:04 2011
@@ -150,11 +150,10 @@ public interface MicroKernel {
 
     /**
      * Returns the node tree rooted at the specified parent node. The depth of
-     * the returned tree is governed by <code>depth</code> parameter:
-     * <p/>
+     * the returned tree is governed by the <code>depth</code> parameter:
      * <table>
-     * <tr><td>depth = 0</td><td>just properties, including <code>:childNodesCount</code></td></tr>
-     * <tr><td>depth = 1</td><td>properties, child nodes and their properties (including <code>:childNodesCount</code>)</td></tr>
+     * <tr><td>depth = 0</td><td>just properties, including <code>:childNodeCount</code></td></tr>
+     * <tr><td>depth = 1</td><td>properties, child nodes and their properties (including <code>:childNodeCount</code>)</td></tr>
      * <tr><td>depth = 2</td><td>[and so on...]</td></tr>
      * </table>
      * <p/>
@@ -163,21 +162,21 @@ public interface MicroKernel {
      * {
      *     ":name" : "parent",
      *     "someprop" : "someval",
-     *     ":childNodesCount" : 2,
+     *     ":childNodeCount" : 2,
      *     ":childNodes" : [
-     *         { ":name" : "child1", "prop1" : "foo", ":childNodesCount" : 1, ":childNodes" : [
-     *             { ":name" : "grandchild", "propA" : "blahblah", ":childNodesCount" : 0 }
+     *         { ":name" : "child1", "prop1" : "foo", ":childNodeCount" : 1, ":childNodes" : [
+     *             { ":name" : "grandchild", "propA" : "blahblah", ":childNodeCount" : 0 }
      *         ]},
-     *         { ":name" : "child2", "prop1" : "bar", ":childNodesCount" : 0}
-       *   ]
+     *         { ":name" : "child2", "prop1" : "bar", ":childNodeCount" : 0}
+     *     ]
      * }
      * </pre>
      *
      * Some remarks:
      * <ul>
-     * <li><code>:childNodesCount > 0</code> indicates that the node does have child nodes,
+     * <li><code>:childNodeCount > 0</code> indicates that the node does have child nodes,
      * although they might not be included in the tree.</li>
-     * <li><code>:childNodesCount > lengthOf(:childNodes)</code> indicates that the
+     * <li><code>:childNodeCount > lengthOf(:childNodes)</code> indicates that the
      * node does have more child nodes than those included in the tree. Large number
      * of child nodes can be retrieved in chunks using the {@link #getChildNodes} method</li>
      * </ul>
@@ -188,18 +187,18 @@ public interface MicroKernel {
      * {
      *     ":name" : "parent",
      *     "someprop" : "someval",
-     *     ":childNodesCount" : 2,
+     *     ":childNodeCount" : 2,
      *     "child1" : {
      *         "prop1" : "foo",
-     *         ":childNodesCount" : 1,
+     *         ":childNodeCount" : 1,
      *         "grandchild" : {
      *             "propA" : "blahblah",
-     *             ":childNodesCount" : 0
+     *             ":childNodeCount" : 0
      *         }
      *     }
      *     "child2" : {
      *         "prop1" : "bar",
-     *         ":childNodesCount" : 0
+     *         ":childNodeCount" : 0
      *     }
      * }
      * </pre>
@@ -215,13 +214,33 @@ public interface MicroKernel {
     // specialized methods for reading flat hierarchies
 
     /**
+     * Similar to {@link #getNodes}, except that this method returns an array
+     * of child node trees and allows for reading large lists of child nodes
+     * in chunks (by specifying appropriate values for <code>offset</code>
+     * and <code>count</code>).
+     * <p/>
+     * The depth of the returned trees is governed by the <code>depth</code> parameter:
+     * <table>
+     * <tr><td>depth = 0</td><td>child nodes with just properties, including <code>:childNodeCount</code></td></tr>
+     * <tr><td>depth = 1</td><td>child nodes with properties, grandchildren with their properties (including <code>:childNodeCount</code>)</td></tr>
+     * <tr><td>depth = 2</td><td>[and so on...]</td></tr>
+     * </table>
+     * <p/>
+     * Format:
+     * <pre>
+     * [
+     *     { ":name" : "child1", "prop1" : "foo", ":childNodeCount" : 101},
+     *     { ":name" : "child2", "prop1" : "bar", ":childNodeCount" : 0},
+     *     { ":name" : "child3", "prop1" : "blah", ":childNodeCount" : 2}
+     * ]
+     * </pre>
      *
      * @param idOrPath identifier or path denoting parent node
-     * @param offset
-     * @param count
-     * @param depth
+     * @param offset start position in child node list
+     * @param count maximum number of child nodes to retrieve
+     * @param depth maximum depth of returned trees
      * @param revisionId revision
-     * @return
+     * @return array of node tree in JSON format
      * @throws MicroKernelException if an error occurs
      */
     String /* array of jsonTrees */ getChildNodes(String idOrPath, long offset, long count, int depth, String revisionId) throws MicroKernelException;
@@ -229,7 +248,7 @@ public interface MicroKernel {
     /**
      * Returns the number of child nodes of the specified parent node.
      *
-     * @todo could be represented as special property (":childNodeCount") -> no need for specific api method (TBD)
+     * @todo if we represent the number as child nodes as a special property on the parent(":childNodeCount") there's probably no need for specific api method (TBD)
      *
      * @param idOrPath identifier or path denoting parent node
      * @param revisionId revision