cd70e4c8524ff59b590d9d3d3806b86bc198a2f8
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / api / RpcConsumerRegistry.java
1 /*
2  * Copyright (c) 2014 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.api;
9
10 import org.opendaylight.controller.md.sal.binding.api.BindingService;
11 import org.opendaylight.yangtools.yang.binding.RpcService;
12
13 /**
14  * Provides access to registered Remote Procedure Call (RPC) service implementations. The RPCs are
15  * defined in YANG models.
16  *
17  * <p>
18  * RPC implementations are registered using the {@link RpcProviderRegistry}.
19  *
20  * @deprecated Use {@link org.opendaylight.mdsal.binding.api.RpcConsumerRegistry} instead
21  */
22 @Deprecated
23 public interface RpcConsumerRegistry extends BindingAwareService, BindingService {
24     /**
25      * Returns an implementation of a requested RPC service.
26      *
27      * <p>
28      * The returned instance is not an actual implementation of the RPC service interface, but a proxy implementation
29      * of the interface that forwards to an actual implementation, if any.
30      *
31      * <p>
32      * The following describes the behavior of the proxy when invoking RPC methods:
33      * <ul>
34      * <li>If an actual implementation is registered with the MD-SAL, all invocations are
35      * forwarded to the registered implementation.</li>
36      * <li>If no actual implementation is registered, all invocations will fail by
37      * throwing {@link IllegalStateException}.</li>
38      * <li>Prior to invoking the actual implementation, the method arguments are are validated.
39      * If any are invalid, an {@link IllegalArgumentException} is thrown.
40      * </ul>
41      *
42      * <p>
43      * The returned proxy is automatically updated with the most recent registered implementation.
44      * {@code
45      *   final Future<RpcResult<SomeRpcOutput>> future = someRpcService.someRpc( ... );
46      *   Futures.addCallback(future,
47      *       new FutureCallback<RpcResult<SomeRpcOutput>>() {
48      *           public void onSuccess(RpcResult<SomeRpcOutput> result) {
49      *               // process result ...
50      *           }
51      *
52      *           public void onFailure(Throwable t) {
53      *              // RPC failed
54      *           }
55      *       });
56      *  }
57      *
58      * @param serviceInterface the interface of the RPC Service. Typically this is an interface generated
59      *                         from a YANG model.
60      * @return the proxy for the requested RPC service. This method never returns null.
61      */
62     <T extends RpcService> T getRpcService(Class<T> serviceInterface);
63 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.