Bump MRI upstreams
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / DeviceActionFactoryImpl.java
index 9c0828a91aeb514fb6e7e23e26befad87e65d1a9..6f48d89bde4364670248ca037e658da74e702dff 100644 (file)
@@ -9,24 +9,17 @@ package org.opendaylight.netconf.sal.connect.netconf;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import javax.inject.Singleton;
-import org.opendaylight.mdsal.dom.api.DOMActionResult;
 import org.opendaylight.mdsal.dom.api.DOMActionService;
-import org.opendaylight.mdsal.dom.api.DOMActionServiceExtension;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.sal.connect.api.DeviceActionFactory;
 import org.opendaylight.netconf.sal.connect.api.MessageTransformer;
 import org.opendaylight.netconf.sal.connect.api.RemoteDeviceCommunicator;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,33 +38,24 @@ public class DeviceActionFactoryImpl implements DeviceActionFactory {
     @Override
     public DOMActionService createDeviceAction(final MessageTransformer<NetconfMessage> messageTransformer,
             final RemoteDeviceCommunicator<NetconfMessage> listener, final SchemaContext schemaContext) {
-
-        return new DOMActionService() {
-            @Override
-            public ListenableFuture<? extends DOMActionResult> invokeAction(final Absolute schemaPath,
-                    final DOMDataTreeIdentifier dataTreeIdentifier, final ContainerNode input) {
-                requireNonNull(schemaPath);
-                requireNonNull(dataTreeIdentifier);
-                requireNonNull(input);
-
-                final ListenableFuture<RpcResult<NetconfMessage>> actionResultFuture = listener.sendRequest(
-                        messageTransformer.toActionRequest(schemaPath, dataTreeIdentifier, input), input.getNodeType());
-
-                return Futures.transform(actionResultFuture, netconfMessageRpcResult -> {
-                    if (netconfMessageRpcResult != null) {
-                        return messageTransformer.toActionResult(schemaPath, netconfMessageRpcResult.getResult());
-                    } else {
-                        final String message = "Missing action result of action on schema path: " + schemaPath;
-                        LOG.error(message);
-                        throw new IllegalStateException(message);
-                    }
-                }, MoreExecutors.directExecutor());
-            }
-
-            @Override
-            public ClassToInstanceMap<DOMActionServiceExtension> getExtensions() {
-                return ImmutableClassToInstanceMap.of();
-            }
+        return (schemaPath, dataTreeIdentifier, input) -> {
+            requireNonNull(schemaPath);
+            requireNonNull(dataTreeIdentifier);
+            requireNonNull(input);
+
+            final ListenableFuture<RpcResult<NetconfMessage>> actionResultFuture = listener.sendRequest(
+                messageTransformer.toActionRequest(schemaPath, dataTreeIdentifier, input),
+                input.getIdentifier().getNodeType());
+
+            return Futures.transform(actionResultFuture, netconfMessageRpcResult -> {
+                if (netconfMessageRpcResult != null) {
+                    return messageTransformer.toActionResult(schemaPath, netconfMessageRpcResult.getResult());
+                }
+
+                final String message = "Missing action result of action on schema path: " + schemaPath;
+                LOG.error(message);
+                throw new IllegalStateException(message);
+            }, MoreExecutors.directExecutor());
         };
     }
-}
\ No newline at end of file
+}