Solved

Get File Properties of a file residing on FTP server from APP Server

Posted on 2004-03-24
14
196 Views
Last Modified: 2010-05-18
Hi All,

I have a scenaraio where files are FTP'd by the client to FTPServer & my Helper class which resides on APP Tier(EJB tier) should get the file size of the file FTP'd to the FTPserver using FTPServer,FTPDir & filename parameters from the APP server.Once the file size of tht file is got,the either file has to be moved by creating a directory  or deleted from the FTP server.
I would need ur help on how can i get the file size from the FTP server through my APP server.Both servers are on diffrent machines??
How can  create dir's or move & delete files from FTP server from my EJB tier??
Kindly help me on how do i implement this in java.

Thanks in advance.
Rashmi
0
Comment
Question by:gcr2002
  • 5
  • 5
  • 2
14 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
You will have to rely on the FTP protocol completely. Good thing it is very well specified! :-)

See http://www.faqs.org/rfcs/rfc959.html  for details.

The command for getting the file size is 'ls' (without the quotes). There will be some parsing of the result involved. You can rename, copy and delete files and directories using FTP commands.

You will have to use an FTP client inside your EJB tier. The protocol is pretty small, not too difficult to implement the client yourself, and there are free implementations available on the internet.
0
 
LVL 9

Expert Comment

by:mmuruganandam
Comment Utility
Use this freeware,

http://www.fooware.com/downloads/fooware_FtpClient-1.0.tgz

(The file within this tgz is a jar file which is not present within that tgz.  Extract that file and add the extension to jar)


You have the example at
http://www.fooware.com/docs/API_ftpclient.html


Hope this helps.
0
 

Author Comment

by:gcr2002
Comment Utility
hey one more thing,i got to know just know it can be any server,need not necesaarily be FTP server.We give the server name to the client & they will fTP to that server which will be a backend server.How do i implement in this case.It shud be assumed tht it can be any server need not be FTP Server.Please Help
0
 
LVL 9

Expert Comment

by:mmuruganandam
Comment Utility
You need to have your server (own socket implementation) sitting at the designated end.

That is the only possible solution.
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
I would strongly recommend using an ftp server. Why would you want to re-invent the wheel? It seems to me that ftp will solve your problem. It can be done for a low cost.
0
 
LVL 9

Expert Comment

by:mmuruganandam
Comment Utility
>> it can be any server,need not necesaarily be FTP server

orangehead911, their requirement is like that it seems.  So it is possible only via the custom server or using RMI.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
>>>> it can be any server,need not necesaarily be FTP server

>> orangehead911, their requirement is like that it seems.  So it is possible only via the custom server or using RMI.

The statement means that any solution that meets the requirement will do, ftp is included.

So, please read the questions properly before you answer and make categorical statements such as: " You need to have your server (own socket implementation) sitting at the designated end. That is the only possible solution." or " So it is possible only via the custom server or using RMI."
0
 
LVL 9

Expert Comment

by:mmuruganandam
Comment Utility
orangehead911,

Well!  FTP is very well included in the solution.  Since she is specifically saying that "it need not be FTP Server"
Can you tell me, in that case, what would be solution.

Please read the post properly.

If you look at my initial post, I was also giving the FTP related stuffs.  Since, the author specifically saying it need not be FTP Server, we need to look out for different solution.

0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
mmuruganandam,

Rashmi is asking for a solution to two problems, whereas initially it was only one. One solution for discovery of the FTP service, and one solution for the actual FTP service.

Your comment attacking my statement was utterly uncalled for, unprofessional and essentially incorrect. There is a nice little thing called JNDI which can be used to obtain information about services, in this case an FTP or FTP-like service. No need for a custom implementation. Once more, why reinvent the wheel?

This might be a case of the language barrier, in any case, good luck Rashmi!
0
 

Author Comment

by:gcr2002
Comment Utility
I have not got my solution yet.Can someone help me on this please.The file could reside on any server.I have to read the file paramaters or delete file residing on the remote server.I need to perform any file related stuff from my java code on the remote server.Can someone suggest how can i implement this?
0
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 63 total points
Comment Utility
If you use JNDI you can create service names, the result of a query is for instance a protocol/resource address. You would then use this information to connect to whatever service and or server you need.
0
 
LVL 9

Assisted Solution

by:mmuruganandam
mmuruganandam earned 62 total points
Comment Utility
Why don't you try RMI
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count7 challenge 12 66
java set up 1 45
Which is the latest version of Apache Tomcatl 3 35
JList custom Cell Renderer refresh 15 39
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now