1 package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
3 import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.api.rev160411.DatatreeType;
4 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
5 import org.opendaylight.yangtools.yang.data.api.schema.tree.*;
6 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
7 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
11 public class InMemoryDataTreeModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryDataTreeModule {
13 private static final Logger LOG = LoggerFactory.getLogger(InMemoryDataTreeModule.class);
15 public InMemoryDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
16 super(identifier, dependencyResolver);
19 public InMemoryDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.InMemoryDataTreeModule oldModule, java.lang.AutoCloseable oldInstance) {
20 super(identifier, dependencyResolver, oldModule, oldInstance);
24 public void customValidation() {
25 // add custom validation form module attributes here.
29 public java.lang.AutoCloseable createInstance() {
30 LOG.debug("InMemoryConfigDataTreeModule.createInstance()");
31 return new CloseableConfigDataTree(getSchemaServiceDependency().getGlobalContext(), getType());
34 private static class CloseableConfigDataTree implements AutoCloseable,
35 org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree {
36 private final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree dataTree;
38 public CloseableConfigDataTree(final SchemaContext schemaContext, final DatatreeType type) {
39 this.dataTree = InMemoryDataTreeFactory.getInstance().create(
40 type == DatatreeType.Config ? TreeType.CONFIGURATION : TreeType.OPERATIONAL
42 dataTree.setSchemaContext(schemaContext);
46 public void close() throws Exception {
51 public DataTreeSnapshot takeSnapshot() {
52 return dataTree.takeSnapshot();
56 public void setSchemaContext(final SchemaContext newSchemaContext) {
57 dataTree.setSchemaContext(newSchemaContext);
61 public void commit(final DataTreeCandidate candidate) {
62 dataTree.commit(candidate);
66 public YangInstanceIdentifier getRootPath() {
67 return dataTree.getRootPath();
71 public void validate(final DataTreeModification modification) throws DataValidationFailedException {
72 dataTree.validate(modification);
76 public DataTreeCandidate prepare(final DataTreeModification modification) {
77 return dataTree.prepare(modification);