X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fmd%2Fsal%2Fbinding%2Fimpl%2FBindingAsyncDataBrokerImplModule.java;fp=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fmd%2Fsal%2Fbinding%2Fimpl%2FBindingAsyncDataBrokerImplModule.java;h=17cd67a8576018485d3f1162dab89d51be0fcf15;hb=3e5b44dbf2576fb9b2af1a36f927555eb7ed5990;hp=0000000000000000000000000000000000000000;hpb=331b8a41d5e326ec0769ef8ae731c67061fda8bd;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModule.java new file mode 100644 index 0000000000..17cd67a857 --- /dev/null +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModule.java @@ -0,0 +1,75 @@ +package org.opendaylight.controller.config.yang.md.sal.binding.impl; + +import java.util.Collection; +import java.util.Collections; + +import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.sal.core.api.Broker; +import org.opendaylight.controller.sal.core.api.Broker.ProviderSession; +import org.opendaylight.controller.sal.core.api.Provider; +import org.opendaylight.controller.sal.core.api.model.SchemaService; +import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService; +import org.osgi.framework.BundleContext; + +public class BindingAsyncDataBrokerImplModule extends + org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModule implements + Provider { + private BundleContext bundleContext; + + public BindingAsyncDataBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public BindingAsyncDataBrokerImplModule( + final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + final org.opendaylight.controller.config.yang.md.sal.binding.impl.BindingAsyncDataBrokerImplModule oldModule, + final 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() { + Broker domBroker = getDomAsyncBrokerDependency(); + BindingIndependentMappingService mappingService = getBindingMappingServiceDependency(); + + // FIXME: Switch this to DOM Broker registration which would not require + // BundleContext when API are updated. + ProviderSession session = domBroker.registerProvider(this, getBundleContext()); + DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class); + SchemaService schemaService = session.getService(SchemaService.class); + return new ForwardedBindingDataBroker(domDataBroker, mappingService, schemaService); + } + + // FIXME: Remove this when DOM Broker registration would not require + // BundleContext + @Deprecated + private BundleContext getBundleContext() { + return bundleContext; + } + + // FIXME: Remove this when DOM Broker registration would not require + // BundleContext + @Deprecated + void setBundleContext(final BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + @Override + public Collection getProviderFunctionality() { + return Collections.emptySet(); + } + + @Override + public void onSessionInitiated(final ProviderSession arg0) { + // intentional NOOP + } + +}