Class EmptyHook
java.lang.Object
org.apache.jackrabbit.oak.spi.commit.EmptyHook
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final CommitHook
Static instance of this class, useful as a "null object". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull NodeState
processCommit
(NodeState before, NodeState after, CommitInfo info) Validates and/or modifies the given content change before it gets persisted.
-
Field Details
-
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 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
-