In addition to the field elements, the BatchFTP OTD’s Client node contains methods that extend the client interface functionality of the adapter. These methods are essential to the proper use of the OTD and require some additional explanation. They are:
get(): Retrieves a file from the remote FTP server then stores its contents as a data payload. The method retrieves the first matching file based on the Target Directory Name and Target File Name parameters and stores the contents as a data payload (a byte array). It then performs any Post Transfer Command.
After this method call, you can get the payload’s contents through the method getPayload().
If no qualified file is available for retrieving, you get the exception containing java.io.FTPFileException as a nested exception.
put(): Places the payload data on the FTP server, that is, it performs an append or put action from the Payload node to the remote FTP server and performs any Post Transfer Command.
If no qualified file is available for sending, you get the exception containing java.io.FTPFileException as a nested exception.
When you are using the adapter’s data-streaming feature, the get() and put() methods operate differently. See the Streaming Data Between Components section for details on this operation.
reset(): Allows you to return the Client node to its state immediately after the previous initialization.
The reset() method is available in the Batch FTP OTDs and BatchLocalFile OTD. The reset method must be called when the OTD has to be reused for another transfer during the same execution of executeBusinessRules() (for example, when you are using the Dynamic Configuration feature). Thereset() method resets the content of the Client node without resetting the whole OTD. If you attempt another transfer without calling reset() first, the system throws an exception and makes an entry in the adapter’s error log file.
restoreConfigValues(): Allows you to restore the configuration parameter defaults to the related adapter configuration.
connect(), disconnect(), and isConnected(): Perform connection-related operations with respect to the FTP server.