Package com.ibm.di.fc.remotecmdlnfc
Interface CmdLineExecutor
-
- All Known Implementing Classes:
RemoteCmdLineExecutor
public interface CmdLineExecutorThe object that connects to the target machine, executes the commands and returns the results.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close the connection to the targetEntryexecuteCommand(java.lang.String cmd)Execute the command on the target machine.EntryexecuteCommand(java.lang.String cmd, java.lang.String[] args, java.lang.String argDelimiter)Execute the command on the target machine.chargetOSSeparator()Return the correct path separator for the target system.java.lang.StringgetRandomDir(java.lang.String path)Create a random directory on the target machine.booleanprepareConnection()Create a connection with the target machinevoidremoveDir(java.lang.String dirPath)Remove a file/directory from the targetvoidsetExecutorCmdArgsEncoding(java.lang.String enc)Sets encoding for the command arguments before executing the actual commandvoidtransferFile(java.lang.String localStdin, java.lang.String remoteStdin)Transfer file localStdin to remoteStdin.
-
-
-
Method Detail
-
executeCommand
Entry executeCommand(java.lang.String cmd) throws GeneralCLFCException
Execute the command on the target machine.- Parameters:
cmd- The command to be executed- Returns:
- Entry object containing three output attributes: command.out, command.error and command.returnCode.
- Throws:
GeneralCLFCException- When an exception occurs trying to execute the command remotely.
-
executeCommand
Entry executeCommand(java.lang.String cmd, java.lang.String[] args, java.lang.String argDelimiter) throws GeneralCLFCException
Execute the command on the target machine.- Parameters:
cmd- The command to be executedargs- The command arguments as a String ArrayargDelimiter- The command argument delimiter- Returns:
- Entry object containing three output attributes: command.out, command.error and command.returnCode.
- Throws:
GeneralCLFCException- When an exception occurs trying to execute the command remotely.
-
prepareConnection
boolean prepareConnection() throws GeneralCLFCExceptionCreate a connection with the target machine- Returns:
- boolean value representing the success of the connection
- Throws:
GeneralCLFCException
-
getRandomDir
java.lang.String getRandomDir(java.lang.String path) throws GeneralCLFCExceptionCreate a random directory on the target machine. Can be used to store temporary files.- Parameters:
path- The path to the directory under which the random directory is to be created- Returns:
- String Representing the complete path to the random directory that was created
- Throws:
GeneralCLFCException- If random directory creation fails
-
transferFile
void transferFile(java.lang.String localStdin, java.lang.String remoteStdin) throws GeneralCLFCExceptionTransfer file localStdin to remoteStdin.- Parameters:
localStdin- Path to standard input source file on local machineremoteStdin- Path to standard input destination file on target machine- Throws:
GeneralCLFCException- If file transfer is unsuccessful
-
removeDir
void removeDir(java.lang.String dirPath) throws GeneralCLFCExceptionRemove a file/directory from the target- Parameters:
dirPath- Path to the file/folder to be removed on target machine- Throws:
GeneralCLFCException- If delete operation is unsuccessful
-
getOSSeparator
char getOSSeparator() throws GeneralCLFCExceptionReturn the correct path separator for the target system.- Returns:
- char path separator on target machine
- Throws:
GeneralCLFCException- If problems encountered obtaining the OS Separator.
-
close
void close()
Close the connection to the target
-
setExecutorCmdArgsEncoding
void setExecutorCmdArgsEncoding(java.lang.String enc)
Sets encoding for the command arguments before executing the actual command- Parameters:
enc- encoding to be used
-
-