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;
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;
16 import com.google.common.util.concurrent.ListenableFuture;
19 * {@link Provider}'s implementation of an RPC.
21 * In order to expose an RPC to other components, the provider MUST register
22 * a concrete implementation of this interface.
24 * The registration could be done by :
26 * <li>returning an instance of implementation in the return value of
27 * {@link Provider#getProviderFunctionality()}
28 * <li>passing an instance of implementation and {@link QName} of rpc as
30 * {@link org.opendaylight.controller.sal.core.api.Broker.ProviderSession#addRpcImplementation(QName, RpcImplementation)}
33 * The simplified process of the invocation of rpc is following:
36 * <li> {@link Consumer} invokes
37 * {@link org.opendaylight.controller.sal.core.api.Broker.ConsumerSession#rpc(QName, CompositeNode)}
38 * <li> {@link Broker} finds registered {@link RpcImplementation}s
39 * <li> {@link Broker} invokes
40 * {@link RpcImplementation#invokeRpc(QName, CompositeNode)}
41 * <li> {@link RpcImplementation} processes the data and returns a
43 * <li> {@link Broker} returns the {@link RpcResult} to {@link Consumer}
46 public interface RpcImplementation extends Provider.ProviderFunctionality {
49 * A set of rpc types supported by implementation.
51 * The set of rpc {@link QName}s which are supported by this implementation.
52 * This set is used, when {@link Provider} is registered to the SAL, to
53 * register and expose the implementation of the returned rpcs.
55 * @return Set of QNames identifying supported RPCs
57 Set<QName> getSupportedRpcs();
60 * Invokes a implementation of specified RPC asynchronously.
65 * Input data for the RPC.
67 * @throws IllegalArgumentException
70 * <li>If input is not <code>null</code> and
71 * <code>false == rpc.equals(input.getNodeType)</code>
73 * @return Future promising an RpcResult containing the output of
74 * the RPC if was executed successfully, the list of errors
77 ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input);