Link to home
Start Free TrialLog in
Avatar of Helen_B
Helen_B

asked on

Using RMI and the FileSystemView class

Hi

I have two Java applications that communicate via RMI. In the client application I want to allow the user to specify a file on a server and then send a job to the server application. The server application requires the correct path of the file chosen by the user and the client application requires the IP address of the machine the file resides on.

In Swing for Java 1.4 it seems the JFileChooser is clever enough to browse the LAN. However, it is not possible to obtain the IP address of the machine the file resides on or the correct path due to mounted file systems etc from the JFileChooser.

To overcome this problem I am going to ask the user to specify in the preferences for the client application the IP address for all the servers the may wish to use. Then create a customised JFileChooser that has a drop down list of the specified server IP addresses. When a new IP address is selected the event handler will create a stub to a remote FileSystemView object initiated by the server application. This new remote FileSystemView object will replace the one currently used by the JFileChooser.  

I don’t know if this solution is a bit heavy handed. I also think that my problem isn’t that obscure and someone else must have encountered it before. If anyone else has an alternate solution that is a lot more elegant that would be great. Also if you think the above idea is just not feasible to implement please let me know as I am just about to start the prototyping phase.

If you haven’t guessed already, network programming is something I am relatively new to so any help would be greatly appreciated.

Thanks

Helen B
ASKER CERTIFIED SOLUTION
Avatar of krakatoa
krakatoa
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In fact, what I might look at (RMI aside) in your situation is from the initial client to server protocol primer, get the server to return its filesystemview over an objectoutputstream to a clientside filechooser constructor, and have the chosen file or files resent to the server in a similar objectstreamer. (You may even be able to re-use this clientside if required, so you could do a loop over all the servers at startup, and have them all available locally).
Please proceed with that recommendation.