Class SimpleSftpClientImpl
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.subsystem.sftp.impl.SimpleSftpClientImpl
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,SimpleSftpClient
public class SimpleSftpClientImpl extends AbstractLoggingBean implements SimpleSftpClient
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleClient
clientInstance
private SftpClientFactory
sftpClientFactory
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description SimpleSftpClientImpl()
SimpleSftpClientImpl(SimpleClient client)
SimpleSftpClientImpl(SimpleClient client, SftpClientFactory sftpClientFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected SftpClient
createSftpClient(ClientSession session)
protected SftpClient
createSftpClient(ClientSession session, SftpClient client)
protected SftpClient
createSftpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider)
SimpleClient
getClient()
SftpClientFactory
getSftpClientFactory()
boolean
isOpen()
void
setClient(SimpleClient client)
void
setSftpClientFactory(SftpClientFactory sftpClientFactory)
SftpClient
sftpLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password)
Creates an SFTP session using the provided credentialsSftpClient
sftpLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity)
Creates an SFTP session using the provided credentials-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
-
-
-
Field Detail
-
clientInstance
private SimpleClient clientInstance
-
sftpClientFactory
private SftpClientFactory sftpClientFactory
-
-
Constructor Detail
-
SimpleSftpClientImpl
public SimpleSftpClientImpl()
-
SimpleSftpClientImpl
public SimpleSftpClientImpl(SimpleClient client)
-
SimpleSftpClientImpl
public SimpleSftpClientImpl(SimpleClient client, SftpClientFactory sftpClientFactory)
-
-
Method Detail
-
getClient
public SimpleClient getClient()
-
setClient
public void setClient(SimpleClient client)
-
getSftpClientFactory
public SftpClientFactory getSftpClientFactory()
-
setSftpClientFactory
public void setSftpClientFactory(SftpClientFactory sftpClientFactory)
-
sftpLogin
public SftpClient sftpLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password) throws java.io.IOException
Description copied from interface:SimpleSftpClient
Creates an SFTP session using the provided credentials- Specified by:
sftpLogin
in interfaceSimpleSftpClient
- Parameters:
target
- The targetSocketAddress
username
- Usernamepassword
- Password- Returns:
- Created
SftpClient
- Note: closing the client also closes its underlying session - Throws:
java.io.IOException
- If failed to login or authenticate
-
sftpLogin
public SftpClient sftpLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity) throws java.io.IOException
Description copied from interface:SimpleSftpClient
Creates an SFTP session using the provided credentials- Specified by:
sftpLogin
in interfaceSimpleSftpClient
- Parameters:
target
- The targetSocketAddress
username
- Usernameidentity
- TheKeyPair
identity- Returns:
- Created
SftpClient
- Note: closing the client also closes its underlying session - Throws:
java.io.IOException
- If failed to login or authenticate
-
createSftpClient
protected SftpClient createSftpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider) throws java.io.IOException
- Throws:
java.io.IOException
-
createSftpClient
protected SftpClient createSftpClient(ClientSession session) throws java.io.IOException
- Throws:
java.io.IOException
-
createSftpClient
protected SftpClient createSftpClient(ClientSession session, SftpClient client) throws java.io.IOException
- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfacejava.nio.channels.Channel
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-