Merge "Enhance debug capabilities"
[controller.git] / opendaylight / md-sal / sal-binding-spi / src / main / java / org / opendaylight / controller / sal / binding / spi / RpcMapper.java
1 /*
2  * Copyright (c) 2013 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.binding.spi;
9
10 import java.util.Set;
11 import java.util.concurrent.Future;
12
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.RpcService;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18
19 public interface RpcMapper<T extends RpcService> {
20     
21     Set<QName> getRpcQNames();
22     
23     /**
24      * Returns a class object representing subinterface
25      * to whom, this mapper is assigned.
26      * 
27      * @return
28      */
29     Class<T> getServiceClass();
30     
31     /**
32      * Returns a Binding Mapper for Rpc Input Data
33      * @return
34      */
35     Mapper<?> getInputMapper();
36     /**
37      * Returns a Binding Mapper for Rpc Output Data
38      * 
39      * @return
40      */
41     Mapper<?> getOutputMapper();
42     
43     /**
44      * Returns a consumer proxy, which is responsible
45      * for invoking the rpc functionality of {@link BindingAwareBroker} implementation.
46      * 
47      * @return Proxy of {@link RpcService} assigned to this mapper.
48      */
49     T getConsumerProxy(RpcProxyInvocationHandler handler);
50     
51     /**
52      * Invokes the method of RpcService representing the supplied rpc.
53      * 
54      * @param rpc QName of Rpc
55      * @param impl Implementation of RpcService on which the method should be invoked
56      * @param baInput Input Data to RPC method
57      * @return Result of RPC invocation.
58      */
59     RpcResult<? extends DataObject> invokeRpcImplementation(QName rpc,
60             RpcService impl, DataObject baInput);
61     
62     public interface RpcProxyInvocationHandler {
63         
64         Future<RpcResult<? extends DataObject>> invokeRpc(RpcService proxy, QName rpc, DataObject input);
65     }
66 }