+ LOG.trace("{}: Rpc operation invoked with schema type: {} and node: {}.", id, type, input);
+
+ final NormalizedNodeMessage normalizedNodeMessage = input != null
+ ? new NormalizedNodeMessage(YangInstanceIdentifier.EMPTY, input) : null;
+ final Future<Object> scalaFuture = Patterns.ask(masterActorRef,
+ new InvokeRpcMessage(new SchemaPathMessage(type), normalizedNodeMessage), actorResponseWaitTime);
+
+ final SettableFuture<DOMRpcResult> settableFuture = SettableFuture.create();
+
+ scalaFuture.onComplete(new OnComplete<Object>() {
+ @Override
+ public void onComplete(final Throwable failure, final Object response) {
+ if (failure != null) {
+ settableFuture.setException(failure);
+ return;
+ }
+
+ if (response instanceof EmptyResultResponse) {
+ settableFuture.set(null);
+ return;
+ }
+
+ final Collection<RpcError> errors = ((InvokeRpcMessageReply) response).getRpcErrors();
+ final NormalizedNodeMessage normalizedNodeMessageResult =
+ ((InvokeRpcMessageReply) response).getNormalizedNodeMessage();
+ final DOMRpcResult result;
+ if (normalizedNodeMessageResult == null) {
+ result = new DefaultDOMRpcResult(errors);
+ } else {
+ result = new DefaultDOMRpcResult(normalizedNodeMessageResult.getNode(), errors);
+ }
+ settableFuture.set(result);
+ }
+ }, actorSystem.dispatcher());
+
+ return Futures.makeChecked(settableFuture, domRpcExceptionMapper);