Changeset 102 in tmcsimulator for trunk/src


Ignore:
Timestamp:
10/11/2017 07:37:14 PM (9 years ago)
Author:
jdalbey
Message:

ATMSDriverClient.java New skeleton for a CAD Client shell for ATMS Driver.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/client/ATMSDriverClient.java

    r64 r102  
    2020 
    2121/** 
    22  * ClockClient shows the simulation clock time. It operates as a client of the 
     22 * Skeleton for ATMS Driver that reads a "batch" file of highway 
     23 * status update commands.  
     24 * It operates as a client of the 
    2325 * CAD server, using RMI to poll the server every second for the current 
    24  * simulation clock time. 
     26 * simulation clock time.  It uses the simulation clock time 
     27 * to fire update commands at the desired time. 
     28 * Note: Sim Mgr must be running before starting this application. 
    2529 * 
    2630 * @author jdalbey 
    2731 */ 
    28 public class ClockClient extends UnicastRemoteObject implements 
     32public class ATMSDriverClient extends UnicastRemoteObject implements 
    2933        CADClientInterface 
    3034{ 
     
    6569     */ 
    6670    private CADClientSocket theClientSocket; 
    67     /** 
    68      * Instance of the ClockView. 
    69      */ 
    70     private ClockView theView; 
     71 
    7172    /** 
    7273     * Properties object for the CADClient class. 
     
    9192     * file containing configuration data. 
    9293     */ 
    93     public ClockClient(String propertiesFile) throws SimulationException, 
     94    public ATMSDriverClient(String propertiesFile) throws SimulationException, 
    9495            RemoteException 
    9596    { 
     
    102103                cadClientProp.getProperty(PROPERTIES.CAD_RMI_PORT.name).trim()); 
    103104 
    104         theView = new ClockView(); 
    105         theView.setVisible(true); 
    106  
     105        // READ THE BATCH FILE OF COMMANDS and put in a queue 
     106        // Consider special cases:  1) time to fire first command 
     107        // has already past when application starts. 
     108        // 2.  Two commands have same fire time specified. 
     109        // 3.  How to "override" a command, to clear an incident. 
     110         
    107111        // Create a timer that fetches the simulation time every second. 
    108112        Timer timer = new Timer(ONE_SECOND, new ActionListener() 
     
    113117                { 
    114118                    long simtime = theCoorInt.getCurrentSimulationTime(); 
    115                     theView.updateTime("" + formatInterval(simtime)); 
     119                    // Check the queue of commands to see if the first 
     120                    // item matches the current time.  IF so,  
     121                    // issue that command and remove it from queue. 
     122                     
     123                    //theView.updateTime("" + formatInterval(simtime)); 
    116124                } catch (RemoteException ex) 
    117125                { 
    118                     Logger.getLogger(ClockClient.class.getName()).log(Level.SEVERE, null, ex); 
     126                    Logger.getLogger(ATMSDriverClient.class.getName()).log(Level.SEVERE, null, ex); 
    119127                } 
    120128            } 
     
    245253        { 
    246254            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    247             new ClockClient(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
     255            new ATMSDriverClient(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
    248256 
    249257        } catch (Exception e) 
Note: See TracChangeset for help on using the changeset viewer.