2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.remote.rpc;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
12 import org.opendaylight.mdsal.dom.api.DOMRpcException;
13 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
14 import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import scala.concurrent.Future;
18 final class RemoteDOMRpcFuture extends AbstractRemoteFuture<QName, DOMRpcResult, DOMRpcException> {
19 RemoteDOMRpcFuture(final @NonNull QName type, final @NonNull Future<Object> requestFuture) {
20 super(type, requestFuture);
24 DOMRpcResult processReply(final Object reply) {
25 return reply instanceof RpcResponse ? new DefaultDOMRpcResult(((RpcResponse) reply).getOutput()) : null;
29 Class<DOMRpcException> exceptionClass() {
30 return DOMRpcException.class;
34 DOMRpcException wrapCause(final Throwable cause) {
35 return new RemoteDOMRpcException("Exception during invoking RPC", cause);