The following sample code demonstrates how to dynamically configure the adapter and perform a simple file transfer.
From BatchLocalFile:
Set the TargetDirectoryName
//@map:Copy "InDir" to TargetDirectoryName BatchLocalFile_1.getConfiguration().setTargetDirectoryName( "InDir" ); |
From BatchFTP:
Disconnect the adapter
//@map:Client.disconnect BatchFTP_1.getClient().disconnect(); |
Set the TargetDirectoryName
//@map:Copy "OutDir" to TargetDirectoryName BatchFTP_1.getConfiguration().setTargetDirectoryName( "OutDir" ); |
Set the HostName
//@map:Copy "myftphostname" to HostName BatchFTP_1.getConfiguration().setHostName( "myftphostname" ); |
Connect the adapter
//@map:Client.connect BatchFTP_1.getClient().connect(); |
Perform a simple file transfer:
Get a local file
//@map: BatchLocalFile_1.getClient().get(); |
Assign the Payload
//@map:Copy Payload to Payload BatchFTP_1.getClient().setPayload(BatchLocalFile_1.getClient().getPay load() ); |
Put a file on the FTP server
//@map:Client.put BatchFTP_1.getClient().put(); |
To view the Collaboration Editor’s Java Source Editor, click the Advance mode or Source Code mode icon, available on the Collaboration Editor toolbar.