Adjust for RPCService methods changing
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcImplementation.java
1 /*
2  * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.remote.rpc;
9
10 import akka.actor.ActorRef;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
13 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
14 import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
15 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
16 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
17
18 /**
19  * A {@link DOMRpcImplementation} which routes invocation requests to a remote invoker actor.
20  *
21  * @author Robert Varga
22  */
23 final class RemoteRpcImplementation extends AbstractRemoteImplementation<ExecuteRpc> implements DOMRpcImplementation {
24     RemoteRpcImplementation(final ActorRef remoteInvoker, final RemoteOpsProviderConfig config) {
25         super(remoteInvoker, config);
26     }
27
28     @Override
29     public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final ContainerNode input) {
30         return new RemoteDOMRpcFuture(rpc.getType(), ask(ExecuteRpc.from(rpc, input)));
31     }
32
33     @Override
34     public long invocationCost() {
35         return COST;
36     }
37 }