static protected SftpClient getSftpClient ( MuleContext muleContext , String endpointName ) throws IOException { ImmutableEndpoint endpoint = getImmutableEndpoint ( muleContext , endpointName ) ; try { SftpClient sftpClient = SftpConnectionFactory . createClient ( endpoint ) ; return sftpClient ; } catch ( Exception e ) { throw new RuntimeException ( "Login failed" , e ) ; } /* EndpointURI endpointURI = endpoint.getEndpointURI(); SftpClient sftpClient = new SftpClient(endpointURI.getHost()); SftpConnector sftpConnector = (SftpConnector) endpoint.getConnector(); if (sftpConnector.getIdentityFile() != null) { try { sftpClient.login(endpointURI.getUser(), sftpConnector.getIdentityFile(), sftpConnector.getPassphrase()); } catch (Exception e) { throw new RuntimeException("Login failed", e); } } else { try { sftpClient.login(endpointURI.getUser(), endpointURI.getPassword()); } catch (Exception e) { throw new RuntimeException("Login failed", e); } } return sftpClient; */ }
Returns a SftpClient that is logged in to the sftp server that the endpoint is configured against .