Solved

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

Posted on 2004-03-24
14
202 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

861 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

25 Experts available now in Live!

Get 1:1 Help Now