2 * Copyright (c) 2016 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
9 package org.opendaylight.netconf.test.tool.rpchandler;
11 import java.util.Collections;
13 import org.opendaylight.controller.config.util.capability.Capability;
14 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
15 import org.opendaylight.netconf.mapping.api.NetconfOperation;
16 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
17 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
19 public class SettableOperationRpcProvider implements NetconfOperationServiceFactory {
21 private final RpcHandler rpcHandler;
23 public SettableOperationRpcProvider(RpcHandler rpcHandler) {
24 this.rpcHandler = rpcHandler;
28 public Set<Capability> getCapabilities() {
29 return Collections.emptySet();
33 public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
40 public NetconfOperationService createService(final String netconfSessionIdForReporting) {
41 return new SettableOperationService(rpcHandler);
44 private static class SettableOperationService implements NetconfOperationService {
46 private final SettableRpc rpc;
48 SettableOperationService(RpcHandler rpcHandler) {
49 this.rpc = new SettableRpc(rpcHandler);
53 public Set<NetconfOperation> getNetconfOperations() {
54 return Collections.singleton(rpc);