Example usage for org.springframework.integration.sftp.session DefaultSftpSessionFactory setPassword

List of usage examples for org.springframework.integration.sftp.session DefaultSftpSessionFactory setPassword

Introduction

In this page you can find the example usage for org.springframework.integration.sftp.session DefaultSftpSessionFactory setPassword.

Prototype

public void setPassword(String password) 

Source Link

Document

The password to authenticate against the remote host.

Usage

From source file:com.qpark.eip.core.sftp.SftpSessionFactoryProvider.java

/**
 * Get the {@link DefaultSftpSessionFactory} according to the
 * {@link ConnectionDetails}./*w  w  w .  j ava  2  s . com*/
 *
 * @param connectionDetails
 *            the {@link ConnectionDetails}.
 * @return the {@link DefaultSftpSessionFactory}.
 */
public static DefaultSftpSessionFactory getSessionFactory(final ConnectionDetails connectionDetails) {
    Properties sessionConfig = new Properties();
    sessionConfig.setProperty("compression.s2c", "zlib@openssh.com,none");
    sessionConfig.setProperty("compression.c2s", "zlib@openssh.com,none");
    sessionConfig.setProperty("compression_level", "9");
    DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory();
    sessionFactory.setHost(connectionDetails.getHostName());
    sessionFactory.setPort(connectionDetails.getPort());
    sessionFactory.setUser(connectionDetails.getUserName());
    sessionFactory.setPassword(new String(connectionDetails.getPassword()));
    sessionFactory.setSessionConfig(sessionConfig);
    return sessionFactory;
}

From source file:com.apress.prospringintegration.ftp.SftpConfiguration.java

@Bean
public DefaultSftpSessionFactory sftpSessionFactory() {
    DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory();
    sessionFactory.setHost(host);//from   ww  w .  j  a  v a2s . c o  m
    sessionFactory.setUser(username);
    sessionFactory.setPassword(password);

    return sessionFactory;
}