public class ApacheSshdSftpSessionFactory extends org.apache.sshd.common.util.logging.AbstractLoggingBean implements org.springframework.integration.file.remote.session.SessionFactory<SftpClient.DirEntry>, org.springframework.integration.file.remote.session.SharedSessionCapable, MutableBasicCredentials, org.apache.sshd.common.config.keys.FilePasswordProviderManager, SimpleClientConfigurator, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
org.springframework.integration.sftp.session.DefaultSftpSessionFactory
log
DEFAULT_AUTHENTICATION_TIMEOUT, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PORT
Constructor and Description |
---|
ApacheSshdSftpSessionFactory() |
ApacheSshdSftpSessionFactory(boolean sharedSession) |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
providerHolderOf
public ApacheSshdSftpSessionFactory()
public ApacheSshdSftpSessionFactory(boolean sharedSession)
public String getHost()
public void setHost(String host)
host
- The host to connect to - this is a mandatory property.public int getPort()
public void setPort(int port)
22
. If specified, this property must be a positive number.port
- The port valuepublic String getUsername()
getUsername
in interface UsernameHolder
public void setUsername(String user)
setUsername
in interface MutableUserHolder
user
- The (never null
/empty) usernamepublic String getPassword()
getPassword
in interface PasswordHolder
public void setPassword(String password)
setPrivateKeyLocation(Resource)
call is mandatory.setPassword
in interface MutablePassword
password
- The password to use - if null
then no password is set - in which case the
getPrivateKeyLocation()
resource is usedpublic org.springframework.core.io.Resource getPrivateKeyLocation()
public void setPrivateKeyLocation(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)
call is
mandatoryprivateKey
- The private key Resource
public String getPrivateKeyPassphrase()
public void setPrivateKeyPassphrase(String privateKeyPassphrase)
privateKeyPassphrase
- The password for the private key - required if the private key resource is encryptedpublic org.apache.sshd.common.config.keys.FilePasswordProvider getFilePasswordProvider()
getFilePasswordProvider
in interface org.apache.sshd.common.config.keys.FilePasswordProviderHolder
public void setFilePasswordProvider(org.apache.sshd.common.config.keys.FilePasswordProvider provider)
setFilePasswordProvider
in interface org.apache.sshd.common.config.keys.FilePasswordProviderManager
public KeyPair getPrivateKeyPair()
public void setPrivateKeyPair(KeyPair privateKeyPair)
public long getConnectTimeout()
getConnectTimeout
in interface SimpleClientConfigurator
public void setConnectTimeout(long timeout)
setConnectTimeout
in interface SimpleClientConfigurator
public long getAuthenticationTimeout()
getAuthenticationTimeout
in interface SimpleClientConfigurator
public void setAuthenticationTimeout(long timeout)
setAuthenticationTimeout
in interface SimpleClientConfigurator
public Properties getSessionConfig()
public void setSessionConfig(Properties sessionConfig)
sessionConfig
- Extra Properties
that can be used to set specific SSHD session propertiespublic SshClient getSshClient()
public void setSshClient(SshClient sshClient)
public boolean isSharedSession()
isSharedSession
in interface org.springframework.integration.file.remote.session.SharedSessionCapable
public SftpVersionSelector getSftpVersionSelector()
public void setSftpVersion(String version)
public void setSftpVersionSelector(SftpVersionSelector selector)
protected ClientSession getSharedClientSession()
public void resetSharedSession()
resetSharedSession
in interface org.springframework.integration.file.remote.session.SharedSessionCapable
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
protected SshClient createSshClientInstance() throws Exception
Exception
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
protected KeyPair resolveKeyIdentity(ClientSession session) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected org.apache.sshd.common.config.keys.FilePasswordProvider resolveFilePasswordProvider(ClientSession session, org.springframework.core.io.Resource keyResource, String keyPassword)
protected KeyPair loadPrivateKey(ClientSession session, org.springframework.core.io.Resource keyResource, String keyPassword) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public org.springframework.integration.file.remote.session.Session<SftpClient.DirEntry> getSession()
getSession
in interface org.springframework.integration.file.remote.session.SessionFactory<SftpClient.DirEntry>
protected ClientSession resolveClientSession(boolean sharedInstance) throws Exception
Exception
protected ClientSession createClientSession() throws Exception
Exception
protected ClientSession createClientSession(String hostname, String username, int port, long timeout) throws IOException
IOException
protected ClientSession configureClientSessionProperties(ClientSession session, Properties props) throws IOException
IOException
protected ClientSession authenticateClientSession(ClientSession session, long timeout) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected long getEffectiveTimeoutValue(long timeoutSeconds)
Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.