Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-10011

Use javax.jcr.Item.getParent() when resolving parent JCR node in JcrResourceProvider#getParent

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: JCR Resource 3.0.22
    • Fix Version/s: None
    • Component/s: JCR
    • Labels:
      None

      Description

      Currently JcrResourceProvider.getParent is using JcrItemResourceFactory.getItemOrNull(String path), which eventually is using JCR session to retrieve parent node using absolute path.

      I propose using javax.jcr.Item.getParent() instead.

      Reasoning wold be to utilise potential improvements in JCR implementation that would for a given node retrieve the whole subtree. That can be configured for example by using particular node type or node path.

          root
           |
           a 
         /   \
        b     c    
      

      If node 'a' in picture above, is matching desired configuration, then code below would return the whole subtree.

      Node a = jcrSession.getNode("a");
      

      That further means retrieved subtree can be traversed in memory, without the need to communicate with the JCR repository storage.

      (!)That is particularly important when remote (cloud) storage is used for repository in JCR implementation, and tree traversal can be done without doing additional network roundtrips.

      //JCR tree traversal happens in memory
      Node b = a.getNode("b");
      Node c = a.getNode("c");
      

      Also going from child to parent, is resolved in memory as well (proposal relates to this fact)

      //JCR tree traversal happens in memory
      assert b.getParent() == c.getParent();
      

      Jackrabbit Oak, for document node store is supporting node bundling for configured node type
      http://jackrabbit.apache.org/oak/docs/nodestore/document/node-bundling.html

      Currently I am also doing some experiments to support node bundling/aggregation for arbitrary node store (NodeDelegateFullyLoaded, FullyLoadedTree).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                miroslav Miroslav Smiljanic
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m