wood burning stoves*
The moose likes Distributed Java and the fly likes passing a file object between two remote systems using RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "passing a file object between two remote systems using RMI" Watch "passing a file object between two remote systems using RMI" New topic
Author

passing a file object between two remote systems using RMI

s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 151
hi,

Can we pass a file object between two remote systems using RMI by any means?

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Assuming you are talking about a java.io.File object - the "abstract representation of directory and file pathnames" - well File is serializable so you could pass it, but why would you want to since I don't see how those names could be meaningful on the receiving system.

Bill
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 151
thanks for replying. well, it's not only the name, but i need the complete file on the other system. there is an existing application based on RMI, I have to add few things to it. They are saying that they will be passing files from their client machine, I need to process it and send it to some other business processing layer. I don't know how they actually pass the file, as I see it, even if we serialize a file object, we would only get the file attribute with the reference and not the content, so it is looking really odd to me.

I wanted to know if it is possible by some means, something which I may not be knowing about object reference or file object reference to be specific. is there a way to get a file remotely along with a content using RMI? logically it seems to be contrary to the object reference working itself.

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Please clarify - do you really need to physically move the file from machine A to machine B so machine B can work on it or would reading the file as a stream (say with sockets) from machine A be sufficient?

How much control do you have over machines A and B?

Hopefully you now realize that moving a File object is not what you want.

Bill
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 151
File movement is not a requirement. Reading the file and its content would be sufficient. RMI is used in the existing architecture, so I can't design anything more suitable for this requirement. a client system will be sending an array of files to the server, at the server I should have the file and the content, which I can process further according to the business process.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I just did a google search for "java rmi file streaming" - a couple of potentially useful references popped up, including a recent one on sourceforge.

Bill
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 151
William Brogden wrote:I just did a google search for "java rmi file streaming" - a couple of potentially useful references popped up, including a recent one on sourceforge.

Bill


thanks for the reply. I will check it out. This can be a good solution. Only issue I see it that if I use inputstream concept, then I will have to tell the client to pass the inputstream in place of the file array, that is upto them to agree or not. If they are fine with it, then some headache will be removed from my end..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing a file object between two remote systems using RMI
 
Similar Threads
Use of sockets through RMI
RMI structure,protocol
Sun article : RMI vs. CORBA in Developing Distributed Applications
Interview question
JRMP in EJB ??