|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SSHFTPClient
The SSHFTPClient interface models an SSHFTP client that can connect to an SSH server utilzing its sftp subsystem and perform file manipulation based based on the SSH File Transfer Protocol. The SSHFTPClient exposes the functionality defined in this specification. The SSH File Transfer Protocol specification is available at:
http://tools.ietf.org/html/draft-ietf-secsh-filexfer-03
The SSH Protocol specification is available at:
http://www.ietf.org/rfc/rfc4250.txt
http://www.ietf.org/rfc/rfc4251.txt
http://www.ietf.org/rfc/rfc4252.txt
http://www.ietf.org/rfc/rfc4253.txt
http://www.ietf.org/rfc/rfc4254.txt
The SSHFTPClient operates only in secure mode, which is an inherent property of the ssh transport.
It is possible to override the trading partner's server credential and the client's private key credential
objects - which had to be specified (created) in the configuration store on the corresponding transport and
business agreement - with alternative credentials. See setPeerPublicKey(String peerPublicKeyName)
,
setHostPrivateKey(String hostPrivateKeyName)
.
Users of this interface will be given an SSHFTPClient object through the Job variable. One can get this object inside EcmaScript or JavaScript as shown below:
var sshFtpClient = job.get(FTP_OBJ
); Your logic ... // no need to connect or disconnect as the transport tunnel will be established and managed by the framework
This sshFtpClient object is available only during the duration of the script and is not a serializable or persistent object. Once the sshFtpClient object is obtained, users can call any of the methods described in the interface below if they have not configured for file transfer through an http proxy server. All the commands are supported if the connection is configured with a non-http proxy (e.g. socks4 or socks5).
The SSHFTP transport can only be configured with SOCKS4, SOCKS5 proxies or without proxies.
Apart from the ftpObj job variable, there are few variables to get information relating to local directories, filenames, trading partner, and trading host name.
The variables that are available for the SSHFTP transport configured in trading partner outbound transports (FTP outbound) are: To get the directory of the file (in cases where the payload is referenced by a file) located in the local directory, you can use
To get the filename (in cases where the payload is referenced by a file) located in the local directory, you can usevar srcPath = job.get("srcFilePath");
To get the data object, which is not referenced by a filenamevar srcFile = job.get("srcFileName");
To get the trading partner namevar dataObject = job.get("dataObj");
To get the trading host namevar tpName = job.get("tpName");
var hostName = job.get("hostName");
The variables that are available for the FTP inbound transport configured in business agreements (FTP inbound) are: To get the temporary directory, where the file(s) will be downloaded from the FTP server, you can use
To get the trading partner namevar getTmpDir = job.get("getTmpDir");
To get the trading host namevar tpName = job.get("tpName");
var hostName = job.get("hostName");
Field Summary | |
---|---|
static java.lang.String |
ALL_FILE_LIST
Optional, it can be used by business protocols during post processing messages. |
static java.lang.String |
COMMON_ALL_FILE_LIST
Optional, it can be used by business protocols during post processing messages. |
static java.lang.String |
DATA_OBJ
If the payload exists in memory and therefore it is not referenced by a filename, this slot holds the object, which can be retrieved through the method get("dataObj"). |
static int |
DEFAULT_SSHFTP_PORT
|
static java.lang.String |
DELETE_FILE
Currently not used. |
static java.lang.String |
FTP_OBJ
The name of the slot, which returns the ftp client itself. |
static int |
FTP_STATUS_ERROR
Generic failure, possibly due to unknown reasons. |
static int |
FTP_STATUS_OK
Generic successful completion. |
static java.lang.String |
HOSTNAME
The host name |
static java.lang.String |
INPUT_SOURCE_DIR
For FTP Get this is the path where the fetched files are to be stored |
static java.lang.String |
LOG_OBJ
The log client extension handle for custom scripts to log. |
static java.lang.String |
OPERATION_ID
The operation ID of the message. |
static java.lang.String |
ORIG_FILE_NAME
Optional, it can be used by business protocols to indicate the original file name location of a file reference. |
static java.lang.String |
ORIG_FILE_PATH
Optional, it can be used by business protocols to indicate the original path of a file reference. |
static java.lang.String |
OUTPUT_SOURCE_DIR
For FTP Put this is the path where the referenced file is taken from. |
static java.lang.String |
RETRY_SLOT
The value "true" or "false" depending on whether the custom script wants BusinessConnect to re-execute itself. |
static java.lang.String |
SRC_FILE_NAME
The file name used specifically for outbound referenced payload. |
static java.lang.String |
TPNAME
The partner name |
static java.lang.String |
TRANSACTION_ID
The transaction ID of the message. |
static java.lang.String |
USER_STATUS_CODE
The custom script can return a status code in this slot. |
static java.lang.String |
USER_STATUS_MSG
The custom script can return a status message in this slot. |
Method Summary | |
---|---|
void |
aeTrace(java.lang.String role,
java.lang.String msgcode,
java.lang.String desc,
java.lang.String trackingInfo)
Send information to the BusinessConnect log. |
SSHFTPReply |
executeAppendCmd(java.lang.String filename)
Append a file to the ssh server. |
SSHFTPReply |
executeDelCmd(java.lang.String filename)
Delete a file from the ssh server. |
SSHFTPReply |
executeGetCmd(java.lang.String filename)
Retrieve the file specified. |
SSHFTPReply |
executeListCmd(java.lang.String filename)
Retrieve a list of entries from a directory on the SSH server. |
SSHFTPReply[] |
executeMdelCmd(java.lang.String filename)
Delete one or more files from the ssh server. |
SSHFTPReply[] |
executeMgetCmd(java.lang.String filename)
Retrieve file(s) specified by a pattern. |
SSHFTPReply |
executeMkdirCmd(java.lang.String pathname)
Create a directory on the ssh server. |
SSHFTPReply[] |
executeMputCmd(java.lang.String filename)
Copy one or more files to the ssh server. |
SSHFTPReply |
executePutCmd(java.lang.Object data,
boolean isreference,
java.lang.String remotefilename)
Copy a file to the ssh server and create the file with the name 'remotefilename'. |
SSHFTPReply |
executePutCmd(java.lang.Object data,
boolean isreference,
java.lang.String remotefilename,
boolean append)
Copy a file to the ssh server and create the file with the name 'remotefilename'. |
SSHFTPReply |
executePutCmd(java.lang.String filename)
Copy a file to the ssh server. |
SSHFTPReply |
executePutCmd(java.lang.String filename,
boolean append)
Copy a file to the ssh server and possibly append it to an existing file with the same name. |
SSHFTPReply |
executePutCmd(java.lang.String filename,
java.lang.String remotefilename)
Copy a file to the ssh server and create the file with the name 'remotefilename' on the ssh server. |
SSHFTPReply |
executePutCmd(java.lang.String filename,
java.lang.String remotefilename,
boolean append)
Copy a file to the ssh server and create the file with the name 'remotefilename'. |
SSHFTPReply |
executeRenameCmd(java.lang.String oldfilename,
java.lang.String newfilename)
Rename a file on the ssh server. |
SSHFTPReply |
executeRmdirCmd(java.lang.String pathname)
Delete a directory from the ssh server. |
IClientObject |
getClientObject()
Retrieve a client object, which can provide more context specific information about the transaction. |
java.lang.String |
getHost()
Gets the hostname of the SSHFTP server. |
java.lang.String |
getName()
Retrieve the name of the ssh client instance. |
java.lang.String |
getPassword()
Gets the password that is used to connect to the SSHFTP server. |
int |
getPort()
Gets the port number that is used to connect to the SSHFTP server. |
java.lang.String |
getRemoteDir()
Retrieve the effective remote directory, which is currently used by the sshftp client instance. |
int |
getTimeout()
Retrieve the timeout on a connected tunnel awaiting the peer's reply |
java.lang.String |
getUsername()
Gets the username that is used to connect to the SSHFTP server. |
void |
setHostPrivateKey(java.lang.String hostPrivateKeyName)
The ssh private key, which the custom script wants to use instead of the one configured for the transport. |
void |
setPeerPublicKey(java.lang.String peerPublicKeyName)
The ssh public key, which the custom script wants to use instead of the one configured for the transport. |
void |
setRemoteDir(java.lang.String relativePath)
Set the effective remote directory, which will be used by the sshftp client instance. |
void |
setTimeout(int timeout)
Set the timeout on a connected tunnel awaiting the peer's reply |
boolean |
useProxyServer()
Checks if a proxy server is used to connect to the SSHFTP server. |
Field Detail |
---|
static final int FTP_STATUS_OK
static final int FTP_STATUS_ERROR
static final java.lang.String FTP_OBJ
static final java.lang.String TPNAME
static final java.lang.String HOSTNAME
static final java.lang.String LOG_OBJ
static final java.lang.String SRC_FILE_NAME
static final java.lang.String OUTPUT_SOURCE_DIR
static final java.lang.String ORIG_FILE_NAME
static final java.lang.String ORIG_FILE_PATH
static final java.lang.String TRANSACTION_ID
static final java.lang.String OPERATION_ID
static final java.lang.String DATA_OBJ
static final java.lang.String INPUT_SOURCE_DIR
static final java.lang.String RETRY_SLOT
static final java.lang.String USER_STATUS_CODE
static final java.lang.String USER_STATUS_MSG
static final java.lang.String ALL_FILE_LIST
static final java.lang.String COMMON_ALL_FILE_LIST
static final java.lang.String DELETE_FILE
static final int DEFAULT_SSHFTP_PORT
Method Detail |
---|
java.lang.String getUsername()
java.lang.String getPassword()
getUsername()
.
java.lang.String getHost()
int getPort()
DEFAULT_SSHFTP_PORT
if the url specifies no port.
void setPeerPublicKey(java.lang.String peerPublicKeyName) throws java.lang.Exception
peerPublicKeyName
- The name of the alternative credential to be used.
java.lang.Exception
void setHostPrivateKey(java.lang.String hostPrivateKeyName) throws java.lang.Exception
hostPrivateKeyName
- The name of the alternative credential to be used.
java.lang.Exception
boolean useProxyServer()
SSHFTPReply executeListCmd(java.lang.String filename) throws java.lang.Exception
SSHFTPReply
object, using the IFTPFlavorReply.getRemoteFileList()
method. This method returns a Vector
object, whose elements are FileAttr
objects, each
representing one entry from the list.
filename
- The name of the path from which to retrieve entries.
java.lang.Exception
SSHFTPReply executeGetCmd(java.lang.String filename) throws java.lang.Exception
filename
- The file to be retrieved.
java.lang.Exception
SSHFTPReply[] executeMgetCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file or a pattern. Currently, the '*' character can be
used to match part(s) of the filename. Only files (not directories) will be returned that
match the specified pattern.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.String filename, boolean append) throws java.lang.Exception
filename
- The name of the file.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.String filename, java.lang.String remotefilename) throws java.lang.Exception
filename
- The name of the file on the local system.remotefilename
- The name to of the file.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.String filename, java.lang.String remotefilename, boolean append) throws java.lang.Exception
filename
- The name of the file on the local system.remotefilename
- The name to of the file.append
- true if want to append, false otherwise.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.Object data, boolean isreference, java.lang.String remotefilename) throws java.lang.Exception
data
- The name of the file on the local system.isreference
- true if data is a reference, false otherwise. E.g. if data is a filename, it refers to the
content, therefore isreference should be true in this case.remotefilename
- The name to of the file.
java.lang.Exception
SSHFTPReply executePutCmd(java.lang.Object data, boolean isreference, java.lang.String remotefilename, boolean append) throws java.lang.Exception
data
- The name of the file on the local system.isreference
- true if data is a reference, false otherwise. E.g. if data is a filename, it refers to the
content, therefore isreference should be true in this case.remotefilename
- The name to of the file.append
- true if want to append, false otherwise.
java.lang.Exception
SSHFTPReply[] executeMputCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file to be copied ('*' can be used for wildcard)
java.lang.Exception
SSHFTPReply executeAppendCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file.
java.lang.Exception
SSHFTPReply executeRenameCmd(java.lang.String oldfilename, java.lang.String newfilename) throws java.lang.Exception
oldfilename
- The name of the file to be renamed from.newfilename
- The name of the file to be renamed to.
java.lang.Exception
SSHFTPReply executeDelCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file.
java.lang.Exception
SSHFTPReply[] executeMdelCmd(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file to be deleted ('*' can be used for wildcard)
java.lang.Exception
SSHFTPReply executeMkdirCmd(java.lang.String pathname) throws java.lang.Exception
pathname
- The name of the directory to be created.
java.lang.Exception
SSHFTPReply executeRmdirCmd(java.lang.String pathname) throws java.lang.Exception
pathname
- The name of the directory to be deleted.
java.lang.Exception
void aeTrace(java.lang.String role, java.lang.String msgcode, java.lang.String desc, java.lang.String trackingInfo)
role
- any of the values "INFO", "ERROR", "WARN", "DEBUG".msgcode
- any message code that the script may want to return, e.g. 200.desc
- any message describing the event, e.g. "Message has been sent successfully."trackingInfo
- any optional info to track/identify the event, e.g. an identifier of
the business message. May be null or empty.java.lang.String getRemoteDir()
void setRemoteDir(java.lang.String relativePath)
relativePath
- The remote directory that the sshftp client will use as the base
for the available operations. This path is relative to the configured directory, that is,
if the transport is confiured with .../mydir then providing 'mysubdir' will set the
remote directory to .../mydir/mysubdir.java.lang.String getName()
IClientObject getClientObject()
IClientObject
.int getTimeout()
void setTimeout(int timeout)
timeout
- the max blocking wait in seconds
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |