1 package org.opendaylight.controller.sal.dom.broker;
3 import java.util.Hashtable;
5 import org.opendaylight.controller.sal.core.api.Broker;
6 import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
7 import org.opendaylight.controller.sal.core.api.data.DataProviderService;
8 import org.opendaylight.controller.sal.core.api.model.SchemaService;
9 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
10 import org.osgi.framework.BundleActivator;
11 import org.osgi.framework.BundleContext;
12 import org.osgi.framework.ServiceRegistration;
14 public class BrokerActivator implements BundleActivator {
17 private ServiceRegistration<Broker> brokerReg;
18 private ServiceRegistration<SchemaService> schemaReg;
19 private ServiceRegistration<DataBrokerService> dataReg;
20 private ServiceRegistration<DataProviderService> dataProviderReg;
21 private SchemaServiceImpl schemaService;
22 private DataBrokerImpl dataService;
25 public void start(BundleContext context) throws Exception {
26 Hashtable<String, String> emptyProperties = new Hashtable<String, String>();
27 broker = new BrokerImpl();
28 broker.setBundleContext(context);
29 brokerReg = context.registerService(Broker.class, broker, emptyProperties);
31 schemaService = new SchemaServiceImpl();
32 schemaService.setContext(context);
33 schemaService.setParser(new YangParserImpl());
34 schemaService.start();
35 schemaReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String, String>());
37 dataService = new DataBrokerImpl();
38 dataReg = context.registerService(DataBrokerService.class, dataService, emptyProperties);
39 dataProviderReg = context.registerService(DataProviderService.class, dataService, emptyProperties);
45 public void stop(BundleContext context) throws Exception {
46 if (brokerReg != null) {
47 brokerReg.unregister();