Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix B Scripts : FTP and File Outbound

FTP and File Outbound
Job Variables
A client interface is available for developing the script and the object implementing the terrifies is available in the job slot variable.
ftpObj  The variable to retrieve the client object.
Example: var ftpClient = job.get("ftpObj");
In addition, you can use the following job variables in scripts:
dataObj  An in-memory object containing the data to be transmitted.
Example: var dataObject = job.get("dataObj");
deleteFileRef  Set to false to prevent TIBCO BusinessConnect from deleting the outbound file from the local machine at the end of script execution. The default value for this variable is true, and the outbound file gets deleted at the end of script execution.
fileURL  Variable entered in the URL field for File transport. You can use this to dynamically store the file in the file system.
Example: var fileURL = job.get("fileURL");
hostName  The variable containing the trading host name from whom the file came.
Example: var hostName = job.get("hostName");
logObj  The variable to retrieve the UserLogAccess object that does audit logging.
Example: var logClient = job.get("logObj");
srcFileName  The variable for the file name on the local machine that has the outbound file ready to be stored in the FTP server.
Example: var localfile = job.get("srcFileName")
Skip Content Threshold   If BusinessConnect uses the Outbound File poller to get the file from the private process and the file size is smaller than the threshold set as Skip Content Threshold, then the file will be directly read into memory and the value of localFile will be null. In such cases, you should use job.get("dataObject") to access the data to be transmitted;
The default for the property Skip Content Threshold set in the dialog Edit Application Configuration is 10000 KB. This property defines a threshold for large files.
Any file with the size that exceeds this threshold will not be fully written into memory, which increases the available memory for the system.
To find out how to define this property, see TIBCO BusinessConnect Interior Server Administration, "Intercomponent Advanced."
srcFilePath  The directory on the local machine that has the outbound files ready to be stored in the FTP server.
Example: var localdir = job.get("srcFilePath");
tpName  The variable containing the trading partner for whom the file is intended to be stored.
Example: var tpName = job.get("tpName");
obPGPHandler   The variable to be used for outbound PGP packaging in an FTP session. Users can use the handler to set the PGP process options.
Example:
var obPGPHandler = job.get("obPGPHandler");
var sign = ...
var encryption = ...
var compress = ...
//sign, encryption and compress are boolean values (true or false);
obPGPHandler.setPGPOptions(sign, encryption, compress);
You can also set the format of the payload after PGP processing, and the compression algorithm:
obPGPHandler.setCompressionAlgo("ZLIB"); //"ZLIB" or "ZIP"
obPGPHandler.setFormat("armored"); //"armored" or "binary"
and then you can package the payload with PGP processing:
obPGPHandler.packageMessage();
Supported FTP Commands
The commands available in the FTP specification 959 are supported:
USER  Logs in
PASS  Sends a password
CWD  Changes the working directory
PASV  Asks the server-DTP to listen on a data port and to wait for a connection rather than initiate one upon receipt of a transfer command. This command is executed only if the FTP server supports the command. A server socket is opened if the FTP server does not support the command.
TYPE  The argument specifies the representation type. The following types are supported, depending on the FTP server implementation:
A (ASCII)
I (Image)
E (EBCDIC)
L (Local byte size) byte size
RETR  Requests a file to be retrieved
STOR  Sends the request to store the data as a file in FTP server
APPE  Causes the server-DTP to accept the data transferred through the data connection and to store the data in a file at the server site. If the file specified exists at the server site, then the data is appended.
PWD  Prints the working directory
DELE  Sends the command to the server site to delete the file that is sent as the argument
RMD  Removes a directory at the FTP server
MKD  Creates a new directory at the FTP server
LIST  Retrieves the directory listing
NLST  Retrieves the filenames for the directory. This command is used to do multiple gets/delete.
SITE  Provides services specific to its system that are essential to file transfer but not sufficiently universal to be included as commands in the protocol.
STAT  Causes the status response to be sent over the control connection in the form of a reply
SYST  Finds the operating system of the server
RNFR  Renames filename from
RNTO  Renames filename to
STOU  Stores unique filename (system generated)
REIN  Reinitializes user
File Outbound
A new interface com.tibco.ax.fw.runtime.transport.file/FILEClient has been added to the JavaDoc. See TIBCO BusinessConnect API Reference, Viewing the Java API Reference Pages.
This interface is used when a customer wants to implement custom scripts on the outbound File transport.
The script example for the outbound File transport is available at BC_HOME/samples/bc/filescripts/copyexample.txt.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved