Bump versions 9.0.4-SNAPSHOT
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / OpsInvoker.java
index 4ac3867d67382fe00587378b4a37d1ed42c1d9d1..2d2bd7933830178e05dc996b29420504bb5114af 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.controller.remote.rpc.messages.ActionResponse;
 import org.opendaylight.controller.remote.rpc.messages.ExecuteAction;
 import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
-import org.opendaylight.mdsal.dom.api.DOMActionResult;
 import org.opendaylight.mdsal.dom.api.DOMActionService;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
@@ -33,7 +32,6 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 
 /**
@@ -69,11 +67,11 @@ final class OpsInvoker extends AbstractUntypedActor {
 
     @Override
     protected void handleReceive(final Object message) {
-        if (message instanceof ExecuteRpc) {
+        if (message instanceof ExecuteRpc executeRpc) {
             LOG.debug("Handling ExecuteOps Message");
-            execute((ExecuteRpc) message);
-        } else if (message instanceof ExecuteAction) {
-            execute((ExecuteAction) message);
+            execute(executeRpc);
+        } else if (message instanceof ExecuteAction executeAction) {
+            execute(executeAction);
         } else {
             unknownMessage(message);
         }
@@ -102,8 +100,8 @@ final class OpsInvoker extends AbstractUntypedActor {
 
             @Override
             Object response(final QName type, final DOMRpcResult result) {
-                final Collection<? extends RpcError> errors = result.getErrors();
-                return errors.isEmpty() ? new RpcResponse(result.getResult())
+                final Collection<? extends RpcError> errors = result.errors();
+                return errors.isEmpty() ? new RpcResponse(result.value())
                         // This is legacy (wrong) behavior, which ignores the fact that errors may be just warnings,
                         // discarding any output
                         : new Failure(new RpcErrorsException(String.format("Execution of rpc %s failed", type),
@@ -118,7 +116,7 @@ final class OpsInvoker extends AbstractUntypedActor {
 
         final ActorRef sender = getSender();
 
-        final ListenableFuture<? extends DOMActionResult> future;
+        final ListenableFuture<? extends DOMRpcResult> future;
         try {
             future = actionService.invokeAction(msg.getType(), msg.getPath(), msg.getInput());
         } catch (final RuntimeException e) {
@@ -127,16 +125,16 @@ final class OpsInvoker extends AbstractUntypedActor {
             return;
         }
 
-        Futures.addCallback(future, new AbstractCallback<Absolute, DOMActionResult>(getSender(), msg.getType()) {
+        Futures.addCallback(future, new AbstractCallback<Absolute, DOMRpcResult>(getSender(), msg.getType()) {
             @Override
             Object nullResponse(final Absolute type) {
                 throw new IllegalStateException("Null invocation result of action " + type);
             }
 
             @Override
-            Object response(final Absolute type, final DOMActionResult result) {
-                final Collection<? extends RpcError> errors = result.getErrors();
-                return errors.isEmpty() ? new ActionResponse(result.getOutput(), result.getErrors())
+            Object response(final Absolute type, final DOMRpcResult result) {
+                final var errors = result.errors();
+                return errors.isEmpty() ? new ActionResponse(result.value(), errors)
                     // This is legacy (wrong) behavior, which ignores the fact that errors may be just warnings,
                     // discarding any output
                     : new Failure(new RpcErrorsException(String.format("Execution of action %s failed", type),