/** * Finds a node or closest parent in the tree. * * @param <T> * Store tree node type. * @param tree Data Tree * @param path Path to the node * @return Map.Entry Entry with key which is path to closest parent and value is parent node. */ public static <T extends StoreTreeNode<T>> Entry<YangInstanceIdentifier, T> findClosest(final T tree, final YangInstanceIdentifier path) { return findClosestsOrFirstMatch(tree, path, input -> false); }
private ModificationApplyOperation resolveModificationStrategy(final YangInstanceIdentifier path) { LOG.trace("Resolving modification apply strategy for {}", path); upgradeIfPossible(); return StoreTreeNodes.findNodeChecked(strategyTree, path); }
private ModificationApplyOperation resolveModificationStrategy(final YangInstanceIdentifier path) { LOG.trace("Resolving modification apply strategy for {}", path); upgradeIfPossible(); return StoreTreeNodes.findNodeChecked(strategyTree, path); }
/** * Finds a node or closest parent in the tree. * * @param <T> * Store tree node type. * @param tree Data Tree * @param path Path to the node * @return Map.Entry Entry with key which is path to closest parent and value is parent node. */ public static <T extends StoreTreeNode<T>> Entry<YangInstanceIdentifier, T> findClosest(final T tree, final YangInstanceIdentifier path) { return findClosestsOrFirstMatch(tree, path, input -> false); }
@Override public Optional<NormalizedNode<?, ?>> readNode(final YangInstanceIdentifier path) { /* * Walk the tree from the top, looking for the first node between root and * the requested path which has been modified. If no such node exists, * we use the node itself. */ final Entry<YangInstanceIdentifier, ModifiedNode> entry = StoreTreeNodes.findClosestsOrFirstMatch(rootNode, path, ModifiedNode.IS_TERMINAL_PREDICATE); final YangInstanceIdentifier key = entry.getKey(); final ModifiedNode mod = entry.getValue(); final Optional<TreeNode> result = resolveSnapshot(key, mod); if (result.isPresent()) { final NormalizedNode<?, ?> data = result.get().getData(); return NormalizedNodes.findNode(key, data, path); } return Optional.empty(); }
@Override public Optional<NormalizedNode<?, ?>> readNode(final YangInstanceIdentifier path) { /* * Walk the tree from the top, looking for the first node between root and * the requested path which has been modified. If no such node exists, * we use the node itself. */ final Entry<YangInstanceIdentifier, ModifiedNode> entry = StoreTreeNodes.findClosestsOrFirstMatch(rootNode, path, ModifiedNode.IS_TERMINAL_PREDICATE); final YangInstanceIdentifier key = entry.getKey(); final ModifiedNode mod = entry.getValue(); final Optional<TreeNode> result = resolveSnapshot(key, mod); if (result.isPresent()) { final NormalizedNode<?, ?> data = result.get().getData(); return NormalizedNodes.findNode(key, data, path); } return Optional.empty(); }