Merge "Fix for Bug 2727 - Upgrade Akka from 2.3.4 to 2.3.9"
[controller.git] / opendaylight / md-sal / sal-dom-api / src / main / java / org / opendaylight / controller / sal / core / api / RpcImplementation.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.core.api;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.Set;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.common.RpcResult;
14 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
15
16 /**
17  * {@link Provider}'s implementation of an RPC.
18  *
19  * In order to expose an RPC to other components, the provider MUST register
20  * a concrete implementation of this interface.
21  *
22  * The registration could be done by :
23  * <ul>
24  * <li>returning an instance of implementation in the return value of
25  * {@link Provider#getProviderFunctionality()}
26  * <li>passing an instance of implementation and {@link QName} of rpc as
27  * arguments to the
28  * {@link org.opendaylight.controller.sal.core.api.Broker.ProviderSession#addRpcImplementation(QName, RpcImplementation)}
29  * </ul>
30  *
31  * The simplified process of the invocation of rpc is following:
32  *
33  * <ol>
34  * <li> {@link Consumer} invokes
35  * {@link org.opendaylight.controller.sal.core.api.Broker.ConsumerSession#rpc(QName, CompositeNode)}
36  * <li> {@link Broker} finds registered {@link RpcImplementation}s
37  * <li> {@link Broker} invokes
38  * {@link RpcImplementation#invokeRpc(QName, CompositeNode)}
39  * <li> {@link RpcImplementation} processes the data and returns a
40  * {@link RpcResult}
41  * <li> {@link Broker} returns the {@link RpcResult} to {@link Consumer}
42  * </ol>
43  *
44  * @deprecated Use {@link org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation} instead.
45  */
46 @Deprecated
47 public interface RpcImplementation extends Provider.ProviderFunctionality {
48
49     /**
50      * A set of rpc types supported by implementation.
51      *
52      * The set of rpc {@link QName}s which are supported by this implementation.
53      * This set is used, when {@link Provider} is registered to the SAL, to
54      * register and expose the implementation of the returned rpcs.
55      *
56      * @return Set of QNames identifying supported RPCs
57      */
58     Set<QName> getSupportedRpcs();
59
60     /**
61      * Invokes a implementation of specified RPC asynchronously.
62      *
63      * @param rpc
64      *            RPC to be invoked
65      * @param input
66      *            Input data for the RPC.
67      *
68      * @throws IllegalArgumentException
69      *             <ul>
70      *             <li>If rpc is null.
71      *             <li>If input is not <code>null</code> and
72      *             <code>false == rpc.equals(input.getNodeType)</code>
73      *             </ul>
74      * @return Future promising an RpcResult containing the output of
75      *         the RPC if was executed successfully, the list of errors
76      *         otherwise.
77      */
78     ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input);
79 }