Package org.qubership.atp.mia.repo.impl
Class SshSession
java.lang.Object
org.qubership.atp.mia.repo.impl.SshSession
-
Constructor Summary
ConstructorsConstructorDescriptionSshSession(Server server, CommonConfiguration configuration) Creates details for ssh session, which used when openingChannelandSession. -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseChannel(com.jcraft.jsch.Channel channel) Close channel.voidcreateSession(int retryCount) Creates jschSession.booleanDisconnects ssh session if it was connected.booleanProperties with ssh information, such as host, port etc.inthashCode()booleanIs session connected.booleanbooleanisSame(Server server, CommonConfiguration configuration) Checks that properties not changed since connection store.com.jcraft.jsch.ChannelopenChannel(ChannelType channelType) OpensChannel, don't requires already openedSession, because does it itself.
-
Constructor Details
-
SshSession
Creates details for ssh session, which used when openingChannelandSession.- Parameters:
server- with credentialsconfiguration- used to get SshRsaFilePath field of CommonConfiguration.
-
-
Method Details
-
openChannel
OpensChannel, don't requires already openedSession, because does it itself.- Parameters:
channelType- type of channel depends on ssh operation, checkChannelType.- Returns:
- opened channel or throw error.
-
closeChannel
public void closeChannel(com.jcraft.jsch.Channel channel) Close channel.- Parameters:
channel- channel
-
createSession
public void createSession(int retryCount) Creates jschSession.- Parameters:
retryCount- pass 1 to make retry amount equal to this.retries.
-
isConnected
public boolean isConnected()Is session connected.- Returns:
- true or false.
-
getProperties
Properties with ssh information, such as host, port etc.- Returns:
- ssh connection properties.
-
disconnect
public boolean disconnect()Disconnects ssh session if it was connected. -
isExecuting
public boolean isExecuting() -
isSame
Checks that properties not changed since connection store. It helps to avoid situations when connection is old, while configuration updated.- Parameters:
server- server.configuration- only check sshRsaFilePath field of CommonConfiguration.- Returns:
- false if not the same.
-
equals
-
hashCode
public int hashCode()
-