From: Colin Dixon Date: Tue, 16 Feb 2016 18:06:50 +0000 (-0500) Subject: BUG-2912: Better document DataChangeScope.ONE X-Git-Tag: release/boron~347 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=06f4479a60eae04117a35c24e36d68fddbacfe0a;hp=aeb60bc8ab1b62e18dc090f946c2bdf12b3e9a6c;ds=sidebyside BUG-2912: Better document DataChangeScope.ONE Provides information about the way this scope interacts with lists in and the binding independent data tree that might be counterintuitive when compared with a binding aware view of the same data. Change-Id: If966331b4daa5a88be61fb2efea65a4b69495b0b Signed-off-by: Colin Dixon --- diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java index 3a68092f07..8b62fd25e8 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java @@ -103,14 +103,43 @@ public interface AsyncDataBroker

, D, L extends AsyncDataChange public enum DataChangeScope { /** - * Represents only a direct change of the node, such as replacement of a - * node, addition or deletion. + * Represents only a direct change of the node, such as replacement of a node, addition or + * deletion. Note that, as described in {@link #ONE}, this may have counterintuitive + * interactions when viewed from a binding aware application, in particular when it + * pertains to lists. * */ BASE, /** - * Represent a change (addition,replacement,deletion) of the node or one - * of its direct children. + * Represent a change (addition,replacement,deletion) of the node or one of its direct + * children. + *

+ * Note that this is done in the binding independent data tree and so the behavior + * might be counterintuitive when used with binding aware interfaces particularly + * when it comes to lists. The list itself is a node in the binding independent tree, + * which means that if you want to listen on new elements you must listen on the list itself + * with the scope of {@link #ONE}. + *

+ * As an example, in the below YANG snippet, listening on node with scope + * {@link #ONE} would tell you if the node-connector list was created or deleted, + * but not when elements were added or removed from the list assuming the list itself + * already existed. + * + *

+         * container nodes {
+         *   list node {
+         *     key "id";
+         *     leaf id {
+         *       type string;
+         *     }
+         *     list node-connector {
+         *       leaf id {
+         *         type string;
+         *       }
+         *     }
+         *   }
+         * }
+         * 
* * This scope is superset of {@link #BASE}. *