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=6b5f5acb1945a872d48b925da58283e314014af4;hp=a6aa0ce32eea75a5aa0498bfe22a9bcf4b0c2169;hb=b98d04e31ad212b8549a3cf849ce864bbba90717;hpb=d6e3e28bf86638685e55289d6cd9cb749838a75e 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 a6aa0ce32e..6b5f5acb19 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 @@ -1,67 +1,85 @@ +/* + * Copyright (c) 2013 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 + */ package org.opendaylight.controller.sal.dom.broker -import org.osgi.framework.ServiceRegistration -import org.opendaylight.controller.sal.core.api.model.SchemaService +import java.util.Hashtable import org.opendaylight.controller.sal.core.api.data.DataBrokerService import org.opendaylight.controller.sal.core.api.data.DataProviderService -import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore +import org.opendaylight.controller.sal.core.api.data.DataStore +import org.opendaylight.controller.sal.core.api.model.SchemaService +import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener import org.opendaylight.controller.sal.core.api.mount.MountProvisionService import org.opendaylight.controller.sal.core.api.mount.MountService -import org.osgi.framework.BundleContext -import java.util.Hashtable -import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl +import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter +import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier -import org.opendaylight.controller.sal.core.api.data.DataStore +import org.osgi.framework.BundleContext +import org.osgi.framework.ServiceRegistration +import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders +import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry class BrokerConfigActivator implements AutoCloseable { - - + private static val ROOT = InstanceIdentifier.builder().toInstance(); - - private var ServiceRegistration schemaReg; + + @Property + private var DataBrokerImpl dataService; + private var ServiceRegistration dataReg; private var ServiceRegistration dataProviderReg; private var ServiceRegistration mountReg; private var ServiceRegistration mountProviderReg; - - private var SchemaServiceImpl schemaService; - private var DataBrokerImpl dataService; + private var SchemaService schemaService; + private var ServiceRegistration rpcProvisionRegistryReg; private var MountPointManagerImpl mountService; - public def void start(BrokerImpl broker,DataStore store,BundleContext context) { + SchemaAwareDataStoreAdapter wrappedStore + + public def void start(BrokerImpl broker, DataStore store, BundleContext context) { val emptyProperties = new Hashtable(); broker.setBundleContext(context); - - - schemaService = new SchemaServiceImpl(); - schemaService.setContext(context); - schemaService.setParser(new YangParserImpl()); - schemaService.start(); - schemaReg = context.registerService(SchemaService, schemaService, emptyProperties); - + + val serviceRef = context.getServiceReference(SchemaService); + schemaService = context.getService(serviceRef); + + broker.setRouter(new SchemaAwareRpcBroker("/", SchemaContextProviders.fromSchemaService(schemaService))); + dataService = new DataBrokerImpl(); - dataService.setExecutor(broker.getExecutor()); - + //dataService.setExecutor(broker.getExecutor()); + dataReg = context.registerService(DataBrokerService, dataService, emptyProperties); dataProviderReg = context.registerService(DataProviderService, dataService, emptyProperties); - dataService.registerConfigurationReader(ROOT, store); - dataService.registerCommitHandler(ROOT, store); - dataService.registerOperationalReader(ROOT, store); - + 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); + mountService = new MountPointManagerImpl(); mountService.setDataBroker(dataService); - + mountReg = context.registerService(MountService, mountService, emptyProperties); - mountProviderReg = context.registerService(MountProvisionService, 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(); } - -} \ No newline at end of file + +}