Class DefaultEditor

  • All Implemented Interfaces:
    Editor
    Direct Known Subclasses:
    SubtreeEditor

    public class DefaultEditor
    extends java.lang.Object
    implements Editor
    Editor that does nothing by default and doesn't recurse into subtrees. Useful as a sentinel or as a base class for more complex editors.
    Since:
    Oak 0.7
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Editor INSTANCE  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultEditor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Editor childNodeAdded​(java.lang.String name, NodeState after)
      Processes an added child node.
      Editor childNodeChanged​(java.lang.String name, NodeState before, NodeState after)
      Processes a changed child node.
      Editor childNodeDeleted​(java.lang.String name, NodeState before)
      Processes a deleted child node.
      void enter​(NodeState before, NodeState after)
      Called before the given before and after states are compared.
      void leave​(NodeState before, NodeState after)
      Called after the given before and after states are compared.
      void propertyAdded​(org.apache.jackrabbit.oak.api.PropertyState after)
      Processes an added property.
      void propertyChanged​(org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
      Processes a changed property.
      void propertyDeleted​(org.apache.jackrabbit.oak.api.PropertyState before)
      Processes a removed property.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCE

        public static final Editor INSTANCE
    • Constructor Detail

      • DefaultEditor

        public DefaultEditor()
    • Method Detail

      • enter

        public void enter​(NodeState before,
                          NodeState after)
                   throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Called before the given before and after states are compared. The implementation can use this method to initialize any internal state needed for processing the results of the comparison. For example an implementation could look up the effective node type of the after state to know what constraints to apply to on the content changes.
        Specified by:
        enter in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if this commit should be rejected
      • leave

        public void leave​(NodeState before,
                          NodeState after)
                   throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Called after the given before and after states are compared. The implementation can use this method to post-process information collected during the content diff. For example an implementation that during the diff just recorded the fact that this node was modified in some way could then use this method to trigger an index update based on that modification flag.
        Specified by:
        leave in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if this commit should be rejected
      • propertyAdded

        public void propertyAdded​(org.apache.jackrabbit.oak.api.PropertyState after)
                           throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes an added property.
        Specified by:
        propertyAdded in interface Editor
        Parameters:
        after - the added property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed
      • propertyChanged

        public void propertyChanged​(org.apache.jackrabbit.oak.api.PropertyState before,
                                    org.apache.jackrabbit.oak.api.PropertyState after)
                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes a changed property.
        Specified by:
        propertyChanged in interface Editor
        Parameters:
        before - the original property
        after - the changed property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed
      • propertyDeleted

        public void propertyDeleted​(org.apache.jackrabbit.oak.api.PropertyState before)
                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes a removed property.
        Specified by:
        propertyDeleted in interface Editor
        Parameters:
        before - the removed property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed
      • childNodeAdded

        public Editor childNodeAdded​(java.lang.String name,
                                     NodeState after)
                              throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes an added child node.
        Specified by:
        childNodeAdded in interface Editor
        Parameters:
        name - name of the added node
        after - the added child node
        Returns:
        an editor for processing the subtree below the added node, or null if the subtree does not need processing
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed
      • childNodeChanged

        public Editor childNodeChanged​(java.lang.String name,
                                       NodeState before,
                                       NodeState after)
                                throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes a changed child node. This method gets called for all child nodes that may contain changes between the before and after states.
        Specified by:
        childNodeChanged in interface Editor
        Parameters:
        name - name of the changed node
        before - child node before the change
        after - child node after the change
        Returns:
        an editor for processing the subtree below the added node, or null if the subtree does not need processing
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed
      • childNodeDeleted

        public Editor childNodeDeleted​(java.lang.String name,
                                       NodeState before)
                                throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Editor
        Processes a deleted child node.
        Specified by:
        childNodeDeleted in interface Editor
        Parameters:
        name - name of the deleted node
        before - the deleted child node
        Returns:
        an editor for processing the subtree below the removed node, or null if the subtree does not need processing
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if processing failed