/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.remote.rpc; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.controller.remote.rpc.messages.RpcResponse; import org.opendaylight.mdsal.dom.api.DOMRpcException; import org.opendaylight.mdsal.dom.api.DOMRpcResult; import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import scala.concurrent.Future; final class RemoteDOMRpcFuture extends AbstractRemoteFuture { RemoteDOMRpcFuture(final @NonNull SchemaPath type, final @NonNull Future requestFuture) { super(type, requestFuture); } @Override DOMRpcResult processReply(final Object reply) { return reply instanceof RpcResponse ? new DefaultDOMRpcResult(((RpcResponse) reply).getOutput()) : null; } @Override Class exceptionClass() { return DOMRpcException.class; } @Override DOMRpcException wrapCause(final Throwable cause) { return new RemoteDOMRpcException("Exception during invoking RPC", cause); } }