Package org.apache.sshd.client.scp
Class SimpleScpClientImpl
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.scp.SimpleScpClientImpl
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,SimpleScpClient
public class SimpleScpClientImpl extends AbstractLoggingBean implements SimpleScpClient
TODO Add javadoc
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleClient
clientInstance
private ScpClientCreator
scpClientCreator
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description SimpleScpClientImpl()
SimpleScpClientImpl(SimpleClient client)
SimpleScpClientImpl(SimpleClient client, ScpClientCreator scpClientCreator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected CloseableScpClient
createScpClient(ClientSession session)
protected CloseableScpClient
createScpClient(ClientSession session, ScpClient client)
protected CloseableScpClient
createScpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider)
SimpleClient
getClient()
ScpClientCreator
getScpClientCreator()
boolean
isOpen()
CloseableScpClient
scpLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password)
Creates an SCP session using the provided credentialsCloseableScpClient
scpLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity)
Creates an SCP session using the provided credentialsvoid
setClient(SimpleClient client)
void
setScpClientCreator(ScpClientCreator scpClientCreator)
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
-
-
-
Field Detail
-
clientInstance
private SimpleClient clientInstance
-
scpClientCreator
private ScpClientCreator scpClientCreator
-
-
Constructor Detail
-
SimpleScpClientImpl
public SimpleScpClientImpl()
-
SimpleScpClientImpl
public SimpleScpClientImpl(SimpleClient client)
-
SimpleScpClientImpl
public SimpleScpClientImpl(SimpleClient client, ScpClientCreator scpClientCreator)
-
-
Method Detail
-
getClient
public SimpleClient getClient()
-
setClient
public void setClient(SimpleClient client)
-
getScpClientCreator
public ScpClientCreator getScpClientCreator()
-
setScpClientCreator
public void setScpClientCreator(ScpClientCreator scpClientCreator)
-
scpLogin
public CloseableScpClient scpLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password) throws java.io.IOException
Description copied from interface:SimpleScpClient
Creates an SCP session using the provided credentials- Specified by:
scpLogin
in interfaceSimpleScpClient
- Parameters:
target
- The targetSocketAddress
username
- Usernamepassword
- Password- Returns:
- Created
CloseableScpClient
- Note: closing the client also closes its underlying session - Throws:
java.io.IOException
- If failed to login or authenticate
-
scpLogin
public CloseableScpClient scpLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity) throws java.io.IOException
Description copied from interface:SimpleScpClient
Creates an SCP session using the provided credentials- Specified by:
scpLogin
in interfaceSimpleScpClient
- Parameters:
target
- The targetSocketAddress
username
- Usernameidentity
- TheKeyPair
identity- Returns:
- Created
CloseableScpClient
- Note: closing the client also closes its underlying session - Throws:
java.io.IOException
- If failed to login or authenticate
-
createScpClient
protected CloseableScpClient createScpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider) throws java.io.IOException
- Throws:
java.io.IOException
-
createScpClient
protected CloseableScpClient createScpClient(ClientSession session) throws java.io.IOException
- Throws:
java.io.IOException
-
createScpClient
protected CloseableScpClient createScpClient(ClientSession session, ScpClient 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
-
-