You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2012/07/06 14:31:35 UTC

[jira] [Commented] (OAK-170) Child node state builder

    [ https://issues.apache.org/jira/browse/OAK-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13407949#comment-13407949 ] 

Jukka Zitting commented on OAK-170:
-----------------------------------

I committed a slightly revised version of the proposed method in revision 1358157. It works quite nicely for the lucene index editor, and I'm looking at also using this mechanism to simplify the relevant bits in TreeImpl.
                
> Child node state builder
> ------------------------
>
>                 Key: OAK-170
>                 URL: https://issues.apache.org/jira/browse/OAK-170
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jukka Zitting
>
> To make it easier to construct and manage complex NodeState changes it's currently necessary to explicitly track multiple NodeStates and NodeStateBuilders and carefully update each builder all the way to the root of the content tree.
> We could simplify this by allowing NodeStateBuilders to be linked to each other by a parent-child relationship so that changes to a child builder would automatically update also the parent builder.
> A quick draft of how this could look like and behave in the {{NodeStateBuilder}} interface is shown below:
> {code:java}
> /**
>  * Returns a builder for constructing changes to the named child node.
>  * If the named child node does not already exist, a new empty child
>  * node is automatically created as the base state of the returned
>  * child builder. Otherwise the existing child node state is used
>  * as the base state of the returned builder.
>  * <p>
>  * All updates to the returned child builder will implicitly affect
>  * also this builder, as if a
>  * <code>setNode(name, childBilder.getNodeState())</code> method call
>  * had been made after each update. An explicit
>  * {@link #setNode(String, NodeState)}, {@link #removeNode(String)}
>  * or another {@link #getChildBuilder(String)} call on this builder
>  * will break the link to a possible corresponding previously
>  * returned child builder.
>  *
>  * @since Oak 0.4
>  * @param name name of the child node
>  * @return child builder
>  */
> @Nonnull
> NodeStateBuilder getChildBuilder(String name);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira