News Server Semestral Project (SWI068 - Object Oriented Systems)

by Tomáš Matoušek & Ladislav Prošek

Basic information

We have worked out the extended assignment, version A (only a Czech version is available at the moment). The server has no user interface at all. Clients have a Swing-based graphical user interface. As far as we know, all required functionality is implemented.

Build instructions

If you have a working MS Visual Studio .NET 2003 installation, just open OOS.sln OOS.sln and build the entire solution. If you don't have VS.NET but you have Windows, execute the Build.bat batch file. If you don't have Windows, you can build the project manually - process the OOS.idl file and then compile all *.java files in IDL/OOS, Client and Server directories.

Running the programs

If you have Windows, execute the RunServer.bat and RunClient.bat batch files. If you don't have Windows, you can run the programs manually - with all the Java- and Jacorb-related environment variables set appropriately, instruct your Java VM to execute ServerMain and ClientMain classes.

The server program expects one argument that specifies a name under which it registers itself in the Naming Service. The client program can also be given one argument that specifies a nick name of the client. However, if the argument is not given, user is requested to supply a nick name after the program is started.

Using the programs

The server program has no user interface at all. After you've run it, the only thing you can do is shut it down by pressing Ctrl+C.

The client program represents one client and has a Swing-based graphical user interface. In the left pane there is tree rooted with "News servers" node. Under this node it displays servers, under servers there are news groups and finally, clients are child nodes of the news groups they are subscribed to. There are seven buttons whose functionality might depend on the tree node that is currently selected.

  1. Connect to server... is always enabled and works regardless of the selected tree node. It prompts the user for server name, tries to look up this name in the Naming Service and if found, adds server-groups-clients subtree into the tree. Pressing this button will typically be the first thing you do after running the client program. You can add the same server more than once - it does nothing but adding a subtree and remembering references to the server, its groups and subscribed clients.
  2. Create group... is enabled only if the selected node represents a news server. In that case, it prompts the user for news group name and tries to create the group in the particular server.
  3. Delete group is enabled only is the selected node represents a news group. In that case, this particular news group is deleted from its news server. All subscribed clients are notified and respond by closing the tab in the right pane (see later).
  4. Subscribe is enabled if the selected node represents a news group. In that case, the client represented by this program is subscribed to the news group and a new tab appears in the right pane. This button alternatively shows Send private msg when the selected node prepresents a client that is not equal to the client represented by this program. In that case, a new tab appears in the right pane (with no communication taking place).
  5. Interconnect groups is enabled if the selected node represents a news group and the selected tab in the right pane represents another group. In that case, these two groups are interconnected as required by the assignment. This button alternatively shows Clone subscription if the selected node represents a client that is not equal to the client represented by this program. In that case, subscription of the selected client is cloned for "this" client as required by the assignment.
  6. Disconnect groups is enabled only if the selected node represents a news group and the selected tab in the right pane represents another group. If an edge exists between these two groups in the graph of interconnected groups, this edge is removed. Beware that the groups may still be interconnected via another group(s). This is an extra functionality not required by the assignment.
  7. Refresh tree is always enabled and works regardless of the selected tree node. It re-scans news servers for available news groups and these in turn for subscribed clients. The tree is then refreshed to reflect the current state. You will use this button quite often as there are no client notifications for most changes that happen on servers.

In the right pane there are tabs representing the news groups this client is subscribed to, and clients with whom this client has some private communication. Type messages into the text line in the bottom and send them with ENTER. Detailed description is omitted since this part is pretty intuitive - especially for anyone who's ever used some kind of chat or instant messaging system.

Internals

The IDL file is IDL/OOS.idl. All string parameters are declared as wstring to support Czech characters. The implementation is quite straightforward (see javadoc-generated documentation).

Regarding the interconnected groups cycle issue: the graph of interconnected groups can contain cycles. Every message that is being forwarded among groups carries a list of groups where it has already been (see news group's forwardMessage operation). This means that a spanning tree is implicitly constructed every time a message is sent into one of the groups. This is a robust, bulletproof solution that might, however, suffer from bad scalability.

As for the dead client issue: the client's acceptMessage operation is declared oneway, so that a dead client does not affect the (single-threaded) message distribution. Moreover, there is thread in the server that periodically checks for dead clients and unsubscribes them.

Source code

Complete source code is available in a form of Microsoft Visual Studio .NET 2003 solution.