On Thu, Dec 29, 2011 at 6:19 PM, Michael Dürig <mic...@gmail.com> wrote: > Hi, > > Over at the sandbox [1] I implemented a new (AFAIK) approach for the JCR > transient space. The gist of it is in the ChangeTree class [2] while some > more Microkernel specific things are factored out into the TransientSpace > class [3].
great work! it's good to see a fresh take on jcr client implementation. some comments from the peanut gallery follow inline ;) > > The key idea is to only store changes to the node hierarchy in the > ChangeTree and to do that in a way which allows reconstructing a list of > corresponding operations (add, remove, move for nodes and set for > properties) from that ChangeTree. This differs from other implementations > where the list of operations is kept *together* with the modified hierarchy. > Furthermore with the ChangeTree approach no untouched nodes need to be kept > in memory. that's also true for the existing jackrabbit-core implementation. > Finally the list of operations reconstructed from a ChangeTree is > minimal. That is, all cancelling operations are reduced as much as possible: same here, jackrabbit-core does consolidate transient changes as well. cheers stefan > add followed by remove of the same item results in no operations, add > followed by move of the same node results in the node being added at the > target of the move, move followed by remove of a node results in the node > being removed at the source of the move and move followed by another move of > a node results in a single move from the original source to the eventual > target. More details are in the class comment of ChangeTree and even more > details in the implementation ;-) > > Michael > > > [1] http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/ > > [2] > http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java?view=markup > > [3] > http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientSpace.java?view=markup