Support for a recurive create in AsyncDocumentTree + Javadoc clean up
Change-Id: I2a4a961e24ff34aa106c93d3a8cb9093f10cee72
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
index 6589a98..a351ad5 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
@@ -106,6 +106,25 @@
}
@Override
+ public boolean createRecursive(DocumentPath path, V value) {
+ checkRootModification(path);
+ DocumentTreeNode<V> node = getNode(path);
+ if (node != null) {
+ return false;
+ }
+ DocumentPath parentPath = path.parent();
+ if (getNode(parentPath) == null) {
+ createRecursive(parentPath, null);
+ }
+ DefaultDocumentTreeNode<V> parentNode = getNode(parentPath);
+ if (parentNode == null) {
+ throw new IllegalDocumentModificationException();
+ }
+ parentNode.addChild(simpleName(path), value, versionSupplier.get());
+ return true;
+ }
+
+ @Override
public boolean replace(DocumentPath path, V newValue, long version) {
checkRootModification(path);
DocumentTreeNode<V> node = getNode(path);