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, DataTree {
35 private final DataTree dataTree;
37 CloseableConfigDataTree(final SchemaContext schemaContext, final DatatreeType type) {
38 this.dataTree = InMemoryDataTreeFactory.getInstance().create(
39 type == DatatreeType.Config ? TreeType.CONFIGURATION : TreeType.OPERATIONAL
41 dataTree.setSchemaContext(schemaContext);
45 public void close() throws Exception {
50 public DataTreeSnapshot takeSnapshot() {
51 return dataTree.takeSnapshot();
55 public void setSchemaContext(final SchemaContext newSchemaContext) {
56 dataTree.setSchemaContext(newSchemaContext);
60 public void commit(final DataTreeCandidate candidate) {
61 dataTree.commit(candidate);
65 public YangInstanceIdentifier getRootPath() {
66 return dataTree.getRootPath();
70 public void validate(final DataTreeModification modification) throws DataValidationFailedException {
71 dataTree.validate(modification);
75 public DataTreeCandidate prepare(final DataTreeModification modification) {
76 return dataTree.prepare(modification);