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 java.lang.Object
implements Connection

This class encapsulates the RXA library's Connection related objects


Field Summary
protected  java.lang.String as400Proxy
          This parameter defines an AS400 proxy server if so required
protected  boolean as400RunProg
          An optional Remote CLFC parameter that defines the type of command execution to use for an AS400 (i5/OS) connection
protected  boolean as400SSL
          This parameter governs whether an SSL connection is enforced on the AS400 (i5/OS) connection
protected  java.lang.String cmdArgsCharEncode
          The character encoding to use for AS400 command line arguments
protected static java.lang.String EMPTYSTRING
          Empty String
protected  java.lang.String hostName
          The hostname (address) of the target machine.
protected  int initial_timeout
          An optional Remote CLFC parameter that defines a timeout period for the initial connection to the target system.
protected  java.lang.String keystore
          Full path to the file containing the keystore
protected  LogProxy lp
          Used for logging
protected  java.lang.String parentDirToStdin
          Parent directory to the folder containing the stdin destination folder
protected  byte[] passphrase
          The passphrase that protects your private key, in the keystore specified by the Keystore Path parameter above
protected  byte[] password
          The password for the user (specified as Remote User) on the target machine.
protected  int port
          The port to use to connect to the target machine
protected  java.lang.String randomDir
          Path to random directory created
protected  Attribute rtnCodeAttr
          The return code from the executed command indicating the success of the requested operation
protected  Attribute stdErrorAttr
          The standard error from the executed command
protected  Attribute stdOutputAttr
          The standard output from the executed command
protected  int timeout
          The desired CPU timeout period in milliseconds
protected  java.lang.String userName
          The name of a user with Administrative privileges on the target machine
 
Constructor Summary
ConnectionImpl(LogProxy log)
          ConnectionImpl Constructor
 
Method Summary
abstract  com.ibm.tivoli.remoteaccess.RemoteAccess beginSession()
          Begin a session with the target machine
 java.lang.String createRandomDir(java.lang.String p)
          Create a random directory on the target machine
 void endSession()
          End the session with the target machine
 java.lang.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  java.lang.String getType()
          Return this connection type
 java.lang.String getUser()
          Get the username being used in the connection
 void initializeProps(java.util.Properties p)
          Initialize the properties of the connection
 void removeDir(java.lang.String dir)
          Remove a directory on the target machine
 Entry runCommand(java.lang.String c)
          Run the specified command on the target machine
 void setCmdArgsCharEncode(java.lang.String enc)
          Sets encoding for the command arguments before executing the actual command
 void setHost(java.lang.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(java.lang.String u)
          Set the username to be used when connecting to the target
 void transferFile(java.lang.String localPath, java.lang.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 java.lang.String hostName
The hostname (address) of the target machine. This is a required parameter


userName

protected java.lang.String userName
The name of a user with Administrative privileges on the target machine


password

protected byte[] password
The password for the user (specified as Remote User) on the target machine. This parameter may be optional in the case of SSH connections using a keystore, as well as for RSH connections


passphrase

protected byte[] passphrase
The passphrase that protects your private key, in the keystore specified by the Keystore Path parameter above


cmdArgsCharEncode

protected java.lang.String cmdArgsCharEncode
The character encoding to use for AS400 command line arguments


keystore

protected java.lang.String keystore
Full path to the file containing the keystore


timeout

protected int timeout
The desired CPU timeout period in milliseconds


port

protected int port
The port to use to connect to the target machine


as400SSL

protected boolean as400SSL
This parameter governs whether an SSL connection is enforced on the AS400 (i5/OS) connection


as400Proxy

protected java.lang.String as400Proxy
This parameter defines an AS400 proxy server if so required


as400RunProg

protected boolean as400RunProg
An optional Remote CLFC parameter that defines the type of command execution to use for an AS400 (i5/OS) connection


initial_timeout

protected int initial_timeout
An optional Remote CLFC parameter that defines a timeout period for the initial connection to the target system. This has no effect on AS400 targets


rtnCodeAttr

protected Attribute rtnCodeAttr
The return code from the executed command indicating the success of the requested operation


stdErrorAttr

protected Attribute stdErrorAttr
The standard error from the executed command


stdOutputAttr

protected Attribute stdOutputAttr
The standard output from the executed command


lp

protected LogProxy lp
Used for logging


parentDirToStdin

protected java.lang.String parentDirToStdin
Parent directory to the folder containing the stdin destination folder


randomDir

protected java.lang.String randomDir
Path to random directory created


EMPTYSTRING

protected static final java.lang.String EMPTYSTRING
Empty String

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(java.util.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 java.lang.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(java.lang.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 java.lang.String createRandomDir(java.lang.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(java.lang.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(java.lang.String localPath,
                         java.lang.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(java.lang.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 java.lang.String getHost()
Get the hostname of the target for the connection

Specified by:
getHost in interface Connection
Returns:
String hostname

setUser

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

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

getUser

public java.lang.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

setCmdArgsCharEncode

public void setCmdArgsCharEncode(java.lang.String enc)
Sets encoding for the command arguments before executing the actual command

Specified by:
setCmdArgsCharEncode in interface Connection
Parameters:
enc - encoding to be used