Spring Integration

org.springframework.integration.sftp.session
Class DefaultSftpSessionFactory

java.lang.Object
  extended by org.springframework.integration.sftp.session.DefaultSftpSessionFactory
All Implemented Interfaces:
SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry>

public class DefaultSftpSessionFactory
extends java.lang.Object
implements SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry>

Factory for creating SftpSession instances.

Since:
2.0
Author:
Josh Long, Mario Gray, Oleg Zhurakousky, Gunnar Hillert

Constructor Summary
DefaultSftpSessionFactory()
           
 
Method Summary
 Session<com.jcraft.jsch.ChannelSftp.LsEntry> getSession()
           
 void setClientVersion(java.lang.String clientVersion)
          Allows you to set the client version property.
 void setEnableDaemonThread(java.lang.Boolean enableDaemonThread)
          If true, all threads will be daemon threads.
 void setHost(java.lang.String host)
          The url of the host you want connect to.
 void setHostKeyAlias(java.lang.String hostKeyAlias)
          Sets the host key alias, used when comparing the host key to the known hosts list.
 void setKnownHosts(java.lang.String knownHosts)
          Specifies the filename that will be used to create a host key repository.
 void setPassword(java.lang.String password)
          The password to authenticate against the remote host.
 void setPort(int port)
          The port over which the SFTP connection shall be established.
 void setPrivateKey(org.springframework.core.io.Resource privateKey)
          Allows you to set a Resource, which represents the location of the private key used for authenticating against the remote host.
 void setPrivateKeyPassphrase(java.lang.String privateKeyPassphrase)
          The password for the private key.
 void setProxy(com.jcraft.jsch.Proxy proxy)
          Allows for specifying a JSch-based Proxy.
 void setServerAliveCountMax(java.lang.Integer serverAliveCountMax)
          Specifies the number of server-alive messages, which will be sent without any reply from the server before disconnecting.
 void setServerAliveInterval(java.lang.Integer serverAliveInterval)
          Sets the timeout interval (milliseconds) before a server alive message is sent, in case no message is received from the server.
 void setSessionConfig(java.util.Properties sessionConfig)
          Using Properties, you can set additional configuration settings on the underlying JSch Session.
 void setSocketFactory(com.jcraft.jsch.SocketFactory socketFactory)
          Allows you to pass in a SocketFactory.
 void setTimeout(java.lang.Integer timeout)
          The timeout property is used as the socket timeout parameter, as well as the default connection timeout.
 void setUser(java.lang.String user)
          The remote user to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSftpSessionFactory

public DefaultSftpSessionFactory()
Method Detail

setHost

public void setHost(java.lang.String host)
The url of the host you want connect to. This is a mandatory property.

See Also:
JSch.getSession(String, String, int)

setPort

public void setPort(int port)
The port over which the SFTP connection shall be established. If not specified, this value defaults to 22. If specified, this properties must be a positive number.

See Also:
JSch.getSession(String, String, int)

setUser

public void setUser(java.lang.String user)
The remote user to use. This is a mandatory property.

See Also:
JSch.getSession(String, String, int)

setPassword

public void setPassword(java.lang.String password)
The password to authenticate against the remote host. If a password is not provided, then the privateKey is mandatory.

See Also:
Session.setPassword(String)

setKnownHosts

public void setKnownHosts(java.lang.String knownHosts)
Specifies the filename that will be used to create a host key repository. The resulting file has the same format as OpenSSH's known_hosts file.

See Also:
JSch.setKnownHosts(String)

setPrivateKey

public void setPrivateKey(org.springframework.core.io.Resource privateKey)
Allows you to set a Resource, which represents the location of the private key used for authenticating against the remote host. If the privateKey is not provided, then the setPassword(String) property is mandatory.

See Also:
JSch.addIdentity(String), JSch.addIdentity(String, String)

setPrivateKeyPassphrase

public void setPrivateKeyPassphrase(java.lang.String privateKeyPassphrase)
The password for the private key. Optional.

See Also:
JSch.addIdentity(String, String)

setSessionConfig

public void setSessionConfig(java.util.Properties sessionConfig)
Using Properties, you can set additional configuration settings on the underlying JSch Session.

See Also:
Session.setConfig(Properties)

setProxy

public void setProxy(com.jcraft.jsch.Proxy proxy)
Allows for specifying a JSch-based Proxy. If set, then the proxy object is used to create the connection to the remote host.

See Also:
Session.setProxy(Proxy)

setSocketFactory

public void setSocketFactory(com.jcraft.jsch.SocketFactory socketFactory)
Allows you to pass in a SocketFactory. The socket factory is used to create a socket to the target host. When a Proxy is used, the socket factory is passed to the proxy. By default plain TCP sockets are used.

See Also:
Session.setSocketFactory(SocketFactory)

setTimeout

public void setTimeout(java.lang.Integer timeout)
The timeout property is used as the socket timeout parameter, as well as the default connection timeout. Defaults to 0, which means, that no timeout will occur.

See Also:
Session.setTimeout(int)

setClientVersion

public void setClientVersion(java.lang.String clientVersion)
Allows you to set the client version property. It's default depends on the underlying JSch version but it will look like SSH-2.0-JSCH-0.1.45

See Also:
Session.setClientVersion(String)

setHostKeyAlias

public void setHostKeyAlias(java.lang.String hostKeyAlias)
Sets the host key alias, used when comparing the host key to the known hosts list.

See Also:
Session.setHostKeyAlias(String)

setServerAliveInterval

public void setServerAliveInterval(java.lang.Integer serverAliveInterval)
Sets the timeout interval (milliseconds) before a server alive message is sent, in case no message is received from the server.

See Also:
Session.setServerAliveInterval(int)

setServerAliveCountMax

public void setServerAliveCountMax(java.lang.Integer serverAliveCountMax)
Specifies the number of server-alive messages, which will be sent without any reply from the server before disconnecting. If not set, this property defaults to 1.

See Also:
Session.setServerAliveCountMax(int)

setEnableDaemonThread

public void setEnableDaemonThread(java.lang.Boolean enableDaemonThread)
If true, all threads will be daemon threads. If set to false, normal non-daemon threads will be used. This property will be set on the underlying Session using Session.setDaemonThread(boolean). There, this property will default to false, if not explicitly set.

See Also:
Session.setDaemonThread(boolean)

getSession

public Session<com.jcraft.jsch.ChannelSftp.LsEntry> getSession()
Specified by:
getSession in interface SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry>

Spring Integration