Package com.ibm.di.protocols.rxa
Interface Connection
-
- All Known Implementing Classes:
AS400Connection
,ConnectionImpl
,RexecConnection
,RSHConnection
,SSHConnection
,WinConnection
public interface Connection
Represents 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.RemoteAccess
beginSession()
Begin a session with the target machinevoid
createDir(java.lang.String dir)
Create a directory on the target machinejava.lang.String
createRandomDir(java.lang.String p)
Create a random directory on the target machinevoid
endSession()
End the session with the target machinejava.lang.String
getHost()
Return the name of the target machinechar
getOSSeparator()
Return the character that the target uses to separate path informationcom.ibm.tivoli.remoteaccess.RemoteAccess
getRXAProtocol()
Return the internal RXA connection objectjava.lang.String
getType()
Return the connection protocol used for this connectionjava.lang.String
getUser()
Return the username being used to connect to the targetvoid
initializeProps(java.util.Properties p)
Initialize the connection propertiesboolean
isExists(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 filesvoid
receiveFile(java.lang.String remote, java.lang.String local)
Receives the specified file from the specified target machine to local machinevoid
removeDir(java.lang.String dir)
Remove a directory on the target machineEntry
runCommand(java.lang.String cmd)
Execute the command on the targetvoid
setCmdArgsCharEncode(java.lang.String enc)
Sets encoding for the command arguments before executing the actual commandvoid
setHost(java.lang.String h)
Set the hostname of the targetvoid
setUser(java.lang.String u)
Set the username being used to connect to the targetvoid
transferFile(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 RemoteConnectException
Begin 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 RemoteConnectException
Return the character that the target uses to separate path information- Returns:
- char separator
- Throws:
RemoteConnectException
-
createDir
void createDir(java.lang.String dir) throws GeneralCLFCException
Create 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 GeneralCLFCException
Remove 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 GeneralCLFCException
Transfer 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 GeneralCLFCException
Receives 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 GeneralCLFCException
Returns 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 GeneralCLFCException
Retrieves the list of files- Parameters:
path
- path on the remote machine- Throws:
GeneralCLFCException
-
createRandomDir
java.lang.String createRandomDir(java.lang.String p) throws GeneralCLFCException, RemoteConnectException
Create 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:
GeneralCLFCException
RemoteConnectException
-
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
-
-