com.ibm.di.fc.remotecmdlnfc
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
 com.ibm.tivoli.remoteaccess.RemoteAccess beginSession()
          Begin a session with the target machine
 String createRandomDir(String p)
          Create a random directory on the target machine
 void endSession()
          End the session with the target machine
 String getHost()
          Return the name of the target machine
 char getOSSeparator()
          Return the character that the target uses to separate path information
 com.ibm.tivoli.remoteaccess.RemoteAccess getRXAProtocol()
          Return the internal RXA connection object
 String getType()
          Return the connection protocol used for this connection
 String getUser()
          Return the username being used to connect to the target
 void initializeProps(Properties p)
          Initialize the connection properties
 void removeDir(String dir)
          Remove a directory on the target machine
 Entry runCommand(String cmd)
          Execute the command on the target
 void setCmdArgsCharEncode(String enc)
          Sets encoding for the command arguments before executing the actual command
 void setHost(String h)
          Set the hostname of the target
 void setUser(String u)
          Set the username being used to connect to the target
 void transferFile(String local, String remote)
          Transfer the specified file from the local machine to a specified destination on the remote target
 

Method Detail

getHost

String getHost()
Return the name of the target machine

Returns:
String hostname

setHost

void setHost(String h)
Set the hostname of the target

Parameters:
h - Hostname of target machine

getUser

String getUser()
Return the username being used to connect to the target

Returns:
Username

setUser

void setUser(String u)
Set the username being used to connect to the target

Parameters:
u - The name of the user

initializeProps

void initializeProps(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(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

removeDir

void removeDir(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(String local,
                  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 machine
remote - Path to where the file is to be stored on the remote machine
Throws:
GeneralCLFCException - if the transfer fails

createRandomDir

String createRandomDir(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

String getType()
Return the connection protocol used for this connection

Returns:
String type of connection

setCmdArgsCharEncode

void setCmdArgsCharEncode(String enc)
Sets encoding for the command arguments before executing the actual command

Parameters:
enc - encoding to be used