Merge "AbstractConfigTest - exposed BundleContext and ServiceRegistration mock."
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / impl / RpcRouterCodegenInstance.xtend
index b255504a00e46e57eda13ae18d7aa403b2f5da47..b6dcde19ee18a4ae3e05571b6c56e448d50c1794 100644 (file)
@@ -8,45 +8,57 @@ import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeC
 import java.util.Set
 import java.util.HashMap
 import org.opendaylight.controller.sal.binding.spi.RpcRoutingTable
-import org.opendaylight.yangtools.yang.binding.DataObject
-import static org.opendaylight.controller.sal.binding.codegen.impl.XtendHelper.*
+import org.opendaylight.yangtools.yang.binding.DataContainer
+import org.opendaylight.yangtools.yang.binding.RpcImplementation
 
 class RpcRouterCodegenInstance<T extends RpcService> implements RpcRouter<T> {
-    
+
     @Property
     val T invocationProxy
-    
+
+    @Property
+    val RpcImplementation invokerDelegate;
+
     @Property
-    val Class<T> rpcServiceType
-    
+    val Class<T> serviceType
+
     @Property
     val Set<Class<? extends BaseIdentity>> contexts
-    
-    val routingTables = new HashMap<Class<? extends BaseIdentity>,RpcRoutingTableImpl<? extends BaseIdentity,?>>;
-    
-    
-    
+
+    @Property
+    val Set<Class<? extends DataContainer>> supportedInputs;
+
+    val routingTables = new HashMap<Class<? extends BaseIdentity>, RpcRoutingTableImpl<? extends BaseIdentity, ? extends RpcService>>;
+
     @Property
     var T defaultService
-    
-    new(Class<T> type,T routerImpl,Set<Class<? extends BaseIdentity>> contexts) {
-        _rpcServiceType = type
+
+    new(Class<T> type, T routerImpl, Set<Class<? extends BaseIdentity>> contexts,
+        Set<Class<? extends DataContainer>> inputs) {
+        _serviceType = type
         _invocationProxy = routerImpl
+        _invokerDelegate = routerImpl as RpcImplementation
         _contexts = contexts
-        
-        for(ctx : contexts) {
+        _supportedInputs = inputs;
+
+        for (ctx : contexts) {
             val table = XtendHelper.createRoutingTable(ctx)
-            invocationProxy.setRoutingTable(ctx,table.routes);
-            routingTables.put(ctx,table);
+            invocationProxy.setRoutingTable(ctx, table.routes);
+            routingTables.put(ctx, table);
         }
     }
-    
+
     override <C extends BaseIdentity> getRoutingTable(Class<C> table) {
         routingTables.get(table) as RpcRoutingTable<C,T>
     }
-    
+
     override getService(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path) {
         val table = getRoutingTable(context);
         return table.getRoute(path);
     }
-}
\ No newline at end of file
+
+    override <T extends DataContainer> invoke(Class<T> type, T input) {
+        return invokerDelegate.invoke(type, input);
+    }
+
+}