From 7a5d09a57cedf0ad1259b72dc918f5925e248683 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 2 Jun 2022 21:22:31 +0200 Subject: [PATCH] Remove NetconfServerSessionPreferences This class is a pure DTO used only internally in netconf-impl. Remove it and adjust users accordingly. JIRA: NETCONF-590 Change-Id: I1f99fbea705ce4a6128413ff7f68d782744bd68a Signed-off-by: Robert Varga --- .../api/NetconfServerSessionPreferences.java | 28 ------------------- .../impl/NetconfServerSessionNegotiator.java | 7 ++--- ...NetconfServerSessionNegotiatorFactory.java | 13 ++++----- 3 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfServerSessionPreferences.java diff --git a/netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfServerSessionPreferences.java b/netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfServerSessionPreferences.java deleted file mode 100644 index 72f9813f03..0000000000 --- a/netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfServerSessionPreferences.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.netconf.api; - -import org.opendaylight.netconf.api.messages.NetconfHelloMessage; - -/** - * The only input for the start of a NETCONF session is hello-message. - */ -public final class NetconfServerSessionPreferences extends NetconfSessionPreferences { - - private final long sessionId; - - public NetconfServerSessionPreferences(final NetconfHelloMessage helloMessage, long sessionId) { - super(helloMessage); - this.sessionId = sessionId; - } - - public long getSessionId() { - return sessionId; - } -} diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java index 071c75f51c..4af12fe78d 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java @@ -16,7 +16,6 @@ import java.net.SocketAddress; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Map; import org.opendaylight.netconf.api.NetconfDocumentedException; -import org.opendaylight.netconf.api.NetconfServerSessionPreferences; import org.opendaylight.netconf.api.messages.NetconfHelloMessage; import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader; import org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator; @@ -30,11 +29,11 @@ public final class NetconfServerSessionNegotiator private final long sessionId; - protected NetconfServerSessionNegotiator(final NetconfServerSessionPreferences sessionPreferences, + protected NetconfServerSessionNegotiator(final NetconfHelloMessage hello, final long sessionId, final Promise promise, final Channel channel, final Timer timer, final NetconfServerSessionListener sessionListener, final long connectionTimeoutMillis) { - super(sessionPreferences.getHelloMessage(), promise, channel, timer, sessionListener, connectionTimeoutMillis); - sessionId = sessionPreferences.getSessionId(); + super(hello, promise, channel, timer, sessionListener, connectionTimeoutMillis); + this.sessionId = sessionId; } @Override diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java index 0aefb841eb..38df10178b 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java @@ -16,7 +16,6 @@ import io.netty.util.Timer; import io.netty.util.concurrent.Promise; import java.net.SocketAddress; import java.util.Set; -import org.opendaylight.netconf.api.NetconfServerSessionPreferences; import org.opendaylight.netconf.api.NetconfSessionListenerFactory; import org.opendaylight.netconf.api.messages.NetconfHelloMessage; import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService; @@ -60,7 +59,7 @@ public class NetconfServerSessionNegotiatorFactory final NetconfMonitoringService monitoringService, final Set baseCapabilities) { this.timer = timer; - this.aggregatedOpService = netconfOperationProvider; + aggregatedOpService = netconfOperationProvider; this.idProvider = idProvider; this.connectionTimeoutMillis = connectionTimeoutMillis; this.monitoringService = monitoringService; @@ -99,11 +98,9 @@ public class NetconfServerSessionNegotiatorFactory final Channel channel, final Promise promise) { final long sessionId = idProvider.getNextSessionId(); - NetconfServerSessionPreferences proposal = - new NetconfServerSessionPreferences(createHelloMessage(sessionId, monitoringService), sessionId); - - return new NetconfServerSessionNegotiator(proposal, promise, channel, timer, - getListener(Long.toString(sessionId), channel.parent().localAddress()), connectionTimeoutMillis); + return new NetconfServerSessionNegotiator(createHelloMessage(sessionId, monitoringService), sessionId, promise, + channel, timer, getListener(Long.toString(sessionId), channel.parent().localAddress()), + connectionTimeoutMillis); } private NetconfServerSessionListener getListener(final String netconfSessionIdForReporting, @@ -117,7 +114,7 @@ public class NetconfServerSessionNegotiatorFactory protected NetconfOperationService getOperationServiceForAddress(final String netconfSessionIdForReporting, final SocketAddress socketAddress) { - return this.aggregatedOpService.createService(netconfSessionIdForReporting); + return aggregatedOpService.createService(netconfSessionIdForReporting); } protected final NetconfOperationServiceFactory getOperationServiceFactory() { -- 2.36.6