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 protectedAbstractSimpleClientSessionCreator()protectedAbstractSimpleClientSessionCreator(long connTimeout, long authTimeout)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClientSessionauthSession(ConnectFuture future, String password)protected ClientSessionauthSession(ConnectFuture future, KeyPair identity)protected ClientSessionauthSession(ClientSession clientSession)longgetAuthenticationTimeout()longgetConnectTimeout()protected ClientSessionloginSession(ConnectFuture future, String password)protected ClientSessionloginSession(ConnectFuture future, KeyPair identity)ClientSessionsessionLogin(String uri, String password)Creates a session and logs in using the provided credentialsClientSessionsessionLogin(String uri, KeyPair identity)Creates a session and logs in using the provided credentialsClientSessionsessionLogin(SocketAddress target, String username, String password)Creates a session and logs in using the provided credentialsClientSessionsessionLogin(SocketAddress target, String username, KeyPair identity)Creates a session and logs in using the provided credentialsvoidsetAuthenticationTimeout(long timeout)voidsetConnectTimeout(long timeout)static SimpleClientwrap(ClientSessionCreator creator, Channel channel)Wraps an existingClientSessionCreatorinto 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:
getConnectTimeoutin interfaceSimpleClientConfigurator- Returns:
- Current connect timeout (msec.) - always positive
-
setConnectTimeout
public void setConnectTimeout(long timeout)
- Specified by:
setConnectTimeoutin interfaceSimpleClientConfigurator- Parameters:
timeout- Requested connect timeout (msec.) - always positive
-
getAuthenticationTimeout
public long getAuthenticationTimeout()
- Specified by:
getAuthenticationTimeoutin interfaceSimpleClientConfigurator- Returns:
- Current authentication timeout (msec.) - always positive
-
setAuthenticationTimeout
public void setAuthenticationTimeout(long timeout)
- Specified by:
setAuthenticationTimeoutin 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:SimpleSessionClientCreates a session and logs in using the provided credentials- Specified by:
sessionLoginin interfaceSimpleSessionClient- Parameters:
target- The targetSocketAddressusername- 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:SimpleSessionClientCreates a session and logs in using the provided credentials- Specified by:
sessionLoginin interfaceSimpleSessionClient- Parameters:
target- The targetSocketAddressusername- Usernameidentity- TheKeyPairidentity- 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:SimpleSessionClientCreates a session and logs in using the provided credentials- Specified by:
sessionLoginin 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:SimpleSessionClientCreates a session and logs in using the provided credentials- Specified by:
sessionLoginin interfaceSimpleSessionClient- Parameters:
uri- The target uriidentity- TheKeyPairidentity- 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 existingClientSessionCreatorinto aSimpleClient- Parameters:
creator- TheClientSessionCreator- nevernullchannel- TheChannelrepresenting the creator for relayingChannel.isOpen()andChannel.close()calls- Returns:
- The
SimpleClientwrapper. Note: closing the wrapper also closes the underlying sessions creator.
-
-