Index: trunk/src/tmcsim/paramicscommunicator/PComm.java
===================================================================
--- trunk/src/tmcsim/paramicscommunicator/PComm.java	(revision 47)
+++ trunk/src/tmcsim/paramicscommunicator/PComm.java	(revision 47)
@@ -0,0 +1,586 @@
+package tmcsim.paramicscommunicator;
+
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import tmcsim.common.CADProtocol.PARAMICS_ACTIONS;
+import tmcsim.common.CADProtocol.PARAMICS_COMM_TAGS;
+import tmcsim.paramicscommunicator.FileIOUpdate.IO_TYPE;
+import tmcsim.paramicscommunicator.FileRegUpdate.REG_TYPE;
+import tmcsim.paramicscommunicator.gui.ParamicsCommunicatorGUI;
+
+/**
+ * ParamicsCommunicator is the main class for this module. The Paramics
+ * Communicator is used to provide communication between the CAD Simulator and
+ * the Paramics traffic modeler. While the application is running, data is
+ * received on a socket from the CAD Simulator. Transmitted data are XML
+ * documents containing information and action commands. The CAD Simulator
+ * registers readers and writers with the ParamicsCommunicator. Any data read by
+ * a ParamicsReader is sent back to the CAD Simulator. All data to be written by
+ * a ParamicsWriter is received through the socket.<br><br>
+ * The properties file for the ParamicsCommunicator class contains the following
+ * data.<br>
+ * <code>
+ * -----------------------------------------------------------------------------<br>
+ * Socket Port The port number to use for socket communication.<br>
+ * Working Directory The working directory use for Paramics file
+ * communication.<br>
+ * Error File The target file to use for error logging.<br>
+ * -----------------------------------------------------------------------------<br>
+ * Example File: <br>
+ * SocketPort = 4450 <br>
+ * WorkingDirectory = c:\\tmc_simulator\\ <br>
+ * ErrorFile = sim_mgr_error.xml <br>
+ * -----------------------------------------------------------------------------<br>
+ * </code>
+ *
+ * @author Matthew Cechini (mcechini@calpoly.edu)
+ * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.7
+ */
+public class PComm extends Observable implements Observer
+{
+
+    /**
+     * Error logger.
+     */
+    private static Logger paramLogger = Logger.getLogger("tmcsim.paramicscommunicator");
+
+    /**
+     * Enumeration containing property names.
+     *
+     * @author Matthew Cechini
+     */
+    private static enum PROPERTIES
+    {
+
+        SOCKET_PORT("SocketPort"),
+        WORKING_DIR("WorkingDirectory");
+        public String name;
+
+        private PROPERTIES(String n)
+        {
+            name = n;
+        }
+    }
+    /**
+     * Properties object.
+     */
+    private Properties paramicsCommProp = null;
+    /**
+     * Current working directory where files will be read and written
+     */
+    private String workingDirectory = null;
+    /**
+     * Socket used to create socket communication with the CAD Simulator.
+     */
+    private ServerSocket serverSocket = null;
+    /**
+     * Soccket used to communicate with CAD Simulator.
+     */
+    private Socket paramicsSocket = null;
+    /**
+     * Input Stream for reading data from the CAD Simulator.
+     */
+    private ObjectInputStream in = null;
+    /**
+     * Output Stream for writing data to the CAD Simulator.
+     */
+    private ObjectOutputStream out = null;
+    /**
+     * Map of all current ParamicsFileWriters referenced by I/O ID.
+     */
+    private TreeMap<String, ParamicsFileWriter> writers = null;
+    /**
+     * Map of all current ParamicsFileReaders referenced by I/O ID.
+     */
+    private TreeMap<String, ParamicsFileReader> readers = null;
+    /**
+     * The view class for the ParamicsCommunicator.
+     */
+    private static ParamicsCommunicatorGUI theGUI;
+    /**
+     * The thread used to initialize the socket connection with the CADSimulator
+     */
+    Thread initThread;
+
+    /**
+     * Constructor. Read in the property values. If the properties file does not
+     * contain a value for the working directory, open a dialog to prompt the
+     * user for the path of the Paramics working directory. An empty string is
+     * not accepted. A null signifies that the user pressed cancel. Prompt the
+     * user to accept the cancel and exit the application if confirmed. Continue
+     * until a valid directory has been entered, that exists, and append a '\'
+     * to the end of the directory if necessary.
+     *
+     * Initialize the Sockets and begin communication.
+     *
+     * @param propertiesFilePath File Path of ParamicsCommunicator properties
+     * file.
+     */
+    public PComm(String propertiesFile)
+    {
+        writers = new TreeMap<String, ParamicsFileWriter>();
+        readers = new TreeMap<String, ParamicsFileReader>();
+
+        try
+        {
+            paramicsCommProp = new Properties();
+            paramicsCommProp.load(new FileInputStream(propertiesFile));
+
+            if (paramicsCommProp.getProperty(PROPERTIES.SOCKET_PORT.name) == null)
+            {
+                JOptionPane.showMessageDialog(theGUI,
+                        "Properties file missing CAD Simulator Port information.",
+                        "Invalid Configuration", JOptionPane.ERROR_MESSAGE);
+                System.exit(0);
+            }
+            else if (paramicsCommProp.getProperty(PROPERTIES.WORKING_DIR.name) == null
+                    || paramicsCommProp.getProperty(PROPERTIES.WORKING_DIR.name).length() == 0)
+            {
+
+                try
+                {
+                    String workingDir = null;
+
+                    while (workingDir == null || workingDir.length() == 0)
+                    {
+                        workingDir = JOptionPane.showInputDialog(null,
+                                "Please set the output directory for Paramics communication.",
+                                "Paramics Working Directory", JOptionPane.QUESTION_MESSAGE);
+
+                        if (workingDir == null)
+                        {
+                        }
+                        else if (!new File(workingDir).exists())
+                        {
+                            JOptionPane.showMessageDialog(null,
+                                    "Directory does not exist.",
+                                    "Invalid Working Directory", JOptionPane.WARNING_MESSAGE);
+
+                            workingDir = null;
+                        }
+                        else if (!new File(workingDir).isDirectory())
+                        {
+                            JOptionPane.showMessageDialog(null,
+                                    workingDir + " is not a directory.",
+                                    "Invalid Working Directory", JOptionPane.WARNING_MESSAGE);
+
+                            workingDir = null;
+                        }
+                    }
+
+                    if (workingDir.lastIndexOf("\\") != workingDir.length() - 1)
+                    {
+                        workingDir = workingDir + "\\";
+                    }
+
+                    paramicsCommProp.setProperty(PROPERTIES.WORKING_DIR.name, workingDir);
+                    paramicsCommProp.store(new FileOutputStream(propertiesFile), "");
+                } catch (IOException ioe)
+                {
+                    paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "Constructor",
+                            "Exception in writing properties file.", ioe);
+                }
+
+            }
+
+            workingDirectory = paramicsCommProp.getProperty(
+                    PROPERTIES.WORKING_DIR.name).trim();
+
+        } catch (Exception e)
+        {
+            paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "Constructor",
+                    "Exception in reading properties file.", e);
+        }
+
+        Integer desiredPort = Integer.parseInt(paramicsCommProp.getProperty(
+                PROPERTIES.SOCKET_PORT.name).trim());
+        /* Start a thread to initialize the sockets that talk to CADsimulator */
+        initThread = new Thread(new SocketStarter(desiredPort));
+        initThread.start();
+    }
+
+    /**
+     * For testing, we want to be able to provide a non-visible instance of the
+     * GUI to be used. (As main won't be called).
+     *
+     * @param viewer
+     */
+    public void setGUI(ParamicsCommunicatorGUI viewer)
+    {
+        theGUI = viewer;
+        addObserver(theGUI);
+    }
+
+    /**
+     * Start the thread that does the main work of the communicator. This method
+     * waits until the initial thread has opened the needed sockets to connect
+     * to the CADSimulator, then it starts the socket reader thread, which runs
+     * until the application is terminated. Usage: Normally this method is
+     * called immediately after constructing this object, but for testing
+     * purposes it is available to be invoked by the test harness after the
+     * Simulation Manager initiates a connection.
+     */
+    public void startReading()
+    {
+        while (initThread.isAlive())
+        {
+            try
+            {
+                Thread.sleep(1000);
+            } catch (InterruptedException ex)
+            {
+                paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "runstarter",
+                        "Sleep interrupted.");
+            }
+        }
+        Runnable sr = new SocketReader();
+        new Thread(sr).start();
+    }
+
+    /**
+     * Transmits a message XML document object to the CAD Simulator.
+     *
+     * @param mess The ParamicsCommMessage to be transmitted.
+     */
+    private void write(Document mess)
+    {
+
+        synchronized (paramicsSocket)
+        {
+            try
+            {
+                out.writeObject(mess);
+                out.flush();
+            } catch (Exception e)
+            {
+                paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "write",
+                        "Exception in writing to the socket.", e);
+            }
+        }
+    }
+
+    /**
+     * Observer/Observable update method. The Paramics Communicator observers
+     * registered ParamicsReaders. When messages are to be sent, they are sent
+     * through this method. All messages are ParamicsCommMessage objects. Send
+     * these messages to the write() method for transmission on the socket.
+     */
+    public void update(Observable o, Object arg)
+    {
+
+        if (arg instanceof Document)
+        {
+            write((Document) arg);
+        }
+    }
+
+    private class SocketReader implements Runnable
+    {
+
+        /**
+         * Runnable method. While this thread is not interrupted, read in an
+         * object from the socket input stream. If an object exists, call
+         * doMessage() to parse and perform the received action in the message.
+         */
+        public void run()
+        {
+
+            while (true)
+            {
+                try
+                {
+                    doMessage((Document) in.readObject());
+                } catch (SocketTimeoutException ste)
+                {
+                    //just try again
+                } catch (EOFException eofe)
+                {
+                    paramLogger.logp(Level.SEVERE, "ParamicsCommunicator",
+                            "run", "EOF Exception in reading data from the socket.", eofe);
+                } catch (Exception e)
+                {
+                    paramLogger.logp(Level.SEVERE, "ParamicsCommunicator",
+                            "run", "Exception in reading data from the socket.", e);
+
+                    JOptionPane.showMessageDialog(theGUI,
+                            "Connection has been lost to the CAD Simulator.  "
+                            + "Paramics Communicator will now shutdown.",
+                            "Dropped Connection", JOptionPane.ERROR_MESSAGE);
+                    break;
+                }
+                try
+                {
+                    // Sleep for a second while waiting in this infinite loop
+                    // to yield to other threads run by test harness.
+                    Thread.sleep(1000);
+                } catch (InterruptedException ex)
+                {
+                    paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                            "run", "Exception in reading data from the socket.", ex);
+                }
+            }
+
+
+            try
+            {
+                in.close();
+            } catch (Exception e)
+            {
+            }
+            try
+            {
+                out.close();
+            } catch (Exception e)
+            {
+            }
+            try
+            {
+                serverSocket.close();
+            } catch (Exception e)
+            {
+            }
+            try
+            {
+                paramicsSocket.close();
+            } catch (Exception e)
+            {
+            }
+
+        }
+    }
+
+    /**
+     * Perform the action represented in the received XML document message.
+     * First determine if the action is from a READER, WRITER, and RESET. If the
+     * paramics action is REGISTER, add a new ParamicsFileReader/Writer to the
+     * local list of readers/writers and update the GUI with a FileRegUpdate
+     * object. If the paramics action is UNREGISTER, remove the
+     * ParamicsFileReader/Writer from the local list of readers/writers and
+     * update the GUI with a FileRegUpdate object. If RESET is received, clear
+     * all readers and writers.
+     *
+     * @param mess Received XML document message.
+     */
+    private void doMessage(Document mess)
+    {
+
+        Element rootElement = mess.getDocumentElement();
+
+        String id = null;
+        String action = null;
+
+        switch (PARAMICS_COMM_TAGS.fromString(rootElement.getNodeName()))
+        {
+            case READER:
+                id = rootElement.getAttribute(PARAMICS_COMM_TAGS.ID.tag);
+                action = rootElement.getAttribute(PARAMICS_COMM_TAGS.ACTION.tag);
+
+                switch (PARAMICS_ACTIONS.fromString(action))
+                {
+                    case REGISTER:
+                        Integer interval = Integer.parseInt(rootElement.getChildNodes().item(0).getTextContent());
+                        String targetFile = rootElement.getChildNodes().item(1).getTextContent();
+
+                        readers.put(id, new ParamicsFileReader(workingDirectory, id,
+                                interval, targetFile));
+                        readers.get(id).addObserver(this);
+                        readers.get(id).addObserver(theGUI);
+
+                        setChanged();
+                        notifyObservers(new FileRegUpdate(IO_TYPE.READ,
+                                REG_TYPE.REGISTER, id, targetFile, interval));
+                        break;
+                    case UNREGISTER:
+                        readers.get(id).deleteObserver(this);
+                        readers.get(id).deleteObserver(theGUI);
+                        readers.remove(id);
+
+                        setChanged();
+                        notifyObservers(new FileRegUpdate(IO_TYPE.READ,
+                                REG_TYPE.UNREGISTER, id, null, null));
+                        break;
+                }
+                break;
+            case WRITER:
+                id = rootElement.getAttribute(PARAMICS_COMM_TAGS.ID.tag);
+                action = rootElement.getAttribute(PARAMICS_COMM_TAGS.ACTION.tag);
+
+                switch (PARAMICS_ACTIONS.fromString(action))
+                {
+                    case REGISTER:
+                        String targetFile = rootElement.getChildNodes().item(0).getTextContent();
+
+                        writers.put(id, new ParamicsFileWriter(id,
+                                workingDirectory, targetFile));
+                        writers.get(id).addObserver(theGUI);
+
+                        setChanged();
+                        notifyObservers(new FileRegUpdate(IO_TYPE.WRITE,
+                                REG_TYPE.REGISTER, id, targetFile, null));
+                        break;
+                    case UNREGISTER:
+                        writers.remove(id);
+
+                        writers.get(id).deleteObserver(theGUI);
+
+                        setChanged();
+                        notifyObservers(new FileRegUpdate(IO_TYPE.WRITE,
+                                REG_TYPE.UNREGISTER, id, null, null));
+                        break;
+                    case WRITE_FILE:
+                        writers.get(id).writeMessage((Element) rootElement.getChildNodes().item(0));
+                        break;
+                }
+                break;
+            case RESET:
+                readers.clear();
+                writers.clear();
+                break;
+        }
+    }
+
+    private class SocketStarter implements Runnable
+    {
+
+        Integer socketPort;
+
+        /**
+         * Method waits to accept a socket connection from the CAD Simulator.
+         * When a connection has been established the method exits. The input
+         * and output streams are created on the new socket.
+         *
+         * @param socketPort Socket port to use for establishing Socket
+         * communication.
+         * @throws IOException if there is an exception in establishing Socket
+         * communication.
+         */
+        //private void initializeSockets(Integer socketPort) throws IOException
+        public SocketStarter(Integer socketPort)
+        {
+            this.socketPort = socketPort;
+        }
+
+        public void run()
+        {
+
+            boolean waiting = true;
+
+            try
+            {
+                serverSocket = new ServerSocket(socketPort);
+                //delay for accept timeout(milliseconds)
+                serverSocket.setSoTimeout(10 * 1000);
+            } catch (IOException ioe)
+            {
+                paramLogger.logp(Level.SEVERE, "ParamicsCommunicator",
+                        "initializeSockets", "Exception in creating "
+                        + "the server socket on port " + socketPort + ", terminating.");
+                System.exit(1);
+            }
+
+            while (waiting)
+            {
+                try
+                {
+                    paramicsSocket = serverSocket.accept();
+                    waiting = false;
+                } catch (SocketTimeoutException ste)
+                {
+                    System.out.println("...waiting...");
+                    try
+                    {
+                        Thread.sleep(2000);
+                        paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                                "initializeSockets", "sleeping.");
+                    } catch (InterruptedException ex)
+                    {
+                        paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                                "initializeSockets", "Exception exiting for socket.", ex);
+                    }
+                } catch (IOException ioe)
+                {
+                    paramLogger.logp(Level.SEVERE, "ParamicsCommunicator",
+                            "initializeSockets", "Exception in creating "
+                            + "the receiving socket on port " + socketPort + ", terminating.");
+                    System.exit(1);
+                }
+
+            }
+
+
+            //** out must be performed before in to unlock for connecting socket **//
+            try
+            {
+                out = new ObjectOutputStream(paramicsSocket.getOutputStream());
+                in = new ObjectInputStream(paramicsSocket.getInputStream());
+            } catch (IOException ioe)
+            {
+                paramLogger.logp(Level.SEVERE, "ParamicsCommunicator",
+                        "initializeSockets", "Exception in creating "
+                        + "input and output streams on socket, terminating.");
+                System.exit(1);
+            }
+
+        }
+    }
+
+    /**
+     * Construct the ParamicsCommunicator with the properties file path, either
+     * from the command line arguments or default.
+     *
+     * @param args Command line arguments.
+     */
+    public static void main(String[] args)
+    {
+        System.setProperty("PARAMICS_COMM_PROPERTIES", "config/paramics_communicator_config.properties");
+
+        try
+        {
+            if (System.getProperty("PARAMICS_COMM_PROPERTIES") != null)
+            {
+                PComm pc = new PComm(System.getProperty("PARAMICS_COMM_PROPERTIES"));
+                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+                theGUI = new ParamicsCommunicatorGUI();
+                pc.addObserver(theGUI);
+                theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                theGUI.setVisible(true);
+                pc.startReading();
+
+            }
+            else
+            {
+                throw new Exception("PARAMICS_COMM_PROPERTIES system property not defined.");
+            }
+        } catch (Exception e)
+        {
+            paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "Main",
+                    "Error occured initializing application", e);
+
+            JOptionPane.showMessageDialog(null, e.getMessage(),
+                    "Error - Program Exiting", JOptionPane.ERROR_MESSAGE);
+
+            System.exit(-1);
+        }
+
+
+    }
+}
Index: trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java
===================================================================
--- trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java	(revision 33)
+++ trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java	(revision 47)
@@ -19,5 +19,5 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
+import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIManager;
@@ -140,8 +140,13 @@
     public ParamicsCommunicator(String propertiesFile)
     {
+        paramLogger.logp(Level.INFO, "ParamicsCommunicator", "Constructor",
+                "Entering ");
 
         writers = new TreeMap<String, ParamicsFileWriter>();
         readers = new TreeMap<String, ParamicsFileReader>();
 
+        theGUI = new ParamicsCommunicatorGUI();
+        addObserver(theGUI);
+        theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         try
         {
@@ -301,4 +306,14 @@
                         "Dropped Connection", JOptionPane.ERROR_MESSAGE);
                 break;
+            }
+            try
+            {
+                Thread.sleep(2000);
+                paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                        "run", "sleeping.");
+            } catch (InterruptedException ex)
+            {
+                paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                        "run", "Exception in reading data from the socket.", ex);
             }
         }
@@ -456,5 +471,15 @@
             } catch (SocketTimeoutException ste)
             {
-                System.out.println("...waiting for socket connection from the CAD Simulator...");
+                System.out.println("...waiting...");
+                try
+                {
+                    Thread.sleep(2000);
+                    paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                            "initializeSockets", "sleeping.");
+                } catch (InterruptedException ex)
+                {
+                    paramLogger.logp(Level.INFO, "ParamicsCommunicator",
+                            "initializeSockets", "Exception exiting for socket.", ex);
+                }
             } catch (IOException ioe)
             {
@@ -462,4 +487,5 @@
                         + "the receiving socket on port " + socketPort);
             }
+
         }
 
Index: trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java
===================================================================
--- trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java	(revision 40)
+++ trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java	(revision 47)
@@ -5,4 +5,5 @@
 import java.io.FileWriter;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
 import java.util.Observable;
 import java.util.Timer;
@@ -67,4 +68,8 @@
      */
     private long readerInterval;
+    /**
+     * Time formatter for diagnostic messages
+     */
+    private SimpleDateFormat formatter;
 
     /**
@@ -80,12 +85,10 @@
         public void run()
         {
-//            paramLogger.logp(Level.INFO,
-//                    "ParamicsFileReader.ReaderTimerTask", "run()",
-//                    "Waiting for " + inputFile + " to be modified.");
+//            System.out.println(
+//                    "Checking last modified time on " + inputFile.getName()
+//                    + formatter.format(lastModified) + ":" + formatter.format(inputFile.lastModified()));
+
             if (lastModified < inputFile.lastModified())
             {
-//                paramLogger.logp(Level.INFO,
-//                        "ParamicsFileReader.ReaderTimerTask", "run()",
-//                        "Cool, " + inputFile + " has been modified, let's read it.");
 
                 try
@@ -101,9 +104,4 @@
                     Element messageElem = readerDoc.createElement(PARAMICS_COMM_TAGS.MESSAGE.tag);
                     String fileContents = readFromFile();
- //                   int stringlen = Math.min(160, fileContents.length()-1);
-                    // Log two lines that were read
-//                    paramLogger.logp(Level.INFO,
-//                            "ParamicsFileReader.ReaderTimerTask", "run()",
-//                            "Nice, we read " + fileContents.length() + " bytes.");
                     messageElem.appendChild(readerDoc.createTextNode(fileContents));
                     readerElem.appendChild(messageElem);
@@ -142,4 +140,5 @@
         try
         {
+            formatter = new SimpleDateFormat("HH:mm:ss");
             readerID = id;
             readerInterval = interval;
@@ -159,5 +158,5 @@
         {
             paramLogger.logp(Level.SEVERE, "ParamicsFileReader",
-                    "Constructor()", "Exception in initializing file reading.", ioe);
+                    "Constructor()", "Exception in initializing file reading of "+workingDir + targetFile, ioe);
         }
     }
@@ -194,4 +193,6 @@
 
         lastModified = inputFile.lastModified();
+//        System.out.println(
+//                "Read from a file last modified at " + formatter.format(lastModified));
 
         setChanged();
Index: trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java
===================================================================
--- trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java	(revision 29)
+++ trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java	(revision 47)
@@ -11,5 +11,4 @@
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
-
 import javax.swing.BorderFactory;
 import javax.swing.Box;
@@ -21,5 +20,4 @@
 import javax.swing.JTabbedPane;
 import javax.swing.JTextArea;
-
 import tmcsim.common.RevisionNumber;
 import tmcsim.paramicscommunicator.FileIOUpdate;
@@ -126,5 +124,6 @@
                         "Exception in receiving FileIOUpdate object.", e);
             }
-        } else if (arg instanceof FileRegUpdate)
+        }
+        else if (arg instanceof FileRegUpdate)
         {
             try
@@ -218,5 +217,5 @@
                 BorderFactory.createRaisedBevelBorder(), "Registered Readers "),
                 BorderFactory.createEmptyBorder(5, 5, 5, 5)));
-        
+
         fileWriterTabs = new JTabbedPane();
         fileWriterTabs.setAlignmentX(Box.CENTER_ALIGNMENT);
@@ -243,5 +242,5 @@
         tabbedBox.add(fileReaderTabs);
         tabbedBox.add(fileWriterTabs);
-        
+
         Box guiBox = new Box(BoxLayout.Y_AXIS);
         guiBox.add(tabbedBox);
@@ -255,5 +254,5 @@
         setResizable(false);
         pack();
-        setVisible(true);
+        //setVisible(true);
     }
 
@@ -284,5 +283,4 @@
 
     }
-    
     private JTabbedPane fileReaderTabs;
     private JTabbedPane fileWriterTabs;
Index: trunk/src/tmcsim/paramicslog/ParamicsLogFileHandler.java
===================================================================
--- trunk/src/tmcsim/paramicslog/ParamicsLogFileHandler.java	(revision 47)
+++ trunk/src/tmcsim/paramicslog/ParamicsLogFileHandler.java	(revision 47)
@@ -0,0 +1,307 @@
+package tmcsim.paramicslog;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.rmi.Naming;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import tmcsim.common.SimulationException;
+import tmcsim.interfaces.CoordinatorInterface;
+
+/**
+ * Logs communication from ParamicsCommunicator to ParamicsSimulator.
+ *
+ * The system property "PARAMICS_LOG_CONFIG" should be set to the path where the
+ * properties file for this class is located. <br><br>
+ * The data for the properties file follows. <br>
+ * <code>
+ * -----------------------------------------------------------------<br>
+ * Log File The file to write the communication to. CAD Simulator Host The host
+ * that runs the CAD Simulator. CAD Simulator RMI Port The port on the host that
+ * runs the CAD Simulator where the RMI Coordinator object is registered to.
+ * -----------------------------------------------------------------<br>
+ * Example File: <br>
+ * LogFile=c:\\log.txt CADSimulatorHost=localhost CADSimulatorRMIPort=4445
+ * -----------------------------------------------------------------<br>
+ * </code>
+ *
+ * @author Nathaniel Lehrer
+ * @version
+ */
+public class ParamicsLogFileHandler extends java.util.logging.FileHandler
+{
+
+    /**
+     * Enmeration containing property names.
+     *
+     * @author Nathaniel Lehrer
+     */
+    private enum PROPERTIES
+    {
+
+        LOG_FILE("LogFile"),
+        CAD_SIM_HOST("CADSimulatorHost"),
+        CAD_SIM_PORT("CADSimulatorRMIPort");
+        public String name;
+
+        private PROPERTIES(String n)
+        {
+            name = n;
+        }
+    }
+    /**
+     * Error logger.
+     */
+    private static Logger paramLogger = Logger.getLogger("tmcsim.paramicslog");
+    /**
+     * Static instance.
+     */
+    private static ParamicsLogFileHandler instance;
+    private static String propertiesFile;
+    /**
+     * Properties object.
+     */
+    private static Properties paramicsLogProp;
+    /**
+     * File log entries are written to
+     */
+//    private static String logFile;
+    /**
+     * Stores the log entries. This contains the same information logFile.
+     */
+    private StringBuilder log;
+    /**
+     * Remote reference to the simulation
+     */
+    private CoordinatorInterface theCoorInt;
+    /**
+     * Object for synchronizing IO
+     */
+    Object lock;
+
+    /**
+     * Creates the singleton instance of this class.
+     */
+    public static ParamicsLogFileHandler getInstance() throws IOException
+    {
+        System.setProperty("PARAMICS_LOG_PROPERTIES", "config/paramics_communicator_logging.properties");
+        // Has an instance been created yet?
+        if (instance == null)
+        {
+            try
+            {
+                if (System.getProperty("PARAMICS_LOG_PROPERTIES") != null)
+                {
+                    propertiesFile = System.getProperty("PARAMICS_LOG_PROPERTIES");
+
+                    paramicsLogProp = new Properties();
+                    paramicsLogProp.load(new FileInputStream(propertiesFile));
+
+                    if ((paramicsLogProp.getProperty(PROPERTIES.LOG_FILE.name)) == null)
+                    {
+                        throw new Exception("Properties file missing log file location.");
+                    }
+                    String logFile = paramicsLogProp.getProperty(PROPERTIES.LOG_FILE.name);
+                    instance = new ParamicsLogFileHandler(logFile);
+                }
+                else
+                {
+                    throw new Exception("PARAMICS_LOG_PROPERTIES system property not defined.");
+                }
+            } catch (Exception e)
+            {
+                instance = new ParamicsLogFileHandler();
+
+                paramLogger.logp(Level.WARNING, "ParamicsLog", "static initializer",
+                        "Error occured initializing application", e);
+
+                JOptionPane.showMessageDialog(null, e.getMessage(),
+                        "Error - ParamicsLog will not save log to file.",
+                        JOptionPane.ERROR_MESSAGE);
+            }
+        }
+        return instance;
+    }
+
+    /**
+     * Creates an instance of ParamicsLog that does not write to a file when
+     * writeToLog is called.
+     */
+    private ParamicsLogFileHandler() throws IOException
+    {
+        lock = new Object();
+        log = new StringBuilder("");
+    }
+
+    /**
+     * Creates an instance of ParamicsLog that writes to a file when writeToLog
+     * is called.
+     *
+     * @param propertiesFile
+     */
+    private ParamicsLogFileHandler(String logFile) throws IOException
+    {
+        super(logFile);
+        lock = new Object();
+        log = new StringBuilder("");
+
+        //String logFile = null;
+        String CADSIMHost = null;
+        String CADSIMPort = null;
+
+        try
+        {
+            paramicsLogProp = new Properties();
+            paramicsLogProp.load(new FileInputStream(propertiesFile));
+
+            if ((CADSIMHost = paramicsLogProp.getProperty(PROPERTIES.CAD_SIM_HOST.name)) == null)
+            {
+                throw new Exception("Properties file missing CAD Simulator host.");
+            }
+            else if ((CADSIMPort = paramicsLogProp.getProperty(PROPERTIES.CAD_SIM_PORT.name)) == null)
+            {
+                throw new Exception("Properties file missing CAD Simulator RMI port.");
+            }
+
+            try
+            {
+                connect(CADSIMHost, CADSIMPort);
+            } catch (Exception e)
+            {
+                JOptionPane.showMessageDialog(null,
+                        "ParamicsLog: Could not connect to remote Coordinator object.",
+                        "Network Error", JOptionPane.ERROR_MESSAGE);
+            }
+
+//            try
+//            {
+//                createLogFile(logFile);
+//            } catch (Exception e)
+//            {
+//                JOptionPane.showMessageDialog(null,
+//                        "ParamicsLog: Could not create new log file.",
+//                        "File Error", JOptionPane.ERROR_MESSAGE);
+//            }
+
+        } catch (Exception e)
+        {
+
+            paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor",
+                    "Properties file incorrect or missing.", e);
+
+            JOptionPane.showMessageDialog(null,
+                    "ParamicsLog: Properties file invalid.",
+                    "Invalid Configuration", JOptionPane.ERROR_MESSAGE);
+        }
+    }
+
+    /**
+     * Connect to the Coordinator's RMI object.
+     *
+     * @param hostname Host name of the CAD Simulator.
+     * @param portNumber Port number of the CAD Simulator RMI communication.
+     * @throws SimulationException if there is an error creating the RMI
+     * connection.
+     */
+    private void connect(String hostname, String portNumber)
+            throws SimulationException
+    {
+
+        String coorIntURL = "";
+
+        try
+        {
+            coorIntURL = "rmi://" + hostname + ":" + portNumber + "/coordinator";
+
+            theCoorInt = (CoordinatorInterface) Naming.lookup(coorIntURL);
+        } catch (Exception e)
+        {
+            paramLogger.logp(Level.WARNING, "ParamicsLog",
+                    "establishRMIConnection", "Unable to establish RMI "
+                    + "communication with the CAD Simulator.  URL <" + coorIntURL + ">", e);
+        }
+    }
+
+    /**
+     * Accessor to the entries in the log. No file IO is used.
+     *
+     * @return The entries in the log.
+     */
+    public String getLog()
+    {
+
+        return log.toString();
+    }
+
+    /**
+     * Writes an entry to the log. The simulator time when the message was sent
+     * is prepended to the entry. Entries are padded by a blank line before and
+     * after them. TODO: Ensure output is written in order of request.
+     *
+     * @param entry
+     */
+    public void publish(LogRecord rec)
+    {
+
+        String time = "?";
+        String formattedEntry;
+        String entry = rec.getMessage();
+
+        if (theCoorInt != null)
+        {
+            try
+            {
+                time = formatTime(theCoorInt.getCurrentSimulationTime());
+            } catch (Exception e)
+            {
+                paramLogger.logp(Level.WARNING, "ParamicsLog",
+                        "RMICommunication", "Unable to communicate with RMI object", e);
+            }
+        }
+
+        formattedEntry = "\n" + "<!-- Time written to file: " + time + " -->\n" + entry + "\n";
+        log.append(formattedEntry);
+        rec.setMessage(formattedEntry);
+        super.publish(rec);
+
+        //ParamicsLogGUI.getInstance().update(this, entry);
+    }
+
+    /**
+     * Formats the time given in seconds to hh:mm:ss format.
+     *
+     * @param time The time in seconds.
+     */
+    public String formatTime(long time)
+    {
+        long seconds = time % 60;
+        long minutes = (time - seconds) / 60;
+        long hours = (time - seconds - minutes * 60) / 60;
+
+        return padr(hours) + ":" + padr(minutes) + ":" + padr(seconds);
+    }
+
+    private String padr(long n)
+    {
+        if (n < 10)
+        {
+            return "0" + n;
+        }
+        {
+            return "" + n;
+        }
+    }
+    /**
+     * Accessor for static instance of this class.
+     *
+     * @return The instance of this class.
+     */
+//    public static ParamicsLogFileHandler getInstance()
+//    {
+//
+//        return instance;
+//    }
+}
Index: trunk/src/tmcsim/paramicslog/ParamicsLog.java
===================================================================
--- trunk/src/tmcsim/paramicslog/ParamicsLog.java	(revision 33)
+++ trunk/src/tmcsim/paramicslog/ParamicsLog.java	(revision 47)
@@ -10,9 +10,5 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import javax.swing.JOptionPane;
-
-import org.w3c.dom.Element;
-
 import tmcsim.common.SimulationException;
 import tmcsim.interfaces.CoordinatorInterface;
@@ -21,40 +17,38 @@
 /**
  * Logs communication from ParamicsCommunicator to ParamicsSimulator.
- * 
- * The system property "PARAMICS_LOG_CONFIG" should be set to the path
- * where the properties file for this class is located. <br><br>
+ *
+ * The system property "PARAMICS_LOG_CONFIG" should be set to the path where the
+ * properties file for this class is located. <br><br>
  * The data for the properties file follows. <br>
  * <code>
  * -----------------------------------------------------------------<br>
- * Log File                The file to write the communication to.
- * CAD Simulator Host      The host that runs the CAD Simulator.
- * CAD Simulator RMI Port  The port on the host that runs the CAD 
- *                         Simulator where the RMI Coordinator
- *                         object is registered to. 
+ * Log File The file to write the communication to. CAD Simulator Host The host
+ * that runs the CAD Simulator. CAD Simulator RMI Port The port on the host that
+ * runs the CAD Simulator where the RMI Coordinator object is registered to.
  * -----------------------------------------------------------------<br>
  * Example File: <br>
- * LogFile=c:\\log.txt
- * CADSimulatorHost=localhost
- * CADSimulatorRMIPort=4445
+ * LogFile=c:\\log.txt CADSimulatorHost=localhost CADSimulatorRMIPort=4445
  * -----------------------------------------------------------------<br>
  * </code>
- * 
+ *
  * @author Nathaniel Lehrer
- * @version 
+ * @version
  */
-public class ParamicsLog extends Observable 
-{   
+public class ParamicsLog extends Observable
+{
+
     /**
      * Enmeration containing property names.
+     *
      * @author Nathaniel Lehrer
      */
-    private enum PROPERTIES 
-    {
-        LOG_FILE      ("LogFile"),
-        CAD_SIM_HOST  ("CADSimulatorHost"),
-        CAD_SIM_PORT  ("CADSimulatorRMIPort");
-        
+    private enum PROPERTIES
+    {
+
+        LOG_FILE("LogFile"),
+        CAD_SIM_HOST("CADSimulatorHost"),
+        CAD_SIM_PORT("CADSimulatorRMIPort");
         public String name;
-        
+
         private PROPERTIES(String n)
         {
@@ -62,79 +56,92 @@
         }
     }
-
-	private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties";
-    
-    /** Error logger. */
+    private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties";
+    /**
+     * Error logger.
+     */
     private static Logger paramLogger = Logger.getLogger("tmcsim.paramicslog");
-    
-    /** Static instance. */
+    /**
+     * Static instance.
+     */
     private static ParamicsLog instance;
-    
-    /** Properties object. */
+    /**
+     * Properties object.
+     */
     private Properties paramicsLogProp;
-    
-    /** File log entries are written to */
+    /**
+     * File log entries are written to
+     */
     private File logFile;
-    
-    /** Stores the log entries. This contains the same information logFile. */
+    /**
+     * Stores the log entries. This contains the same information logFile.
+     */
     private StringBuilder log;
-
-    /** Remote reference to the simulation */
+    /**
+     * Remote reference to the simulation
+     */
     private CoordinatorInterface theCoorInt;
-    
-    /** Object for synchronizing IO */
+    /**
+     * Object for synchronizing IO
+     */
     Object lock;
-    
+
     /**
      * Creates the singleton instance of this class.
      */
-    static {
-        try {
-        	if(System.getProperty("CONFIG_DIR") == null){
-            	System.setProperty("CONFIG_DIR", "config");
-            }
-        	
-        	instance = new ParamicsLog(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME);
-        } 
-        catch (Exception e) 
+    static
+    {
+        try
+        {
+            if (System.getProperty("CONFIG_DIR") == null)
+            {
+                System.setProperty("CONFIG_DIR", "config");
+            }
+
+            instance = new ParamicsLog(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME);
+        } catch (Exception e)
         {
             instance = new ParamicsLog();
-            
-            paramLogger.logp(Level.WARNING, "ParamicsLog", "static initializer", 
+
+            paramLogger.logp(Level.WARNING, "ParamicsLog", "static initializer",
                     "Error occured initializing application", e);
 
-            JOptionPane.showMessageDialog(null, e.getMessage(), 
-                    "Error - ParamicsLog will not save log to file.", 
-                    JOptionPane.ERROR_MESSAGE); 
-        }
-        
+            JOptionPane.showMessageDialog(null, e.getMessage(),
+                    "Error - ParamicsLog will not save log to file.",
+                    JOptionPane.ERROR_MESSAGE);
+        }
+
         instance.addObserver(ParamicsLogGUI.getInstance());
     }
-    
-    /**
-     * Creates an instance of ParamicsLog that does not write to a file when 
+
+    /**
+     * Creates an instance of ParamicsLog that does not write to a file when
      * writeToLog is called.
      */
-    private ParamicsLog() {
-        
+    private ParamicsLog()
+    {
+
         lock = new Object();
         log = new StringBuilder("");
     }
-    
-    /**
-     * Creates an instance of ParamicsLog that writes to a file when writeToLog is called.
+
+    /**
+     * Creates an instance of ParamicsLog that writes to a file when writeToLog
+     * is called.
+     *
      * @param propertiesFile
      */
-    private ParamicsLog(String propertiesFile) {
+    private ParamicsLog(String propertiesFile)
+    {
         this();
-        
+
         String logFile = null;
         String CADSIMHost = null;
         String CADSIMPort = null;
-        
-        try {
+
+        try
+        {
             paramicsLogProp = new Properties();
             paramicsLogProp.load(new FileInputStream(propertiesFile));
-            
+
             if ((logFile = paramicsLogProp.getProperty(PROPERTIES.LOG_FILE.name)) == null)
             {
@@ -142,5 +149,5 @@
             }
             else if ((CADSIMHost = paramicsLogProp.getProperty(PROPERTIES.CAD_SIM_HOST.name)) == null)
-            {   
+            {
                 throw new Exception("Properties file missing CAD Simulator host.");
             }
@@ -149,40 +156,40 @@
                 throw new Exception("Properties file missing CAD Simulator RMI port.");
             }
-            
+
             try
             {
                 connect(CADSIMHost, CADSIMPort);
-            }
-            catch (Exception e)
-            {
-                JOptionPane.showMessageDialog(null, 
-                        "ParamicsLog: Could not connect to remote Coordinator object.", 
-                        "Network Error", JOptionPane.ERROR_MESSAGE);                
-            }
-            
-            try 
+            } catch (Exception e)
+            {
+                JOptionPane.showMessageDialog(null,
+                        "ParamicsLog: Could not connect to remote Coordinator object.",
+                        "Network Error", JOptionPane.ERROR_MESSAGE);
+            }
+
+            try
             {
                 createLogFile(logFile);
-            }
-            catch (Exception e)
-            {
-                JOptionPane.showMessageDialog(null, 
-                        "ParamicsLog: Could not create new log file.", 
+            } catch (Exception e)
+            {
+                JOptionPane.showMessageDialog(null,
+                        "ParamicsLog: Could not create new log file.",
                         "File Error", JOptionPane.ERROR_MESSAGE);
             }
-            
-        } catch (Exception e) {
-            
-            paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 
+
+        } catch (Exception e)
+        {
+
+            paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor",
                     "Properties file incorrect or missing.", e);
-            
-            JOptionPane.showMessageDialog(null, 
-                    "ParamicsLog: Properties file invalid.", 
+
+            JOptionPane.showMessageDialog(null,
+                    "ParamicsLog: Properties file invalid.",
                     "Invalid Configuration", JOptionPane.ERROR_MESSAGE);
         }
     }
-    
+
     /**
      * Creates the log file.
+     *
      * @param filePath The path to the file including the file name.
      * @throws IOException If the log file could not be created.
@@ -190,69 +197,78 @@
     private void createLogFile(String filePath) throws IOException
     {
-        try {
+        try
+        {
             logFile = new File(filePath);
-            
-            if (logFile.exists()) {
+
+            if (logFile.exists())
+            {
                 logFile.delete();
             }
-            
+
             logFile.createNewFile();
-            
-        } catch (Exception e) {
-            
+
+        } catch (Exception e)
+        {
+
             logFile = null;
-            
-            paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 
+
+            paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor",
                     "Could not create new log file.", e);
-            
+
             throw new IOException("Could not create log file.");
-        }               
-    }
-    
+        }
+    }
+
     /**
      * Connect to the Coordinator's RMI object.
-     * @param hostname Host name of the CAD Simulator.    
-     * @param portNumber Port number of the CAD Simulator RMI communication. 
-     * @throws SimulationException if there is an error creating the RMI connection.
-     */ 
-    private void connect(String hostname, String portNumber) 
-        throws SimulationException {
-        
+     *
+     * @param hostname Host name of the CAD Simulator.
+     * @param portNumber Port number of the CAD Simulator RMI communication.
+     * @throws SimulationException if there is an error creating the RMI
+     * connection.
+     */
+    private void connect(String hostname, String portNumber)
+            throws SimulationException
+    {
+
         String coorIntURL = "";
-        
-        try {  
-            coorIntURL = "rmi://" + hostname + ":" + portNumber + "/coordinator"; 
-            
-            theCoorInt = (CoordinatorInterface)Naming.lookup(coorIntURL);           
-        }
-        catch (Exception e) 
-        {
-            paramLogger.logp(Level.WARNING, "ParamicsLog", 
-                    "establishRMIConnection", "Unable to establish RMI " +
-                    "communication with the CAD Simulator.  URL <" + coorIntURL + ">", e);
-        }   
-    }
-    
+
+        try
+        {
+            coorIntURL = "rmi://" + hostname + ":" + portNumber + "/coordinator";
+
+            theCoorInt = (CoordinatorInterface) Naming.lookup(coorIntURL);
+        } catch (Exception e)
+        {
+            paramLogger.logp(Level.WARNING, "ParamicsLog",
+                    "establishRMIConnection", "Unable to establish RMI "
+                    + "communication with the CAD Simulator.  URL <" + coorIntURL + ">", e);
+        }
+    }
+
     /**
      * Accessor to the entries in the log. No file IO is used.
+     *
      * @return The entries in the log.
      */
-    public String getLog() {
-        
+    public String getLog()
+    {
+
         return log.toString();
     }
-    
-    /**
-     * Writes an entry to the log. 
-     * The simulator time when the message was sent is prepended to the entry.
-     * Entries are padded by a blank line before and after them.
-     * TODO: Ensure output is written in order of request.
+
+    /**
+     * Writes an entry to the log. The simulator time when the message was sent
+     * is prepended to the entry. Entries are padded by a blank line before and
+     * after them. TODO: Ensure output is written in order of request.
+     *
      * @param entry
      */
-    public void writeToLog(String entry) {
-        
+    public void writeToLog(String entry)
+    {
+
         String time = "?";
         String formattedEntry;
-        
+
         if (theCoorInt != null)
         {
@@ -260,20 +276,19 @@
             {
                 time = formatTime(theCoorInt.getCurrentSimulationTime());
-            }
-            catch (Exception e)
-            {
-                paramLogger.logp(Level.WARNING, "ParamicsLog", 
+            } catch (Exception e)
+            {
+                paramLogger.logp(Level.WARNING, "ParamicsLog",
                         "RMICommunication", "Unable to communicate with RMI object", e);
             }
         }
-        
+
         formattedEntry = "\n" + "<!-- Time written to file: " + time + " -->\n" + entry + "\n";
         log.append(formattedEntry);
-        
+
         if (logFile != null)
         {
-            try 
-            {
-                synchronized(lock)
+            try
+            {
+                synchronized (lock)
                 {
                     FileWriter writer = new FileWriter(logFile, true);
@@ -282,21 +297,21 @@
                     writer.close();
                 }
-            } 
-            catch (IOException e) 
-            {
-                paramLogger.logp(Level.WARNING, "ParamicsLog", "writeToLog", 
+            } catch (IOException e)
+            {
+                paramLogger.logp(Level.WARNING, "ParamicsLog", "writeToLog",
                         "Could not write to log file.", e);
             }
         }
-        
+
         setChanged();
         notifyObservers(entry);
     }
-    
+
     /**
      * Formats the time given in seconds to hh:mm:ss format.
+     *
      * @param time The time in seconds.
      */
-    private String formatTime(long time)
+    public String formatTime(long time)
     {
         long seconds = time % 60;
@@ -306,5 +321,5 @@
         return padr(hours) + ":" + padr(minutes) + ":" + padr(seconds);
     }
-    
+
     private String padr(long n)
     {
@@ -317,11 +332,13 @@
         }
     }
-    
+
     /**
      * Accessor for static instance of this class.
+     *
      * @return The instance of this class.
      */
-    public static ParamicsLog getInstance() {
-        
+    public static ParamicsLog getInstance()
+    {
+
         return instance;
     }
Index: trunk/src/tmcsim/paramicslog/gui/ParamicsLogGUI.java
===================================================================
--- trunk/src/tmcsim/paramicslog/gui/ParamicsLogGUI.java	(revision 2)
+++ trunk/src/tmcsim/paramicslog/gui/ParamicsLogGUI.java	(revision 47)
@@ -1,39 +1,52 @@
 package tmcsim.paramicslog.gui;
 
-import javax.swing.*;
 import java.awt.event.WindowEvent;
 import java.util.*;
+import javax.swing.*;
 
 /**
- * The UI for ParamicsLog. 
+ * The UI for ParamicsLog.
+ *
  * @author Nathaniel Lehrer
  * @version
  */
-public class ParamicsLogGUI extends JFrame implements Observer {
+public class ParamicsLogGUI extends JFrame implements Observer
+{
 
-    /** The static instance */
+    /**
+     * The static instance
+     */
     private static ParamicsLogGUI instance = new ParamicsLogGUI();
+    /**
+     * The text area to display the log in
+     */
+    private JTextArea textArea;
 
-    /** The text area to display the log in */
-    private JTextArea textArea;
-    
-    /** Creates an instance of this class */
-    public ParamicsLogGUI() {
-        
+    /**
+     * Creates an instance of this class
+     */
+    public ParamicsLogGUI()
+    {
+
         setupGUI();
     }
-    
-    /** Creates the UI */
+
+    /**
+     * Creates the UI
+     */
     private void setupGUI()
     {
-        try {
+        try
+        {
             UIManager.setLookAndFeel(
-                UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
+                    UIManager.getSystemLookAndFeelClassName());
+        } catch (Exception ex)
+        {
+            System.out.println(ex.getMessage());
             System.err.println("Couldn't use system look and feel.");
         }
-        
-        this.addWindowListener(new java.awt.event.WindowAdapter() {
-            
+
+        this.addWindowListener(new java.awt.event.WindowAdapter()
+        {
             public void windowClosing(WindowEvent e)
             {
@@ -41,18 +54,20 @@
             }
         });
-        
-        
+
+
         setTitle("Paramics Log");
-        
+
         textArea = new JTextArea();
         textArea.setColumns(60);
         textArea.setRows(30);
         JScrollPane scrollPane = new JScrollPane(textArea);
-        
+
         getContentPane().add(scrollPane);
-        
+
     }
-    
-    /** Shows the UI window */
+
+    /**
+     * Shows the UI window
+     */
     public void display()
     {
@@ -62,6 +77,7 @@
 
     /**
-     * Updates the text area. If the observable class given is of type ParamicsLog then
-     * the log entries are displayed.
+     * Updates the text area. If the observable class given is of type
+     * ParamicsLog then the log entries are displayed.
+     *
      * @param o The model for this viewer.
      * @param arg An argument that is not used.
@@ -72,16 +88,17 @@
         {
             textArea.setText(((tmcsim.paramicslog.ParamicsLog) o).getLog());
-        } 
+        }
 
         repaint();
     }
-    
+
     /**
      * Accessor for the instance of ParamicsLogGUI.
+     *
      * @return The instance of ParamicsLogGUI.
      */
-    public static ParamicsLogGUI getInstance() {
+    public static ParamicsLogGUI getInstance()
+    {
         return instance;
     }
-    
 }
Index: trunk/src/tmcsim/application.properties
===================================================================
--- trunk/src/tmcsim/application.properties	(revision 44)
+++ trunk/src/tmcsim/application.properties	(revision 47)
@@ -1,5 +1,5 @@
-#Thu, 23 Jun 2016 19:19:14 -0700
+#Tue, 28 Jun 2016 14:56:40 -0700
 
-Application.revision=43
+Application.revision=44
 
-Application.buildnumber=1
+Application.buildnumber=10
Index: trunk/src/tmcsim/simulationmanager/SimulationManagerView.java
===================================================================
--- trunk/src/tmcsim/simulationmanager/SimulationManagerView.java	(revision 9)
+++ trunk/src/tmcsim/simulationmanager/SimulationManagerView.java	(revision 47)
@@ -866,4 +866,5 @@
         paramicsStatusLabel     = new JLabel("Status:");
         paramicsStatusInfoLabel = new JLabel("Unknown");
+        paramicsStatusInfoLabel.setName("paramicsStatusInfoLabel");
         paramicsStatusBox.add(paramicsStatusLabel);
         paramicsStatusBox.add(Box.createHorizontalStrut(10));
Index: trunk/src/tmcsim/simulationmanager/SimulationManager.java
===================================================================
--- trunk/src/tmcsim/simulationmanager/SimulationManager.java	(revision 33)
+++ trunk/src/tmcsim/simulationmanager/SimulationManager.java	(revision 47)
@@ -9,9 +9,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import javax.swing.JOptionPane;
 import javax.swing.UIManager;
-
 import tmcsim.common.CADEnums.PARAMICS_STATUS;
+import tmcsim.common.ScriptException;
 import tmcsim.common.SimulationException;
 
@@ -48,5 +47,5 @@
 
     private static final String CONFIG_FILE_NAME = "sim_manager_config.properties";
-	/**
+    /**
      * Error logger.
      */
@@ -192,18 +191,35 @@
 
     /**
+     * Load a simulation script from the specified file.
+     *
+     * @param scriptFile the XML file containing the simulation control script
+     * to be run.
+     * @throws ScriptException if the script throws an exception
+     * @throws SimulationException if the simulation throws an exception
+     */
+    public void loadScript(File scriptFile) throws ScriptException, SimulationException
+    {
+        theSimManagerModel.loadScript(scriptFile);
+    }
+
+    /**
      * Main class.
      *
      * @param args Command line arguments.
      */
-    static public void main(String[] args) {
+    static public void main(String[] args)
+    {
         //System.setProperty("swing.defaultlaf", "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
-    	if(System.getProperty("CONFIG_DIR") == null){
-        	System.setProperty("CONFIG_DIR", "config");
-        }
-    	
-        try {           
-        	UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        if (System.getProperty("CONFIG_DIR") == null)
+        {
+            System.setProperty("CONFIG_DIR", "config");
+        }
+
+        try
+        {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
             new SimulationManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME);
-        } catch (Exception e) {
+        } catch (Exception e)
+        {
             simManLogger.logp(Level.SEVERE, "SimulationManager", "Main",
                     "Error occured initializing application", e);
