Class ReportingNodeState
java.lang.Object
org.apache.jackrabbit.oak.spi.state.AbstractNodeState
org.apache.jackrabbit.oak.plugins.migration.AbstractDecoratedNodeState
org.apache.jackrabbit.oak.plugins.migration.report.ReportingNodeState
- All Implemented Interfaces:
NodeState
A decoration layer for NodeState instances that intercepts
all accesses to NodeStates and PropertyStates (getters) and
informs a
The decoration is deep, i.e. any child NodeStates will be decorated as well and will report to the same
For convenience, a
Note: Multiple accesses to the same node or property are each reported. Therefore if exactly counting unique accesses is a requirement, the reporter needs to take care of de-duplication.
Reporter
via its callbacks that the respective
NodeStates or PropertyStates have been accessed.
The decoration is deep, i.e. any child NodeStates will be decorated as well and will report to the same
Reporter
instance.
For convenience, a
PeriodicReporter
abstract class exists.
This simplifies reporting every nth node/property only.
Note: Multiple accesses to the same node or property are each reported. Therefore if exactly counting unique accesses is a requirement, the reporter needs to take care of de-duplication.
- See Also:
-
Field Summary
Fields inherited from class org.apache.jackrabbit.oak.plugins.migration.AbstractDecoratedNodeState
delegate
-
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull NodeState
decorateChild
(@NotNull String name, @NotNull NodeState delegateChild) protected @Nullable PropertyState
decorateProperty
(@NotNull PropertyState delegatePropertyState) getPath()
ReportingNodeState instances provide access to their path via their parent hierarchy.toString()
Returns a string representation of this node state.static NodeState
Allows wrapping a NodeState as a ReportingNodeState.Methods inherited from class org.apache.jackrabbit.oak.plugins.migration.AbstractDecoratedNodeState
builder, compareAgainstBaseState, equals, exists, fixChildOrderPropertyState, getChildNode, getChildNodeEntries, getDelegate, getNewPropertyStates, getProperties, getProperty, hasChildNode, hideChild, hideProperty
Methods inherited from class org.apache.jackrabbit.oak.spi.state.AbstractNodeState
checkValidName, compareAgainstBaseState, comparePropertiesAgainstBaseState, count, equals, getBoolean, getBoolean, getChildNodeCount, getChildNodeNames, getLong, getLong, getName, getName, getNames, getNames, getPropertyCount, getString, getString, getStrings, getStrings, hashCode, hasProperty, isValidName, toString
-
Method Details
-
wrap
Allows wrapping a NodeState as a ReportingNodeState. The wrapped NodeState is treated as the root of a tree (i.e. path is "/").
Any children accessed via this NodeState are also wrapped. Each wrapped NodeState is also reported to the provided Reporter.- Parameters:
nodeState
- The NodeState to be wrapped.reporter
- The reporter to report to.- Returns:
- the wrapped NodeState.
-
getPath
ReportingNodeState instances provide access to their path via their parent hierarchy. Note that calculating the path on every access may incur a significant performance penalty.- Returns:
- The path of the ReportingNodeState instance, assuming that the first wrapped instance is the root node.
-
decorateChild
@NotNull protected @NotNull NodeState decorateChild(@NotNull @NotNull String name, @NotNull @NotNull NodeState delegateChild) - Specified by:
decorateChild
in classAbstractDecoratedNodeState
-
decorateProperty
@Nullable protected @Nullable PropertyState decorateProperty(@NotNull @NotNull PropertyState delegatePropertyState) - Specified by:
decorateProperty
in classAbstractDecoratedNodeState
-
toString
Description copied from class:AbstractNodeState
Returns a string representation of this node state.- Overrides:
toString
in classAbstractNodeState
- Returns:
- string representation
-