X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2FBrokerConfigActivator.xtend;h=357a516b57ab29575f4742c6ac2230ddc9aa1ead;hp=b5737a5454e2f12ec230233055e23cccac5675e5;hb=26da3c2a206a753356b507b018052cbb9cccca7d;hpb=3c6f666df68dfa61608dba4566afefb168fc7e7a diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend index b5737a5454..357a516b57 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend @@ -8,76 +8,85 @@ package org.opendaylight.controller.sal.dom.broker import java.util.Hashtable +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker +import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker +import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry import org.opendaylight.controller.sal.core.api.data.DataBrokerService import org.opendaylight.controller.sal.core.api.data.DataProviderService import org.opendaylight.controller.sal.core.api.data.DataStore import org.opendaylight.controller.sal.core.api.model.SchemaService -import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener import org.opendaylight.controller.sal.core.api.mount.MountProvisionService import org.opendaylight.controller.sal.core.api.mount.MountService import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker +import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier +import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener import org.osgi.framework.BundleContext import org.osgi.framework.ServiceRegistration -import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders class BrokerConfigActivator implements AutoCloseable { private static val ROOT = InstanceIdentifier.builder().toInstance(); @Property - private var DataBrokerImpl dataService; + private var DataProviderService dataService; - private var ServiceRegistration schemaReg; private var ServiceRegistration dataReg; private var ServiceRegistration dataProviderReg; private var ServiceRegistration mountReg; private var ServiceRegistration mountProviderReg; private var SchemaService schemaService; + private var ServiceRegistration rpcProvisionRegistryReg; private var MountPointManagerImpl mountService; SchemaAwareDataStoreAdapter wrappedStore - public def void start(BrokerImpl broker, DataStore store, BundleContext context) { + public def void start(BrokerImpl broker, DataStore store, DOMDataBroker asyncBroker,BundleContext context) { val emptyProperties = new Hashtable(); broker.setBundleContext(context); val serviceRef = context.getServiceReference(SchemaService); schemaService = context.getService(serviceRef); - schemaReg = context.registerService(SchemaService, schemaService, emptyProperties); broker.setRouter(new SchemaAwareRpcBroker("/", SchemaContextProviders.fromSchemaService(schemaService))); - - dataService = new DataBrokerImpl(); - dataService.setExecutor(broker.getExecutor()); - - dataReg = context.registerService(DataBrokerService, dataService, emptyProperties); - dataProviderReg = context.registerService(DataProviderService, dataService, emptyProperties); - - wrappedStore = new SchemaAwareDataStoreAdapter(); - wrappedStore.changeDelegate(store); - wrappedStore.setValidationEnabled(false); - - context.registerService(SchemaServiceListener, wrappedStore, emptyProperties) - - dataService.registerConfigurationReader(ROOT, wrappedStore); - dataService.registerCommitHandler(ROOT, wrappedStore); - dataService.registerOperationalReader(ROOT, wrappedStore); + + + if(asyncBroker == null) { + dataService = new DataBrokerImpl(); + dataProviderReg = context.registerService(DataProviderService, dataService, emptyProperties); + + wrappedStore = new SchemaAwareDataStoreAdapter(); + wrappedStore.changeDelegate(store); + wrappedStore.setValidationEnabled(false); + context.registerService(SchemaServiceListener, wrappedStore, emptyProperties) + + dataService.registerConfigurationReader(ROOT, wrappedStore); + dataService.registerCommitHandler(ROOT, wrappedStore); + dataService.registerOperationalReader(ROOT, wrappedStore); + } else { + val compatibleDataBroker = new BackwardsCompatibleDataBroker(asyncBroker); + context.registerService(SchemaServiceListener,compatibleDataBroker,emptyProperties); + dataService = compatibleDataBroker; + } + + +// mountService = new MountPointManagerImpl(); - mountService.setDataBroker(dataService); - - mountReg = context.registerService(MountService, mountService, emptyProperties); + dataReg = context.registerService(DataBrokerService, dataService, emptyProperties); + mountReg = context.registerService(MountService, mountService, emptyProperties); mountProviderReg = context.registerService(MountProvisionService, mountService, emptyProperties); + + rpcProvisionRegistryReg = context.registerService(RpcProvisionRegistry, broker.getRouter(), emptyProperties); } override def close() { - schemaReg?.unregister(); dataReg?.unregister(); dataProviderReg?.unregister(); mountReg?.unregister(); mountProviderReg?.unregister(); + rpcProvisionRegistryReg?.unregister(); } }