Changeset 33 in tmcsimulator for trunk/src


Ignore:
Timestamp:
04/29/2016 12:55:04 AM (10 years ago)
Author:
bokumura
Message:

Directory Restructure: All system properties have been deprecated and replaced by the system property: "CONFIG_DIR". If CONFIG_DIR is not specified at run time, it will default to the "config/" directory.

Location:
trunk/src/tmcsim
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/cadsimulator/CADSimulator.java

    r5 r33  
    135135    private Properties cadSimulatorProperties;   
    136136     
     137    private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 
    137138 
    138139    /** 
     
    329330     */ 
    330331    public static void main(String[] args) { 
    331         System.setProperty("CAD_SIM_PROPERTIES",  "config/cad_simulator_config.properties"); 
    332          
    333         try  
    334         { 
    335             if(System.getProperty("CAD_SIM_PROPERTIES") != null) 
    336             { 
    337                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    338                  
    339                 new CADSimulator(System.getProperty("CAD_SIM_PROPERTIES")); 
    340             } 
    341             else 
    342             { 
    343                 throw new Exception ("CAD_SIM_PROPERTIES system property not defined."); 
    344             } 
     332        if(System.getProperty("CONFIG_DIR") == null){ 
     333                System.setProperty("CONFIG_DIR", "config"); 
     334        } 
     335        try { 
     336            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
     337           new CADSimulator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
    345338        } 
    346339        catch (Exception e) { 
  • trunk/src/tmcsim/client/CADClient.java

    r2 r33  
    6060 * @version $Date: 2009/04/17 16:27:47 $ $Revision: 1.8 $ 
    6161 */ 
    62 /*Hai :3  yeeeee*/ 
     62 
    6363public class CADClient extends UnicastRemoteObject implements 
    6464        CADClientInterface { 
     
    113113    private CADClientInterface client = this; 
    114114 
     115    private static final String CONFIG_FILE_NAME = "cad_client_config.properties"; 
     116     
    115117    /** 
    116118     * Constructor. Initialize data from parsed properties file. Create a socket 
     
    319321                    e); 
    320322        } 
     323         
    321324 
    322325        // Ensure that the properties file does not have null values for the 
     
    473476     */ 
    474477    public static void main(String[] args) { 
    475         System.setProperty("CAD_CLIENT_PROPERTIES", 
    476                 "config/cad_client_config.properties"); 
     478        if(System.getProperty("CONFIG_DIR") == null){ 
     479                System.setProperty("CONFIG_DIR", "config"); 
     480        } 
    477481 
    478482        try { 
    479             if (System.getProperty("CAD_CLIENT_PROPERTIES") != null) { 
    480                 UIManager.setLookAndFeel(UIManager 
    481                         .getSystemLookAndFeelClassName()); 
    482  
    483                 new CADClient(System.getProperty("CAD_CLIENT_PROPERTIES")); 
    484             } else { 
    485                 throw new Exception( 
    486                         "CAD_CLIENT_PROPERTIES system property not defined."); 
    487             } 
     483            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
     484            new CADClient(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
     485          
    488486        } catch (Exception e) { 
    489487            cadClientLogger.logp(Level.SEVERE, "SimulationManager", "Main", 
  • trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java

    r26 r33  
    1919import java.util.logging.Level; 
    2020import java.util.logging.Logger; 
     21 
    2122import javax.swing.JOptionPane; 
    2223import javax.swing.UIManager; 
     24 
    2325import org.w3c.dom.Document; 
    2426import org.w3c.dom.Element; 
     27 
    2528import tmcsim.common.CADProtocol.PARAMICS_ACTIONS; 
    2629import tmcsim.common.CADProtocol.PARAMICS_COMM_TAGS; 
     
    6063{ 
    6164 
    62     /** 
     65    private static final String CONFIG_FILE_NAME = "paramics_communicator_config.properties"; 
     66        /** 
    6367     * Error logger. 
    6468     */ 
     
    480484     * @param args Command line arguments. 
    481485     */ 
    482     public static void main(String[] args) 
    483     { 
    484         System.setProperty("PARAMICS_COMM_PROPERTIES", "config/paramics_communicator_config.properties"); 
    485  
    486         try 
    487         { 
    488             if (System.getProperty("PARAMICS_COMM_PROPERTIES") != null) 
    489             { 
    490                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    491  
    492                 new Thread(new ParamicsCommunicator(System.getProperty( 
    493                         "PARAMICS_COMM_PROPERTIES"))).start(); 
    494             } else 
    495             { 
    496                 throw new Exception("PARAMICS_COMM_PROPERTIES system property not defined."); 
    497             } 
    498         } catch (Exception e) 
    499         { 
     486    public static void main(String[] args) { 
     487        if(System.getProperty("CONFIG_DIR") == null){ 
     488                System.setProperty("CONFIG_DIR", "config"); 
     489        } 
     490         
     491        try{ 
     492 
     493                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
     494            new Thread(new ParamicsCommunicator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME)).start(); 
     495         
     496        } catch (Exception e) { 
    500497            paramLogger.logp(Level.SEVERE, "ParamicsCommunicator", "Main", 
    501498                    "Error occured initializing application", e); 
  • trunk/src/tmcsim/paramicslog/ParamicsLog.java

    r2 r33  
    6262        } 
    6363    } 
     64 
     65        private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties"; 
    6466     
    6567    /** Error logger. */ 
     
    8789     * Creates the singleton instance of this class. 
    8890     */ 
    89     static 
    90     { 
    91         try  
    92         { 
    93             if (System.getProperty("PARAMICS_LOG_PROPERTIES") != null) 
    94             { 
    95                 instance = new ParamicsLog(System.getProperty("PARAMICS_LOG_PROPERTIES")); 
    96             } 
    97             else 
    98             { 
    99                 throw new Exception("PARAMICS_LOG_PROPERTIES system property not defined."); 
    100             } 
     91    static { 
     92        try { 
     93                if(System.getProperty("CONFIG_DIR") == null){ 
     94                System.setProperty("CONFIG_DIR", "config"); 
     95            } 
     96                 
     97                instance = new ParamicsLog(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
    10198        }  
    10299        catch (Exception e)  
  • trunk/src/tmcsim/simulationmanager/SimulationManager.java

    r14 r33  
    99import java.util.logging.Level; 
    1010import java.util.logging.Logger; 
     11 
    1112import javax.swing.JOptionPane; 
    1213import javax.swing.UIManager; 
     14 
    1315import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    1416import tmcsim.common.SimulationException; 
     
    4547{ 
    4648 
    47     /** 
     49    private static final String CONFIG_FILE_NAME = "sim_manager_config.properties"; 
     50        /** 
    4851     * Error logger. 
    4952     */ 
     
    193196     * @param args Command line arguments. 
    194197     */ 
    195     static public void main(String[] args) 
    196     { 
    197         //System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager_config.properties"); 
     198    static public void main(String[] args) { 
    198199        //System.setProperty("swing.defaultlaf", "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 
    199  
    200         try 
    201         { 
    202             if (System.getProperty("SIM_MGR_PROPERTIES") != null) 
    203             { 
    204                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    205  
    206                 new SimulationManager(System.getProperty("SIM_MGR_PROPERTIES")); 
    207             } else 
    208             { 
    209                 throw new Exception("SIM_MGR_PROPERTIES system property not defined."); 
    210             } 
    211         } catch (Exception e) 
    212         { 
     200        if(System.getProperty("CONFIG_DIR") == null){ 
     201                System.setProperty("CONFIG_DIR", "config"); 
     202        } 
     203         
     204        try {            
     205                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
     206            new SimulationManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
     207        } catch (Exception e) { 
    213208            simManLogger.logp(Level.SEVERE, "SimulationManager", "Main", 
    214209                    "Error occured initializing application", e); 
Note: See TracChangeset for help on using the changeset viewer.