Updated xml generated by get netconf operation to conform to yang schema in config-api
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / BrokerActivator.java
1 package org.opendaylight.controller.sal.dom.broker;
2
3 import java.util.Hashtable;
4
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.controller.sal.core.api.mount.MountProvisionService;
10 import org.opendaylight.controller.sal.core.api.mount.MountService;
11 import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.osgi.framework.ServiceRegistration;
17
18 public class BrokerActivator implements BundleActivator {
19
20     private static final InstanceIdentifier ROOT = InstanceIdentifier.builder().toInstance();
21     BrokerImpl broker;
22     private ServiceRegistration<Broker> brokerReg;
23     private ServiceRegistration<SchemaService> schemaReg;
24     private ServiceRegistration<DataBrokerService> dataReg;
25     private ServiceRegistration<DataProviderService> dataProviderReg;
26     private SchemaServiceImpl schemaService;
27     private DataBrokerImpl dataService;
28     private MountPointManagerImpl mountService;
29     private ServiceRegistration<MountService> mountReg;
30     private ServiceRegistration<MountProvisionService> mountProviderReg;
31     private HashMapDataStore hashMapStore;
32
33     @Override
34     public void start(BundleContext context) throws Exception {
35         Hashtable<String, String> emptyProperties = new Hashtable<String, String>();
36         broker = new BrokerImpl();
37         broker.setBundleContext(context);
38         
39
40         schemaService = new SchemaServiceImpl();
41         schemaService.setContext(context);
42         schemaService.setParser(new YangParserImpl());
43         schemaService.start();
44         schemaReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String, String>());
45         
46         dataService = new DataBrokerImpl();
47         dataService.setExecutor(broker.getExecutor());
48         
49         dataReg = context.registerService(DataBrokerService.class, dataService, emptyProperties);
50         dataProviderReg = context.registerService(DataProviderService.class, dataService, emptyProperties);
51         
52         hashMapStore = new HashMapDataStore();
53         
54         dataService.registerConfigurationReader(ROOT, hashMapStore);
55         dataService.registerCommitHandler(ROOT, hashMapStore);
56         dataService.registerOperationalReader(ROOT, hashMapStore);
57         
58         mountService = new MountPointManagerImpl();
59         mountService.setDataBroker(dataService);
60         
61         mountReg = context.registerService(MountService.class, mountService, emptyProperties);
62         mountProviderReg =  context.registerService(MountProvisionService.class, mountService, emptyProperties);
63         
64         brokerReg = context.registerService(Broker.class, broker, emptyProperties);
65     }
66
67     @Override
68     public void stop(BundleContext context) throws Exception {
69         if (brokerReg != null) {
70             brokerReg.unregister();
71         }
72     }
73 }