2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.sal.core.api;
10 import com.google.common.util.concurrent.ListenableFuture;
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;
17 * {@link Provider}'s implementation of an RPC.
19 * In order to expose an RPC to other components, the provider MUST register
20 * a concrete implementation of this interface.
22 * The registration could be done by :
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
28 * {@link org.opendaylight.controller.sal.core.api.Broker.ProviderSession#addRpcImplementation(QName, RpcImplementation)}
31 * The simplified process of the invocation of rpc is following:
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
41 * <li> {@link Broker} returns the {@link RpcResult} to {@link Consumer}
44 * @deprecated Use {@link org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation} instead.
47 public interface RpcImplementation extends Provider.ProviderFunctionality {
50 * A set of rpc types supported by implementation.
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.
56 * @return Set of QNames identifying supported RPCs
58 Set<QName> getSupportedRpcs();
61 * Invokes a implementation of specified RPC asynchronously.
66 * Input data for the RPC.
68 * @throws IllegalArgumentException
71 * <li>If input is not <code>null</code> and
72 * <code>false == rpc.equals(input.getNodeType)</code>
74 * @return Future promising an RpcResult containing the output of
75 * the RPC if was executed successfully, the list of errors
78 ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input);