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


Appendix B FTP Script Examples : Fifth Tutorial Example

Fifth Tutorial Example
Two scripts are used for the fifth tutorial example:
The ssh_putencrypted.txt script, which uses the PGP API to process documents and then puts them on the SSHFTP server.
The ssh_getdecrypted.txt script, which receives files from the SSHFTP server and then processed them using the PGP API. These files match a particular search filter.
How ssh_putencrypted.txt Works
The ssh_putencrypted.txt script gets the SSHFTPClient object from the job variable that is created at runtime by BusinessConnect.
The SSHFTPClient object is used to connect to the SSHFTP server, both in proxy or non-proxy mode. It checks whether the examples1 directory is available and proceeds as follows:
If the examples1 directory is present, the script puts in the file created by the Initiator's outbound process and processed using the PGP API.
If the examples1 directory is not present, it is created before the file is actually stored on the SSHFTP server.
If there are connection failures, a flag called retryScripts (with the constant name defined in the API com.tibco.ax.fw.runtime.transport.sshftp.SSHFTPClient.RETRY_SLOT) may be used to set the value as true, and passed on to BusinessConnect to retry the execution when retry of the outbound process occurs.
How ssh_getdecrypted.txt Works
The ssh_getdecrypted.txt script gets the SSHFTPClient object from the job variable that is created at runtime by BusinessConnect.
The SSHFTPClient object is used to connect to the SSHFTP server. It checks whether the examples1 directory is available. If it is, the script calls executeMgetCmd to get all the files from the SSHFTP Server.
Once the files are successfully retrieved and then processed by the PGP API, the files from the examples1 directory are deleted. If the files could not be retrieved for some reason (such as when a communication failure happens), the corresponding tracing and auditing entries are created. In such case, the script retrieves all files from the examples2 directory whose extension is *.bin and whose size is greater than or equal to 200 KB. Upon successful retrieval, the retrieved files are deleted.
How to Send Files
For this example, send a document using BusinessWorks process as described in File Pollers.
Tutorial Files
The following files are part of this tutorial:
BC_HOME\samples\bc\sshftp_bcpg\ssh_putencrypted.txt
BC_HOME\samples\bc\sshftp_bcpg\ssh_getdecrypted.txt

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