X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2FBrokerConfigActivator.xtend;h=b5737a5454e2f12ec230233055e23cccac5675e5;hb=9390dd5bea2420cdbb1e4f6c2029091811c4df5a;hp=482cfa959f2b8e11ce125a53da97d52b5990a808;hpb=ac65af650d550ae56dd02b660e1c5eef24b78740;p=controller.git 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 482cfa959f..b5737a5454 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,70 +1,75 @@ +/* + * 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.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.osgi.framework.BundleContext -import java.util.Hashtable -import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier -import org.opendaylight.controller.sal.core.api.data.DataStore import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter -import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener +import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier +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 ServiceRegistration schemaReg; private var ServiceRegistration dataReg; private var ServiceRegistration dataProviderReg; private var ServiceRegistration mountReg; private var ServiceRegistration mountProviderReg; - private var SchemaServiceImpl schemaService; + private var SchemaService schemaService; private var MountPointManagerImpl mountService; - + SchemaAwareDataStoreAdapter wrappedStore - public def void start(BrokerImpl broker,DataStore store,BundleContext context) { + 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(); + 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) - + + 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); } override def close() { @@ -74,5 +79,5 @@ class BrokerConfigActivator implements AutoCloseable { mountReg?.unregister(); mountProviderReg?.unregister(); } - -} \ No newline at end of file + +}