BUG-8291: expose additional DataTreeFactory methods 89/56089/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2017 20:32:06 +0000 (22:32 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 26 Apr 2017 15:33:19 +0000 (15:33 +0000)
commit29f680f7c9debe57fce321fb3f336078eaea81aa
treed88698cdce8e2c3f76160786faec8948f7e6e1a7
parentb3da5d0dd25e8ddfb08b32e45d2e080cf667dba0
BUG-8291: expose additional DataTreeFactory methods

There are use cases when we want to instantiate a DataTree rooted
at a list itself, which is something we cannot discover from
YangInstanceIdentifier because lists and containers share the same
identifier.

Therefore we need to expose a factory method which takes an initial
SchemaContext, from which we can derive the appropriate root node.

While we are at it, we also expose another factory method, which
takes additionally the initial tree state. Since the state is not
empty, we can run full validation on it before we give out the
DataTree -- allowing us to perform full enforcement of mandatory
nodes.

Change-Id: Id362234b9ef42d93ae01577809fb004864d05d1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit cbb18c74acab8a9b77ddf1dc19d988e3d0fe37fc)
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeFactory.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/InMemoryDataTree.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/InMemoryDataTreeFactory.java