2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.netconf.topology.spi;
10 import static java.util.Objects.requireNonNull;
12 import java.util.List;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.netconf.client.NetconfClientSessionListener;
15 import org.opendaylight.netconf.client.mdsal.NetconfDeviceCommunicator;
16 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceHandler;
17 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceRegistration;
19 final class NetconfConnectorDTO implements AutoCloseable {
20 private final @NonNull List<SchemaSourceRegistration<?>> yanglibRegistrations;
21 private final @NonNull NetconfDeviceCommunicator communicator;
22 private final @NonNull RemoteDeviceHandler facade;
24 NetconfConnectorDTO(final NetconfDeviceCommunicator communicator, final RemoteDeviceHandler facade,
25 final List<SchemaSourceRegistration<?>> yanglibRegistrations) {
26 this.communicator = requireNonNull(communicator);
27 this.facade = requireNonNull(facade);
28 this.yanglibRegistrations = List.copyOf(yanglibRegistrations);
31 NetconfDeviceCommunicator getCommunicator() {
35 NetconfClientSessionListener getSessionListener() {
43 yanglibRegistrations.forEach(SchemaSourceRegistration::close);