X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FNormalizedNodeAggregator.java;h=18604587f12465d8b57d274f4042fa712e69b3b9;hp=a406b9aaf5707c305b497f49096509a44f23c188;hb=43aab07cdbc80eda69e84a26085afe1b37f4002e;hpb=f0a3398f9a6598b9b7321ddf7d1a2f9433065d92 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java index a406b9aaf5..18604587f1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java @@ -23,10 +23,11 @@ public class NormalizedNodeAggregator { private final List>> nodes; private final DataTree dataTree; - private NormalizedNodeAggregator(YangInstanceIdentifier rootIdentifier, List>> nodes, - SchemaContext schemaContext) { + private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier, final List>> nodes, + final SchemaContext schemaContext) { this.rootIdentifier = rootIdentifier; this.nodes = nodes; + // FIXME: BUG-1014: pass down proper DataTree this.dataTree = InMemoryDataTreeFactory.getInstance().create(); this.dataTree.setSchemaContext(schemaContext); } @@ -39,9 +40,9 @@ public class NormalizedNodeAggregator { * @return * @throws DataValidationFailedException */ - public static Optional> aggregate(YangInstanceIdentifier rootIdentifier, - List>> nodes, - SchemaContext schemaContext) throws DataValidationFailedException { + public static Optional> aggregate(final YangInstanceIdentifier rootIdentifier, + final List>> nodes, + final SchemaContext schemaContext) throws DataValidationFailedException { return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext).aggregate(); } @@ -50,14 +51,14 @@ public class NormalizedNodeAggregator { } private NormalizedNodeAggregator combine() throws DataValidationFailedException { - DataTreeModification mod = dataTree.takeSnapshot().newModification(); + final DataTreeModification mod = dataTree.takeSnapshot().newModification(); - for (Optional> node : nodes) { + for (final Optional> node : nodes) { if (node.isPresent()) { mod.merge(rootIdentifier, node.get()); } } - + mod.ready(); dataTree.validate(mod); final DataTreeCandidate candidate = dataTree.prepare(mod); dataTree.commit(candidate);