1 package org.opendaylight.controller.sal.binding.codegen.impl
3 import org.opendaylight.yangtools.yang.binding.RpcService
4 import org.opendaylight.controller.sal.binding.spi.RpcRouter
5 import org.opendaylight.yangtools.yang.binding.BaseIdentity
6 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
7 import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*
9 import java.util.HashMap
10 import org.opendaylight.controller.sal.binding.spi.RpcRoutingTable
11 import org.opendaylight.yangtools.yang.binding.DataObject
12 import static org.opendaylight.controller.sal.binding.codegen.impl.XtendHelper.*
14 class RpcRouterCodegenInstance<T extends RpcService> implements RpcRouter<T> {
20 val Class<T> rpcServiceType
23 val Set<Class<? extends BaseIdentity>> contexts
25 val routingTables = new HashMap<Class<? extends BaseIdentity>,RpcRoutingTableImpl<? extends BaseIdentity,?>>;
32 new(Class<T> type,T routerImpl,Set<Class<? extends BaseIdentity>> contexts) {
33 _rpcServiceType = type
34 _invocationProxy = routerImpl
38 val table = XtendHelper.createRoutingTable(ctx)
39 invocationProxy.setRoutingTable(ctx,table.routes);
40 routingTables.put(ctx,table);
44 override <C extends BaseIdentity> getRoutingTable(Class<C> table) {
45 routingTables.get(table) as RpcRoutingTable<C,T>
48 override getService(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path) {
49 val table = getRoutingTable(context);
50 return table.getRoute(path);