Unified Two Phase Commit implementation, fixed BA to BI connection
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / BrokerActivator.java
index e49cb4bb0a7580c6905eade22b13b7ae88e3f7a5..3af645a2b8a48753b79659f58877c1044ff83394 100644 (file)
@@ -8,6 +8,8 @@ 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.controller.sal.dom.broker.impl.HashMapDataStore;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -15,6 +17,7 @@ import org.osgi.framework.ServiceRegistration;
 
 public class BrokerActivator implements BundleActivator {
 
+    private static final InstanceIdentifier ROOT = InstanceIdentifier.builder().toInstance();
     BrokerImpl broker;
     private ServiceRegistration<Broker> brokerReg;
     private ServiceRegistration<SchemaService> schemaReg;
@@ -25,13 +28,14 @@ public class BrokerActivator implements BundleActivator {
     private MountPointManagerImpl mountService;
     private ServiceRegistration<MountService> mountReg;
     private ServiceRegistration<MountProvisionService> mountProviderReg;
+    private HashMapDataStore hashMapStore;
 
     @Override
     public void start(BundleContext context) throws Exception {
         Hashtable<String, String> emptyProperties = new Hashtable<String, String>();
         broker = new BrokerImpl();
         broker.setBundleContext(context);
-        brokerReg = context.registerService(Broker.class, broker, emptyProperties);
+        
 
         schemaService = new SchemaServiceImpl();
         schemaService.setContext(context);
@@ -40,14 +44,24 @@ public class BrokerActivator implements BundleActivator {
         schemaReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String, String>());
         
         dataService = new DataBrokerImpl();
+        dataService.setExecutor(broker.getExecutor());
+        
         dataReg = context.registerService(DataBrokerService.class, dataService, emptyProperties);
         dataProviderReg = context.registerService(DataProviderService.class, dataService, emptyProperties);
         
+        hashMapStore = new HashMapDataStore();
+        
+        dataService.registerConfigurationReader(ROOT, hashMapStore);
+        dataService.registerCommitHandler(ROOT, hashMapStore);
+        dataService.registerOperationalReader(ROOT, hashMapStore);
+        
         mountService = new MountPointManagerImpl();
         mountService.setDataBroker(dataService);
         
         mountReg = context.registerService(MountService.class, mountService, emptyProperties);
         mountProviderReg =  context.registerService(MountProvisionService.class, mountService, emptyProperties);
+        
+        brokerReg = context.registerService(Broker.class, broker, emptyProperties);
     }
 
     @Override