c56560ac75f074f9ba735916c6a709e6f0de62c0
[controller.git] / opendaylight / md-sal / sal-connector-api / src / main / java / org / opendaylight / controller / sal / connector / api / RpcRouter.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.connector.api;
9
10 import java.util.concurrent.Future;
11
12 /**
13  * Interface for an RPC router.
14  *
15  * @author ttkacik
16  *
17  * @param <C> Routing Context Identifier
18  * @param <R> Route Type
19  * @param <T> Rpc Type
20  * @param <D> Data Type
21  */
22 public interface RpcRouter<C,T,R,D> {
23     Future<RpcReply<D>> sendRpc(RpcRequest<C, T, R, D> input);
24
25
26     /**
27      * Interface for an RPC request.
28      *
29      * @param <C> Routing Context Identifier
30      * @param <R> Route Type
31      * @param <T> Rpc Type
32      * @param <D> Data Type
33      */
34     interface RpcRequest<C,T,R,D> {
35
36         RouteIdentifier<C,T,R> getRoutingInformation();
37
38         D getPayload();
39     }
40
41     interface RouteIdentifier<C,T,R> {
42
43         C getContext(); // defines a routing table (e.g. NodeContext)
44
45         T getType(); // rpc type
46
47         R getRoute(); // e.g. (node identity)
48     }
49
50     interface RpcReply<D> {
51         D getPayload();
52     }
53 }