Package org.apache.sshd.client.simple
Class AbstractSimpleClientSessionCreator
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.simple.AbstractSimpleClient
-
- org.apache.sshd.client.simple.AbstractSimpleClientSessionCreator
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,ClientSessionCreator
,SimpleClient
,SimpleClientConfigurator
,SimpleSessionClient
public abstract class AbstractSimpleClientSessionCreator extends AbstractSimpleClient implements ClientSessionCreator
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.client.session.ClientSessionCreator
TARGET_SERVER
-
Fields inherited from interface org.apache.sshd.client.simple.SimpleClientConfigurator
DEFAULT_AUTHENTICATION_TIMEOUT, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PORT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSimpleClientSessionCreator()
protected
AbstractSimpleClientSessionCreator(long connTimeout, long authTimeout)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClientSession
authSession(ConnectFuture future, String password)
protected ClientSession
authSession(ConnectFuture future, KeyPair identity)
protected ClientSession
authSession(ClientSession clientSession)
long
getAuthenticationTimeout()
long
getConnectTimeout()
protected ClientSession
loginSession(ConnectFuture future, String password)
protected ClientSession
loginSession(ConnectFuture future, KeyPair identity)
ClientSession
sessionLogin(String uri, String password)
Creates a session and logs in using the provided credentialsClientSession
sessionLogin(String uri, KeyPair identity)
Creates a session and logs in using the provided credentialsClientSession
sessionLogin(SocketAddress target, String username, String password)
Creates a session and logs in using the provided credentialsClientSession
sessionLogin(SocketAddress target, String username, KeyPair identity)
Creates a session and logs in using the provided credentialsvoid
setAuthenticationTimeout(long timeout)
void
setConnectTimeout(long timeout)
static SimpleClient
wrap(ClientSessionCreator creator, Channel channel)
Wraps an existingClientSessionCreator
into aSimpleClient
-
Methods 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.client.session.ClientSessionCreator
connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect
-
Methods inherited from interface org.apache.sshd.client.simple.SimpleSessionClient
sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin
-
-
-
-
Method Detail
-
getConnectTimeout
public long getConnectTimeout()
- Specified by:
getConnectTimeout
in interfaceSimpleClientConfigurator
- Returns:
- Current connect timeout (msec.) - always positive
-
setConnectTimeout
public void setConnectTimeout(long timeout)
- Specified by:
setConnectTimeout
in interfaceSimpleClientConfigurator
- Parameters:
timeout
- Requested connect timeout (msec.) - always positive
-
getAuthenticationTimeout
public long getAuthenticationTimeout()
- Specified by:
getAuthenticationTimeout
in interfaceSimpleClientConfigurator
- Returns:
- Current authentication timeout (msec.) - always positive
-
setAuthenticationTimeout
public void setAuthenticationTimeout(long timeout)
- Specified by:
setAuthenticationTimeout
in interfaceSimpleClientConfigurator
- Parameters:
timeout
- Requested authentication timeout (msec.) - always positive
-
sessionLogin
public ClientSession sessionLogin(SocketAddress target, String username, String password) throws IOException
Description copied from interface:SimpleSessionClient
Creates a session and logs in using the provided credentials- Specified by:
sessionLogin
in interfaceSimpleSessionClient
- Parameters:
target
- The targetSocketAddress
username
- Usernamepassword
- Password- Returns:
- Created
ClientSession
- Throws:
IOException
- If failed to login or authenticate
-
sessionLogin
public ClientSession sessionLogin(SocketAddress target, String username, KeyPair identity) throws IOException
Description copied from interface:SimpleSessionClient
Creates a session and logs in using the provided credentials- Specified by:
sessionLogin
in interfaceSimpleSessionClient
- Parameters:
target
- The targetSocketAddress
username
- Usernameidentity
- TheKeyPair
identity- Returns:
- Created
ClientSession
- Throws:
IOException
- If failed to login or authenticate
-
sessionLogin
public ClientSession sessionLogin(String uri, String password) throws IOException
Description copied from interface:SimpleSessionClient
Creates a session and logs in using the provided credentials- Specified by:
sessionLogin
in interfaceSimpleSessionClient
- Parameters:
uri
- The target uripassword
- Password- Returns:
- Created
ClientSession
- Throws:
IOException
- If failed to login or authenticate
-
sessionLogin
public ClientSession sessionLogin(String uri, KeyPair identity) throws IOException
Description copied from interface:SimpleSessionClient
Creates a session and logs in using the provided credentials- Specified by:
sessionLogin
in interfaceSimpleSessionClient
- Parameters:
uri
- The target uriidentity
- TheKeyPair
identity- Returns:
- Created
ClientSession
- Throws:
IOException
- If failed to login or authenticate
-
loginSession
protected ClientSession loginSession(ConnectFuture future, String password) throws IOException
- Throws:
IOException
-
loginSession
protected ClientSession loginSession(ConnectFuture future, KeyPair identity) throws IOException
- Throws:
IOException
-
authSession
protected ClientSession authSession(ConnectFuture future, String password) throws IOException
- Throws:
IOException
-
authSession
protected ClientSession authSession(ConnectFuture future, KeyPair identity) throws IOException
- Throws:
IOException
-
authSession
protected ClientSession authSession(ClientSession clientSession) throws IOException
- Throws:
IOException
-
wrap
public static SimpleClient wrap(ClientSessionCreator creator, Channel channel)
Wraps an existingClientSessionCreator
into aSimpleClient
- Parameters:
creator
- TheClientSessionCreator
- nevernull
channel
- TheChannel
representing the creator for relayingChannel.isOpen()
andChannel.close()
calls- Returns:
- The
SimpleClient
wrapper. Note: closing the wrapper also closes the underlying sessions creator.
-
-