Fixup checkstyle
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / api / RpcConsumerRegistry.java
index 7da0a48517fddf715db5f55ced1d431680f0a755..cd70e4c8524ff59b590d9d3d3806b86bc198a2f8 100644 (file)
@@ -7,19 +7,57 @@
  */
 package org.opendaylight.controller.sal.binding.api;
 
+import org.opendaylight.controller.md.sal.binding.api.BindingService;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 /**
- * Base interface defining contract for retrieving MD-SAL
- * version of RpcServices
+ * Provides access to registered Remote Procedure Call (RPC) service implementations. The RPCs are
+ * defined in YANG models.
  *
+ * <p>
+ * RPC implementations are registered using the {@link RpcProviderRegistry}.
+ *
+ * @deprecated Use {@link org.opendaylight.mdsal.binding.api.RpcConsumerRegistry} instead
  */
-public interface RpcConsumerRegistry extends BindingAwareService {
+@Deprecated
+public interface RpcConsumerRegistry extends BindingAwareService, BindingService {
     /**
-     * Returns a session specific instance (implementation) of requested
-     * YANG module implementation / service provided by consumer.
+     * Returns an implementation of a requested RPC service.
+     *
+     * <p>
+     * The returned instance is not an actual implementation of the RPC service interface, but a proxy implementation
+     * of the interface that forwards to an actual implementation, if any.
+     *
+     * <p>
+     * The following describes the behavior of the proxy when invoking RPC methods:
+     * <ul>
+     * <li>If an actual implementation is registered with the MD-SAL, all invocations are
+     * forwarded to the registered implementation.</li>
+     * <li>If no actual implementation is registered, all invocations will fail by
+     * throwing {@link IllegalStateException}.</li>
+     * <li>Prior to invoking the actual implementation, the method arguments are are validated.
+     * If any are invalid, an {@link IllegalArgumentException} is thrown.
+     * </ul>
+     *
+     * <p>
+     * The returned proxy is automatically updated with the most recent registered implementation.
+     * {@code
+     *   final Future<RpcResult<SomeRpcOutput>> future = someRpcService.someRpc( ... );
+     *   Futures.addCallback(future,
+     *       new FutureCallback<RpcResult<SomeRpcOutput>>() {
+     *           public void onSuccess(RpcResult<SomeRpcOutput> result) {
+     *               // process result ...
+     *           }
+     *
+     *           public void onFailure(Throwable t) {
+     *              // RPC failed
+     *           }
+     *       });
+     *  }
      *
-     * @return Session specific implementation of service
+     * @param serviceInterface the interface of the RPC Service. Typically this is an interface generated
+     *                         from a YANG model.
+     * @return the proxy for the requested RPC service. This method never returns null.
      */
-    <T extends RpcService> T getRpcService(Class<T> module);
+    <T extends RpcService> T getRpcService(Class<T> serviceInterface);
 }