diff options
author | 2016-04-11 08:56:06 +0200 | |
---|---|---|
committer | 2016-04-12 11:04:11 +0200 | |
commit | f93415dd8b3719b380b4295ab364420b9bf3d927 (patch) | |
tree | 057de7e397985b74cef738936983c7db6e741cd7 /v3po/impl/src/main/java/org/opendaylight/yang | |
parent | d99066504f76a181c90832b939956f43b409c075 (diff) |
HONEYCOMB-34: Config tree initialization using ModifiableDataTree dependency
Change-Id: I9fa6119a92cc1979ed6f3364bb74e856a7a712c5
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/impl/src/main/java/org/opendaylight/yang')
3 files changed, 118 insertions, 1 deletions
diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java new file mode 100644 index 000000000..76f014456 --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.data.impl.DataBroker; +import java.util.Map; +import javax.annotation.Nonnull; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension; +import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener; +import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; +import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; +import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; +import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataBrokerModule extends + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractDataBrokerModule { + + private static final Logger LOG = LoggerFactory.getLogger(DataBrokerModule.class); + + public DataBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public DataBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.DataBrokerModule oldModule, + java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + LOG.info("DataBrokerModule.createInstance()"); + return new CloseableDataBroker( + new DataBroker(getOperationalDataTreeDependency(), getConfigDataTreeDependency())); + } + + private static final class CloseableDataBroker implements AutoCloseable, DOMDataBroker { + + private final DataBroker delegate; + + CloseableDataBroker(final DataBroker delegate) { + this.delegate = delegate; + } + + @Override + public void close() throws Exception { + LOG.info("CloseableDataBroker.close()"); + // NOP + } + + @Override + public DOMDataReadOnlyTransaction newReadOnlyTransaction() { + LOG.trace("CloseableDataBroker.newReadOnlyTransaction()"); + return delegate.newReadOnlyTransaction(); + } + + @Override + public DOMDataReadWriteTransaction newReadWriteTransaction() { + LOG.trace("CloseableDataBroker.newReadWriteTransaction()"); + return delegate.newReadWriteTransaction(); + } + + @Override + public DOMDataWriteTransaction newWriteOnlyTransaction() { + LOG.trace("CloseableDataBroker.newWriteOnlyTransaction()"); + return delegate.newWriteOnlyTransaction(); + } + + @Override + public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, + final YangInstanceIdentifier path, + final DOMDataChangeListener listener, + final DataChangeScope triggeringScope) { + LOG.trace("CloseableDataBroker.createTransactionChain store={}, path={}, listener={}, triggeringScope={}", + store, path, listener, triggeringScope); + return delegate.registerDataChangeListener(store, path, listener, triggeringScope); + } + + @Override + public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) { + LOG.trace("CloseableDataBroker.createTransactionChain listener={}", listener); + return delegate.createTransactionChain(listener); + } + + @Nonnull + @Override + public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() { + LOG.trace("CloseableDataBroker.getSupportedExtensions()"); + return delegate.getSupportedExtensions(); + } + } +} diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java new file mode 100644 index 000000000..cc30beacf --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: honeycomb-dom-data-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Apr 11 07:53:38 CEST 2016 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; +public class DataBrokerModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractDataBrokerModuleFactory { + +} diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java index bae4a29d3..959780496 100644 --- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java @@ -58,7 +58,7 @@ public class V3poModule extends domBroker.registerProvider(new InitializationProvider()); final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getReaderRegistryDependency(), - getWriterRegistryDependency(), getBindingNormalizedNodeSerializerDependency(), + getWriterRegistryDependency(), getSerializerDependency(), getConfigDataTreeDependency(), getOperationalDataTreeDependency()); getBrokerDependency().registerProvider(provider); return provider; |