Solved

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

Posted on 2004-03-24
14
216 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 video teaches viewers about errors in exception handling.

688 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