Package com.ibm.di.protocols.rxa
Interface Connection
-
- All Known Implementing Classes:
AS400Connection,ConnectionImpl,RexecConnection,RSHConnection,SSHConnection,WinConnection
public interface ConnectionRepresents a connection using the Remote Execution and Access Library
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.ibm.tivoli.remoteaccess.RemoteAccessbeginSession()Begin a session with the target machinevoidcreateDir(java.lang.String dir)Create a directory on the target machinejava.lang.StringcreateRandomDir(java.lang.String p)Create a random directory on the target machinevoidendSession()End the session with the target machinejava.lang.StringgetHost()Return the name of the target machinechargetOSSeparator()Return the character that the target uses to separate path informationcom.ibm.tivoli.remoteaccess.RemoteAccessgetRXAProtocol()Return the internal RXA connection objectjava.lang.StringgetType()Return the connection protocol used for this connectionjava.lang.StringgetUser()Return the username being used to connect to the targetvoidinitializeProps(java.util.Properties p)Initialize the connection propertiesbooleanisExists(java.lang.String path)Returns true/false to check a given file exists or notjava.util.ArrayList<java.lang.String>list(java.lang.String path)Retrieves the list of filesvoidreceiveFile(java.lang.String remote, java.lang.String local)Receives the specified file from the specified target machine to local machinevoidremoveDir(java.lang.String dir)Remove a directory on the target machineEntryrunCommand(java.lang.String cmd)Execute the command on the targetvoidsetCmdArgsCharEncode(java.lang.String enc)Sets encoding for the command arguments before executing the actual commandvoidsetHost(java.lang.String h)Set the hostname of the targetvoidsetUser(java.lang.String u)Set the username being used to connect to the targetvoidtransferFile(java.lang.String local, java.lang.String remote)Transfer the specified file from the local machine to a specified destination on the remote target
-
-
-
Method Detail
-
getHost
java.lang.String getHost()
Return the name of the target machine- Returns:
- String hostname
-
setHost
void setHost(java.lang.String h)
Set the hostname of the target- Parameters:
h- Hostname of target machine
-
getUser
java.lang.String getUser()
Return the username being used to connect to the target- Returns:
- Username
-
setUser
void setUser(java.lang.String u)
Set the username being used to connect to the target- Parameters:
u- The name of the user
-
initializeProps
void initializeProps(java.util.Properties p)
Initialize the connection properties- Parameters:
p- The configurable attributes for the connection
-
beginSession
com.ibm.tivoli.remoteaccess.RemoteAccess beginSession() throws RemoteConnectExceptionBegin a session with the target machine- Returns:
- RemoteAccess RXA connection object that is using a particular protocol to connect to the target system
- Throws:
RemoteConnectException- Thrown if starting the session is unsuccessful
-
runCommand
Entry runCommand(java.lang.String cmd) throws GeneralCLFCException
Execute the command on the target- Parameters:
cmd- The command to be executed- Returns:
- Entry object containing the results from the command execution as three attributes: command.out, command.error and command.returnCode.
- Throws:
GeneralCLFCException- If errors are encountered when attempting to run the command
-
getOSSeparator
char getOSSeparator() throws RemoteConnectExceptionReturn the character that the target uses to separate path information- Returns:
- char separator
- Throws:
RemoteConnectException
-
createDir
void createDir(java.lang.String dir) throws GeneralCLFCExceptionCreate a directory on the target machine- Parameters:
dir- The path to the folder to be created- Throws:
GeneralCLFCException- if the folder cannot be successfully created on the target
-
removeDir
void removeDir(java.lang.String dir) throws GeneralCLFCExceptionRemove a directory on the target machine- Parameters:
dir- The path to the folder to be deleted- Throws:
GeneralCLFCException- if the folder cannot be successfully removed from the target
-
transferFile
void transferFile(java.lang.String local, java.lang.String remote) throws GeneralCLFCExceptionTransfer the specified file from the local machine to a specified destination on the remote target- Parameters:
local- Path to the source file on the local machineremote- Path to where the file is to be stored on the remote machine- Throws:
GeneralCLFCException- if the transfer fails
-
receiveFile
void receiveFile(java.lang.String remote, java.lang.String local) throws GeneralCLFCExceptionReceives the specified file from the specified target machine to local machine- Parameters:
remote- Path to the source file on the remote machinelocal- Path to where the file is to be stored on the local machine- Throws:
GeneralCLFCException- if the transfer fails
-
isExists
boolean isExists(java.lang.String path) throws GeneralCLFCExceptionReturns true/false to check a given file exists or not- Parameters:
path- path of the file on the remote machine- Throws:
GeneralCLFCException
-
list
java.util.ArrayList<java.lang.String> list(java.lang.String path) throws GeneralCLFCExceptionRetrieves the list of files- Parameters:
path- path on the remote machine- Throws:
GeneralCLFCException
-
createRandomDir
java.lang.String createRandomDir(java.lang.String p) throws GeneralCLFCException, RemoteConnectExceptionCreate a random directory on the target machine- Parameters:
p- The path to the parent directory where the random directory is to be created- Returns:
- String specifying the path to the random directory that was created
- Throws:
GeneralCLFCExceptionRemoteConnectException
-
endSession
void endSession()
End the session with the target machine
-
getRXAProtocol
com.ibm.tivoli.remoteaccess.RemoteAccess getRXAProtocol()
Return the internal RXA connection object- Returns:
- RemoteAccess The RXA connection object that is connected to the target system
-
getType
java.lang.String getType()
Return the connection protocol used for this connection- Returns:
- String type of connection
-
setCmdArgsCharEncode
void setCmdArgsCharEncode(java.lang.String enc)
Sets encoding for the command arguments before executing the actual command- Parameters:
enc- encoding to be used
-
-