2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.sal.core.api;
\r
10 import java.util.Set;
\r
12 import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
\r
13 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
\r
14 import org.opendaylight.controller.yang.common.QName;
\r
15 import org.opendaylight.controller.yang.common.RpcResult;
\r
16 import org.opendaylight.controller.yang.data.api.CompositeNode;
\r
19 * {@link Provider}'s implementation of rpc.
\r
21 * In order to expose the rpc to other components, the provider MUST register
\r
22 * concrete implementation of this interface
\r
24 * The registration could be done by :
\r
26 * <li>returning an instance of implementation in the return value of
\r
27 * {@link Provider#getProviderFunctionality()}
\r
28 * <li>passing an instance of implementation and {@link QName} of rpc as
\r
30 * {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)}
\r
33 * The simplified process of the invocation of rpc is following:
\r
36 * <li> {@link Consumer} invokes
\r
37 * {@link ConsumerSession#rpc(QName, CompositeNode)}
\r
38 * <li> {@link Broker} finds registered {@link RpcImplementation}s
\r
39 * <li> {@link Broker} invokes
\r
40 * {@link RpcImplementation#invokeRpc(QName, CompositeNode)}
\r
41 * <li> {@link RpcImplementation} processes the data and returns a
\r
43 * <li> {@link Broker} returns the {@link RpcResult} to {@link Consumer}
\r
48 public interface RpcImplementation extends Provider.ProviderFunctionality {
\r
51 * A set of rpc types supported by implementation.
\r
53 * The set of rpc {@link QName}s which are supported by this implementation.
\r
54 * This set is used, when {@link Provider} is registered to the SAL, to
\r
55 * register and expose the implementation of the returned rpcs.
\r
57 * @return Set of QNames identifying supported RPCs
\r
59 Set<QName> getSupportedRpcs();
\r
62 * Invokes a implementation of specified rpc.
\r
68 * Input data for rpc.
\r
70 * @throws IllegalArgumentException
\r
72 * <li>If rpc is null.
\r
73 * <li>If input is not <code>null</code> and
\r
74 * <code>false == rpc.equals(input.getNodeType)</code>
\r
76 * @return RpcResult containing the output of rpc if was executed
\r
77 * successfully, the list of errors otherwise.
\r
79 RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input);
\r