com.ibm.di.fc.remotecmdlnfc
Class ConnectionImpl

java.lang.Object
  extended by com.ibm.di.fc.remotecmdlnfc.ConnectionImpl
All Implemented Interfaces:
Connection
Direct Known Subclasses:
AS400Connection, RexecConnection, RSHConnection, SSHConnection, WinConnection

public abstract class ConnectionImpl
extends Object
implements Connection

This class encapsulates the RXA library's Connection related objects


Field Summary
protected  String as400Proxy
           
protected  boolean as400RunProg
           
protected  boolean as400SSL
           
protected static String EMPTYSTRING
           
protected  String hostName
           
protected  String keystore
           
protected  LogProxy lp
           
protected  String parentDirToStdin
           
protected  byte[] passphrase
           
protected  byte[] password
           
protected  int port
           
protected  String randomDir
           
protected  Attribute rtnCodeAttr
           
protected  Attribute stdErrorAttr
           
protected  Attribute stdOutputAttr
           
protected  int timeout
           
protected  String userName
           
 
Constructor Summary
ConnectionImpl(LogProxy log)
          ConnectionImpl Constructor
 
Method Summary
abstract  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()
          Get the hostname of the target for the connection
 char getOSSeparator()
          Return the character that the target uses to separate path information
 com.ibm.tivoli.remoteaccess.RemoteAccess getRXAProtocol()
          Return the RXA Connection Object
abstract  String getType()
          Return this connection type
 String getUser()
          Get the username being used in the connection
 void initializeProps(Properties p)
          Initialize the properties of the connection
 void removeDir(String dir)
          Remove a directory on the target machine
 Entry runCommand(String c)
          Run the specified command on the target machine
 void setHost(String s)
          Set the hostname of the target with which to connect
 void setRXAProtocol(com.ibm.tivoli.remoteaccess.RemoteAccess remote)
          Set the RXA connection object for this connection
 void setUser(String u)
          Set the username to be used when connecting to the target
 void transferFile(String localPath, String remotePath)
          Transfer the specified file from the local machine to a specified destination on the remote target
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hostName

protected String hostName

userName

protected String userName

password

protected byte[] password

passphrase

protected byte[] passphrase

keystore

protected String keystore

timeout

protected int timeout

port

protected int port

as400SSL

protected boolean as400SSL

as400Proxy

protected String as400Proxy

as400RunProg

protected boolean as400RunProg

rtnCodeAttr

protected Attribute rtnCodeAttr

stdErrorAttr

protected Attribute stdErrorAttr

stdOutputAttr

protected Attribute stdOutputAttr

lp

protected LogProxy lp

parentDirToStdin

protected String parentDirToStdin

randomDir

protected String randomDir

EMPTYSTRING

protected static final String EMPTYSTRING
See Also:
Constant Field Values
Constructor Detail

ConnectionImpl

public ConnectionImpl(LogProxy log)
ConnectionImpl Constructor

Parameters:
log - LogProxy for logging
Method Detail

initializeProps

public void initializeProps(Properties p)
Initialize the properties of the connection

Specified by:
initializeProps in interface Connection
Parameters:
p - Properties object containing the configurable connection attributes

beginSession

public abstract com.ibm.tivoli.remoteaccess.RemoteAccess beginSession()
                                                               throws RemoteConnectException
Begin a session with the target machine

Specified by:
beginSession in interface Connection
Returns:
RemoteAccess The RXA connection object connecting to the target
Throws:
RemoteConnectException

getType

public abstract String getType()
Return this connection type

Specified by:
getType in interface Connection
Returns:
String The connection protocol used for this connection. One of: WIN, REXEC, RSH, SSH

endSession

public void endSession()
End the session with the target machine

Specified by:
endSession in interface Connection

runCommand

public Entry runCommand(String c)
                 throws GeneralCLFCException
Run the specified command on the target machine

Specified by:
runCommand in interface Connection
Parameters:
c - String containing the command to be executed
Returns:
Entry containing the results from executing the command. It contains three attributes: command.out, command.error and command.returnCode.
Throws:
GeneralCLFCException

createRandomDir

public String createRandomDir(String p)
                       throws RemoteConnectException,
                              GeneralCLFCException
Create a random directory on the target machine

Specified by:
createRandomDir in interface Connection
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

removeDir

public void removeDir(String dir)
               throws GeneralCLFCException
Remove a directory on the target machine

Specified by:
removeDir in interface Connection
Parameters:
dir - The path to the folder to be deleted
Throws:
GeneralCLFCException - if the folder cannot be successfully removed from the target

transferFile

public void transferFile(String localPath,
                         String remotePath)
                  throws GeneralCLFCException
Transfer the specified file from the local machine to a specified destination on the remote target

Specified by:
transferFile in interface Connection
Parameters:
localPath - Path to the source file on the local machine
remotePath - Path to where the file is to be stored on the remote machine
Throws:
GeneralCLFCException - if the transfer fails

getOSSeparator

public char getOSSeparator()
                    throws RemoteConnectException
Return the character that the target uses to separate path information

Specified by:
getOSSeparator in interface Connection
Returns:
char separator
Throws:
RemoteConnectException

getRXAProtocol

public com.ibm.tivoli.remoteaccess.RemoteAccess getRXAProtocol()
Return the RXA Connection Object

Specified by:
getRXAProtocol in interface Connection
Returns:
RemoteAccess connection object accessing the target

setHost

public void setHost(String s)
Set the hostname of the target with which to connect

Specified by:
setHost in interface Connection
Parameters:
s - The hostname of the target

getHost

public String getHost()
Get the hostname of the target for the connection

Specified by:
getHost in interface Connection
Returns:
String hostname

setUser

public void setUser(String u)
Set the username to be used when connecting to the target

Specified by:
setUser in interface Connection
Parameters:
u - Username

getUser

public String getUser()
Get the username being used in the connection

Specified by:
getUser in interface Connection
Returns:
String username

setRXAProtocol

public void setRXAProtocol(com.ibm.tivoli.remoteaccess.RemoteAccess remote)
Set the RXA connection object for this connection

Parameters:
remote - The protocol-specific connection object