Interface Editor

All Known Subinterfaces:
IndexEditor, MoveValidator, Validator
All Known Implementing Classes:
AtomicCounterEditor, CompositeEditor, ConflictValidator, CrossMountReferenceValidator, DefaultEditor, DefaultMoveValidator, DefaultValidator, FailingValidator, IncrementalFlatFileStoreEditor, IndexUpdate, MoveAwarePermissionValidator, MoveDetector, ProgressNotificationEditor, SubtreeEditor, SubtreeExcludingValidator, SubtreeValidator, TypeEditor, VersionableEditor, VersionablePropertiesEditor, VisibleEditor, VisibleValidator

public interface Editor
Content change editor. An editor receives information about changes to the content tree and can reject the changes by throwing a CommitFailedException or adjust them using the NodeBuilder instance passed to the EditorProvider that returned this editor. Note that the given builder can contain updates from multiple different editors, so its state might not match exactly the state of the given after state.
Since:
Oak 0.7
See Also:
  • Method Details

    • enter

      void enter(NodeState before, NodeState after) throws CommitFailedException
      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.
      Parameters:
      before - before state, non-existent if this node was added
      after - after state, non-existent if this node was removed
      Throws:
      CommitFailedException - if this commit should be rejected
    • leave

      void leave(NodeState before, NodeState after) throws CommitFailedException
      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.
      Parameters:
      before - before state, non-existent if this node was added
      after - after state, non-existent if this node was removed
      Throws:
      CommitFailedException - if this commit should be rejected
    • propertyAdded

      void propertyAdded(PropertyState after) throws CommitFailedException
      Processes an added property.
      Parameters:
      after - the added property
      Throws:
      CommitFailedException - if processing failed
    • propertyChanged

      void propertyChanged(PropertyState before, PropertyState after) throws CommitFailedException
      Processes a changed property.
      Parameters:
      before - the original property
      after - the changed property
      Throws:
      CommitFailedException - if processing failed
    • propertyDeleted

      void propertyDeleted(PropertyState before) throws CommitFailedException
      Processes a removed property.
      Parameters:
      before - the removed property
      Throws:
      CommitFailedException - if processing failed
    • childNodeAdded

      @Nullable @Nullable Editor childNodeAdded(String name, NodeState after) throws CommitFailedException
      Processes an added child node.
      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:
      CommitFailedException - if processing failed
    • childNodeChanged

      @Nullable @Nullable Editor childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException
      Processes a changed child node. This method gets called for all child nodes that may contain changes between the before and after states.
      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:
      CommitFailedException - if processing failed
    • childNodeDeleted

      @Nullable @Nullable Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException
      Processes a deleted child node.
      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:
      CommitFailedException - if processing failed