Package org.apache.sshd.sftp.client.impl
Class SimpleSftpClientImpl
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.sftp.client.impl.SimpleSftpClientImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,SimpleSftpClient
-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleSftpClientImpl
(SimpleClient client) SimpleSftpClientImpl
(SimpleClient client, SftpClientFactory sftpClientFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected SftpClient
createSftpClient
(ClientSession session) protected SftpClient
createSftpClient
(IOFunction<? super SimpleClient, ? extends ClientSession> sessionProvider) boolean
isOpen()
void
setClient
(SimpleClient client) void
setSftpClientFactory
(SftpClientFactory sftpClientFactory) sftpLogin
(SocketAddress target, String username, String password) Creates an SFTP session using the provided credentialssftpLogin
(SocketAddress target, String username, KeyPair identity) Creates an SFTP session using the provided credentialsMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Field Details
-
clientInstance
-
sftpClientFactory
-
-
Constructor Details
-
SimpleSftpClientImpl
public SimpleSftpClientImpl() -
SimpleSftpClientImpl
-
SimpleSftpClientImpl
-
-
Method Details
-
getClient
-
setClient
-
getSftpClientFactory
-
setSftpClientFactory
-
sftpLogin
public SftpClient sftpLogin(SocketAddress target, String username, String password) throws 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:
IOException
- If failed to login or authenticate
-
sftpLogin
public SftpClient sftpLogin(SocketAddress target, String username, KeyPair identity) throws 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:
IOException
- If failed to login or authenticate
-
createSftpClient
protected SftpClient createSftpClient(IOFunction<? super SimpleClient, ? extends ClientSession> sessionProvider) throws IOException- Throws:
IOException
-
createSftpClient
- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-