Disconnect NetconfDeviceRpc from DOMRpcService
[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 org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
12 import org.opendaylight.mdsal.dom.api.DOMRpcService;
13 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceCommunicator;
14 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceServices.Rpcs;
15 import org.opendaylight.netconf.client.mdsal.api.RpcTransformer;
16 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
17 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
18
19 /**
20  * Invokes RPC by sending netconf message via listener. Also transforms result from NetconfMessage to
21  * {@link ContainerNode}.
22  */
23 public final class NetconfDeviceRpc implements Rpcs.Normalized {
24     private final @NonNull NetconfDeviceDOMRpcService domRpcService;
25
26     public NetconfDeviceRpc(final EffectiveModelContext modelContext, final RemoteDeviceCommunicator communicator,
27             final RpcTransformer<ContainerNode, DOMRpcResult> transformer) {
28         domRpcService = new NetconfDeviceDOMRpcService(modelContext, communicator, transformer);
29     }
30
31     @Override
32     public DOMRpcService domRpcService() {
33         return domRpcService;
34     }
35 }