Class EmptyHook
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.commit.EmptyHook
-
- All Implemented Interfaces:
CommitHook
public class EmptyHook extends java.lang.Object implements CommitHook
Basic commit hook implementation that by default doesn't do anything. This class has a dual purpose:- 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. - 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 Summary
Fields Modifier and Type Field Description static CommitHook
INSTANCE
Static instance of this class, useful as a "null object".
-
Constructor Summary
Constructors Constructor Description EmptyHook()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull NodeState
processCommit(NodeState before, NodeState after, CommitInfo info)
Validates and/or modifies the given content change before it gets persisted.
-
-
-
Field Detail
-
INSTANCE
public static final CommitHook INSTANCE
Static instance of this class, useful as a "null object".
-
-
Method Detail
-
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 interfaceCommitHook
- Parameters:
before
- content tree before the commitafter
- content tree prepared for the commitinfo
- metadata associated with this commit- Returns:
- content tree to be committed
- Throws:
CommitFailedException
- if the commit should be rejected
-
-