Class EmptyHook

java.lang.Object
org.apache.jackrabbit.oak.spi.commit.EmptyHook
All Implemented Interfaces:
CommitHook

public class EmptyHook extends Object implements CommitHook
Basic commit hook implementation that by default doesn't do anything. This class has a dual purpose:
  1. The static INSTANCE instance can be used as a "null object" in cases where another commit hook has not been configured, thus avoiding the need for extra code for such cases.
  2. Other commit hook implementations can extend this class and gain improved forwards-compatibility to possible changes in the CommitHook interface. For example if it is later decided that new arguments are needed in the hook methods, this class is guaranteed to implement any new method signatures in a way that falls gracefully back to any earlier behavior.
  • Field Details

    • INSTANCE

      public static final CommitHook INSTANCE
      Static instance of this class, useful as a "null object".
  • Constructor Details

    • EmptyHook

      public EmptyHook()
  • Method Details

    • processCommit

      @NotNull public @NotNull NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException
      Description copied from interface: CommitHook
      Validates and/or modifies the given content change before it gets persisted.
      Specified by:
      processCommit in interface CommitHook
      Parameters:
      before - content tree before the commit
      after - content tree prepared for the commit
      info - metadata associated with this commit
      Returns:
      content tree to be committed
      Throws:
      CommitFailedException - if the commit should be rejected