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

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

Introduction

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

Prototype

public void setSessionConfig(Properties sessionConfig) 

Source Link

Document

Using Properties , you can set additional configuration settings on the underlying JSch com.jcraft.jsch.Session .

Usage

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

/**
 * Get the {@link DefaultSftpSessionFactory} according to the
 * {@link ConnectionDetails}./*from ww w  . j  a va  2  s .c o m*/
 *
 * @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;
}