public class SSHClient extends ShellClient
SSHClient
runs shell commands using SSH. For a creation example,
see ShellClient
. SSHAgent.SSH_LOG_LEVEL
. The log level is 1-7 where the debug
level is 7. The log messages appear on the console.
SSHAgent.PROMPTS
and
SSHAgent.PROMPT_RESPONSES
. The property values are a
java.util.List
of java.util.String
. The prompts and
responses are matched by index.
ShellClient
,
ClientFactory
,
ClientsConsts
BaseClient.FilteredMethodsHandler
UNIX_CMD_SEPARATOR, WIN_CMD_SEPARATOR
CREDENTIALS_ID, ENCODING
Constructor and Description |
---|
SSHClient(ClientsFrameworkImpl framework,
java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
int |
downloadFile(java.lang.String localFilePath,
java.lang.String remoteFilePath,
boolean shouldOverrideLocalFile)
Download the specified file (remoteFilePath) from remote machine to
probe.
|
int |
downloadFile(java.lang.String localFilePath,
java.lang.String remoteFilePath,
ExistingFileResolution localFileResolution)
Download the specified file (remoteFilePath) from remote machine to probe.
|
void |
executeSuCommand() |
void |
exitFromSu() |
java.lang.String |
getFile(java.lang.String remoteFileName,
java.lang.String remoteShareName) |
java.lang.String |
getKeyPath()
Returns the key file path from the protocol definition.
|
int |
getPort()
Returns the port from the protocol definition.
|
boolean |
isInSuMode() |
boolean |
isSuConfigured() |
java.lang.String |
putFile(java.lang.String localFileName,
java.lang.String remoteShareName) |
boolean |
supportsSudo() |
int |
uploadFile(java.lang.String localFilePath,
java.lang.String remoteFilePath,
boolean shouldOverrideRemoteFile)
Upload the specified file (localFilePath) from probe's machine to remote
machine
|
int |
uploadFile(java.lang.String localFilePath,
java.lang.String remoteFilePath,
ExistingFileResolution remoteFileResolution)
Upload the specified file (localFilePath) from probe's machine to remote machine
|
canCopyFile, deleteFile, deleteOption, executeCmd, executeCmd, executeCmd, executeCmd, executeCmd, executeCmdWithTimeOut, getBandwidthLimit, getErrorVariable, getLastCommandOutputBytes, getMaxCommandLength, getOptionsDirectory, getOptionsMap, getRemotePlatform, getServerPort, getWelcomeBuffer, setBandwidthLimit, setCharset, setErrorVariable, setMaxCommandLength, setOptionIfNotExist, setOptionsDirectory, setOptionsMap, setOptionsMap, setRemotePlatform
addDeniedPackage, close, getClientType, getCredentialId, getIpAddress, getProperty, getShellCmdSeperator, getSudoCommands, getSudoPaths, getTimeout, getUserName, isConnected, setAttributeEncrypted
public SSHClient(ClientsFrameworkImpl framework, java.util.Properties props) throws java.lang.Exception
java.lang.Exception
public int getPort() throws java.lang.Exception
java.lang.Exception
ClientFactory
public java.lang.String getKeyPath() throws java.lang.Exception
java.lang.Exception
ClientFactory
public boolean supportsSudo()
supportsSudo
in class BaseClient
public void executeSuCommand() throws java.lang.Exception
java.lang.Exception
public void exitFromSu() throws java.lang.Exception
java.lang.Exception
public java.lang.String putFile(java.lang.String localFileName, java.lang.String remoteShareName) throws java.lang.Exception
putFile
in class ShellClient
java.lang.Exception
public java.lang.String getFile(java.lang.String remoteFileName, java.lang.String remoteShareName) throws java.lang.Exception
getFile
in class ShellClient
remoteFileName
- -
file name we want to get from remote machineremoteShareName
- -
name of the remote share from which we want to get the filejava.lang.Exception
public boolean isInSuMode()
public boolean isSuConfigured()
public int downloadFile(java.lang.String localFilePath, java.lang.String remoteFilePath, boolean shouldOverrideLocalFile) throws java.lang.Exception
downloadFile
in interface RemoteFileSystemManager
downloadFile
in class ShellClient
localFilePath
- - defines the name of downloaded file on probe's machine.remoteFilePath
- - the path of the downloaded file on remote machine.shouldOverrideLocalFile
- - defines behavior if the localFilePath already exists on
probe machine. True to override already existing local file
with the downloaded file. False to not to perform download if
the localFilePath already exists.java.lang.Exception
- - exception is thrown in case of download failed.public int uploadFile(java.lang.String localFilePath, java.lang.String remoteFilePath, boolean shouldOverrideRemoteFile) throws java.lang.Exception
uploadFile
in interface RemoteFileSystemManager
uploadFile
in class ShellClient
localFilePath
- - the path of the file to be upload from probe machineremoteFilePath
- - the path of the uploaded file on remote machineshouldOverrideRemoteFile
- - what to do if the file on remote machine already exists.
True will cause to override the file on remote machine, false
will cause to not to upload the file if it already exists.java.lang.Exception
- - exception is thrown in case the upload failed.public int uploadFile(java.lang.String localFilePath, java.lang.String remoteFilePath, ExistingFileResolution remoteFileResolution) throws java.lang.Exception
uploadFile
in interface RemoteFileSystemManager
uploadFile
in class ShellClient
localFilePath
- - the path of the file to be upload from probe machineremoteFilePath
- - the path of the uploaded file on remote machineremoteFileResolution
- - defines behavior if the file on remote machine already exists.java.lang.Exception
- - exception is thrown in case the upload failed.public int downloadFile(java.lang.String localFilePath, java.lang.String remoteFilePath, ExistingFileResolution localFileResolution) throws java.lang.Exception
downloadFile
in interface RemoteFileSystemManager
downloadFile
in class ShellClient
localFilePath
- - defines the name of downloaded file on probe's machine.remoteFilePath
- - the path of the downloaded file on remote machine.localFileResolution
- - defines behavior if the localFilePath already exists on probe machine.java.lang.Exception
- - exception is thrown in case of download failed.Documentation Feedback
Copyright 2012 Micro Focus or one of its affiliates.