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
public class ReportingNodeState extends AbstractDecoratedNodeState
A decoration layer for NodeState instances that intercepts all accesses to NodeStates and PropertyStates (getters) and informs aReporter
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 sameReporter
instance.
For convenience, aPeriodicReporter
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:
Reporter
,PeriodicReporter
,LoggingReporter
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getPath()
ReportingNodeState instances provide access to their path via their parent hierarchy.java.lang.String
toString()
Returns a string representation of this node state.static NodeState
wrap(NodeState nodeState, Reporter reporter)
Allows wrapping a NodeState as a ReportingNodeState.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.migration.AbstractDecoratedNodeState
builder, compareAgainstBaseState, equals, exists, getChildNode, getChildNodeEntries, getDelegate, getProperties, getProperty, hasChildNode
-
Methods inherited from class org.apache.jackrabbit.oak.spi.state.AbstractNodeState
checkValidName, compareAgainstBaseState, comparePropertiesAgainstBaseState, equals, getBoolean, getBoolean, getChildNodeCount, getChildNodeNames, getLong, getLong, getName, getName, getNames, getNames, getPropertyCount, getString, getString, getStrings, getStrings, hashCode, hasProperty, isValidName, toString
-
-
-
-
Method Detail
-
wrap
public static NodeState wrap(NodeState nodeState, Reporter reporter)
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
public java.lang.String 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.
-
toString
public java.lang.String toString()
Description copied from class:AbstractNodeState
Returns a string representation of this node state.- Overrides:
toString
in classAbstractNodeState
- Returns:
- string representation
-
-