jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig (JIRA) <j...@apache.org>
Subject [jira] Updated: (JCR-2688) Provide utility for handling large number of child nodes/properties
Date Wed, 28 Jul 2010 10:13:20 GMT

     [ https://issues.apache.org/jira/browse/JCR-2688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael Dürig updated JCR-2688:
-------------------------------

    Attachment: JCR-2688.patch

Proposed patch

Example usage:

 // Create a new TreeManager instance rooted at node. Splitting of nodes takes place
 // when the number of children of a node exceeds 40 and is done such that each new
 // node has at least 40 child nodes. The keys are ordered according to the natural
 // order of java.lang.String.
 TreeManager treeManager = new BTreeManager(node, 20, 40, Rank.<String>comparableComparator(),
true);

 // Create a new NodeSequence with that tree manager
 NodeSequence nodes = ItemSequence.createNodeSequence(treeManager);

 // Add nodes with key "jcr" and "day"
 nodes.addNode("jcr", NodeType.NT_UNSTRUCTURED);
 nodes.addNode("day", NodeType.NT_UNSTRUCTURED);

 // Iterate over the node in the sequence.
 // Prints "day jcr "
 for (Node n : nodes) {
     System.out.print(n.getName() + " ");
 }

 // Retrieve node with key "jcr"
 Node n = nodes.getItem("jcr");

 // Remove node with key "day"
 nodes.removeNode("day");

The nodes in the JCR sub tree are arranged such that any node named x only contains child
nodes with names greater or equal to x. The implementation keeps the child nodes in the sub
tree ordered if the respective node type supports ordering of child nodes. Ordering is always
wrt. to a Comparator on the respective keys. For lexical order this arrangement corresponds
to how words are arranged in a multi volume encyclopedia.



> Provide utility for handling large number of child nodes/properties
> -------------------------------------------------------------------
>
>                 Key: JCR-2688
>                 URL: https://issues.apache.org/jira/browse/JCR-2688
>             Project: Jackrabbit Content Repository
>          Issue Type: New Feature
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.2.0
>            Reporter: Michael Dürig
>            Assignee: Michael Dürig
>         Attachments: JCR-2688.patch
>
>
> Jackrabbit does not cope well with 'flat' hierarchies. That is with hierarchies where
a node has many child nodes and/or properties. The current recommendation for such situations
is to manually add intermediate nodes. 
> It would be nice to have an utility which adds/removes intermediate nodes as needed and
expose a 'flat' view to users. Such an utility should:
> - expose a large number of nodes/properties as sequence
> - parametrize the order of how nodes/properties appear in the sequence
> - provide methods to lookup/add/remove nodes/properties by key 
> - organize the node/properties in the underlying JCR hierarchy in a way which is both
efficient for above operations and easily understandable to users looking at the hierarchy.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message