Index: trunk/src/tmcsim/cadsimulator/managers/IncidentManager.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/managers/IncidentManager.java	(revision 2)
+++ trunk/src/tmcsim/cadsimulator/managers/IncidentManager.java	(revision 123)
@@ -7,5 +7,5 @@
 import tmcsim.cadmodels.IncidentInquiryModel_obj;
 import tmcsim.cadmodels.IncidentSummaryModel_obj;
-import tmcsim.cadsimulator.CADSimulator;
+import tmcsim.cadsimulator.CADServer;
 import tmcsim.cadsimulator.Coordinator;
 import tmcsim.cadsimulator.SoundPlayer;
@@ -247,5 +247,5 @@
                 
             for(IncidentEvent event : inc.getCompletedEvents()) {
-                event.finalizeEvent(currentSimTime, CADSimulator.getCADTime());
+                event.finalizeEvent(currentSimTime, CADServer.getCADTime());
                 updateIncident(inc.getLogNumber(), event);
                 theCoordinator.updateIncidentInGUI(inc.getLogNumber(), event);
@@ -311,6 +311,6 @@
         if(targetIncident == null) {
             completedEvent.eventInfo.getHeader().logStatus    = "A";             
-            completedEvent.eventInfo.getHeader().incidentDate = CADSimulator.getCADDate().substring(0,4);  
-            completedEvent.eventInfo.getHeader().incidentTime = CADSimulator.getCADTime();
+            completedEvent.eventInfo.getHeader().incidentDate = CADServer.getCADDate().substring(0,4);  
+            completedEvent.eventInfo.getHeader().incidentTime = CADServer.getCADTime();
             
             targetIncident = new IncidentInquiryModel_obj(completedEvent.eventInfo);
Index: trunk/src/tmcsim/cadsimulator/managers/MediaManager.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/managers/MediaManager.java	(revision 44)
+++ trunk/src/tmcsim/cadsimulator/managers/MediaManager.java	(revision 123)
@@ -19,5 +19,5 @@
 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;
 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;
-import tmcsim.cadsimulator.viewer.model.CADSimulatorModel;
+import tmcsim.cadsimulator.viewer.model.CADSimulatorState;
 import tmcsim.common.CCTVDirections;
 import tmcsim.common.CCTVInfo;
@@ -74,5 +74,5 @@
     
     /** Reference to the CADSimulatorModel. */
-    private CADSimulatorModel theModel;
+    private CADSimulatorState theModel;
 
     /** Properties object for the Media portion of the CAD. */
@@ -90,5 +90,5 @@
      */
     public MediaManager(String propertiesFile, ATMSManager theATMSManager, 
-            CADSimulatorModel model) {
+            CADSimulatorState model) {
         theDVD_DB   = new DVDPlayerDB();        
         theImage_DB = new StillImagesDB();
Index: trunk/src/tmcsim/cadsimulator/managers/SimulationClockManager.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/managers/SimulationClockManager.java	(revision 123)
+++ trunk/src/tmcsim/cadsimulator/managers/SimulationClockManager.java	(revision 123)
@@ -0,0 +1,91 @@
+package tmcsim.cadsimulator.managers;
+
+import java.rmi.RemoteException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import tmcsim.cadsimulator.Coordinator;
+import tmcsim.common.CADEnums.SCRIPT_STATUS;
+
+/** Manage the simulation clock, "the heartbeat of the simulation". */
+public class SimulationClockManager  {
+
+    /** 
+     * Define what happens every second.
+     */
+    private class ClockTask extends TimerTask {     
+        public void run() {
+            currentSimTime++;
+            theCoordinator.tick();
+        }
+    }
+    
+    /** The SimulationTimer used to keep track of simulation time. */
+    private Timer simTimer = null;
+    
+    /**  */
+    private Coordinator theCoordinator;
+    
+        /**
+     * Boolean flag to designate whether the simulation has been started or not.
+     */    
+    private boolean simulationStarted;
+    
+    /**
+     * Object used to count the number of seconds that the simulation has run.
+     * The value is initialized to 0, and is reset to 0 every time a new simulation
+     * is loaded, or the current simulation is stopped and reset.
+     */
+    private long currentSimTime;    
+    
+    
+    public SimulationClockManager(Coordinator coor) {
+        
+        theCoordinator    = coor;       
+        simulationStarted = false;
+        currentSimTime    = 0;    
+    }
+    
+    public boolean simulationStarted() {
+        return simulationStarted;
+    }
+    
+    public long getCurrentSimTime() {
+        return currentSimTime;
+    }
+    
+    public void gotoSimulationTime(long newSimTime) {
+        currentSimTime = newSimTime;
+    }
+    
+    public void startSimulation() {
+        /** Start the clock running */    
+        simTimer = new Timer();     
+        simTimer.scheduleAtFixedRate(new ClockTask(), 0, 1000);
+        
+        simulationStarted = true;   
+        
+        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING);
+    }
+    
+    public void pauseSimulation() {  
+        
+        if(simTimer != null)
+            simTimer.cancel();          
+            
+        simulationStarted = false;              
+        
+        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_PAUSED_STARTED);
+    }
+    
+    public void resetSimulation() throws RemoteException {      
+        
+        if(simTimer != null)
+            simTimer.cancel(); 
+         
+        currentSimTime = 0;              
+        
+        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED);
+    }
+    
+}
Index: trunk/src/tmcsim/cadsimulator/managers/SimulationControlManager.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/managers/SimulationControlManager.java	(revision 2)
+++ 	(revision )
@@ -1,90 +1,0 @@
-package tmcsim.cadsimulator.managers;
-
-import java.rmi.RemoteException;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import tmcsim.cadsimulator.Coordinator;
-import tmcsim.common.CADEnums.SCRIPT_STATUS;
-
-public class SimulationControlManager  {
-
-    /** 
-     * 
-     */
-    private class ClockTask extends TimerTask {     
-        public void run() {
-            currentSimTime++;
-            theCoordinator.tick();
-        }
-    }
-    
-    /** The SimulationTimer used to keep track of simulation time. */
-    private Timer simTimer = null;
-    
-    /**  */
-    private Coordinator theCoordinator;
-    
-        /**
-     * Boolean flag to designate whether the simulation has been started or not.
-     */    
-    private boolean simulationStarted;
-    
-    /**
-     * Object used to count the number of seconds that the simulation has run.
-     * The value is initialized to 0, and is reset to 0 every time a new simulation
-     * is loaded, or the current simulation is stopped and reset.
-     */
-    private long currentSimTime;    
-    
-    
-    public SimulationControlManager(Coordinator coor) {
-        
-        theCoordinator    = coor;       
-        simulationStarted = false;
-        currentSimTime    = 0;    
-    }
-    
-    public boolean simulationStarted() {
-        return simulationStarted;
-    }
-    
-    public long getCurrentSimTime() {
-        return currentSimTime;
-    }
-    
-    public void gotoSimulationTime(long newSimTime) {
-        currentSimTime = newSimTime;
-    }
-    
-    public void startSimulation() {
-            
-        simTimer = new Timer();     
-        simTimer.scheduleAtFixedRate(new ClockTask(), 0, 1000);
-        
-        simulationStarted = true;   
-        
-        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING);
-    }
-    
-    public void pauseSimulation() {  
-        
-        if(simTimer != null)
-            simTimer.cancel();          
-            
-        simulationStarted = false;              
-        
-        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_PAUSED_STARTED);
-    }
-    
-    public void resetSimulation() throws RemoteException {      
-        
-        if(simTimer != null)
-            simTimer.cancel(); 
-         
-        currentSimTime = 0;              
-        
-        theCoordinator.setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED);
-    }
-    
-}
Index: trunk/src/tmcsim/cadsimulator/CADServer.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADServer.java	(revision 123)
+++ trunk/src/tmcsim/cadsimulator/CADServer.java	(revision 123)
@@ -0,0 +1,426 @@
+package tmcsim.cadsimulator;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.util.Calendar;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import javax.swing.JWindow;
+import javax.swing.UIManager;
+import javax.xml.parsers.DocumentBuilderFactory;
+import tmcsim.cadsimulator.db.CMSDiversionDB;
+import tmcsim.cadsimulator.managers.ATMSManager;
+import tmcsim.cadsimulator.managers.IncidentManager;
+import tmcsim.cadsimulator.managers.MediaManager;
+import tmcsim.cadsimulator.managers.ParamicsSimulationManager;
+import tmcsim.cadsimulator.managers.SimulationClockManager;
+import tmcsim.cadsimulator.viewer.model.CADSimulatorState;
+import tmcsim.common.SimulationException;
+import tmcsim.interfaces.CADViewer;
+
+/**
+ * CADSimulator is main class for the CAD Simulator application. At construction
+ * the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are
+ * initialized and data relationships are established. Simulation control is
+ * managed through the Coordinator and Managers. The CADSimulator contains the
+ * instances of all Manager Objects that are used to control the Simulation flow
+ * of data.<br>
+ * <br>
+ *
+ * The CADSimulator is initialized with a properties file containing the
+ * following data items:<br>
+ * <code>
+ * -----------------------------------------------------------------------------<br>
+ * CADClientPort The port number to use for remote CAD Client connections.<br>
+ * CoordinatorRMIPort The port number to use for binding the Coordinator.<br>
+ * CMSDiversionXML The filepath for the xml file containing initialization data
+ * for the Diversion "database." AudioFileLocation The root directory path where
+ * audio files are referenced from.<br>
+ * ParamicsProperties The filepath for the properties file to initialize the
+ * ParamicsControlManager.<br>
+ * ATMSProperties The filepath for the properties file to initialize the
+ * ATMSManager.<br>
+ * MediaProperties The filepath for the properties file to initialize the
+ * MediaManager.<br>
+ * ErrorFile The filename of the error file used for logging errors.<br>
+ * ----------------------------------------------------------------------------<br>
+ * Example File:<br>
+ * CADClientPort = 4444<br>
+ * CoordinatorRMIPort = 4445<br>
+ * CMSDiversionXML = ../data/cmsdiversions.xml<br>
+ * AudioFileLocation = ../audio/<br>
+ * ParamicsProperties = ../config/paramics.properties<br>
+ * ATMSProperties = ../config/atms.properties<br>
+ * MediaProperties = ../config/media.properties<br>
+ * ErrorFile = cad_sim_error.xml<br>
+ * </code>
+ *
+ * @author Matthew Cechini (mcechini@calpoly.edu) jdalbey
+ * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.5 $
+ */
+public class CADServer
+{
+
+    private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties";
+    /**
+     * Error logger.
+     */
+    private static Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator");
+
+    /**
+     * Enumeration containing properties name values. See CADSimulator class
+     * description for more information.
+     *
+     * @author Matthew
+     * @see CADServer
+     */
+    private static enum CAD_PROPERTIES
+    {
+
+        /**
+         * RMI port to accept CAD Client connections.
+         */
+        CLIENT_PORT("CADClientPort"),
+        /**
+         * RMI port to bind the Coordinator to for RMI communication.
+         */
+        COOR_RMI_PORT("CoordinatorRMIPort"),
+        CAD_RMI_PORT("CADRmiPort"),
+        /**
+         * Filepath for xml file containing diversion data.
+         */
+        CMS_XML_FILE("CMSDiversionXML"),
+        /**
+         * Filepath for xml file containing dvd control data.
+         */
+        DVD_XML_FILE("DVDPlayerXML"),
+        /**
+         * Filepath for xml file containing still image control data.
+         */
+        IMAGE_XML_FILE("StillImagesXML"),
+        /**
+         * Root directory path where audio files are referenced from.
+         */
+        AUDIO_LOCATION("AudioFileLocation"),
+        /**
+         * Filepath for the properties file to initialize the media manager.
+         */
+        MEDIA_PROP_FILE("MediaProperties"),
+        /**
+         * Filepath for the properties file to initialize the paramics control
+         * manager.
+         */
+        PARAMICS_PROP_FILE("ParamicsProperties"),
+        /**
+         * Filepath for the properties file to initialize the atms manager.
+         */
+        ATMS_PROP_FILE("ATMSProperties"),
+        /**
+         * Class name of desired user interface.
+         */
+        USER_INTERFACE("UserInterface");
+        public String name;
+
+        private CAD_PROPERTIES(String nam)
+        {
+            name = nam;
+        }
+    };
+    /** NOTE: Protected fields are accessed by Coordinator */
+    /**
+     * CADSimulatorViewer instance.
+     */
+    protected static CADViewer theViewer;
+    //protected static CADSimulatorViewer theViewer;
+    //protected static CADConsoleViewer theConsole;
+    protected static CADSimulatorState theModel;
+    /**
+     * Coordinator instance.
+     */
+    protected static Coordinator theCoordinator;
+    /**
+     * SoundPlayer instance.
+     */
+    protected static SoundPlayer theSoundPlayer = null;
+    /**
+     * SimulationControlManager instance.
+     */
+    protected static SimulationClockManager theSimulationCntrlMgr = null;
+    /**
+     * ParamicsSimulationManager instance.
+     */
+    protected static ParamicsSimulationManager theParamicsSimMgr = null;
+    /**
+     * IncidentManager instance.
+     */
+    protected static IncidentManager theIncidentMgr = null;
+    /**
+     * MediaManager instance.
+     */
+    protected static MediaManager theMediaMgr = null;
+    /**
+     * ATMSManager instance.
+     */
+    protected static ATMSManager theATMSMgr = null;
+    /**
+     * Properties file for the CADSimulator.
+     */
+    private Properties cadSimulatorProperties;
+
+    /**
+     * Constructor. Load the Properties file and initialize all CAD Simulator
+     * Managers and establish Manager data relationships. A
+     * CADSimulatorSocketHandler is instantiated and started to being listening
+     * for remote CAD connections. The CMSDiversionDB is initialized with the
+     * XML data(incomplete design).
+     *
+     * @param propertiesFile Filename of CAD Simulator properties file.
+     * @throws SimulationException if there is an error in initializing the CAD
+     * Simulator.
+     */
+    public CADServer(String propertiesFile) throws SimulationException
+    {
+
+        try
+        {
+            cadSimulatorProperties = new Properties();
+            cadSimulatorProperties.load(new FileInputStream(propertiesFile));
+            cadSimLogger.logp(Level.INFO, "CADSimulator", "Constructor",
+                    "Properties loaded from " + propertiesFile);
+        } catch (Exception e)
+        {
+            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
+                    "Exception in reading properties file.", e);
+
+            throw new SimulationException(SimulationException.INITIALIZE_ERROR, e);
+        }
+
+        //Create the Coordinator and register it for RMI communicator.  Start the
+        //CAD Simulator Socket Handler to begin to accept connections from CAD Clients.
+        try
+        {
+            String userInterfaceName =
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.USER_INTERFACE.name);
+            if (userInterfaceName == null)
+            {
+                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
+                        propertiesFile + " missing property for user interface.");
+                throw new SimulationException(SimulationException.INITIALIZE_ERROR);
+            }
+            try
+            {
+                Class uiClass = Class.forName(userInterfaceName);
+                theViewer = (CADViewer) uiClass.newInstance();
+            } catch (Exception exc)
+            {
+                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
+                        "Unable to instantiate user interface: " + userInterfaceName
+                        + " " + exc);
+                throw new SimulationException(SimulationException.INITIALIZE_ERROR);
+            }
+            theModel = new CADSimulatorState();
+            theModel.addObserver(theViewer);
+
+            theCoordinator = new Coordinator(theModel);
+
+            startRegistry(Integer.parseInt(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.COOR_RMI_PORT.name).trim()));
+            startRegistry(Integer.parseInt(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.CAD_RMI_PORT.name).trim()));
+
+            theSimulationCntrlMgr = new SimulationClockManager(theCoordinator);
+
+            theATMSMgr = new ATMSManager(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.ATMS_PROP_FILE.name));
+
+            theMediaMgr = new MediaManager(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.MEDIA_PROP_FILE.name),
+                    theATMSMgr, theModel);
+
+            theParamicsSimMgr = new ParamicsSimulationManager(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.PARAMICS_PROP_FILE.name),
+                    theCoordinator, theMediaMgr);
+
+            theSoundPlayer = new SoundPlayer(
+                    cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.AUDIO_LOCATION.name));
+            theSoundPlayer.start();
+
+            theIncidentMgr = new IncidentManager(theCoordinator, theSoundPlayer);
+
+
+            //Begin accepting Client connections
+            CADSimulatorSocketHandler tmsh = new CADSimulatorSocketHandler(
+                    Integer.parseInt(cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.CLIENT_PORT.name).trim()));
+            tmsh.start();
+        } catch (RemoteException e)
+        {
+            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
+                    "Exception in starting Coordinator.", e);
+
+            throw new SimulationException(SimulationException.BINDING, e);
+        }
+
+        //Load CMS Diversion Information from the XML file
+        try
+        {
+            if (cadSimulatorProperties.getProperty(
+                    CAD_PROPERTIES.CMS_XML_FILE.name) != null)
+            {
+                CMSDiversionDB.getInstance().loadFromXML(
+                        DocumentBuilderFactory.newInstance().newDocumentBuilder()
+                        .parse(new File(cadSimulatorProperties.getProperty(
+                        CAD_PROPERTIES.CMS_XML_FILE.name))));
+            }
+        } catch (Exception e)
+        {
+            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
+                    "Exception in parsing CMSDiversion xml file.", e);
+
+            JOptionPane.showMessageDialog(new JWindow(), "Unable to open "
+                    + cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name),
+                    "Initialization Error", JOptionPane.WARNING_MESSAGE);
+        }
+
+        theViewer.setVisible(true);
+
+    }
+
+    /**
+     * Binds the Coordinator to an RMI port so that the SimulationManager can
+     * communicate with it, and so that the Coordinator can perform RMI callback
+     * method calls. The port numbers and RMI designators are parsed from the
+     * properties file file.
+     *
+     * @param theCoor A reference to the Coordinator object.
+     * @throws SimulationException if there are errors in binding the RMI to a
+     * port and name.
+     */
+    private void startRegistry(Integer regPort) throws SimulationException
+    {
+
+        try
+        {
+//            if (LocateRegistry.getRegistry(regPort) == null)
+//            {
+            LocateRegistry.createRegistry(regPort);
+            String registryURL = "rmi://localhost:" + regPort + "/coordinator";
+            Naming.rebind(registryURL, theCoordinator);
+//            }
+        } catch (Exception e)
+        {
+            throw new SimulationException(SimulationException.BINDING, e);
+        }
+    }
+
+    /**
+     * Method returns a String representation of the current time. String format
+     * is HHMM
+     *
+     * @return String representation of the current time.
+     */
+    public static String getCADTime()
+    {
+        String time = new String();
+
+        Calendar rightNow = Calendar.getInstance();
+
+        if (rightNow.get(Calendar.HOUR_OF_DAY) < 10)
+        {
+            time += "0";
+        }
+
+        time += (String.valueOf(rightNow.get(Calendar.HOUR_OF_DAY)));
+
+        if (rightNow.get(Calendar.MINUTE) < 10)
+        {
+            time += "0";
+        }
+
+        time += (String.valueOf(rightNow.get(Calendar.MINUTE)));
+
+        return time;
+    }
+
+    /**
+     * Returns a string representation of the current date. String format is:
+     * MMDDYY
+     *
+     * @return String format of the date.
+     */
+    public static String getCADDate()
+    {
+        String date = new String();
+
+        Calendar rightNow = Calendar.getInstance();
+
+        //Months are zero referenced
+        if (rightNow.get(Calendar.MONTH) + 1 < 10)
+        {
+            date += "0";
+        }
+
+        date += (String.valueOf(rightNow.get(Calendar.MONTH) + 1));
+
+        if (rightNow.get(Calendar.DAY_OF_MONTH) < 10)
+        {
+            date += "0";
+        }
+
+        date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH)));
+
+        if (rightNow.get(Calendar.YEAR) % 1000 < 10)
+        {
+            date += "0";
+        }
+
+        date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000));
+
+        return date;
+
+    }
+
+    /**
+     * Main class. Instantiate a CAD Simulator with the properties file
+     * specified on the command line or the default properties file
+     *
+     * @param args Command line arguments.
+     */
+    public static void main(String[] args)
+    {
+        if (System.getProperty("CONFIG_DIR") == null)
+        {
+            System.setProperty("CONFIG_DIR", "config");
+        }
+        try
+        {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+            String propFile = System.getProperty("CONFIG_DIR")
+                    + System.getProperty("file.separator")
+                    + CONFIG_FILE_NAME;
+            new CADServer(propFile);
+        } catch (Exception e)
+        {
+            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main",
+                    "Error initializing application.", e);
+
+            JOptionPane.showMessageDialog(new JWindow(), e.getMessage(),
+                    "Error - Program Exiting", JOptionPane.ERROR_MESSAGE);
+
+            System.exit(-1);
+        }
+
+    }
+}
Index: trunk/src/tmcsim/cadsimulator/CADSimulatorSocketHandler.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADSimulatorSocketHandler.java	(revision 2)
+++ trunk/src/tmcsim/cadsimulator/CADSimulatorSocketHandler.java	(revision 123)
@@ -66,5 +66,5 @@
                 clientSocket = serverSocket.accept();
 
-                CADSimulatorClient theTMClient = new CADSimulatorClient(clientSocket);
+                CADClientConnector theTMClient = new CADClientConnector(clientSocket);
                 theTMClient.start();
                 //CADSimulator.theViewer.connectClient();
Index: trunk/src/tmcsim/cadsimulator/CADClientConnector.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADClientConnector.java	(revision 123)
+++ trunk/src/tmcsim/cadsimulator/CADClientConnector.java	(revision 123)
@@ -0,0 +1,448 @@
+package tmcsim.cadsimulator;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.Socket;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import tmcsim.common.CADProtocol;
+import tmcsim.common.ObserverMessage;
+import tmcsim.common.CADEnums.CAD_KEYS;
+import tmcsim.common.CADProtocol.CAD_CLIENT_CMD;
+import tmcsim.common.CADProtocol.CAD_COMMANDS;
+import tmcsim.common.CADProtocol.CAD_SIMULATOR_CMD;
+
+
+/**
+ * CADClientConnector handles communication between the CAD Simulator and 
+ * remote CAD Clients.  Each instance of this class communicates with 
+ * a CAD Client through a socket.  The run() method continuously checks to see 
+ * if data has been received from the client.  If there is data, it is parsed,
+ * and the resulting action is performed by the CADScreenManager.  See the
+ * receiveObject() method description for more information.  The 
+ * CADSimulatorClient is set up as an Observer of the CADScreenManager to listen 
+ * for ObserverMessage objects.  For each object received, the appropriate
+ * action is taken, resulting in data being transmitted to the CAD Client.
+ * See the update() method description for more information.  The 
+ * CADScreenManager is set up as an observer of the Coordinator to listen
+ * for simulation data updates.
+ *
+ * @author Matthew Cechini (mcechini@calpoly.edu)
+ * @version $Date: 2006/06/14 00:12:38 $ $Revision: 1.5 $
+ */
+public class CADClientConnector extends Thread implements Observer {
+    
+    /** Error Logger. */
+    private static Logger cadLogger = Logger.getLogger("tmcsim.cadsimulator");
+    
+    /** CADScreenManager object containing the data for managing the CAD Client's view information. */
+    private CADScreenManager screenManager;
+    
+    /** Socket used for communication with the CAD Client. */
+    private Socket theSocket;
+    
+    /** ObjectOutputStream for writing objects to the socket. */
+    private ObjectOutputStream out;
+    
+    /** ObjectInputStream for reading objects from the socket. */
+    private ObjectInputStream in;
+    
+    /**
+     * Constructor.  A CADScreenManager is instantiated to manage the output
+     * transmitted to the remote CAD Client.  This object is set up as an
+     * observer to that manager to listen for data that will be transmitted
+     * across the socket.  The CADScreenManager is set up as an observer
+     * of the Coordinator.  At construction, streams are created to handle
+     * reading and writing to the Socket.  When complete, the sendScreenRefresh()
+     * method is called to initialize the client.
+     * 
+     *
+     * @param newSocket The socket to use for data transmission
+     * @throws IOException if there is an error in getting the output or input streams
+     * from the socket.
+     */
+    CADClientConnector(Socket newSocket) throws IOException{
+        
+        screenManager = new CADScreenManager(CADServer.theCoordinator);      
+        CADServer.theCoordinator.addObserver(screenManager);
+        screenManager.addObserver(this);
+        
+        
+        theSocket = newSocket;        
+        out       = new ObjectOutputStream(theSocket.getOutputStream());
+        in        = new ObjectInputStream(theSocket.getInputStream());   
+   
+        //initialize the CAD client
+        sendScreenRefresh();
+    }
+    
+    /**
+     * Method declaration for the Thread.run() method.  While the thread is not 
+     * interrupted, read Objects from the socket and call the receiveObject()
+     * method to parse the data.  If there is an IOException in communicating
+     * with the client, interrupt this thread and close the streams and Socket.
+     */
+    public void run() {
+        
+        try { 
+        
+            while(!isInterrupted()) {
+                receiveObject(in.readObject());         
+            }
+        } 
+        catch (ClassCastException cce) {
+            cce.printStackTrace();
+        }
+        catch (ClassNotFoundException cnfe) {
+            cnfe.printStackTrace();
+        }
+        catch (IOException ioe) {                   
+            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "run", 
+                    "Error in reading from Client socket: " + 
+                    theSocket.getInetAddress() + ", proceeding.\n", ioe);
+            
+            //disconnectClient();
+        }
+    }
+    
+    /**
+     * This method is called to disconnect from the remote CAD Client.
+     * This object's thread is interrupted and the streams and socket
+     * are closed.  This object is removed as an observer of the 
+     * CADScreenManager and the CADScreenManager is removed as an 
+     * observer of the Coordinator.  The viewer is then notified
+     * of a disconnecting client.
+     */
+    protected void disconnectClient() {
+        this.interrupt();
+        
+        try { out.close(); } catch (Exception e) {}
+        try { in.close(); } catch (Exception e) {}
+        try { theSocket.close(); } catch (Exception e) {}
+
+        screenManager.deleteObserver(this);
+        CADServer.theCoordinator.removeObserver(screenManager);
+        //CADSimulator.theViewer.disconnectClient();
+    }
+    
+    
+
+    /**
+     * Observer method.  The update argument is cast to an ObserverMessage 
+     * object and the message type is used to define the action taken by the
+     * CADSimulatorClient.  Command messages are created in the form of XML
+     * Document. The root Element name is value from the CAD_SIMULATOR_CMD 
+     * enumeration.  The root text content is the value Object from the
+     * received Observer argument. 
+     * 
+     * The following table describes the messages sent for the ObserverMessage 
+     * types.<br>
+     * 
+     *<table cellpadding="2" cellspacing="2" border="1"
+    * style="text-align: left; width: 250px;">
+    *  <tbody>
+    *    <tr>
+    *      <th>Observer Message Type<br></th>
+    *      <th>Command Message Type<br></th>
+    *      <th>Data Content<br></th>
+    *    </tr>
+    *    <tr>
+    *      <td>SCREEN_UPDATE<br></td>
+    *      <td>UPDATE_STATUS</td>
+    *      <td>Screen update map String.</td>
+    *    </tr>
+    *    <tr>
+    *      <td>TIME_UPDATE<br></td>
+    *      <td>UPDATE_TIME</td>
+    *      <td>CAD time String.  (HHMM)</td>
+    *    </tr>
+    *    <tr>
+    *      <td>ROUTED_MESSAGE<br></td>
+    *      <td>UPDATE_MSG_COUNT</td>
+    *      <td>Number of messages.</td>
+    *    </tr>
+    *    <tr>
+    *      <td><br></td>
+    *      <td>UPDATE_MSG_UNREAD</td>
+    *      <td>Boolean flag to designate unread messages.</td>
+    *    </tr>
+    *    <tr>
+    *      <td>CAD_INFO_MESSAGE<br></td>
+    *      <td>CAD_INFO</td>
+    *      <td></td>
+    *    </tr>
+    *    <tr>
+    *      <td>REFRESH_VIEW<br></td>
+    *      <td>UPDATE_SCREEN</td>
+    *      <td>Current CAD model XML data.</td>
+    *    </tr>    
+    *  </tbody>
+    *</table>
+     *
+     * @see ObserverMessage
+     * @see CAD_SIMULATOR_CMD
+     */ 
+    public void update(Observable o, Object arg) {
+        
+        ObserverMessage oMessage = (ObserverMessage)arg;
+        CAD_SIMULATOR_CMD simCmd = null;
+        
+        switch(oMessage.type) {
+            case SCREEN_UPDATE:
+                simCmd = CAD_SIMULATOR_CMD.UPDATE_STATUS;
+                break;
+                        
+            case TIME_UPDATE:
+                simCmd = CAD_SIMULATOR_CMD.UPDATE_TIME;
+                break;
+                
+            case ROUTED_MESSAGE:
+                sendRoutedMessageUpdate();
+                break;
+                
+            case CAD_INFO_MESSAGE:
+                simCmd = CAD_SIMULATOR_CMD.CAD_INFO;
+                break;      
+                
+            case REFRESH_VIEW:
+                sendScreenRefresh();
+                break;
+        }
+        
+
+        if(simCmd != null) {
+            try {
+                
+                Document cmdDoc = DocumentBuilderFactory.newInstance()
+                        .newDocumentBuilder().newDocument();
+                cmdDoc.appendChild(cmdDoc.createElement(
+                        simCmd.type));
+                cmdDoc.getDocumentElement().appendChild(
+                        cmdDoc.createTextNode(oMessage.value.toString()));
+                transmitCommand(cmdDoc);
+    
+            } catch (Exception e) {
+                cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "update", 
+                        "Error in transmitting a command to client.", e);
+            }           
+        }
+        
+    }
+    
+    /**
+     * This method acts as a helper method to create a XML Document
+     * update messages with the number of routed messages and 
+     * whether there are unread messages for this client.  These
+     * two messages are sent separately due to the defined
+     * command protocol.
+     */
+    private void sendRoutedMessageUpdate() {
+
+        try {           
+            Document cmdDoc = DocumentBuilderFactory.newInstance()
+                .newDocumentBuilder().newDocument();
+            Element docElem = cmdDoc.createElement(
+                    CAD_SIMULATOR_CMD.UPDATE_MSG_COUNT.type);
+            docElem.appendChild(cmdDoc
+                    .createTextNode(String.valueOf(screenManager
+                            .getCurrentCADModel().numberRoutedMessages)));
+            cmdDoc.appendChild(docElem);
+            transmitCommand(cmdDoc);
+            
+
+            cmdDoc = DocumentBuilderFactory.newInstance()
+                .newDocumentBuilder().newDocument();
+            docElem = cmdDoc.createElement(
+                    CAD_SIMULATOR_CMD.UPDATE_MSG_UNREAD.type);
+            docElem.appendChild(cmdDoc
+                    .createTextNode(String.valueOf(screenManager
+                            .getCurrentCADModel().unreadMessages)));
+            cmdDoc.appendChild(docElem);
+            transmitCommand(cmdDoc);            
+
+        } catch (Exception e) {
+            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
+                    "sendRoutedMessageUpdate", 
+                    "Error in transmitting a command to client.", e);
+        }   
+    }
+    
+    /**
+     * This method acts as a helper method to create an XML Document
+     * update message with the current CAD Model's XML information.
+     */
+    private void sendScreenRefresh() {
+        
+        try {           
+            Document cmdDoc = DocumentBuilderFactory.newInstance()
+                    .newDocumentBuilder().newDocument();
+            Element docElem = cmdDoc.createElement(
+                    CAD_SIMULATOR_CMD.UPDATE_SCREEN.type);
+            
+            screenManager.getCurrentCADModel().toXML(docElem);
+            
+            cmdDoc.appendChild(docElem);
+            transmitCommand(cmdDoc);
+
+        } catch (Exception e) {
+            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
+                    "sendScreenRefresh", 
+                    "Error in transmitting a command to client.", e);
+        }               
+    }
+    
+    /**
+     * This method parses the data that has been received on the socket.  The
+     * Data is cast to an XML Document and the root element determines the
+     * data content.  The possible root elements and the corresponding action
+     * are explained below. <br>
+     * <code>
+     * -----------<br>
+     * TERMINAL_REGISTER<br>
+     * 
+     * The CAD position and user ID are parsed from the Element and these 
+     * values are sent to the CADScreenManager for use.<br>
+     * -----------<br>
+     * SAVE_COMMAND_LINE<br>
+     * 
+     * The current command line text is parsed from the Element and sent
+     * to the CADScreenManager for user.
+     * <br>
+     * -----------<br>
+     * TERMINAL_CMD_LINE<br>
+     * The CAD command is parsed from the Element and converted to a 
+     * CAD_CLIENT_CMD enumeration that is used to call the correct
+     * method in the CADScreenManager to perform the command.
+     * <br>
+     * -----------<br>
+     * TERMINAL_FUNCTION<br>
+     * 
+     * The key value is parsed from the Element and converted to a CAD_KEYS
+     * enumeration that is sent to the CADScreenManager to perform the
+     * associated action.
+     * <br>
+     * -----------<br>
+     * TERMINATE<br>
+     * 
+     * <br>
+     * -----------<br>
+     * </code>
+     * @param receivedData String of data received on the socket.
+     *
+     * @see CADProtocol
+     */
+    private void receiveObject(Object rxData) throws IOException {
+        
+        try {   
+            
+            Element root  = ((Document)rxData).getDocumentElement();
+        
+            switch(CAD_CLIENT_CMD.fromString(root.getNodeName())) {
+            
+                case TERMINAL_REGISTER:
+                    Node positionNode = root.getChildNodes().item(0);
+                    screenManager.setCADPosition(Integer.parseInt(positionNode.getTextContent()));
+                    
+                    Node userIDNode   = root.getChildNodes().item(1);
+                    screenManager.setCADUserID(userIDNode.getTextContent());                            
+                    break;          
+                 
+                case SAVE_COMMAND_LINE:
+                    screenManager.receiveCommandLine(root.getTextContent());
+                    break;
+                case TERMINAL_CMD_LINE:
+                    
+                    Node commandNode = root.getChildNodes().item(0);
+
+                    switch(CAD_COMMANDS.fromFullName(commandNode.getNodeName())) {
+                        case INCIDENT_BOARD:
+                            screenManager.incidentBoardRequest((Element)commandNode);
+                            break;
+                        case INCIDENT_UPDATE:       
+                            screenManager.incidentUpdateRequest((Element)commandNode);
+                            break;
+                        case INCIDENT_INQUIRY:                  
+                            screenManager.incidentInquiryRequest((Element)commandNode);
+                            break;
+                        case INCIDENT_SUMMARY:              
+                            screenManager.incidentSummaryRequest((Element)commandNode);
+                            break;
+                        case ROUTED_MESSAGE:            
+                            screenManager.routedMessageRequest((Element)commandNode);
+                            break;
+                        case ENTER_INCIDENT:            
+                            screenManager.enterIncidentRequest((Element)commandNode);
+                            break;
+                        case TERMINAL_OFF:              
+                            screenManager.terminalOffRequest();
+                            break;
+                        case APP_CLOSE:             
+                            
+                            try {
+                                Document cmdDoc = DocumentBuilderFactory.newInstance()
+                                        .newDocumentBuilder().newDocument();
+                                cmdDoc.appendChild(cmdDoc.createElement(CAD_SIMULATOR_CMD.
+                                        APP_CLOSE.type));                               transmitCommand(cmdDoc);
+                    
+                            } catch (Exception e) {
+                                cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "update", 
+                                        "Error in transmitting a command to client.", e);
+                            }   
+
+                            //disconnectClient();
+                            break;
+                        case UNKNOWN:
+                            //TODO
+                            break;
+                    }
+                    break;
+            
+                case TERMINAL_FUNCTION:             
+                    screenManager.receiveCommand(CAD_KEYS.fromValue(
+                            root.getTextContent().substring(
+                                    0, root.getTextContent().indexOf(":")),                         
+                            new Integer(root.getTextContent().substring(
+                                    root.getTextContent().indexOf(":") + 1))));
+                    break;
+            }     
+        }
+        catch (ClassCastException cce) {
+            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
+                    "receiveObject", 
+                    "Incorrect object received from client.", cce);
+        }
+    }   
+    
+    /**
+     * This method transmits the Document command message to the remote 
+     * CAD Client.  If an exception occurs in writing to the socket, an 
+     * Exception is thrown and socket communication is closed.
+     *
+     * @param data The data being transmitted
+     * @throws IOException if there is an exception in writing to the socket.
+     */
+    private void transmitCommand(Document data) throws IOException {
+  
+        try {
+            out.writeObject(data);
+            out.flush();
+        } catch (IOException ioe) {
+            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
+                    "transmitCommand",  "Error writing to Client socket: " + 
+                    theSocket.getInetAddress() + ", continuing.\n", ioe);
+
+            //disconnectClient();
+        }
+            
+    }
+}  
Index: trunk/src/tmcsim/cadsimulator/viewer/CADConsoleViewer.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/viewer/CADConsoleViewer.java	(revision 44)
+++ trunk/src/tmcsim/cadsimulator/viewer/CADConsoleViewer.java	(revision 123)
@@ -4,5 +4,5 @@
 import java.io.Writer;
 import java.util.Observable;
-import tmcsim.cadsimulator.viewer.model.CADSimulatorModel;
+import tmcsim.cadsimulator.viewer.model.CADSimulatorState;
 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus;
 import tmcsim.common.CADEnums.PARAMICS_STATUS;
@@ -30,5 +30,5 @@
      * Simulation model
      */
-    private CADSimulatorModel cadstatus;
+    private CADSimulatorState cadstatus;
     private PrintWriter display;
 
Index: trunk/src/tmcsim/cadsimulator/viewer/model/CADSimulatorState.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/viewer/model/CADSimulatorState.java	(revision 123)
+++ trunk/src/tmcsim/cadsimulator/viewer/model/CADSimulatorState.java	(revision 123)
@@ -0,0 +1,133 @@
+package tmcsim.cadsimulator.viewer.model;
+
+import java.util.Observer;
+import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;
+import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;
+import tmcsim.common.CADEnums.PARAMICS_STATUS;
+import tmcsim.common.CADEnums.SCRIPT_STATUS;
+
+/**
+ * CADSimulatorModel represents the state of the Simulation at any point in
+ * time. It is comprised of CADSimulatorStatus and CADMediaStatus.
+ *
+ * @author jdalbey
+ * @version $Revision: 1.3 $ $Date: 2006/06/06 20:46:41 $
+ */
+@SuppressWarnings("serial")
+public class CADSimulatorState
+{
+
+    private CADSimulatorStatus simStatus;
+    private CADMediaStatus mediaStatus;
+
+    /**
+     * Constructor.
+     */
+    public CADSimulatorState()
+    {
+        simStatus = new CADSimulatorStatus();
+        mediaStatus = new CADMediaStatus();
+    }
+
+    /**
+     * Make all of our delegates observers of the given view.
+     *
+     * @param view Someone that wants to observe us
+     */
+    public void addObserver(Observer view)
+    {
+//        super.addObserver(view);
+        simStatus.addObserver(view);
+        mediaStatus.addObserver(view);
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void connectClient()
+    {
+        simStatus.connectClient();
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void disconnectClient()
+    {
+        simStatus.disconnectClient();
+    }
+
+    /**
+     * Accessor to current number of clients.
+     *
+     * @return number of connected clients
+     */
+    public int getNumClients()
+    {
+        return simStatus.getNumClients();
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void setSimManagerStatus(boolean connection)
+    {
+        simStatus.setSimManagerStatus(connection);
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public boolean isSimManagerConnected()
+    {
+        return simStatus.isSimManagerConnected();
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void setTime(long seconds)
+    {
+        simStatus.setTime(seconds);
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void setScriptStatus(SCRIPT_STATUS newStatus)
+    {
+        simStatus.setScriptStatus(newStatus);
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void setParamicsStatus(PARAMICS_STATUS newStatus)
+    {
+        simStatus.setParamicsStatus(newStatus);
+    }
+
+    /**
+     * @see SimulationStatusPanel
+     */
+    public void setParamicsNetworkLoaded(String networkID)
+    {
+        simStatus.setParamicsNetworkLoaded(networkID);
+    }
+
+    /**
+     * @see MediaStatusPanel
+     */
+    public void updateDVDStatus(DVDStatusUpdate update)
+    {
+        mediaStatus.updateDVDStatus(update);
+    }
+
+    /**
+     * @see MediaStatusPanel
+     */
+    public void updateDVDTitle(DVDTitleUpdate update)
+    {
+        mediaStatus.updateDVDTitle(update);
+    }
+}
Index: trunk/src/tmcsim/cadsimulator/viewer/model/CADSimulatorModel.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/viewer/model/CADSimulatorModel.java	(revision 44)
+++ 	(revision )
@@ -1,133 +1,0 @@
-package tmcsim.cadsimulator.viewer.model;
-
-import java.util.Observer;
-import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;
-import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;
-import tmcsim.common.CADEnums.PARAMICS_STATUS;
-import tmcsim.common.CADEnums.SCRIPT_STATUS;
-
-/**
- * CADSimulatorModel represents the state of the Simulation at any point in
- * time. It is comprised of CADSimulatorStatus and CADMediaStatus.
- *
- * @author jdalbey
- * @version $Revision: 1.3 $ $Date: 2006/06/06 20:46:41 $
- */
-@SuppressWarnings("serial")
-public class CADSimulatorModel
-{
-
-    private CADSimulatorStatus simStatus;
-    private CADMediaStatus mediaStatus;
-
-    /**
-     * Constructor.
-     */
-    public CADSimulatorModel()
-    {
-        simStatus = new CADSimulatorStatus();
-        mediaStatus = new CADMediaStatus();
-    }
-
-    /**
-     * Make all of our delegates observers of the given view.
-     *
-     * @param view Someone that wants to observe us
-     */
-    public void addObserver(Observer view)
-    {
-//        super.addObserver(view);
-        simStatus.addObserver(view);
-        mediaStatus.addObserver(view);
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void connectClient()
-    {
-        simStatus.connectClient();
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void disconnectClient()
-    {
-        simStatus.disconnectClient();
-    }
-
-    /**
-     * Accessor to current number of clients.
-     *
-     * @return number of connected clients
-     */
-    public int getNumClients()
-    {
-        return simStatus.getNumClients();
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void setSimManagerStatus(boolean connection)
-    {
-        simStatus.setSimManagerStatus(connection);
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public boolean isSimManagerConnected()
-    {
-        return simStatus.isSimManagerConnected();
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void setTime(long seconds)
-    {
-        simStatus.setTime(seconds);
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void setScriptStatus(SCRIPT_STATUS newStatus)
-    {
-        simStatus.setScriptStatus(newStatus);
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void setParamicsStatus(PARAMICS_STATUS newStatus)
-    {
-        simStatus.setParamicsStatus(newStatus);
-    }
-
-    /**
-     * @see SimulationStatusPanel
-     */
-    public void setParamicsNetworkLoaded(String networkID)
-    {
-        simStatus.setParamicsNetworkLoaded(networkID);
-    }
-
-    /**
-     * @see MediaStatusPanel
-     */
-    public void updateDVDStatus(DVDStatusUpdate update)
-    {
-        mediaStatus.updateDVDStatus(update);
-    }
-
-    /**
-     * @see MediaStatusPanel
-     */
-    public void updateDVDTitle(DVDTitleUpdate update)
-    {
-        mediaStatus.updateDVDTitle(update);
-    }
-}
Index: trunk/src/tmcsim/cadsimulator/CADScreenManager.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADScreenManager.java	(revision 2)
+++ trunk/src/tmcsim/cadsimulator/CADScreenManager.java	(revision 123)
@@ -139,6 +139,6 @@
         screenNum = screenNum.next();       
 
-        CADScreenModel.theCADTime = CADSimulator.getCADTime();
-        CADScreenModel.theCADDate = CADSimulator.getCADDate();  
+        CADScreenModel.theCADTime = CADServer.getCADTime();
+        CADScreenModel.theCADDate = CADServer.getCADDate();  
             
         messageMap = new TreeMap<CADRoutedMessage, Boolean>();     
@@ -158,9 +158,9 @@
      */  
     protected void updateTime() {
-        CADScreenModel.theCADTime = CADSimulator.getCADTime();
+        CADScreenModel.theCADTime = CADServer.getCADTime();
         
         setChanged();
         notifyObservers(new ObserverMessage(ObserverMessage.messageType.TIME_UPDATE, 
-                CADSimulator.getCADTime()));
+                CADServer.getCADTime()));
     }   
  
Index: trunk/src/tmcsim/cadsimulator/Coordinator.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 54)
+++ trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 123)
@@ -27,6 +27,6 @@
 import tmcsim.cadsimulator.managers.MediaManager;
 import tmcsim.cadsimulator.managers.ParamicsSimulationManager;
-import tmcsim.cadsimulator.managers.SimulationControlManager;
-import tmcsim.cadsimulator.viewer.model.CADSimulatorModel;
+import tmcsim.cadsimulator.managers.SimulationClockManager;
+import tmcsim.cadsimulator.viewer.model.CADSimulatorState;
 import tmcsim.client.cadclientgui.CardfileReader;
 import tmcsim.client.cadclientgui.ScriptHandler;
@@ -80,5 +80,5 @@
  * @see MediaManager
  * @see ParamicsSimulationManager
- * @see SimulationControlManager
+ * @see SimulationClockManager
  * @author Matthew Cechini
  * @version
@@ -103,9 +103,9 @@
      * connected Manager, this object is set to null.
      */
-    private static SimulationManagerInterface managerInt = null;
+    private static SimulationManagerInterface simMgr = null;
     private static LinkedList<CADClientInterface> clientList;
     private static CADData cadData;
     private static CardfileData cardfileData;
-    private CADSimulatorModel cadModel;
+    private CADSimulatorState cadModel;
 
     /**
@@ -115,5 +115,5 @@
      * @throws RemoteException
      */
-    public Coordinator(CADSimulatorModel model) throws RemoteException
+    public Coordinator(CADSimulatorState model) throws RemoteException
     {
         super();
@@ -153,5 +153,5 @@
     public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException
     {
-        managerInt = simManInt;
+        simMgr = simManInt;
         cadModel.setSimManagerStatus(true);
     }
@@ -159,5 +159,5 @@
     public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException
     {
-        managerInt = null;
+        simMgr = null;
         cadModel.setSimManagerStatus(false);
     }
@@ -166,9 +166,9 @@
     {
 
-        if (!CADSimulator.theIncidentMgr.areIncidentsLoaded())
+        if (!CADServer.theIncidentMgr.areIncidentsLoaded())
         {
             throw new ScriptException(ScriptException.NO_SCRIPT_LOADED);
         }
-        else if (CADSimulator.theParamicsSimMgr.isConnected())
+        else if (CADServer.theParamicsSimMgr.isConnected())
         {
             Runnable startRun = new Runnable()
@@ -184,5 +184,5 @@
                          * Is some process happening on the ATMS side that we need to wait for?
                          */
-                        long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime();
+                        long currentATMSTime = CADServer.theATMSMgr.getCurrentTime();
                         /* Seems like it waits 0-30 seconds, depending on what the time is on
                          * the ATMS server.  Does something happen every 30 seconds over there?
@@ -205,7 +205,7 @@
                     } finally
                     {
-                        CADSimulator.theSimulationCntrlMgr.startSimulation();
-                        CADSimulator.theParamicsSimMgr.startSimulation();
-                        CADSimulator.theSoundPlayer.setAudioEnabled(true);
+                        CADServer.theSimulationCntrlMgr.startSimulation();
+                        CADServer.theParamicsSimMgr.startSimulation();
+                        CADServer.theSoundPlayer.setAudioEnabled(true);
                     }
                 }
@@ -217,6 +217,6 @@
         else
         {
-            CADSimulator.theSimulationCntrlMgr.startSimulation();
-            CADSimulator.theSoundPlayer.setAudioEnabled(true);
+            CADServer.theSimulationCntrlMgr.startSimulation();
+            CADServer.theSoundPlayer.setAudioEnabled(true);
         }
     }
@@ -224,6 +224,6 @@
     public void pauseSimulation() throws RemoteException
     {
-        CADSimulator.theSimulationCntrlMgr.pauseSimulation();
-        CADSimulator.theSoundPlayer.setAudioEnabled(false);
+        CADServer.theSimulationCntrlMgr.pauseSimulation();
+        CADServer.theSoundPlayer.setAudioEnabled(false);
     }
 
@@ -231,9 +231,9 @@
     {
 
-        CADSimulator.theIncidentMgr.resetIncidents();
+        CADServer.theIncidentMgr.resetIncidents();
         cadData.resetSimulation();
 
-        CADSimulator.theSoundPlayer.setAudioEnabled(false);
-        CADSimulator.theSoundPlayer.deQueueAll();
+        CADServer.theSoundPlayer.setAudioEnabled(false);
+        CADServer.theSoundPlayer.deQueueAll();
 
         cadModel.setTime(0);
@@ -243,6 +243,6 @@
         CMSDiversionDB.getInstance().resetDiversions();
 
-        CADSimulator.theSimulationCntrlMgr.resetSimulation();
-        CADSimulator.theParamicsSimMgr.resetSimulation();
+        CADServer.theSimulationCntrlMgr.resetSimulation();
+        CADServer.theParamicsSimMgr.resetSimulation();
 
         notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null));
@@ -253,7 +253,7 @@
     {
 
-        boolean audioWasEnabled = CADSimulator.theSoundPlayer.getAudioEnabled();
-
-        CADSimulator.theSoundPlayer.setAudioEnabled(false);
+        boolean audioWasEnabled = CADServer.theSoundPlayer.getAudioEnabled();
+
+        CADServer.theSoundPlayer.setAudioEnabled(false);
 
         long tempTime = 0;
@@ -262,10 +262,10 @@
             tempTime++;
 
-            CADSimulator.theIncidentMgr.tick(tempTime);
-        }
-        CADSimulator.theSoundPlayer.setAudioEnabled(audioWasEnabled);
-
-
-        CADSimulator.theSimulationCntrlMgr.gotoSimulationTime(newSimTime);
+            CADServer.theIncidentMgr.tick(tempTime);
+        }
+        CADServer.theSoundPlayer.setAudioEnabled(audioWasEnabled);
+
+
+        CADServer.theSimulationCntrlMgr.gotoSimulationTime(newSimTime);
 
         Runnable gotoRun = new Runnable()
@@ -275,13 +275,13 @@
                 cadModel.setTime(newSimTime);
 
-                if (managerInt != null)
+                if (simMgr != null)
                 {
                     try
                     {
-                        managerInt.tick(newSimTime);
+                        simMgr.tick(newSimTime);
                     } catch (RemoteException re)
                     {
                         //Simulation Manager has disappeared
-                        managerInt = null;
+                        simMgr = null;
                         cadModel.setSimManagerStatus(false);
 
@@ -312,13 +312,13 @@
                 cadModel.setScriptStatus(status);
 
-                if (managerInt != null)
+                if (simMgr != null)
                 {
                     try
                     {
-                        managerInt.setScriptStatus(status);
+                        simMgr.setScriptStatus(status);
                     } catch (RemoteException re)
                     {
                         //Simulation Manager has disappeared
-                        managerInt = null;
+                        simMgr = null;
                         cadModel.setSimManagerStatus(false);
 
@@ -362,13 +362,13 @@
                 }
 
-                if (managerInt != null)
+                if (simMgr != null)
                 {
                     try
                     {
-                        managerInt.setParamicsStatus(status);
+                        simMgr.setParamicsStatus(status);
                     } catch (RemoteException re)
                     {
                         //Simulation Manager has disappeared
-                        managerInt = null;
+                        simMgr = null;
                         cadModel.setSimManagerStatus(false);
 
@@ -387,30 +387,30 @@
     public void connectToParamics() throws RemoteException
     {
-        CADSimulator.theParamicsSimMgr.connectToParamics();
+        CADServer.theParamicsSimMgr.connectToParamics();
     }
 
     public void disconnectFromParamics() throws RemoteException
     {
-        CADSimulator.theParamicsSimMgr.disconnectFromParamics();
+        CADServer.theParamicsSimMgr.disconnectFromParamics();
     }
 
     public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException
     {
-        CADSimulator.theParamicsSimMgr.loadParamicsNetwork(networkID);
+        CADServer.theParamicsSimMgr.loadParamicsNetwork(networkID);
     }
 
     public PARAMICS_STATUS getParamicsStatus() throws RemoteException
     {
-        return CADSimulator.theParamicsSimMgr.getParamicsStatus();
+        return CADServer.theParamicsSimMgr.getParamicsStatus();
     }
 
     public int getParamicsNetworkLoaded() throws RemoteException
     {
-        return CADSimulator.theParamicsSimMgr.getParamicsNetworkLoaded();
+        return CADServer.theParamicsSimMgr.getParamicsNetworkLoaded();
     }
 
     public long getCurrentSimulationTime() throws RemoteException
     {
-        return CADSimulator.theSimulationCntrlMgr.getCurrentSimTime();
+        return CADServer.theSimulationCntrlMgr.getCurrentSimTime();
     }
 
@@ -418,35 +418,35 @@
     {
 
-        if (!CADSimulator.theSimulationCntrlMgr.simulationStarted())
+        if (!CADServer.theSimulationCntrlMgr.simulationStarted())
         {
             throw new ScriptException(ScriptException.SIM_NOT_STARTED);
         }
-        else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded())
+        else if (!CADServer.theIncidentMgr.areIncidentsLoaded())
         {
             throw new ScriptException(ScriptException.NO_SCRIPT_LOADED);
         }
 
-        CADSimulator.theIncidentMgr.triggerIncident(incidentNumber,
-                CADSimulator.theSimulationCntrlMgr.getCurrentSimTime());
+        CADServer.theIncidentMgr.triggerIncident(incidentNumber,
+                CADServer.theSimulationCntrlMgr.getCurrentSimTime());
     }
 
     public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException
     {
-        CADSimulator.theIncidentMgr.deleteIncident(incidentNumber);
-
-        if (CADSimulator.theIncidentMgr.getIncidentList().size() == 0)
+        CADServer.theIncidentMgr.deleteIncident(incidentNumber);
+
+        if (CADServer.theIncidentMgr.getIncidentList().size() == 0)
         {
             setScriptStatus(SCRIPT_STATUS.NO_SCRIPT);
         }
 
-        if (managerInt != null)
+        if (simMgr != null)
         {
             try
             {
-                managerInt.incidentRemoved(incidentNumber);
+                simMgr.incidentRemoved(incidentNumber);
             } catch (RemoteException re)
             {
                 //Simulation Manager has disappeared
-                managerInt = null;
+                simMgr = null;
                 cadModel.setSimManagerStatus(false);
 
@@ -461,10 +461,10 @@
     {
 
-        if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime())
+        if (newTime < CADServer.theSimulationCntrlMgr.getCurrentSimTime())
         {
             throw new ScriptException(ScriptException.TIME_PASSED);
         }
 
-        CADSimulator.theIncidentMgr.rescheduleIncident(incidentNumber, newTime);
+        CADServer.theIncidentMgr.rescheduleIncident(incidentNumber, newTime);
     }
 
@@ -472,15 +472,15 @@
     {
 
-        CADSimulator.theIncidentMgr.addIncident(newIncident);
-
-        if (managerInt != null)
+        CADServer.theIncidentMgr.addIncident(newIncident);
+
+        if (simMgr != null)
         {
             try
             {
-                managerInt.incidentAdded(newIncident);
+                simMgr.incidentAdded(newIncident);
             } catch (RemoteException re)
             {
                 //Simulation Manager has disappeared
-                managerInt = null;
+                simMgr = null;
                 cadModel.setSimManagerStatus(false);
 
@@ -497,5 +497,5 @@
         try
         {
-            CADSimulator.theIncidentMgr.clearIncidents();
+            CADServer.theIncidentMgr.clearIncidents();
             cadData.clearData();
 
@@ -507,5 +507,5 @@
             cadData.setUnitsFromXML(sh.getUnits());
             refreshClients();
-            CADSimulator.theIncidentMgr.addIncidents(sh.getIncidents());
+            CADServer.theIncidentMgr.addIncidents(sh.getIncidents());
 
             resetSimulation();
@@ -519,17 +519,17 @@
     public Vector<Incident> getIncidentList() throws RemoteException
     {
-        return CADSimulator.theIncidentMgr.getIncidentList();
+        return CADServer.theIncidentMgr.getIncidentList();
     }
 
     public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException
     {
-        return CADSimulator.theIncidentMgr.getTriggeredEvents();
+        return CADServer.theIncidentMgr.getTriggeredEvents();
     }
 
     public SCRIPT_STATUS getScriptStatus() throws RemoteException
     {
-        if (CADSimulator.theIncidentMgr.areIncidentsLoaded())
-        {
-            if (CADSimulator.theSimulationCntrlMgr.simulationStarted())
+        if (CADServer.theIncidentMgr.areIncidentsLoaded())
+        {
+            if (CADServer.theSimulationCntrlMgr.simulationStarted())
             {
                 return SCRIPT_STATUS.SCRIPT_RUNNING;
@@ -537,5 +537,5 @@
             else
             {
-                for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList())
+                for (Incident inc : CADServer.theIncidentMgr.getIncidentList())
                 {
                     if (inc.hasOccured() == true)
@@ -599,5 +599,5 @@
     {
         CMSDiversionDB.getInstance().updateDiversions(theDiversion);
-        CADSimulator.theParamicsSimMgr.updateDiversion(theDiversion);
+        CADServer.theParamicsSimMgr.updateDiversion(theDiversion);
     }
 
@@ -614,12 +614,12 @@
     {
 
-        long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime();
+        long currentSimTime = CADServer.theSimulationCntrlMgr.getCurrentSimTime();
 
         IncidentEvent triggeredEvent = new IncidentEvent(currentSimTime);
         triggeredEvent.eventInfo = modelInfo;
 
-        triggeredEvent.finalizeEvent(currentSimTime, CADSimulator.getCADTime());
-
-        CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent);
+        triggeredEvent.finalizeEvent(currentSimTime, CADServer.getCADTime());
+
+        CADServer.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent);
 
         updateIncidentInGUI(modelInfo.getLogNumber(), triggeredEvent);
@@ -633,5 +633,5 @@
      * ParamicsControlManager to send an IncidentUpdate.
      *
-     * @see SimulationControlManager
+     * @see SimulationClockManager
      * @see ParamicsControlManager
      * @see IncidentManager
@@ -639,8 +639,8 @@
     public void tick()
     {
-        if (CADSimulator.theSimulationCntrlMgr.simulationStarted())
-        {
-
-            final long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime();
+        if (CADServer.theSimulationCntrlMgr.simulationStarted())
+        {
+
+            final long currentSimTime = CADServer.theSimulationCntrlMgr.getCurrentSimTime();
 
             Runnable timeRun = new Runnable()
@@ -653,16 +653,16 @@
                     if (currentSimTime % 30 == 0)
                     {
-                        CADSimulator.theParamicsSimMgr.sendIncidentUpdate(currentSimTime);
+                        CADServer.theParamicsSimMgr.sendIncidentUpdate(currentSimTime);
                     }
 
-                    if (managerInt != null)
+                    if (simMgr != null)
                     {
                         try
                         {
-                            managerInt.tick(currentSimTime);
+                            simMgr.tick(currentSimTime);
                         } catch (RemoteException re)
                         {
                             //Simulation Manager has disappeared
-                            managerInt = null;
+                            simMgr = null;
                             cadModel.setSimManagerStatus(false);
 
@@ -672,5 +672,5 @@
                     }
 
-                    CADSimulator.theIncidentMgr.tick(currentSimTime);
+                    CADServer.theIncidentMgr.tick(currentSimTime);
                 }
             };
@@ -699,13 +699,13 @@
             public void run()
             {
-                if (managerInt != null)
+                if (simMgr != null)
                 {
                     try
                     {
-                        managerInt.incidentStarted(completedEvent.eventInfo.getLogNumber());
+                        simMgr.incidentStarted(completedEvent.eventInfo.getLogNumber());
                     } catch (RemoteException re)
                     {
                         //Simulation Manager has disappeared
-                        managerInt = null;
+                        simMgr = null;
                         cadModel.setSimManagerStatus(false);
 
@@ -740,5 +740,5 @@
         for (XMLIncident xmlInc : completedEvent.XMLIncidents)
         {
-            CADSimulator.theParamicsSimMgr.updateIncident(xmlInc);
+            CADServer.theParamicsSimMgr.updateIncident(xmlInc);
         }
 
@@ -753,9 +753,9 @@
             public void run()
             {
-                if (managerInt != null)
+                if (simMgr != null)
                 {
                     try
                     {
-                        managerInt.eventOccured(
+                        simMgr.eventOccured(
                                 completedEvent.eventInfo.getLogNumber(),
                                 completedEvent);
@@ -763,5 +763,5 @@
                     {
                         //Simulation Manager has disappeared
-                        managerInt = null;
+                        simMgr = null;
                         cadModel.setSimManagerStatus(false);
 
@@ -782,5 +782,5 @@
     public boolean incidentExists(Integer logNumber)
     {
-        return CADSimulator.theIncidentMgr.incidentExists(logNumber);
+        return CADServer.theIncidentMgr.incidentExists(logNumber);
     }
 
@@ -790,5 +790,5 @@
     public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects()
     {
-        return CADSimulator.theIncidentMgr.getIncidentBoardModelObjects();
+        return CADServer.theIncidentMgr.getIncidentBoardModelObjects();
     }
 
@@ -798,5 +798,5 @@
     public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber)
     {
-        return CADSimulator.theIncidentMgr.getIncidentInquiryModelObjects(logNumber);
+        return CADServer.theIncidentMgr.getIncidentInquiryModelObjects(logNumber);
     }
 
@@ -806,5 +806,5 @@
     public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects()
     {
-        return CADSimulator.theIncidentMgr.getIncidentSummaryModelObjects();
+        return CADServer.theIncidentMgr.getIncidentSummaryModelObjects();
     }
 
Index: trunk/src/tmcsim/cadsimulator/CADSimulatorClient.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADSimulatorClient.java	(revision 56)
+++ 	(revision )
@@ -1,448 +1,0 @@
-package tmcsim.cadsimulator;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.Socket;
-import java.util.Observable;
-import java.util.Observer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import tmcsim.common.CADProtocol;
-import tmcsim.common.ObserverMessage;
-import tmcsim.common.CADEnums.CAD_KEYS;
-import tmcsim.common.CADProtocol.CAD_CLIENT_CMD;
-import tmcsim.common.CADProtocol.CAD_COMMANDS;
-import tmcsim.common.CADProtocol.CAD_SIMULATOR_CMD;
-
-
-/**
- * CADSimulatorClient handles communication between the CAD Simulator and 
- * remote CAD Clients.  Each instance of this class communicates with 
- * a CAD Client through a socket.  The run() method continuously checks to see 
- * if data has been received from the client.  If there is data, it is parsed,
- * and the resulting action is performed by the CADScreenManager.  See the
- * receiveObject() method description for more information.  The 
- * CADSimulatorClient is set up as an Observer of the CADScreenManager to listen 
- * for ObserverMessage objects.  For each object received, the appropriate
- * action is taken, resulting in data being transmitted to the CAD Client.
- * See the update() method description for more information.  The 
- * CADScreenManager is set up as an observer of the Coordinator to listen
- * for simulation data updates.
- *
- * @author Matthew Cechini (mcechini@calpoly.edu)
- * @version $Date: 2006/06/14 00:12:38 $ $Revision: 1.5 $
- */
-public class CADSimulatorClient extends Thread implements Observer {
-    
-    /** Error Logger. */
-    private static Logger cadLogger = Logger.getLogger("tmcsim.cadsimulator");
-    
-    /** CADScreenManager object containing the data for managing the CAD Client's view information. */
-    private CADScreenManager screenManager;
-    
-    /** Socket used for communication with the CAD Client. */
-    private Socket theSocket;
-    
-    /** ObjectOutputStream for writing objects to the socket. */
-    private ObjectOutputStream out;
-    
-    /** ObjectInputStream for reading objects from the socket. */
-    private ObjectInputStream in;
-    
-    /**
-     * Constructor.  A CADScreenManager is instantiated to manage the output
-     * transmitted to the remote CAD Client.  This object is set up as an
-     * observer to that manager to listen for data that will be transmitted
-     * across the socket.  The CADScreenManager is set up as an observer
-     * of the Coordinator.  At construction, streams are created to handle
-     * reading and writing to the Socket.  When complete, the sendScreenRefresh()
-     * method is called to initialize the client.
-     * 
-     *
-     * @param newSocket The socket to use for data transmission
-     * @throws IOException if there is an error in getting the output or input streams
-     * from the socket.
-     */
-    CADSimulatorClient(Socket newSocket) throws IOException{
-        
-        screenManager = new CADScreenManager(CADSimulator.theCoordinator);      
-        CADSimulator.theCoordinator.addObserver(screenManager);
-        screenManager.addObserver(this);
-        
-        
-        theSocket = newSocket;        
-        out       = new ObjectOutputStream(theSocket.getOutputStream());
-        in        = new ObjectInputStream(theSocket.getInputStream());   
-   
-        //initialize the CAD client
-        sendScreenRefresh();
-    }
-    
-    /**
-     * Method declaration for the Thread.run() method.  While the thread is not 
-     * interrupted, read Objects from the socket and call the receiveObject()
-     * method to parse the data.  If there is an IOException in communicating
-     * with the client, interrupt this thread and close the streams and Socket.
-     */
-    public void run() {
-        
-        try { 
-        
-            while(!isInterrupted()) {
-                receiveObject(in.readObject());         
-            }
-        } 
-        catch (ClassCastException cce) {
-            cce.printStackTrace();
-        }
-        catch (ClassNotFoundException cnfe) {
-            cnfe.printStackTrace();
-        }
-        catch (IOException ioe) {                   
-            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "run", 
-                    "Error in reading from Client socket: " + 
-                    theSocket.getInetAddress() + ", proceeding.\n", ioe);
-            
-            //disconnectClient();
-        }
-    }
-    
-    /**
-     * This method is called to disconnect from the remote CAD Client.
-     * This object's thread is interrupted and the streams and socket
-     * are closed.  This object is removed as an observer of the 
-     * CADScreenManager and the CADScreenManager is removed as an 
-     * observer of the Coordinator.  The viewer is then notified
-     * of a disconnecting client.
-     */
-    protected void disconnectClient() {
-        this.interrupt();
-        
-        try { out.close(); } catch (Exception e) {}
-        try { in.close(); } catch (Exception e) {}
-        try { theSocket.close(); } catch (Exception e) {}
-
-        screenManager.deleteObserver(this);
-        CADSimulator.theCoordinator.removeObserver(screenManager);
-        //CADSimulator.theViewer.disconnectClient();
-    }
-    
-    
-
-    /**
-     * Observer method.  The update argument is cast to an ObserverMessage 
-     * object and the message type is used to define the action taken by the
-     * CADSimulatorClient.  Command messages are created in the form of XML
-     * Document. The root Element name is value from the CAD_SIMULATOR_CMD 
-     * enumeration.  The root text content is the value Object from the
-     * received Observer argument. 
-     * 
-     * The following table describes the messages sent for the ObserverMessage 
-     * types.<br>
-     * 
-     *<table cellpadding="2" cellspacing="2" border="1"
-    * style="text-align: left; width: 250px;">
-    *  <tbody>
-    *    <tr>
-    *      <th>Observer Message Type<br></th>
-    *      <th>Command Message Type<br></th>
-    *      <th>Data Content<br></th>
-    *    </tr>
-    *    <tr>
-    *      <td>SCREEN_UPDATE<br></td>
-    *      <td>UPDATE_STATUS</td>
-    *      <td>Screen update map String.</td>
-    *    </tr>
-    *    <tr>
-    *      <td>TIME_UPDATE<br></td>
-    *      <td>UPDATE_TIME</td>
-    *      <td>CAD time String.  (HHMM)</td>
-    *    </tr>
-    *    <tr>
-    *      <td>ROUTED_MESSAGE<br></td>
-    *      <td>UPDATE_MSG_COUNT</td>
-    *      <td>Number of messages.</td>
-    *    </tr>
-    *    <tr>
-    *      <td><br></td>
-    *      <td>UPDATE_MSG_UNREAD</td>
-    *      <td>Boolean flag to designate unread messages.</td>
-    *    </tr>
-    *    <tr>
-    *      <td>CAD_INFO_MESSAGE<br></td>
-    *      <td>CAD_INFO</td>
-    *      <td></td>
-    *    </tr>
-    *    <tr>
-    *      <td>REFRESH_VIEW<br></td>
-    *      <td>UPDATE_SCREEN</td>
-    *      <td>Current CAD model XML data.</td>
-    *    </tr>    
-    *  </tbody>
-    *</table>
-     *
-     * @see ObserverMessage
-     * @see CAD_SIMULATOR_CMD
-     */ 
-    public void update(Observable o, Object arg) {
-        
-        ObserverMessage oMessage = (ObserverMessage)arg;
-        CAD_SIMULATOR_CMD simCmd = null;
-        
-        switch(oMessage.type) {
-            case SCREEN_UPDATE:
-                simCmd = CAD_SIMULATOR_CMD.UPDATE_STATUS;
-                break;
-                        
-            case TIME_UPDATE:
-                simCmd = CAD_SIMULATOR_CMD.UPDATE_TIME;
-                break;
-                
-            case ROUTED_MESSAGE:
-                sendRoutedMessageUpdate();
-                break;
-                
-            case CAD_INFO_MESSAGE:
-                simCmd = CAD_SIMULATOR_CMD.CAD_INFO;
-                break;      
-                
-            case REFRESH_VIEW:
-                sendScreenRefresh();
-                break;
-        }
-        
-
-        if(simCmd != null) {
-            try {
-                
-                Document cmdDoc = DocumentBuilderFactory.newInstance()
-                        .newDocumentBuilder().newDocument();
-                cmdDoc.appendChild(cmdDoc.createElement(
-                        simCmd.type));
-                cmdDoc.getDocumentElement().appendChild(
-                        cmdDoc.createTextNode(oMessage.value.toString()));
-                transmitCommand(cmdDoc);
-    
-            } catch (Exception e) {
-                cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "update", 
-                        "Error in transmitting a command to client.", e);
-            }           
-        }
-        
-    }
-    
-    /**
-     * This method acts as a helper method to create a XML Document
-     * update messages with the number of routed messages and 
-     * whether there are unread messages for this client.  These
-     * two messages are sent separately due to the defined
-     * command protocol.
-     */
-    private void sendRoutedMessageUpdate() {
-
-        try {           
-            Document cmdDoc = DocumentBuilderFactory.newInstance()
-                .newDocumentBuilder().newDocument();
-            Element docElem = cmdDoc.createElement(
-                    CAD_SIMULATOR_CMD.UPDATE_MSG_COUNT.type);
-            docElem.appendChild(cmdDoc
-                    .createTextNode(String.valueOf(screenManager
-                            .getCurrentCADModel().numberRoutedMessages)));
-            cmdDoc.appendChild(docElem);
-            transmitCommand(cmdDoc);
-            
-
-            cmdDoc = DocumentBuilderFactory.newInstance()
-                .newDocumentBuilder().newDocument();
-            docElem = cmdDoc.createElement(
-                    CAD_SIMULATOR_CMD.UPDATE_MSG_UNREAD.type);
-            docElem.appendChild(cmdDoc
-                    .createTextNode(String.valueOf(screenManager
-                            .getCurrentCADModel().unreadMessages)));
-            cmdDoc.appendChild(docElem);
-            transmitCommand(cmdDoc);            
-
-        } catch (Exception e) {
-            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
-                    "sendRoutedMessageUpdate", 
-                    "Error in transmitting a command to client.", e);
-        }   
-    }
-    
-    /**
-     * This method acts as a helper method to create an XML Document
-     * update message with the current CAD Model's XML information.
-     */
-    private void sendScreenRefresh() {
-        
-        try {           
-            Document cmdDoc = DocumentBuilderFactory.newInstance()
-                    .newDocumentBuilder().newDocument();
-            Element docElem = cmdDoc.createElement(
-                    CAD_SIMULATOR_CMD.UPDATE_SCREEN.type);
-            
-            screenManager.getCurrentCADModel().toXML(docElem);
-            
-            cmdDoc.appendChild(docElem);
-            transmitCommand(cmdDoc);
-
-        } catch (Exception e) {
-            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
-                    "sendScreenRefresh", 
-                    "Error in transmitting a command to client.", e);
-        }               
-    }
-    
-    /**
-     * This method parses the data that has been received on the socket.  The
-     * Data is cast to an XML Document and the root element determines the
-     * data content.  The possible root elements and the corresponding action
-     * are explained below. <br>
-     * <code>
-     * -----------<br>
-     * TERMINAL_REGISTER<br>
-     * 
-     * The CAD position and user ID are parsed from the Element and these 
-     * values are sent to the CADScreenManager for use.<br>
-     * -----------<br>
-     * SAVE_COMMAND_LINE<br>
-     * 
-     * The current command line text is parsed from the Element and sent
-     * to the CADScreenManager for user.
-     * <br>
-     * -----------<br>
-     * TERMINAL_CMD_LINE<br>
-     * The CAD command is parsed from the Element and converted to a 
-     * CAD_CLIENT_CMD enumeration that is used to call the correct
-     * method in the CADScreenManager to perform the command.
-     * <br>
-     * -----------<br>
-     * TERMINAL_FUNCTION<br>
-     * 
-     * The key value is parsed from the Element and converted to a CAD_KEYS
-     * enumeration that is sent to the CADScreenManager to perform the
-     * associated action.
-     * <br>
-     * -----------<br>
-     * TERMINATE<br>
-     * 
-     * <br>
-     * -----------<br>
-     * </code>
-     * @param receivedData String of data received on the socket.
-     *
-     * @see CADProtocol
-     */
-    private void receiveObject(Object rxData) throws IOException {
-        
-        try {   
-            
-            Element root  = ((Document)rxData).getDocumentElement();
-        
-            switch(CAD_CLIENT_CMD.fromString(root.getNodeName())) {
-            
-                case TERMINAL_REGISTER:
-                    Node positionNode = root.getChildNodes().item(0);
-                    screenManager.setCADPosition(Integer.parseInt(positionNode.getTextContent()));
-                    
-                    Node userIDNode   = root.getChildNodes().item(1);
-                    screenManager.setCADUserID(userIDNode.getTextContent());                            
-                    break;          
-                 
-                case SAVE_COMMAND_LINE:
-                    screenManager.receiveCommandLine(root.getTextContent());
-                    break;
-                case TERMINAL_CMD_LINE:
-                    
-                    Node commandNode = root.getChildNodes().item(0);
-
-                    switch(CAD_COMMANDS.fromFullName(commandNode.getNodeName())) {
-                        case INCIDENT_BOARD:
-                            screenManager.incidentBoardRequest((Element)commandNode);
-                            break;
-                        case INCIDENT_UPDATE:       
-                            screenManager.incidentUpdateRequest((Element)commandNode);
-                            break;
-                        case INCIDENT_INQUIRY:                  
-                            screenManager.incidentInquiryRequest((Element)commandNode);
-                            break;
-                        case INCIDENT_SUMMARY:              
-                            screenManager.incidentSummaryRequest((Element)commandNode);
-                            break;
-                        case ROUTED_MESSAGE:            
-                            screenManager.routedMessageRequest((Element)commandNode);
-                            break;
-                        case ENTER_INCIDENT:            
-                            screenManager.enterIncidentRequest((Element)commandNode);
-                            break;
-                        case TERMINAL_OFF:              
-                            screenManager.terminalOffRequest();
-                            break;
-                        case APP_CLOSE:             
-                            
-                            try {
-                                Document cmdDoc = DocumentBuilderFactory.newInstance()
-                                        .newDocumentBuilder().newDocument();
-                                cmdDoc.appendChild(cmdDoc.createElement(CAD_SIMULATOR_CMD.
-                                        APP_CLOSE.type));                               transmitCommand(cmdDoc);
-                    
-                            } catch (Exception e) {
-                                cadLogger.logp(Level.SEVERE, "CADSimulatorClient", "update", 
-                                        "Error in transmitting a command to client.", e);
-                            }   
-
-                            //disconnectClient();
-                            break;
-                        case UNKNOWN:
-                            //TODO
-                            break;
-                    }
-                    break;
-            
-                case TERMINAL_FUNCTION:             
-                    screenManager.receiveCommand(CAD_KEYS.fromValue(
-                            root.getTextContent().substring(
-                                    0, root.getTextContent().indexOf(":")),                         
-                            new Integer(root.getTextContent().substring(
-                                    root.getTextContent().indexOf(":") + 1))));
-                    break;
-            }     
-        }
-        catch (ClassCastException cce) {
-            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
-                    "receiveObject", 
-                    "Incorrect object received from client.", cce);
-        }
-    }   
-    
-    /**
-     * This method transmits the Document command message to the remote 
-     * CAD Client.  If an exception occurs in writing to the socket, an 
-     * Exception is thrown and socket communication is closed.
-     *
-     * @param data The data being transmitted
-     * @throws IOException if there is an exception in writing to the socket.
-     */
-    private void transmitCommand(Document data) throws IOException {
-  
-        try {
-            out.writeObject(data);
-            out.flush();
-        } catch (IOException ioe) {
-            cadLogger.logp(Level.SEVERE, "CADSimulatorClient", 
-                    "transmitCommand",  "Error writing to Client socket: " + 
-                    theSocket.getInetAddress() + ", continuing.\n", ioe);
-
-            //disconnectClient();
-        }
-            
-    }
-}  
Index: trunk/src/tmcsim/cadsimulator/CADSimulator.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/CADSimulator.java	(revision 49)
+++ 	(revision )
@@ -1,425 +1,0 @@
-package tmcsim.cadsimulator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.rmi.Naming;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.util.Calendar;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.JOptionPane;
-import javax.swing.JWindow;
-import javax.swing.UIManager;
-import javax.xml.parsers.DocumentBuilderFactory;
-import tmcsim.cadsimulator.db.CMSDiversionDB;
-import tmcsim.cadsimulator.managers.ATMSManager;
-import tmcsim.cadsimulator.managers.IncidentManager;
-import tmcsim.cadsimulator.managers.MediaManager;
-import tmcsim.cadsimulator.managers.ParamicsSimulationManager;
-import tmcsim.cadsimulator.managers.SimulationControlManager;
-import tmcsim.cadsimulator.viewer.model.CADSimulatorModel;
-import tmcsim.common.SimulationException;
-import tmcsim.interfaces.CADViewer;
-
-/**
- * CADSimulator is main class for the CAD Simulator application. At construction
- * the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are
- * initialized and data relationships are established. Simulation control is
- * managed through the Coordinator and Managers. The CADSimulator contains the
- * instances of all Manager Objects that are used to control the Simulation flow
- * of data.<br>
- * <br>
- *
- * The CADSimulator is initialized with a properties file containing the
- * following data items:<br>
- * <code>
- * -----------------------------------------------------------------------------<br>
- * CADClientPort The port number to use for remote CAD Client connections.<br>
- * CoordinatorRMIPort The port number to use for binding the Coordinator.<br>
- * CMSDiversionXML The filepath for the xml file containing initialization data
- * for the Diversion "database." AudioFileLocation The root directory path where
- * audio files are referenced from.<br>
- * ParamicsProperties The filepath for the properties file to initialize the
- * ParamicsControlManager.<br>
- * ATMSProperties The filepath for the properties file to initialize the
- * ATMSManager.<br>
- * MediaProperties The filepath for the properties file to initialize the
- * MediaManager.<br>
- * ErrorFile The filename of the error file used for logging errors.<br>
- * ----------------------------------------------------------------------------<br>
- * Example File:<br>
- * CADClientPort = 4444<br>
- * CoordinatorRMIPort = 4445<br>
- * CMSDiversionXML = ../data/cmsdiversions.xml<br>
- * AudioFileLocation = ../audio/<br>
- * ParamicsProperties = ../config/paramics.properties<br>
- * ATMSProperties = ../config/atms.properties<br>
- * MediaProperties = ../config/media.properties<br>
- * ErrorFile = cad_sim_error.xml<br>
- * </code>
- *
- * @author Matthew Cechini (mcechini@calpoly.edu) jdalbey
- * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.5 $
- */
-public class CADSimulator
-{
-
-    private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties";
-    /**
-     * Error logger.
-     */
-    private static Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator");
-
-    /**
-     * Enumeration containing properties name values. See CADSimulator class
-     * description for more information.
-     *
-     * @author Matthew
-     * @see CADSimulator
-     */
-    private static enum CAD_PROPERTIES
-    {
-
-        /**
-         * RMI port to accept CAD Client connections.
-         */
-        CLIENT_PORT("CADClientPort"),
-        /**
-         * RMI port to bind the Coordinator to for RMI communication.
-         */
-        COOR_RMI_PORT("CoordinatorRMIPort"),
-        CAD_RMI_PORT("CADRmiPort"),
-        /**
-         * Filepath for xml file containing diversion data.
-         */
-        CMS_XML_FILE("CMSDiversionXML"),
-        /**
-         * Filepath for xml file containing dvd control data.
-         */
-        DVD_XML_FILE("DVDPlayerXML"),
-        /**
-         * Filepath for xml file containing still image control data.
-         */
-        IMAGE_XML_FILE("StillImagesXML"),
-        /**
-         * Root directory path where audio files are referenced from.
-         */
-        AUDIO_LOCATION("AudioFileLocation"),
-        /**
-         * Filepath for the properties file to initialize the media manager.
-         */
-        MEDIA_PROP_FILE("MediaProperties"),
-        /**
-         * Filepath for the properties file to initialize the paramics control
-         * manager.
-         */
-        PARAMICS_PROP_FILE("ParamicsProperties"),
-        /**
-         * Filepath for the properties file to initialize the atms manager.
-         */
-        ATMS_PROP_FILE("ATMSProperties"),
-        /**
-         * Class name of desired user interface.
-         */
-        USER_INTERFACE("UserInterface");
-        public String name;
-
-        private CAD_PROPERTIES(String nam)
-        {
-            name = nam;
-        }
-    };
-    /**
-     * CADSimulatorViewer instance.
-     */
-    protected static CADViewer theViewer;
-    //protected static CADSimulatorViewer theViewer;
-    //protected static CADConsoleViewer theConsole;
-    protected static CADSimulatorModel theModel;
-    /**
-     * Coordinator instance.
-     */
-    protected static Coordinator theCoordinator;
-    /**
-     * SoundPlayer instance.
-     */
-    protected static SoundPlayer theSoundPlayer = null;
-    /**
-     * SimulationControlManager instance.
-     */
-    protected static SimulationControlManager theSimulationCntrlMgr = null;
-    /**
-     * ParamicsSimulationManager instance.
-     */
-    protected static ParamicsSimulationManager theParamicsSimMgr = null;
-    /**
-     * IncidentManager instance.
-     */
-    protected static IncidentManager theIncidentMgr = null;
-    /**
-     * MediaManager instance.
-     */
-    protected static MediaManager theMediaMgr = null;
-    /**
-     * ATMSManager instance.
-     */
-    protected static ATMSManager theATMSMgr = null;
-    /**
-     * Properties file for the CADSimulator.
-     */
-    private Properties cadSimulatorProperties;
-
-    /**
-     * Constructor. Load the Properties file and initialize all CAD Simulator
-     * Managers and establish Manager data relationships. A
-     * CADSimulatorSocketHandler is instantiated and started to being listening
-     * for remote CAD connections. The CMSDiversionDB is initialized with the
-     * XML data(incomplete design).
-     *
-     * @param propertiesFile Filename of CAD Simulator properties file.
-     * @throws SimulationException if there is an error in initializing the CAD
-     * Simulator.
-     */
-    public CADSimulator(String propertiesFile) throws SimulationException
-    {
-
-        try
-        {
-            cadSimulatorProperties = new Properties();
-            cadSimulatorProperties.load(new FileInputStream(propertiesFile));
-            cadSimLogger.logp(Level.INFO, "CADSimulator", "Constructor",
-                    "Properties loaded from " + propertiesFile);
-        } catch (Exception e)
-        {
-            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
-                    "Exception in reading properties file.", e);
-
-            throw new SimulationException(SimulationException.INITIALIZE_ERROR, e);
-        }
-
-        //Create the Coordinator and register it for RMI communicator.  Start the
-        //CAD Simulator Socket Handler to begin to accept connections from CAD Clients.
-        try
-        {
-            String userInterfaceName =
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.USER_INTERFACE.name);
-            if (userInterfaceName == null)
-            {
-                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
-                        propertiesFile + " missing property for user interface.");
-                throw new SimulationException(SimulationException.INITIALIZE_ERROR);
-            }
-            try
-            {
-                Class uiClass = Class.forName(userInterfaceName);
-                theViewer = (CADViewer) uiClass.newInstance();
-            } catch (Exception exc)
-            {
-                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
-                        "Unable to instantiate user interface: " + userInterfaceName
-                        + " " + exc);
-                throw new SimulationException(SimulationException.INITIALIZE_ERROR);
-            }
-            theModel = new CADSimulatorModel();
-            theModel.addObserver(theViewer);
-
-            theCoordinator = new Coordinator(theModel);
-
-            startRegistry(Integer.parseInt(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.COOR_RMI_PORT.name).trim()));
-            startRegistry(Integer.parseInt(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.CAD_RMI_PORT.name).trim()));
-
-            theSimulationCntrlMgr = new SimulationControlManager(theCoordinator);
-
-            theATMSMgr = new ATMSManager(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.ATMS_PROP_FILE.name));
-
-            theMediaMgr = new MediaManager(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.MEDIA_PROP_FILE.name),
-                    theATMSMgr, theModel);
-
-            theParamicsSimMgr = new ParamicsSimulationManager(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.PARAMICS_PROP_FILE.name),
-                    theCoordinator, theMediaMgr);
-
-            theSoundPlayer = new SoundPlayer(
-                    cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.AUDIO_LOCATION.name));
-            theSoundPlayer.start();
-
-            theIncidentMgr = new IncidentManager(theCoordinator, theSoundPlayer);
-
-
-            //Begin accepting Client connections
-            CADSimulatorSocketHandler tmsh = new CADSimulatorSocketHandler(
-                    Integer.parseInt(cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.CLIENT_PORT.name).trim()));
-            tmsh.start();
-        } catch (RemoteException e)
-        {
-            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
-                    "Exception in starting Coordinator.", e);
-
-            throw new SimulationException(SimulationException.BINDING, e);
-        }
-
-        //Load CMS Diversion Information from the XML file
-        try
-        {
-            if (cadSimulatorProperties.getProperty(
-                    CAD_PROPERTIES.CMS_XML_FILE.name) != null)
-            {
-                CMSDiversionDB.getInstance().loadFromXML(
-                        DocumentBuilderFactory.newInstance().newDocumentBuilder()
-                        .parse(new File(cadSimulatorProperties.getProperty(
-                        CAD_PROPERTIES.CMS_XML_FILE.name))));
-            }
-        } catch (Exception e)
-        {
-            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",
-                    "Exception in parsing CMSDiversion xml file.", e);
-
-            JOptionPane.showMessageDialog(new JWindow(), "Unable to open "
-                    + cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name),
-                    "Initialization Error", JOptionPane.WARNING_MESSAGE);
-        }
-
-        theViewer.setVisible(true);
-
-    }
-
-    /**
-     * Binds the Coordinator to an RMI port so that the SimulationManager can
-     * communicate with it, and so that the Coordinator can perform RMI callback
-     * method calls. The port numbers and RMI designators are parsed from the
-     * properties file file.
-     *
-     * @param theCoor A reference to the Coordinator object.
-     * @throws SimulationException if there are errors in binding the RMI to a
-     * port and name.
-     */
-    private void startRegistry(Integer regPort) throws SimulationException
-    {
-
-        try
-        {
-//            if (LocateRegistry.getRegistry(regPort) == null)
-//            {
-            LocateRegistry.createRegistry(regPort);
-            String registryURL = "rmi://localhost:" + regPort + "/coordinator";
-            Naming.rebind(registryURL, theCoordinator);
-//            }
-        } catch (Exception e)
-        {
-            throw new SimulationException(SimulationException.BINDING, e);
-        }
-    }
-
-    /**
-     * Method returns a String representation of the current time. String format
-     * is HHMM
-     *
-     * @return String representation of the current time.
-     */
-    public static String getCADTime()
-    {
-        String time = new String();
-
-        Calendar rightNow = Calendar.getInstance();
-
-        if (rightNow.get(Calendar.HOUR_OF_DAY) < 10)
-        {
-            time += "0";
-        }
-
-        time += (String.valueOf(rightNow.get(Calendar.HOUR_OF_DAY)));
-
-        if (rightNow.get(Calendar.MINUTE) < 10)
-        {
-            time += "0";
-        }
-
-        time += (String.valueOf(rightNow.get(Calendar.MINUTE)));
-
-        return time;
-    }
-
-    /**
-     * Returns a string representation of the current date. String format is:
-     * MMDDYY
-     *
-     * @return String format of the date.
-     */
-    public static String getCADDate()
-    {
-        String date = new String();
-
-        Calendar rightNow = Calendar.getInstance();
-
-        //Months are zero referenced
-        if (rightNow.get(Calendar.MONTH) + 1 < 10)
-        {
-            date += "0";
-        }
-
-        date += (String.valueOf(rightNow.get(Calendar.MONTH) + 1));
-
-        if (rightNow.get(Calendar.DAY_OF_MONTH) < 10)
-        {
-            date += "0";
-        }
-
-        date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH)));
-
-        if (rightNow.get(Calendar.YEAR) % 1000 < 10)
-        {
-            date += "0";
-        }
-
-        date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000));
-
-        return date;
-
-    }
-
-    /**
-     * Main class. Instantiate a CAD Simulator with the properties file
-     * specified on the command line or the default properties file
-     *
-     * @param args Command line arguments.
-     */
-    public static void main(String[] args)
-    {
-        if (System.getProperty("CONFIG_DIR") == null)
-        {
-            System.setProperty("CONFIG_DIR", "config");
-        }
-        try
-        {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-            String propFile = System.getProperty("CONFIG_DIR")
-                    + System.getProperty("file.separator")
-                    + CONFIG_FILE_NAME;
-            new CADSimulator(propFile);
-        } catch (Exception e)
-        {
-            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main",
-                    "Error initializing application.", e);
-
-            JOptionPane.showMessageDialog(new JWindow(), e.getMessage(),
-                    "Error - Program Exiting", JOptionPane.ERROR_MESSAGE);
-
-            System.exit(-1);
-        }
-
-    }
-}
Index: trunk/src/tmcsim/application.properties
===================================================================
--- trunk/src/tmcsim/application.properties	(revision 120)
+++ trunk/src/tmcsim/application.properties	(revision 123)
@@ -1,5 +1,5 @@
-#Sat, 14 Oct 2017 13:43:49 -0700
+#Sun, 15 Oct 2017 17:03:46 -0700
 
-Application.revision=119
+Application.revision=122
 
 Application.buildnumber=52
Index: trunk/src/tmcsim/simulationmanager/actions/StartSimulationAction.java
===================================================================
--- trunk/src/tmcsim/simulationmanager/actions/StartSimulationAction.java	(revision 2)
+++ trunk/src/tmcsim/simulationmanager/actions/StartSimulationAction.java	(revision 123)
@@ -12,9 +12,6 @@
 /**
  * StartSimulationAction is an AbstractAction that is used for starting
- * the simulation. When the action is performed, the action checks
- * whether the a connection has been made to Paramics.  If not, the user
- * is prompted whether they want to continue without a connection to Paramics.
- * If not, the action returns.  If there is a connection, or the user wishes to
- * continue without, the action calls the SimulationManagerModel to start the 
+ * the simulation. When the action is performed, 
+ * the action calls the SimulationManagerModel to start the 
  * simulation.
  * @author Matthew Cechini
@@ -38,14 +35,16 @@
     public void actionPerformed(ActionEvent evt) {
         Runnable startRunnable = new Runnable(){        
-            public void run() {             
-                if(!theSimManagerView.isConnectedToParamics()) {
-                    if (JOptionPane.showConfirmDialog(null, "Connection has not been " +
-                            "made to the Paramics Traffic Modeler.  Do you wish " +
-                            "to continue?", "Paramics Connection", 
-                            JOptionPane.YES_NO_OPTION, 
-                            JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
-                                return;
-                            }
-                }
+            public void run() 
+            {
+                // Remove this check because Paramics is no longer used as of 2017
+//                if(!theSimManagerView.isConnectedToParamics()) {
+//                    if (JOptionPane.showConfirmDialog(null, "Connection has not been " +
+//                            "made to the Paramics Traffic Modeler.  Do you wish " +
+//                            "to continue?", "Paramics Connection", 
+//                            JOptionPane.YES_NO_OPTION, 
+//                            JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
+//                                return;
+//                            }
+//                }
                 
                 try { 
