SyntaxHighlighter

Saturday, November 29, 2008

FTP Operations In Enterprise applications

As far as my experience in enterprise application domain especially the application having integration kind of nature requires frequent FTP operation.
Recently me too had similar requirement,wherein I need to fetch a file from the remote server....
I was using Mule as integration bus for my application,though Mule provides in built support for FTP transport,It has 1 major drawback in case of FTP operations as listed below
1.Mule FTP Connector has polling nature and it deletes the file once its downloaded from FTP server.
Sometimes its allowed and perfectly acceptable to delete the downloaded file from remote FTP server but not always.
That lead me to apache commons NET project
This project consists of basic client side implementation of transport protocols such as SMTP,FTP,POP..
If you look at these API's these are one of the most simplest way to implement the FTPCleint
FTPClient ftpClient = new FTPClient();
ftpClient.connect("ftp.foo.com", "user01", "pass1234");
ftpClient.download("C:\\Temp\\", "README.txt");
// Eventually other operations here ...
ftpClient.disconnect();

Can you see ,how simple is this code...