|
There are a few situations where we want to apply a tree-based operation into a data tree, for example if I want to replicate a DataTreeCandidate to another data tree.
Instead of performing global operations in the YangInstanceIdentifier+data sense, it would be nice if I could maintain a data-tree backed cursor, which I can navigate, such as this:
YangInstanceIdentifer id; // root of the incoming DataTreeCandidate
DataTree tree; // tree the operation needs to be applied to
DataTreeModification tx = tree.takeSnapshot().newModification();
DataTreeModificationCursor cursor = tx.cursor(id);
cursor.write(pathArgument1, data1);
cursor.enter(pathArgument2); // equivalent of 'cd'
cursor.enter(pathArgument3);
cursor.write(pathArgument4, data2);
cursor.exit();
cursor.exit();
cursor.close();
|