package org.opendaylight.controller.sal.dom.broker; import java.util.Hashtable; import org.opendaylight.controller.sal.core.api.Broker; 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.model.SchemaService; import org.opendaylight.controller.sal.core.api.mount.MountProvisionService; import org.opendaylight.controller.sal.core.api.mount.MountService; import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; public class BrokerActivator implements BundleActivator { BrokerImpl broker; private ServiceRegistration brokerReg; private ServiceRegistration schemaReg; private ServiceRegistration dataReg; private ServiceRegistration dataProviderReg; private SchemaServiceImpl schemaService; private DataBrokerImpl dataService; private MountPointManagerImpl mountService; private ServiceRegistration mountReg; private ServiceRegistration mountProviderReg; @Override public void start(BundleContext context) throws Exception { Hashtable emptyProperties = new Hashtable(); broker = new BrokerImpl(); broker.setBundleContext(context); brokerReg = context.registerService(Broker.class, broker, emptyProperties); schemaService = new SchemaServiceImpl(); schemaService.setContext(context); schemaService.setParser(new YangParserImpl()); schemaService.start(); schemaReg = context.registerService(SchemaService.class, schemaService, new Hashtable()); dataService = new DataBrokerImpl(); dataReg = context.registerService(DataBrokerService.class, dataService, emptyProperties); dataProviderReg = context.registerService(DataProviderService.class, dataService, emptyProperties); mountService = new MountPointManagerImpl(); mountService.setDataBroker(dataService); mountReg = context.registerService(MountService.class, mountService, emptyProperties); mountProviderReg = context.registerService(MountProvisionService.class, mountService, emptyProperties); } @Override public void stop(BundleContext context) throws Exception { if (brokerReg != null) { brokerReg.unregister(); } } }