Solved

Using RMI and the FileSystemView class

Posted on 2004-04-02
6
497 Views
Last Modified: 2013-12-29
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
0
Comment
Question by:Helen_B
[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
  • 2
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
krakatoa earned 63 total points
ID: 10739799
AFAIK, the filechooser can look at a filesystemview, so once you have both of these components, it shouldnt matter where they came from in principle. If that's so, then the passing of a simple protocol from client to server requesting the server's filesystemview and (possibly) filechooser, could be sufficient to set up a clientside gui. But how this fits in with RMI would be for others to say. I reckon the local filechooser can only know the local system and LAN, as that is known to the OS; but you want a file/drive view that only your apps know about, so I cant see how else it could happen. Just a thougt. ;)
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 62 total points
ID: 10739917
As far as I know, you need to map to that network drive (Windows) to be able to view the files there.

See if there's something on:

http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 10739953
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).
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10946203
Please proceed with that recommendation.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Oracle SQL syntax check  without executing 6 104
HashTable highest marks enumeration alternative 9 47
Configure a Bean in an XML file 4 48
junit example issue 2 23
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…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

735 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