Implementation for enabling remote rpc calls between 2 instances of md-sal
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / BrokerConfigActivator.xtend
index a6aa0ce32eea75a5aa0498bfe22a9bcf4b0c2169..dc116ca9795537e9d97a7e8de7fac804cda8b041 100644 (file)
@@ -12,27 +12,33 @@ import java.util.Hashtable
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
 import org.opendaylight.controller.sal.core.api.data.DataStore
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter
+import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
+import org.opendaylight.controller.sal.dom.broker.impl.RpcRouterImpl
 
 class BrokerConfigActivator implements AutoCloseable {
     
     
     private static val ROOT = InstanceIdentifier.builder().toInstance();
+
+    @Property
+    private var DataBrokerImpl dataService;
     
     private var ServiceRegistration<SchemaService> schemaReg;
     private var ServiceRegistration<DataBrokerService> dataReg;
     private var ServiceRegistration<DataProviderService> dataProviderReg;
     private var ServiceRegistration<MountService> mountReg;
     private var ServiceRegistration<MountProvisionService> mountProviderReg;
-    
     private var SchemaServiceImpl schemaService;
-    private var DataBrokerImpl dataService;
     private var MountPointManagerImpl mountService;
+    
+    SchemaAwareDataStoreAdapter wrappedStore
 
     public def void start(BrokerImpl broker,DataStore store,BundleContext context) {
         val emptyProperties = new Hashtable<String, String>();
         broker.setBundleContext(context);
         
-
+        broker.setRouter(new RpcRouterImpl("Rpc router"))
         schemaService = new SchemaServiceImpl();
         schemaService.setContext(context);
         schemaService.setParser(new YangParserImpl());
@@ -45,9 +51,15 @@ class BrokerConfigActivator implements AutoCloseable {
         dataReg = context.registerService(DataBrokerService, dataService, emptyProperties);
         dataProviderReg = context.registerService(DataProviderService, dataService, emptyProperties);
 
-        dataService.registerConfigurationReader(ROOT, store);
-        dataService.registerCommitHandler(ROOT, store);
-        dataService.registerOperationalReader(ROOT, store);
+        wrappedStore = new SchemaAwareDataStoreAdapter();
+        wrappedStore.changeDelegate(store);
+        wrappedStore.setValidationEnabled(false);
+       
+        context.registerService(SchemaServiceListener,wrappedStore,emptyProperties)  
+        
+        dataService.registerConfigurationReader(ROOT, wrappedStore);
+        dataService.registerCommitHandler(ROOT, wrappedStore);
+        dataService.registerOperationalReader(ROOT, wrappedStore);
         
         mountService = new MountPointManagerImpl();
         mountService.setDataBroker(dataService);