Clean up SshClient factories 08/101608/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 20 Jun 2022 09:29:37 +0000 (11:29 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 20 Jun 2022 10:30:45 +0000 (10:30 +0000)
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 <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientBuilder.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfSshClient.java

index 0d1c361e574acc2ce3e336bd9fc2991ce56951c7..62b292ff339758593196e8a09efd1be0a7366546 100644 (file)
@@ -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;
index 3ce4c990f6530a5fa9be58eead8a8835564f083a..6f3492ef1fe74def4a809005e31785efaa1584ea 100644 (file)
@@ -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<SshClient> DEFAULT_NETCONF_SSH_CLIENT_FACTORY = SshClient::new;
-
     public NetconfClientSessionImpl(final ClientFactoryManager client, final IoSession ioSession) throws Exception {
         super(client, ioSession);
     }
index d5d0d97aa955636191257b0ef4e8e792fbb1a9ae..1dfac5cc106456c0ce6ef97130ca90df0966ae2d 100644 (file)
@@ -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<SshClient> DEFAULT_NETCONF_SSH_CLIENT_FACTORY = NetconfSshClient::new;
-
     @Override
     protected NetconfSessionFactory createSessionFactory() {
         return new NetconfSessionFactory(this);