public class DefaultSftpSessionFactory extends java.lang.Object implements SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry>, SharedSessionCapable
SftpSession
instances.Constructor and Description |
---|
DefaultSftpSessionFactory() |
DefaultSftpSessionFactory(boolean isSharedSession) |
DefaultSftpSessionFactory(com.jcraft.jsch.JSch jsch,
boolean isSharedSession)
Intended for use in tests so the jsch can be mocked.
|
Modifier and Type | Method and Description |
---|---|
Session<com.jcraft.jsch.ChannelSftp.LsEntry> |
getSession() |
boolean |
isSharedSession() |
void |
resetSharedSession()
Resets the shared session so the next
#getSession() will return a session
using a new connection. |
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.
|
public DefaultSftpSessionFactory()
public DefaultSftpSessionFactory(boolean isSharedSession)
isSharedSession
- public DefaultSftpSessionFactory(com.jcraft.jsch.JSch jsch, boolean isSharedSession)
jsch
- isSharedSession
- public void setHost(java.lang.String host)
JSch.getSession(String, String, int)
public void setPort(int port)
22
. If specified, this properties must
be a positive number.JSch.getSession(String, String, int)
public void setUser(java.lang.String user)
JSch.getSession(String, String, int)
public void setPassword(java.lang.String password)
privateKey
is
mandatory.Session.setPassword(String)
public void setKnownHosts(java.lang.String knownHosts)
JSch.setKnownHosts(String)
public void setPrivateKey(org.springframework.core.io.Resource privateKey)
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.JSch.addIdentity(String)
,
JSch.addIdentity(String, String)
public void setPrivateKeyPassphrase(java.lang.String privateKeyPassphrase)
JSch.addIdentity(String, String)
public void setSessionConfig(java.util.Properties sessionConfig)
Properties
, you can set additional configuration settings on
the underlying JSch Session
.Session.setConfig(Properties)
public void setProxy(com.jcraft.jsch.Proxy proxy)
Proxy
. If set, then the proxy
object is used to create the connection to the remote host.Session.setProxy(Proxy)
public void setSocketFactory(com.jcraft.jsch.SocketFactory socketFactory)
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.Session.setSocketFactory(SocketFactory)
public void setTimeout(java.lang.Integer timeout)
0
, which means,
that no timeout will occur.Session.setTimeout(int)
public void setClientVersion(java.lang.String clientVersion)
SSH-2.0-JSCH-0.1.45
Session.setClientVersion(String)
public void setHostKeyAlias(java.lang.String hostKeyAlias)
Session.setHostKeyAlias(String)
public void setServerAliveInterval(java.lang.Integer serverAliveInterval)
Session.setServerAliveInterval(int)
public void setServerAliveCountMax(java.lang.Integer serverAliveCountMax)
1
.Session.setServerAliveCountMax(int)
public void setEnableDaemonThread(java.lang.Boolean enableDaemonThread)
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.Session.setDaemonThread(boolean)
public Session<com.jcraft.jsch.ChannelSftp.LsEntry> getSession()
getSession
in interface SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry>
public final boolean isSharedSession()
isSharedSession
in interface SharedSessionCapable
public void resetSharedSession()
SharedSessionCapable
#getSession()
will return a session
using a new connection.resetSharedSession
in interface SharedSessionCapable