Demon Module Specification

Author(s): Travis Emmitt, James P. Gunderson
Date: 14-DEC-1998
Version: 3.1

Contents:

Demon Overview

Demon Architecture

Demon Module Descriptions


Return to main Software Specification page

Demon Overview

The Demon is the dependencies monitor. It's an Applet that lets a person view the status of the simulation, not from an individual developer's perspective, but as an system-wide overview.



Demon Architecture

Our system is broken into modules and structured as in the diagram below. The vertical and horizontal bars represent interfaces.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
                                .
         ServerRMItoDemonIface------DemonRMIIface
                 [...]          .         |
                                .      DemonRMI
                                .         |                MONITOR
                                .    DemonEngine           (single)
                                .         |
                                .      DemonGUI
                                .         |
                                .    DemonApplet
                                .         |
. . . . . . . . . . . . . . . . . . . . . | . . . . . . . . . . . .
                                          |
  netscape, appletviewer, etc. -->  APPLET VIEWER
                                          |
        system monitoring user -->      USER



Demon Module Descriptions

This section describes the different modules in the Demon. It focuses on their duties and interfaces.



DemonApplet

This is the main applet for the Demon. The demon is the simulation interface, which allows the user to set up the initial simulation parameters, and monitor the state of the simulation.

DemonApplet Interfaces
Method Throws Invoker Purpose
void Init () Nothing Browser Starts up the DemonGUI
boolean mouseDown (Event e, int x, int y) Nothing Browser Passes mouse events to DemonGUI
boolean action (Event event, Object object) Nothing Browser Passes event/ object to DemonGUI
void paint (Graphics graphics) Nothing applet repaint() invokes DemonGUI.Draw()
void Exit (Exception e) Nothing various Dumps stack trace to system.out, stops applet.




DemonGUI

The DemonGUI is responsible for providing a graphical monitor of the system, and a means of allowing the "boss" of the simulation to select propogations methods, delay factors, levels of automation, etc.

DemonGUI Interfaces
Method Throws Invoker Purpose
DemonGUI (DemonApplet parent_applet) NullException, Exception DemonApplet Constructor
void DisplayMap (Map new_map) NullException, Exception DemonEngine Displays the Matrix View of the map to the screen
void DisplayStats (Stats new_stats) NullException, Exception DemonEngine Displays the Stats
void DisplayClientConnectStatus (ClientConnectStatus new_ccs) NullException, Exception DemonEngine Displays the ccs
void Draw (Graphics graphics) Exception DemonApplet Displays the drawable objects
void HandleClick (Event event, int x, int y) Nothing DemonApplet Determine the source of the event, and update the engine
void HandleAction (Event event, Object object) Exception DemonApplet Determine the source of the event, and update the engine
void Notify (String string) Nothing DemonEngine Displays the String to the status area
void Freeze () Nothing DemonEngine Disables user input
void Unfreeze () Nothing DemonEngine Enables user input
void Error (Exception e) Nothing DemonEngine Displays exception stack trace




DemonEngine

This module handles the high-level logic involved in the operation of the Demon. It decides what happens when the user interacts with the DemonGUI, what happens when the Demon receives a message from the Server, etc.

DemonEngine Interfaces
Method Throws Invoker Purpose
DemonEngine (DemonGUI gui, String address, String port) Exception DemonGUI By passing a reference to itself when calling the DemonEngine construtor, DemonGUI gives DemonEngine a way to invoke the DemonGUI methods, enabling two-way communication between the GUI and the engine. This constructor then creates a DemonRMI, establishing a similar two-way interface. It then performs any other needed initialization.
void Error (Exception e)   ClientRMI Called when the DemonRMI wants to pass an exception to the DemonGUI for display.
void ReceiveStats (Stats my_stats) Exception DemonRMI When the DemonRMI receives new statistics from the ServerRMI, it passes the stats to the DemonEngine via this method. The DemonEngine then passes the stats to the DemonGUI, whose job it is to display it.
void ReceiveState (int state) Exception DemonRMI Passes Demon's state to GUI from RMI so GUI knows which buttons to turn on and off.
void ReceiveMap (Map my_map) Exception DemonRMI When the DemonRMI receives a new map from the ServerRMI, it passes the map to the DemonEngine via this method. The DemonEngine then passes the map to the DemonGUI, and subsequently tells the DemonGUI to display it.
void ReceiveClientConnectStatus (ClientConnectStatus status) Exception DemonRMI This method passes a ClientConnectStatus object to the DemonEngine, where it is passed on to the DemonGUI. This object tells the demon the number of users, and the connection status of each user.
void QuitClicked () Exception DemonGUI Called when the user clicks on the quit button on the user interface. Subsequently calls the ShutDown() method in the DemonRMI module. Returns when shutdown is complete.
boolean SetParameters (int propagation, long delay) Exception DemonGUI Called to pass propagation mechanism and length of cycle delay in millisseconds. Subsequently calls SetParameters() method of DemonRMI. Returns true if propagation and delay are set successfully.
void PrintMessage (String s)   DemonRMI When the DemonRMI wants to print a string to the GUI, it calls this method. This method subsequently calls the Notify() method belonging to the DemonGUI.
boolean SubmitMode (int mode, int runs) Exception DemonGUI Called when the DemonGUI wants to submit the mode to DemonRMI. This method subsequently calls the SubmitMode method belonging to the DemonRMI. Returns true if mode set successfully, otherwise false.
void AbortClicked () Exception DemonGUI When the user wants to abort the current simulation run, he clicks Abort and the DemonGUI calls this method. Subsequently, the Abort method belonging to the DemonRMI is called.
void Quit () Exception DemonGUI When the applet is destroyed, the DemonGUI calls this method, which subsequently calls Quit() in the DemonRMI to inform the system that an applet is going away.




DemonRMI

This module handles all the communications for the Demon, both incoming (from the server-side), and outgoing (calls onto the DemonRMI made by DemonEngine).

DemonRMI Interfaces
Method Throws Invoker Purpose
DemonRMI (DemonEngine engine) Nothing DemonEngine This constructor receives a reference to the DemonEngine to be able to later make calls to it as RMI calls are received. In the constructor, DemonRMI exports itself.
Map Connect (String ip, String port) RemoteException, Exception DemonEngine Makes sure the server exists at given ip/port, and requests an initial map from the server.
boolean RegisterWithServer () RemoteException, Exception DemonEngine When called, this method invokes the server demon registration method, which makes sure that the server gets the demon's interface, and thus the server knows how to talk back to the demon.
void Quit () Exception DemonEngine Called when the applet is shut down. Last warning to the server.
void ReceiveMap (Map my_map) RemoteException, Exception ServerRMI (RMI call) ServerRMI passes the map to DemonRMI, which then passes it to DemonEngine. Makes a call to DemonEngine's ReceiveMap.
void ReceiveStats (Stats my_stats) RemoteException, Exception ServerRMI (RMI call) Another pass-through method. ServerRMI calls it, and ReceiveStats passes a Stats object to the engine. Calls the DemonEngine's ReceiveStats.
void ReceiveClientConnectStatus (ClientConnectStatus status) RemoteException, Exception ServerRMI (RMI call) Similar to the other two receive methods, except that a ClientConnectStatus is received and passed on. Calls the DemonEngine's ReceiveClientConnectStatus.
boolean SubmitMode (int mode, int runs) RemoteException, Exception DemonEngine Send the mode and a number of runs to the server.
boolean StartRun (int propagation, long delay) RemoteException, Exception DemonEngine Makes an RMI call to the ServerRMI's SetParameters() method. This will start the simulation, regardless of who has submitted their maps.
boolean Abort () RemoteException, Exception DemonEngine Called when we want to stop a simulation.
boolean ShutDown () RemoteException, Exception DemonEngine Calls the ServerRMI's Shutdown() method. The ServerRMI then tells each client to shutdown, and returns the cumulative result of those calls as a boolean value.




DemonRMIIface

This is merely an interface which the DemonRMI presents to ServerRMI. All communication from server to the demon is based on this interface. For descriptions of each method, please see the notes on their implementation in ServerRMI.

DemonRMIIface Interfaces
Method Throws Invoker Purpose
void ReceiveClientConnectStatus (ClientConnectStatus status) RemoteException, Exception ServerRMI (RMI call) (see same method in DemonRMI)
void ReceiveStats (Stats my_stats) RemoteException, Exception ServerRMI (RMI call) (see same method in DemonRMI)
void ReceiveMap (Map my_map) RemoteException, Exception ServerRMI (RMI call) (see same method in DemonRMI)



Return to the main Software Specification page
Revision history:

Version 3.1 - 14-DEC-1998 txe
Updated dates, version numbers, format, return values, diagram

Version 3.0 - 14-DEC-1998 rgb
Updated DemonEngine constructor to take port and address
Added ReceiveState() to DemonEngine

Version 2.6 - 03-DEC-1998 rgb
Added Quit() to DemonEngine

Version 2.5 - 02-DEC-1998 rgb
Added SubmitMode() and AbortClicked() to DemonEngine

Version 2.4 - 20-NOV-1998 jpg
Updated DemonGUI (added Exceptions)

Version 2.3 - 18-NOV-1998 Orim
Added DemonRMI, DemonRMIIface information

Version 2.2 - 18-NOV-1998 rgb
Fixed exceptions thrown in DemonEngine
Added Error() to DemonEngine

Version 2.1 - 16-NOV-1998 jpg
Added DemonGUI, DemonApplet

Version 2.0 - 16-NOV-1998 txe
Initial creation (split from spec.html)