jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: [jr3] Tree model
Date Wed, 29 Feb 2012 07:37:52 GMT

Am 28.02.2012 um 15:59 schrieb Jukka Zitting:
>  * A content tree is composed of a hierachy of items
>  * Tree items are either leaves or non-leaves
>  * Non-leaves contain zero or more named child items (*all* other
> data is stored at leaves)
>  * Each child item is *uniquely* named within its parent
>  * Names are just opaque strings
>  * Leaves contain typed data (strings, numbers, binaries, etc.)
>  * Content trees are *immutable* except in specific circumstances
> (transient changes)

I like this idea (and would love to see such a data structure to replace the String parameters
in the existig MK API drafts).

Yet, I have an issue with "Leaf extends Tree". I think this is not true in this case.

I understand that an abstract tree is made up of interior nodes and leaf nodes and so for
ease of implementation etc. we have some common API (maybe empty) and specialized API (child
(interior or leaf) nodes or properties).

  // this is anything part of a tree
  public interface TreePart {
     boolean isLeaf();

  // this is a subtree of a tree
  public interface Tree extends TreePart, Map<String, TreePart> {
     ... contents is child TreeParts ...

  // this is the leaf of a tree
  public interface Leaf extends TreePart, Map<String, Object> {
     ... contents is properties ...

I don't particularly like the isLeaf() method because it is implying that the base interface
knows about all extensions and is duplicate to "treePart instanceof Leaf". But in light of
supporting other languages it might be acceptable.

Another questions: interior nodes thus don't have properties ? How would this map to JCR Nodes
which have JCR Properties ?

View raw message