From: Robert Varga Date: Mon, 20 Jun 2022 09:29:37 +0000 (+0200) Subject: Clean up SshClient factories X-Git-Tag: v4.0.0~32 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=netconf.git;a=commitdiff_plain;h=a4d6dd76378a23a7731ad7e7a3b54b9c9fa15f8c Clean up SshClient factories We really have only a single factory, remove the constant and inline it to its sole caller. Also remove an unused factory. Change-Id: I13523654e3ee4556365c3d809bcdf9f613aa6900 Signed-off-by: Robert Varga --- diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java index 0d1c361e57..62b292ff33 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java @@ -54,7 +54,7 @@ public class NetconfClientBuilder extends ClientBuilder { @Override protected ClientBuilder fillWithDefaultValues() { if (factory == null) { - factory = NetconfSshClient.DEFAULT_NETCONF_SSH_CLIENT_FACTORY; + factory = NetconfSshClient::new; } if (signatureFactories == null) { signatureFactories = FULL_SIGNATURE_PREFERENCE; diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java index 3ce4c990f6..6f3492ef1f 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java @@ -11,9 +11,7 @@ import com.google.common.annotations.Beta; import io.netty.channel.ChannelHandlerContext; import java.io.IOException; import org.opendaylight.netconf.shaded.sshd.client.ClientFactoryManager; -import org.opendaylight.netconf.shaded.sshd.client.SshClient; import org.opendaylight.netconf.shaded.sshd.client.session.ClientSessionImpl; -import org.opendaylight.netconf.shaded.sshd.common.Factory; import org.opendaylight.netconf.shaded.sshd.common.io.IoSession; import org.opendaylight.netconf.shaded.sshd.common.session.ConnectionService; @@ -23,8 +21,6 @@ import org.opendaylight.netconf.shaded.sshd.common.session.ConnectionService; */ @Beta public class NetconfClientSessionImpl extends ClientSessionImpl implements NettyAwareClientSession { - public static final Factory DEFAULT_NETCONF_SSH_CLIENT_FACTORY = SshClient::new; - public NetconfClientSessionImpl(final ClientFactoryManager client, final IoSession ioSession) throws Exception { super(client, ioSession); } diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java index d5d0d97aa9..1dfac5cc10 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java @@ -9,7 +9,6 @@ package org.opendaylight.netconf.nettyutil.handler.ssh.client; import com.google.common.annotations.Beta; import org.opendaylight.netconf.shaded.sshd.client.SshClient; -import org.opendaylight.netconf.shaded.sshd.common.Factory; /** * An extension to {@link SshClient} which uses {@link NetconfSessionFactory} to create sessions (leading towards @@ -17,8 +16,6 @@ import org.opendaylight.netconf.shaded.sshd.common.Factory; */ @Beta public class NetconfSshClient extends SshClient { - public static final Factory DEFAULT_NETCONF_SSH_CLIENT_FACTORY = NetconfSshClient::new; - @Override protected NetconfSessionFactory createSessionFactory() { return new NetconfSessionFactory(this);