Solved

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

Posted on 2004-03-24
14
205 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
ID: 10674733
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
ID: 10674786
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
ID: 10674817
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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10674832
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
ID: 10674966
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
ID: 10674979
>> 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
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 10675067
>>>> 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
ID: 10675089
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
ID: 10675135
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
ID: 10820550
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
ID: 10820977
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
ID: 10821000
Why don't you try RMI
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 91
tomcat not starting 6 45
Problem to Alipay 10 22
printf performancy 11 42
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 first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

810 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