From 5c2c22d99e522ccdc164287757fd2defa62a9f9c Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Mon, 30 Jun 2014 20:03:32 +0200 Subject: [PATCH] Bug 488: Removed BundleContext usage for registering to DOM Components. Change-Id: I8598d0bd8cd3396ea666c9e3d39ead6b155d1af4 Signed-off-by: Tony Tkacik --- .../configuration/initial/01-md-sal.xml | 4 + .../BindingAsyncDataBrokerImplModule.java | 18 +- ...ndingAsyncDataBrokerImplModuleFactory.java | 22 --- .../binding/impl/BindingBrokerImplModule.java | 181 ++++++++---------- .../impl/BindingBrokerImplModuleFactory.java | 20 -- .../binding/impl/DataBrokerImplModule.java | 147 ++++++-------- .../impl/DataBrokerImplModuleFactory.java | 21 -- ...rwardedCompatibleDataBrokerImplModule.java | 13 +- ...CompatibleDataBrokerImplModuleFactory.java | 20 -- .../opendaylight-binding-broker-impl.yang | 11 +- 10 files changed, 166 insertions(+), 291 deletions(-) diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml b/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml index 7b1df98247..afeddbfaab 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml @@ -35,6 +35,10 @@ binding:binding-data-broker binding-data-broker + + binding:binding-async-data-broker + binding-data-broker + 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 index 17cd67a857..018e26878c 100644 --- 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 @@ -10,12 +10,10 @@ 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) { @@ -42,25 +40,15 @@ public class BindingAsyncDataBrokerImplModule extends // FIXME: Switch this to DOM Broker registration which would not require // BundleContext when API are updated. - ProviderSession session = domBroker.registerProvider(this, getBundleContext()); + ProviderSession session = domBroker.registerProvider(this, null); 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() { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModuleFactory.java index 763e6ad3ca..a7c8843fcf 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModuleFactory.java @@ -9,29 +9,7 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; -import org.opendaylight.controller.config.api.DependencyResolver; -import org.osgi.framework.BundleContext; public class BindingAsyncDataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModuleFactory { - - - - @Override - public BindingAsyncDataBrokerImplModule instantiateModule(final String instanceName, - final DependencyResolver dependencyResolver, final BindingAsyncDataBrokerImplModule oldModule, - final AutoCloseable oldInstance, final BundleContext bundleContext) { - BindingAsyncDataBrokerImplModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext); - module.setBundleContext(bundleContext); - return module; - } - - @Override - public BindingAsyncDataBrokerImplModule instantiateModule(final String instanceName, - final DependencyResolver dependencyResolver, final BundleContext bundleContext) { - // TODO Auto-generated method stub - BindingAsyncDataBrokerImplModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext); - module.setBundleContext(bundleContext); - return module; - } } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java index 188272fb60..61e7a2e6a2 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java @@ -1,96 +1,85 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-broker-impl - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ -package org.opendaylight.controller.config.yang.md.sal.binding.impl; - -import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; -import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker; -import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl; -import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl; -import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils; -import org.osgi.framework.BundleContext; - -/** -* -*/ -public final class BindingBrokerImplModule extends - org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule { - - private BundleContext bundleContext; - - public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, - final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, - final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, - final BindingBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void validate() { - super.validate(); - } - - @Override - public java.lang.AutoCloseable createInstance() { - - RootBindingAwareBroker broker; - if (DomForwardingUtils.isDomForwardedBroker(getDataBrokerDependency())) { - broker = createForwardedBroker(); - } else { - broker = createStandaloneBroker(); - } - broker.start(); - return broker; - } - - private RootBindingAwareBroker createStandaloneBroker() { - RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName()); - - broker.setLegacyDataBroker(getDataBrokerDependency()); - broker.setNotificationBroker(getNotificationServiceDependency()); - broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); - // FIXME: Also set Async Data Broker - return broker; - } - - private RootBindingAwareBroker createForwardedBroker() { - DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName()); - - broker.setLegacyDataBroker(getDataBrokerDependency()); - broker.setNotificationBroker(getNotificationServiceDependency()); - broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); - - broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor()); - broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor()); - - // FIXME: Also set Async Data Broker - DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker()); - broker.startForwarding(); - return broker; - } - - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(final BundleContext bundleContext) { - this.bundleContext = bundleContext; - } -} +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +/** + * Generated file + + * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-broker-impl + * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + * Generated at: Wed Nov 20 17:33:01 CET 2013 + * + * Do not modify this file unless it is present under src/main directory + */ +package org.opendaylight.controller.config.yang.md.sal.binding.impl; + +import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; +import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker; +import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl; +import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl; +import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils; + +/** +* +*/ +public final class BindingBrokerImplModule extends + org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule { + + public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + final BindingBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void validate() { + super.validate(); + } + + @Override + public java.lang.AutoCloseable createInstance() { + + RootBindingAwareBroker broker; + if (DomForwardingUtils.isDomForwardedBroker(getDataBrokerDependency())) { + broker = createForwardedBroker(); + } else { + broker = createStandaloneBroker(); + } + broker.start(); + return broker; + } + + private RootBindingAwareBroker createStandaloneBroker() { + RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName()); + + broker.setLegacyDataBroker(getDataBrokerDependency()); + broker.setNotificationBroker(getNotificationServiceDependency()); + broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); + broker.setDataBroker(getRootDataBrokerDependency()); + return broker; + } + + private RootBindingAwareBroker createForwardedBroker() { + DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName()); + + broker.setLegacyDataBroker(getDataBrokerDependency()); + broker.setNotificationBroker(getNotificationServiceDependency()); + broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); + + broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor()); + broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor()); + + broker.setDataBroker(getRootDataBrokerDependency()); + DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker()); + broker.startForwarding(); + return broker; + } +} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java index a11a7d67f5..181b568cf5 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java @@ -16,30 +16,10 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; -import org.opendaylight.controller.config.api.DependencyResolver; -import org.opendaylight.controller.config.api.DynamicMBeanWithInstance; -import org.opendaylight.controller.config.spi.Module; -import org.osgi.framework.BundleContext; /** * */ public class BindingBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModuleFactory { - - @Override - public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) { - BindingBrokerImplModule module = (BindingBrokerImplModule) super.createModule(instanceName, dependencyResolver, bundleContext); - module.setBundleContext(bundleContext); - return module; - } - - @Override - public Module createModule(String instanceName, DependencyResolver dependencyResolver, - DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception { - BindingBrokerImplModule module = (BindingBrokerImplModule) super.createModule(instanceName, dependencyResolver, old, bundleContext); - module.setBundleContext(bundleContext); - return module; - } - } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java index 7357926b9e..4a4e800078 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java @@ -5,8 +5,8 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.md.sal.binding.impl; - +package org.opendaylight.controller.config.yang.md.sal.binding.impl; + import java.util.concurrent.ExecutorService; import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; @@ -16,85 +16,64 @@ import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndepende import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedDataBrokerImpl; import org.opendaylight.controller.sal.core.api.Broker.ProviderSession; import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -/** -* -*/ -public final class DataBrokerImplModule extends - org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractDataBrokerImplModule { - - private BundleContext bundleContext; - - public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, - org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, - DataBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void validate() { - super.validate(); - } - - @Override - public java.lang.AutoCloseable createInstance() { - RootDataBrokerImpl dataBindingBroker; - - - ExecutorService listeningExecutor = SingletonHolder.getDefaultCommitExecutor(); - BindingIndependentMappingService potentialMapping = resolveMappingServiceDependency(); - if (getDomBrokerDependency() != null && potentialMapping != null) { - - dataBindingBroker = createDomConnectedBroker(listeningExecutor,potentialMapping); - } else { - dataBindingBroker = createStandAloneBroker(listeningExecutor); - } - dataBindingBroker.registerRuntimeBean(getRootRuntimeBeanRegistratorWrapper()); - dataBindingBroker.setNotificationExecutor(SingletonHolder.getDefaultChangeEventExecutor()); - return dataBindingBroker; - } - private BindingIndependentMappingService resolveMappingServiceDependency() { - if(getMappingService() != null) { - return getMappingServiceDependency(); - } - - ServiceReference potentialMappingService = bundleContext.getServiceReference(BindingIndependentMappingService.class); - if(potentialMappingService != null) { - return bundleContext.getService(potentialMappingService); - } - return null; - } - - private RootDataBrokerImpl createStandAloneBroker(ExecutorService listeningExecutor) { - RootDataBrokerImpl broker = new RootDataBrokerImpl(); - broker.setExecutor(listeningExecutor); - return broker; - } - - private RootDataBrokerImpl createDomConnectedBroker(ExecutorService listeningExecutor, BindingIndependentMappingService mappingService) { - DomForwardedDataBrokerImpl forwardedBroker = new DomForwardedDataBrokerImpl(); - forwardedBroker.setExecutor(listeningExecutor); - BindingIndependentConnector connector = BindingDomConnectorDeployer.createConnector(mappingService); - getDomBrokerDependency().registerProvider(forwardedBroker, getBundleContext()); - ProviderSession domContext = forwardedBroker.getDomProviderContext(); - forwardedBroker.setConnector(connector); - forwardedBroker.setDomProviderContext(domContext); - forwardedBroker.startForwarding(); - return forwardedBroker; - } - - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(BundleContext bundleContext2) { - this.bundleContext = bundleContext2; - } -} + +/** +* +*/ +public final class DataBrokerImplModule extends + org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractDataBrokerImplModule { + + public DataBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public DataBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, + final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + final DataBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void validate() { + super.validate(); + } + + @Override + public java.lang.AutoCloseable createInstance() { + RootDataBrokerImpl dataBindingBroker; + + + ExecutorService listeningExecutor = SingletonHolder.getDefaultCommitExecutor(); + BindingIndependentMappingService potentialMapping = getMappingServiceDependency(); + if (getDomBrokerDependency() != null && potentialMapping != null) { + + dataBindingBroker = createDomConnectedBroker(listeningExecutor,potentialMapping); + } else { + dataBindingBroker = createStandAloneBroker(listeningExecutor); + } + dataBindingBroker.registerRuntimeBean(getRootRuntimeBeanRegistratorWrapper()); + dataBindingBroker.setNotificationExecutor(SingletonHolder.getDefaultChangeEventExecutor()); + return dataBindingBroker; + } + + + private RootDataBrokerImpl createStandAloneBroker(final ExecutorService listeningExecutor) { + RootDataBrokerImpl broker = new RootDataBrokerImpl(); + broker.setExecutor(listeningExecutor); + return broker; + } + + private RootDataBrokerImpl createDomConnectedBroker(final ExecutorService listeningExecutor, final BindingIndependentMappingService mappingService) { + DomForwardedDataBrokerImpl forwardedBroker = new DomForwardedDataBrokerImpl(); + forwardedBroker.setExecutor(listeningExecutor); + BindingIndependentConnector connector = BindingDomConnectorDeployer.createConnector(mappingService); + getDomBrokerDependency().registerProvider(forwardedBroker, null); + ProviderSession domContext = forwardedBroker.getDomProviderContext(); + forwardedBroker.setConnector(connector); + forwardedBroker.setDomProviderContext(domContext); + forwardedBroker.startForwarding(); + return forwardedBroker; + } + +} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java index 9ce3ebf73f..d3fc5ac215 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java @@ -7,10 +7,6 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; -import org.opendaylight.controller.config.api.DependencyResolver; -import org.opendaylight.controller.config.api.DynamicMBeanWithInstance; -import org.opendaylight.controller.config.spi.Module; -import org.osgi.framework.BundleContext; /** * @@ -18,21 +14,4 @@ import org.osgi.framework.BundleContext; public class DataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractDataBrokerImplModuleFactory { - @Override - public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) { - DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver, - bundleContext); - module.setBundleContext(bundleContext); - return module; - } - - @Override - public Module createModule(String instanceName, DependencyResolver dependencyResolver, - DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception { - DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver, old, - bundleContext); - module.setBundleContext(bundleContext); - return module; - } - } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java index 7467e544fd..0ea30f7e66 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java @@ -19,7 +19,6 @@ 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; import com.google.common.util.concurrent.ListeningExecutorService; @@ -30,8 +29,6 @@ public final class ForwardedCompatibleDataBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModule implements Provider { - private BundleContext bundleContext; - public ForwardedCompatibleDataBrokerImplModule( final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { @@ -57,7 +54,7 @@ public final class ForwardedCompatibleDataBrokerImplModule extends BindingIndependentMappingService mappingService = getBindingMappingServiceDependency(); Broker domBroker = getDomAsyncBrokerDependency(); - ProviderSession session = domBroker.registerProvider(this, getBundleContext()); + ProviderSession session = domBroker.registerProvider(this, null); DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class); SchemaService schemaService = session.getService(SchemaService.class); ForwardedBackwardsCompatibleDataBroker dataBroker = new ForwardedBackwardsCompatibleDataBroker(domDataBroker, @@ -68,14 +65,6 @@ public final class ForwardedCompatibleDataBrokerImplModule extends return dataBroker; } - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(final BundleContext bundleContext2) { - this.bundleContext = bundleContext2; - } - @Override public void onSessionInitiated(final ProviderSession session) { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java index f01977503e..5b5fb45fd9 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java @@ -7,10 +7,6 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; -import org.opendaylight.controller.config.api.DependencyResolver; -import org.opendaylight.controller.config.api.DynamicMBeanWithInstance; -import org.opendaylight.controller.config.spi.Module; -import org.osgi.framework.BundleContext; /** @@ -19,20 +15,4 @@ import org.osgi.framework.BundleContext; public class ForwardedCompatibleDataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModuleFactory { - - @Override - public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, final BundleContext bundleContext) { - ForwardedCompatibleDataBrokerImplModule module = (ForwardedCompatibleDataBrokerImplModule) super.createModule(instanceName, dependencyResolver, bundleContext); - module.setBundleContext(bundleContext); - return module; - } - - @Override - public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, - final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception { - ForwardedCompatibleDataBrokerImplModule module = (ForwardedCompatibleDataBrokerImplModule) super.createModule(instanceName, dependencyResolver, old, bundleContext); - module.setBundleContext(bundleContext); - return module; - } - } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang b/opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang index 4456dea77f..cee4b1efb3 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang +++ b/opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang @@ -105,7 +105,7 @@ module opendaylight-sal-binding-broker-impl { container data-broker { uses config:service-ref { refine type { - mandatory true; + mandatory false; config:required-identity sal:binding-data-broker; } } @@ -119,6 +119,15 @@ module opendaylight-sal-binding-broker-impl { } } } + + container root-data-broker { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity sal:binding-async-data-broker; + } + } + } } } -- 2.36.6