Programming Assignment: Remote Access
due Monday, October 14
Use Java's remote method invocation system to implement a simple remote
login facility. You should provide two programs: a client and a server.
The Client
Upon start-up, the client program should ask for the IP address of the
server. (Provide some mechanism for dealing with the situation that
the server's JVM is running on the same machine as the client.) At
this point the client program should present a window that prompts the
user to enter a user ID and a password. You'll probably want to use
the JTextField class to allow the user to enter data from within the GUI.
Clicking on a button should cause the client to attempt to "log onto" the
server process. If this is not successful, an appropriate message
should be printed on the client window. If it is successful, the
client window should change to provide four new buttons: "list all files",
"delete a file", "create a file", "logoff".
-
The "list all files" button should list all the files belonging to a user.
(At the server side, you can implement these as actual files, or just maintain
a list of strings, corresponding to file names.)
-
The "delete a file" button should prompt the user for a file name, and
then delete that file. For 5% extra credit, display the file names
in a scrollable/selectable list. Double-clicking on a file name should
cause it to be deleted.
-
The "create a file" button should prompt the user for a file name, and
then create such a file.
-
The "logoff" button should disconnect the client from the server, and return
to the window prompting the user for another userID and password.
-
Your GUI need not be exactly like this, but you should be relatively
easy-to-use and easy-to-understand. Be imaginative!
The Server
Before starting your client program, you should start the server program
in its own JVM. The server program must provide a mechanism for creating
new userIDs, and new passwords. It must also provide a mechanism
for listing the files belonging to each user, and for adding and deleting
"files". The mechanism should make use of Java's GUI capabilities,
providing, say, a button to list, add, and delete files, much as in the
Client program. The GUI should display the name of the user currently
connected to the Server, if there is one.
The files need not be actual disk files. If you'd rather, you
can simply emulate "virtual files". Simply provide a data structure
for keeping track of the names associated to these "virtual files" by each
user of the Client.
You might want to start by compiling and running Silberschatz's RMI-based
producer/consumer solution on two machines in the lab, or via two separate DOS
shells, as I showed in class. See the on-line notes for how to do this.
What to turn in:
I will expect you to demonstrate your system in one of the departmental
open labs. I will award 5% extra credit if the demonstration runs
the Client and Server on different computers in the lab.
You should also submit your files via the hwmatt system.
For another 5% extra credit, provide some kind of encryption of the
userID and password as they are passed from Client to Server. Display
the encrypted information on both the client and server as it is sent/received
(this can be in the console windows).
Fair Warning:
The tardiness policy WILL be enforced on this assignment!