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.mdsal.binding.dom.adapter;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.Throwables;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import java.lang.invoke.MethodHandle;
15 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
20 @Deprecated(since = "11.0.0", forRemoval = true)
21 final class LegacyDOMRpcImplementationAdapter extends AbstractDOMRpcImplementationAdapter {
22 private final MethodHandle handle;
24 LegacyDOMRpcImplementationAdapter(final AdapterContext adapterContext, final QName inputName,
25 final MethodHandle handle) {
26 super(adapterContext, inputName);
27 this.handle = requireNonNull(handle);
31 @SuppressWarnings("checkstyle:illegalCatch")
32 ListenableFuture<RpcResult<?>> invokeRpc(final CurrentAdapterSerializer serializer, final DOMRpcIdentifier rpc,
33 final ContainerNode input) {
35 return (ListenableFuture<RpcResult<?>>) handle.invokeExact(deserialize(serializer, rpc.getType(), input));
36 } catch (Throwable e) {
37 Throwables.throwIfUnchecked(e);
38 throw new IllegalStateException(e);