-import akka.dispatch.OnComplete;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
-import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
-import org.opendaylight.controller.sal.core.api.RoutedRpcDefaultImplementation;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.xml.codec.XmlUtils;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import scala.concurrent.ExecutionContext;
-
-import java.util.Collections;
-import java.util.Set;
-
-import static akka.pattern.Patterns.ask;
-
-public class RemoteRpcImplementation implements RpcImplementation, RoutedRpcDefaultImplementation {
- private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcImplementation.class);
- private final ActorRef rpcBroker;
- private final SchemaContext schemaContext;
- private final RemoteRpcProviderConfig config;
-
- public RemoteRpcImplementation(ActorRef rpcBroker, SchemaContext schemaContext, RemoteRpcProviderConfig config) {
- this.rpcBroker = rpcBroker;
- this.schemaContext = schemaContext;
- this.config = config;
+import akka.pattern.Patterns;
+import akka.util.Timeout;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
+import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+/**
+ * A {@link DOMRpcImplementation} which routes invocation requests to a remote invoker actor.
+ *
+ * @author Robert Varga
+ */
+final class RemoteRpcImplementation implements DOMRpcImplementation {
+ // 0 for local, 1 for binding, 2 for remote
+ private static final long COST = 2;
+
+ private final ActorRef remoteInvoker;
+ private final Timeout askDuration;
+
+ RemoteRpcImplementation(final ActorRef remoteInvoker, final RemoteRpcProviderConfig config) {
+ this.remoteInvoker = Preconditions.checkNotNull(remoteInvoker);
+ this.askDuration = config.getAskDuration();