Merge "bug 152"
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / impl / RpcRouterCodegenInstance.xtend
index f63f2a313ef58375e95d165f4b5823b504cda3d4..5b11ec72077876dbe6f2f95183977e30273b7d10 100644 (file)
@@ -8,8 +8,9 @@ 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> {
 
@@ -17,20 +18,29 @@ class RpcRouterCodegenInstance<T extends RpcService> implements RpcRouter<T> {
     val T invocationProxy
 
     @Property
-    val Class<T> rpcServiceType
+    val RpcImplementation invokerDelegate;
+
+    @Property
+    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
+        _supportedInputs = inputs;
 
         for (ctx : contexts) {
             val table = XtendHelper.createRoutingTable(ctx)
@@ -47,4 +57,9 @@ class RpcRouterCodegenInstance<T extends RpcService> implements RpcRouter<T> {
         val table = getRoutingTable(context);
         return table.getRoute(path);
     }
+
+    override <T extends DataContainer> invoke(Class<T> type, T input) {
+        return invokerDelegate.invoke(type, input);
+    }
+
 }