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.DefaultSftpSessionFactorylogDEFAULT_AUTHENTICATION_TIMEOUT, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PORT| Constructor and Description |
|---|
ApacheSshdSftpSessionFactory() |
ApacheSshdSftpSessionFactory(boolean sharedSession) |
getSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitproviderHolderOfpublic 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 UsernameHolderpublic void setUsername(String user)
setUsername in interface MutableUserHolderuser - The (never null/empty) usernamepublic String getPassword()
getPassword in interface PasswordHolderpublic void setPassword(String password)
setPrivateKeyLocation(Resource) call is mandatory.setPassword in interface MutablePasswordpassword - 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 Resourcepublic 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.FilePasswordProviderHolderpublic void setFilePasswordProvider(org.apache.sshd.common.config.keys.FilePasswordProvider provider)
setFilePasswordProvider in interface org.apache.sshd.common.config.keys.FilePasswordProviderManagerpublic KeyPair getPrivateKeyPair()
public void setPrivateKeyPair(KeyPair privateKeyPair)
public long getConnectTimeout()
getConnectTimeout in interface SimpleClientConfiguratorpublic void setConnectTimeout(long timeout)
setConnectTimeout in interface SimpleClientConfiguratorpublic long getAuthenticationTimeout()
getAuthenticationTimeout in interface SimpleClientConfiguratorpublic void setAuthenticationTimeout(long timeout)
setAuthenticationTimeout in interface SimpleClientConfiguratorpublic 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.SharedSessionCapablepublic 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.SharedSessionCapablepublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected SshClient createSshClientInstance() throws Exception
Exceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionprotected KeyPair resolveKeyIdentity(ClientSession session) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected 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
IOExceptionGeneralSecurityExceptionpublic 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
Exceptionprotected ClientSession createClientSession() throws Exception
Exceptionprotected ClientSession createClientSession(String hostname, String username, int port, long timeout) throws IOException
IOExceptionprotected ClientSession configureClientSessionProperties(ClientSession session, Properties props) throws IOException
IOExceptionprotected ClientSession authenticateClientSession(ClientSession session, long timeout) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected long getEffectiveTimeoutValue(long timeoutSeconds)
Copyright © 2017–2019 The Apache Software Foundation. All rights reserved.