Merge "Minor fixes in md-sal and config."
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / osgi / SchemaServiceActivator.java
1 package org.opendaylight.controller.sal.dom.broker.osgi;
2
3 import java.util.Hashtable;
4
5 import org.opendaylight.controller.sal.core.api.model.SchemaService;
6 import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
7 import org.osgi.framework.BundleActivator;
8 import org.osgi.framework.BundleContext;
9 import org.osgi.framework.ServiceRegistration;
10
11 public class SchemaServiceActivator implements BundleActivator {
12
13     
14     private ServiceRegistration<SchemaService> schemaServiceReg;
15     private GlobalBundleScanningSchemaServiceImpl schemaService;
16
17     @Override
18     public void start(BundleContext context) throws Exception {
19         schemaService = new GlobalBundleScanningSchemaServiceImpl();
20         schemaService.setContext(context);
21         schemaService.start();
22         schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
23     }
24     
25     @Override
26     public void stop(BundleContext context) throws Exception {
27         schemaServiceReg.unregister();
28         schemaService.close();
29     }
30 }