A specialized {@code NodeModel} implementation that uses a tracked nodemanaged by an {@link InMemoryNodeModel} object as root node.
Models of this type are useful when working on specific sub trees of a nodes structure. This is the case for instance for a {@code SubnodeConfiguration}.
An instance of this class is constructed with an {@link InMemoryNodeModelSupport} object providing a reference to theunderlying {@code InMemoryNodeModel} and the {@link NodeSelector} pointing tothe tracked node acting as this model's root node. The {@code NodeModel}operations are implemented by delegating to the wrapped {@code InMemoryNodeModel} object specifying the selector to the tracked nodeas target root node for the update transaction. Note that the tracked node can become detached at any time. This situation is handled transparently by the implementation of {@code InMemoryNodeModel}. The reason for using an {@code InMemoryNodeModelSupport} object rather than an{@code InMemoryNodeModel} directly is that this additional layer ofindirection can be used for performing special initializations on the model before it is returned to the {@code TrackedNodeModel} object. This is neededby some dynamic configuration implementations, e.g. by {@code CombinedConfiguration}.
If the tracked node acting as root node is exclusively used by this model, it should be released when this model is no longer needed. This can be done manually by calling the {@link #close()} method. It is also possible to passa value of true to the {@code untrackOnFinalize} argument ofthe constructor. This causes {@code close()} to be called automatically ifthis object gets claimed by the garbage collector.
As {@code InMemoryNodeModel}, this class is thread-safe.
@version $Id: TrackedNodeModel.java 1588832 2014-04-20 19:36:16Z oheger $ @since 2.0
|
|
|
|