86a3f9db47868afbd368880b3f2f56cc94155323
[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.DataTreeModification;
8 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11
12 public class ConfigDataTreeModule extends
13         org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractConfigDataTreeModule {
14
15     private static final Logger LOG = LoggerFactory.getLogger(ConfigDataTreeModule.class);
16
17     public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
18                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
19         super(identifier, dependencyResolver);
20     }
21
22     public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
23                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
24                                 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.ConfigDataTreeModule oldModule,
25                                 java.lang.AutoCloseable oldInstance) {
26         super(identifier, dependencyResolver, oldModule, oldInstance);
27     }
28
29     @Override
30     public void customValidation() {
31         // add custom validation form module attributes here.
32     }
33
34     @Override
35     public java.lang.AutoCloseable createInstance() {
36         LOG.debug("ConfigDataTreeModule.createInstance()");
37         return new CloseableConfigDataTree(
38                 new ConfigDataTree(getSerializerDependency(), getDataTreeDependency(), getWriterRegistryDependency()));
39     }
40
41     private static final class CloseableConfigDataTree implements ModifiableDataTree, AutoCloseable {
42
43         private final ConfigDataTree delegate;
44
45         CloseableConfigDataTree(final ConfigDataTree delegate) {
46             this.delegate = delegate;
47         }
48
49         @Override
50         public void close() throws Exception {
51             LOG.debug("CloseableConfigDataTree.close()");
52             // NOP
53         }
54
55         @Override
56         public void modify(final DataTreeModification modification)
57                 throws DataValidationFailedException, TranslationException {
58             LOG.trace("CloseableConfigDataTree.modify modification={}", modification);
59             delegate.modify(modification);
60         }
61
62         @Override
63         public DataTreeSnapshot takeSnapshot() {
64             LOG.trace("CloseableConfigDataTree.takeSnapshot");
65             return delegate.takeSnapshot();
66         }
67     }
68 }