Solved

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

Posted on 2004-03-24
14
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 48
ejb example issues 3 54
mysql jsp example issue 32 74
Setup GlassFish 4 35
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

733 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