This is a distributed chat room service built using the Java Remote Method Invocation (RMI) framework. In the chat service chat room providers may create and subsequently register any number of chat rooms with the service’s registry (not to be confused with the Java RMI registry). Chat clients may query the service’s registry for registered chat rooms, join them, and send messages to the room’s participants.
The chat service's components may be started from the command line.From the command line, cd to the directory containing this file.
$ cd /path/to/this/directory
Temporarily configure your machine's CLASSPATH
.
$ export CLASSPATH=$CLASSPATH:/path/to/this/directory/bin
Start the Java RMI registry.
$ rmiregistry &
Start the chat service's registry.
$ java -cp bin \
-Djava.rmi.server.codebase=file:bin/ \
-Djava.security.policy=file:src/edu/courses/middleware/chatservice/policy \
edu.courses.middleware.chatservice.ChatRegistry
Next, you may start any number of chat room providers each in their own command line window.
To start a chat room provider open a new command line window and perform the first step.
Then you may start the chat room provider providing the hostname of the machine on which the
chat service registry is running. This will be localhost
if using one machine.
$ java -cp bin \
-Djava.rmi.server.codebase=file:bin/ \
-Djava.security.policy=file:src/edu/courses/middleware/chatservice/policy \
edu.courses.middleware.chatservice.ChatProvider localhost
A chat room provider may be controlled using its command line interface (CLI). Once a chat room provider is started you will be prompted for a screen name. Enter a screen name to register your chat room provider's client with the chat registry. You may then operate the chat room provider using valid commands. At any time you use the command "h" (help) to see a list of available commands and their usage.
Chat room providers aren't required to run on the same machine as the chat service registry. The only requirement is that chat room providers are provided the hostname of the machine on which the chat service registry is running.