Do no implement invokeNetconf() as a default method
[netconf.git] / plugins / netconf-client-mdsal / src / main / java / org / opendaylight / netconf / client / mdsal / spi / NetconfDeviceRpc.java
1 /*
2  * Copyright (c) 2014 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.netconf.client.mdsal.spi;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
13 import org.opendaylight.mdsal.dom.api.DOMRpcService;
14 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceCommunicator;
15 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceServices.Rpcs;
16 import org.opendaylight.netconf.client.mdsal.api.RpcTransformer;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
19 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
20
21 /**
22  * Invokes RPC by sending netconf message via listener. Also transforms result from NetconfMessage to
23  * {@link ContainerNode}.
24  */
25 public final class NetconfDeviceRpc implements Rpcs.Normalized {
26     private final @NonNull NetconfDeviceDOMRpcService domRpcService;
27
28     public NetconfDeviceRpc(final EffectiveModelContext modelContext, final RemoteDeviceCommunicator communicator,
29             final RpcTransformer<ContainerNode, DOMRpcResult> transformer) {
30         domRpcService = new NetconfDeviceDOMRpcService(modelContext, communicator, transformer);
31     }
32
33     @Override
34     public ListenableFuture<? extends DOMRpcResult> invokeNetconf(final QName type, final ContainerNode input) {
35         return domRpcService().invokeRpc(type, input);
36     }
37
38     @Override
39     public DOMRpcService domRpcService() {
40         return domRpcService;
41     }
42 }