The application in this Magercise is a simple message box, like a
telephone answering machine. The MessageBox interface has an
operation for leaving messages, another for the owner to get the
messages, and an attribute for setting the reply that is sent out when
a message is left. Here is the IDL file:
1. First generate the IDL file.
2. Examine the generated Java interface in MessageModule/MessageBox.java.
Using the given skeleton file, MessageBoxImpl.java, implement
the necessary methods.
Don't forget to add a constructor. It should take a string argument
as a name, and call the superclass constructor to set the name of the
object.
Notice how the sequence is generated. No MessageSeq class is
created; instead you use the Java type String[]. There are,
however, helper and holder classes generated for MessageSeq.
3. Modify the MBServer class to instantiate a MessageBoxImpl with a name of your choosing. Remember, you want this name to be unique to avoid conflicts with other ORBs on your network.
4. Look at the MBClient source code provided for you. Make sure
you understand how the command-line parameters are parsed. The usage
of MBClient is:
vbj MBClient servername command param
vbj MBClient servername leave message
vbj MBClient servername reply reply-messsage
vbj MBClient servername get
5.
Finish the skeleton version of MBClient by adding code as
specified by the comments. You should call the reply setter
to set an appropriate reply, call leaveMessage to leave some
messages, and retrieve your messages using getMessages so
they can be printed out.
6. Now compile the program, using vbjc.
7. Run the server: start vbj MBServer. Check that it is
running ok.
8. Run the client: vbj MBClient servername command
param. Check the output of your program.
See the expected behavior section for more detail on the
correct output for your program.
9. If you happen to have multiple machines, run the program on each and
leave and retrieve messages on the other message boxes.
If you leave too many messages, then leaving another message should
produce an infomative message (like "BEEEEEEEEEP").