88e87956b4adff270a13fc2f98e1fc33e5a95081
[hc2vpp.git] /
1 package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
2
3 import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
4 import io.fd.honeycomb.v3po.data.ModifiableDataTree;
5 import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
6 import io.fd.honeycomb.v3po.translate.TranslationException;
7 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
8 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
9 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
10 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
11 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
12
13 public class ConfigDataTreeModule extends
14         org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractConfigDataTreeModule {
15     public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
16                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
17         super(identifier, dependencyResolver);
18     }
19
20     public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
21                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
22                                 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.ConfigDataTreeModule oldModule,
23                                 java.lang.AutoCloseable oldInstance) {
24         super(identifier, dependencyResolver, oldModule, oldInstance);
25     }
26
27     @Override
28     public void customValidation() {
29         // add custom validation form module attributes here.
30     }
31
32     @Override
33     public java.lang.AutoCloseable createInstance() {
34         final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
35         dataTree.setSchemaContext(getSchemaServiceDependency().getGlobalContext());
36         return new CloseableConfigDataTree(new ConfigDataTree(getBindingNormalizedNodeSerializerDependency(), dataTree,
37                 getWriterRegistryDependency()));
38     }
39
40     private static final class CloseableConfigDataTree implements ModifiableDataTree, AutoCloseable {
41
42         private final ConfigDataTree delegate;
43
44         CloseableConfigDataTree(final ConfigDataTree delegate) {
45             this.delegate = delegate;
46         }
47
48         @Override
49         public void close() throws Exception {
50             // NOP
51         }
52
53         @Override
54         public void modify(final DataTreeModification modification)
55                 throws DataValidationFailedException, TranslationException {
56             delegate.modify(modification);
57         }
58
59         @Override
60         public DataTreeSnapshot takeSnapshot() {
61             return delegate.takeSnapshot();
62         }
63     }
64 }