Changeset 44 in tmcsimulator
- Timestamp:
- 06/23/2016 06:30:20 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 11 edited
-
IDE_metadata/NetBeans/TMCSim/build.xml (modified) (1 diff)
-
src/tmcsim/application.properties (added)
-
src/tmcsim/cadsimulator/CADSimulator.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/Coordinator.java (modified) (53 diffs)
-
src/tmcsim/cadsimulator/managers/MediaManager.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/managers/ParamicsSimulationManager.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/stillimagecontrol/ATMSCommunicator.java (modified) (1 diff)
-
src/tmcsim/cadsimulator/viewer/CADConsoleViewer.java (added)
-
src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java (modified) (9 diffs)
-
src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java (modified) (7 diffs)
-
src/tmcsim/cadsimulator/viewer/MediaStatusPanel.java (modified) (2 diffs)
-
src/tmcsim/cadsimulator/viewer/SimulationStatusPanel.java (modified) (12 diffs)
-
src/tmcsim/cadsimulator/viewer/model/CADMediaStatus.java (added)
-
src/tmcsim/cadsimulator/viewer/model/CADSimulatorModel.java (added)
-
src/tmcsim/cadsimulator/viewer/model/CADSimulatorStatus.java (added)
-
src/tmcsim/interfaces/CADViewer.java (added)
-
test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE_metadata/NetBeans/TMCSim/build.xml
r23 r44 13 13 <property name="workdir" value="../../.."/> 14 14 <!-- STORE SUBVERSION BUILD STRING --> 15 <!-- Store the Subversion version string every time you do clean/build. --> 16 <target name="-pre-compile"> 17 <exec executable="svnversion" osfamily="unix" 18 output="${workdir}/config/svn-version.txt"/> 19 <echo file="${workdir}/config/svn-version.txt" append="true"> 20 # Do not edit. This file is autogenerated by the Ant build script # 21 </echo> 15 <target name="-post-init" description="Sets the buildversion for the current build"> 16 <exec outputproperty="svna.version" executable="svnversion"> 17 <arg value="-c" /> 18 <redirector> 19 <outputfilterchain> 20 <tokenfilter> 21 <replaceregex pattern="^[0-9]*:?" replace="" flags="g"/> 22 <replaceregex pattern="M" replace="" flags="g"/> 23 </tokenfilter> 24 </outputfilterchain> 25 </redirector> 26 </exec> 27 <propertyfile file="${src.dir}/tmcsim/application.properties"> 28 <entry key="Application.revision" value="${svna.version}" type="int" operation="="/> 29 </propertyfile> 30 <echo>Setting SVN version: ${svna.version}</echo> 31 </target> 32 <target name="-post-jar" description="Sets the buildversion for the current build"> 33 <propertyfile file="${src.dir}/tmcsim/application.properties"> 34 <entry key="Application.buildnumber" value="1" type="int" operation="+"/> 35 </propertyfile> 22 36 </target> 23 37 <!-- -
trunk/src/tmcsim/cadsimulator/CADSimulator.java
r33 r44 1 1 package tmcsim.cadsimulator; 2 2 3 import java.awt.event.WindowEvent;4 import java.awt.event.WindowListener;5 3 import java.io.File; 6 4 import java.io.FileInputStream; … … 10 8 import java.util.Calendar; 11 9 import java.util.Properties; 12 import java.util.logging.FileHandler;13 10 import java.util.logging.Level; 14 11 import java.util.logging.Logger; 15 16 12 import javax.swing.JOptionPane; 17 13 import javax.swing.JWindow; 18 14 import javax.swing.UIManager; 19 15 import javax.xml.parsers.DocumentBuilderFactory; 20 21 16 import tmcsim.cadsimulator.db.CMSDiversionDB; 22 17 import tmcsim.cadsimulator.managers.ATMSManager; … … 25 20 import tmcsim.cadsimulator.managers.ParamicsSimulationManager; 26 21 import tmcsim.cadsimulator.managers.SimulationControlManager; 27 import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 28 import tmcsim.client.cadclientgui.data.CADData; 22 import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 29 23 import tmcsim.common.SimulationException; 30 import tmcsim.simulationmanager.SimulationManager; 31 24 import tmcsim.interfaces.CADViewer; 32 25 33 26 /** 34 * CADSimulator is main class for the CAD Simulator application. At35 * construction the Coordinator, CoordinatorViewer, and all CAD Simulator36 * Managers are initialized and data relationships are established.37 * Simulation control is managed through the Coordinator and Managers.38 * The CADSimulator contains the instances of all Manager Objects that are used39 * to control the Simulation flowof data.<br>27 * CADSimulator is main class for the CAD Simulator application. At construction 28 * the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are 29 * initialized and data relationships are established. Simulation control is 30 * managed through the Coordinator and Managers. The CADSimulator contains the 31 * instances of all Manager Objects that are used to control the Simulation flow 32 * of data.<br> 40 33 * <br> 41 * 42 * The CADSimulator is initialized with a properties file containing the 34 * 35 * The CADSimulator is initialized with a properties file containing the 43 36 * following data items:<br> 44 37 * <code> 45 38 * -----------------------------------------------------------------------------<br> 46 * CADClientPort The port number to use for remote CAD Client connections.<br> 47 * CoordinatorRMIPort The port number to use for binding the Coordinator.<br> 48 * CMSDiversionXML The filepath for the xml file containing initialization data for the Diversion "database." 49 * AudioFileLocation The root directory path where audio files are referenced from.<br> 50 * ParamicsProperties The filepath for the properties file to initialize the ParamicsControlManager.<br> 51 * ATMSProperties The filepath for the properties file to initialize the ATMSManager.<br> 52 * MediaProperties The filepath for the properties file to initialize the MediaManager.<br> 53 * ErrorFile The filename of the error file used for logging errors.<br> 39 * CADClientPort The port number to use for remote CAD Client connections.<br> 40 * CoordinatorRMIPort The port number to use for binding the Coordinator.<br> 41 * CMSDiversionXML The filepath for the xml file containing initialization data 42 * for the Diversion "database." AudioFileLocation The root directory path where 43 * audio files are referenced from.<br> 44 * ParamicsProperties The filepath for the properties file to initialize the 45 * ParamicsControlManager.<br> 46 * ATMSProperties The filepath for the properties file to initialize the 47 * ATMSManager.<br> 48 * MediaProperties The filepath for the properties file to initialize the 49 * MediaManager.<br> 50 * ErrorFile The filename of the error file used for logging errors.<br> 54 51 * ----------------------------------------------------------------------------<br> 55 52 * Example File:<br> 56 * CADClientPort = 4444<br>57 * CoordinatorRMIPort = 4445<br>58 * CMSDiversionXML = ../data/cmsdiversions.xml<br>59 * AudioFileLocation = ../audio/<br>60 * ParamicsProperties = ../config/paramics.properties<br>61 * ATMSProperties = ../config/atms.properties<br>62 * MediaProperties = ../config/media.properties<br>63 * ErrorFile = cad_sim_error.xml<br>53 * CADClientPort = 4444<br> 54 * CoordinatorRMIPort = 4445<br> 55 * CMSDiversionXML = ../data/cmsdiversions.xml<br> 56 * AudioFileLocation = ../audio/<br> 57 * ParamicsProperties = ../config/paramics.properties<br> 58 * ATMSProperties = ../config/atms.properties<br> 59 * MediaProperties = ../config/media.properties<br> 60 * ErrorFile = cad_sim_error.xml<br> 64 61 * </code> 65 62 * 66 * @author Matthew Cechini (mcechini@calpoly.edu) 63 * @author Matthew Cechini (mcechini@calpoly.edu) jdalbey 67 64 * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.5 $ 68 65 */ 69 public class CADSimulator { 70 71 /** Error logger. */ 66 public class CADSimulator 67 { 68 69 private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 70 /** 71 * Error logger. 72 */ 72 73 private static Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator"); 73 74 74 75 /** 75 * Enumeration containing properties name values. See CADSimulator class76 * Enumeration containing properties name values. See CADSimulator class 76 77 * description for more information. 78 * 77 79 * @author Matthew 78 80 * @see CADSimulator 79 81 */ 80 private static enum CAD_PROPERTIES { 81 /** RMI port to accept CAD Client connections. */ 82 CLIENT_PORT ("CADClientPort"), 83 /** RMI port to bind the Coordinator to for RMI communication. */ 84 COOR_RMI_PORT ("CoordinatorRMIPort"), 85 86 CAD_RMI_PORT ("CADRmiPort"), 87 /** Filepath for xml file containing diversion data. */ 88 CMS_XML_FILE ("CMSDiversionXML"), 89 /** Filepath for xml file containing dvd control data. */ 90 DVD_XML_FILE ("DVDPlayerXML"), 91 /** Filepath for xml file containing still image control data. */ 92 IMAGE_XML_FILE ("StillImagesXML"), 93 /** Root directory path where audio files are referenced from. */ 94 AUDIO_LOCATION ("AudioFileLocation"), 95 /** Filepath for the properties file to initialize the media manager. */ 96 MEDIA_PROP_FILE ("MediaProperties"), 97 /** Filepath for the properties file to initialize the paramics control manager. */ 98 PARAMICS_PROP_FILE ("ParamicsProperties"), 99 /** Filepath for the properties file to initialize the atms manager. */ 100 ATMS_PROP_FILE ("ATMSProperties"); 101 82 private static enum CAD_PROPERTIES 83 { 84 85 /** 86 * RMI port to accept CAD Client connections. 87 */ 88 CLIENT_PORT("CADClientPort"), 89 /** 90 * RMI port to bind the Coordinator to for RMI communication. 91 */ 92 COOR_RMI_PORT("CoordinatorRMIPort"), 93 CAD_RMI_PORT("CADRmiPort"), 94 /** 95 * Filepath for xml file containing diversion data. 96 */ 97 CMS_XML_FILE("CMSDiversionXML"), 98 /** 99 * Filepath for xml file containing dvd control data. 100 */ 101 DVD_XML_FILE("DVDPlayerXML"), 102 /** 103 * Filepath for xml file containing still image control data. 104 */ 105 IMAGE_XML_FILE("StillImagesXML"), 106 /** 107 * Root directory path where audio files are referenced from. 108 */ 109 AUDIO_LOCATION("AudioFileLocation"), 110 /** 111 * Filepath for the properties file to initialize the media manager. 112 */ 113 MEDIA_PROP_FILE("MediaProperties"), 114 /** 115 * Filepath for the properties file to initialize the paramics control 116 * manager. 117 */ 118 PARAMICS_PROP_FILE("ParamicsProperties"), 119 /** 120 * Filepath for the properties file to initialize the atms manager. 121 */ 122 ATMS_PROP_FILE("ATMSProperties"), 123 /** 124 * Class name of desired user interface. 125 */ 126 USER_INTERFACE("UserInterface"); 102 127 public String name; 103 104 private CAD_PROPERTIES(String n) { 105 name = n; 128 129 private CAD_PROPERTIES(String nam) 130 { 131 name = nam; 106 132 } 107 133 }; 108 109 110 /** CADSimulatorViewer instance. */ 111 protected static CADSimulatorViewer theViewer; 112 113 /** Coordinator instance. */ 114 protected static Coordinator theCoordinator; 115 116 /** SoundPlayer instance. */ 117 protected static SoundPlayer theSoundPlayer = null; 118 119 /** SimulationControlManager instance. */ 120 protected static SimulationControlManager theSimulationCntrlMgr = null; 121 122 /** ParamicsSimulationManager instance. */ 123 protected static ParamicsSimulationManager theParamicsSimMgr = null; 124 125 /** IncidentManager instance. */ 126 protected static IncidentManager theIncidentMgr = null; 127 128 /** MediaManager instance. */ 129 protected static MediaManager theMediaMgr = null; 130 131 /** ATMSManager instance. */ 132 protected static ATMSManager theATMSMgr = null; 133 134 /** Properties file for the CADSimulator. */ 135 private Properties cadSimulatorProperties; 136 137 private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 138 139 /** 140 * Constructor. Load the Properties file and initialize all CAD Simulator 141 * Managers and establish Manager data relationships. A 142 * CADSimulatorSocketHandler is instantiated and started to being 143 * listening for remote CAD connections. The CMSDiversionDB is initialized 144 * with the XML data(incomplete design). 145 * 134 /** 135 * CADSimulatorViewer instance. 136 */ 137 protected static CADViewer theViewer; 138 //protected static CADSimulatorViewer theViewer; 139 //protected static CADConsoleViewer theConsole; 140 protected static CADSimulatorModel theModel; 141 /** 142 * Coordinator instance. 143 */ 144 protected static Coordinator theCoordinator; 145 /** 146 * SoundPlayer instance. 147 */ 148 protected static SoundPlayer theSoundPlayer = null; 149 /** 150 * SimulationControlManager instance. 151 */ 152 protected static SimulationControlManager theSimulationCntrlMgr = null; 153 /** 154 * ParamicsSimulationManager instance. 155 */ 156 protected static ParamicsSimulationManager theParamicsSimMgr = null; 157 /** 158 * IncidentManager instance. 159 */ 160 protected static IncidentManager theIncidentMgr = null; 161 /** 162 * MediaManager instance. 163 */ 164 protected static MediaManager theMediaMgr = null; 165 /** 166 * ATMSManager instance. 167 */ 168 protected static ATMSManager theATMSMgr = null; 169 /** 170 * Properties file for the CADSimulator. 171 */ 172 private Properties cadSimulatorProperties; 173 174 /** 175 * Constructor. Load the Properties file and initialize all CAD Simulator 176 * Managers and establish Manager data relationships. A 177 * CADSimulatorSocketHandler is instantiated and started to being listening 178 * for remote CAD connections. The CMSDiversionDB is initialized with the 179 * XML data(incomplete design). 180 * 146 181 * @param propertiesFile Filename of CAD Simulator properties file. 147 * @throws SimulationException if there is an error in initializing the CAD Simulator. 148 */ 149 public CADSimulator(String propertiesFile) throws SimulationException { 150 151 try { 182 * @throws SimulationException if there is an error in initializing the CAD 183 * Simulator. 184 */ 185 public CADSimulator(String propertiesFile) throws SimulationException 186 { 187 188 try 189 { 152 190 cadSimulatorProperties = new Properties(); 153 191 cadSimulatorProperties.load(new FileInputStream(propertiesFile)); 154 } 155 catch (Exception e) {156 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 192 } catch (Exception e) 193 { 194 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 157 195 "Exception in reading properties file.", e); 158 159 throw new SimulationException(SimulationException.INITIALIZE_ERROR, e); 160 } 161 196 197 throw new SimulationException(SimulationException.INITIALIZE_ERROR, e); 198 } 199 162 200 //Create the Coordinator and register it for RMI communicator. Start the 163 201 //CAD Simulator Socket Handler to begin to accept connections from CAD Clients. 164 try { 165 theViewer = new CADSimulatorViewer(); 166 theCoordinator = new Coordinator(); 202 try 203 { 204 String userInterfaceName = 205 cadSimulatorProperties.getProperty( 206 CAD_PROPERTIES.USER_INTERFACE.name); 207 if (userInterfaceName == null) 208 { 209 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 210 propertiesFile + " missing property for user interface."); 211 throw new SimulationException(SimulationException.INITIALIZE_ERROR); 212 } 213 try 214 { 215 Class uiClass = Class.forName(userInterfaceName); 216 theViewer = (CADViewer) uiClass.newInstance(); 217 } catch (Throwable exc) 218 { 219 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 220 "Unable to instantiate user interface: " + userInterfaceName); 221 throw new SimulationException(SimulationException.INITIALIZE_ERROR); 222 } 223 theModel = new CADSimulatorModel(); 224 theModel.addObserver(theViewer); 225 226 theCoordinator = new Coordinator(theModel); 227 167 228 startRegistry(Integer.parseInt( 168 229 cadSimulatorProperties.getProperty( 169 CAD_PROPERTIES.COOR_RMI_PORT.name).trim()));230 CAD_PROPERTIES.COOR_RMI_PORT.name).trim())); 170 231 startRegistry(Integer.parseInt( 171 232 cadSimulatorProperties.getProperty( 172 CAD_PROPERTIES.CAD_RMI_PORT.name).trim()));173 174 theSimulationCntrlMgr = new SimulationControlManager(theCoordinator); 175 176 theATMSMgr = new ATMSManager(177 cadSimulatorProperties.getProperty( 178 CAD_PROPERTIES.ATMS_PROP_FILE.name));179 180 theMediaMgr = new MediaManager(181 cadSimulatorProperties.getProperty( 182 CAD_PROPERTIES.MEDIA_PROP_FILE.name),183 theATMSMgr, theViewer);184 185 theParamicsSimMgr = new ParamicsSimulationManager(186 cadSimulatorProperties.getProperty( 187 CAD_PROPERTIES.PARAMICS_PROP_FILE.name),188 theCoordinator, theMediaMgr);189 190 theSoundPlayer = new SoundPlayer(191 cadSimulatorProperties.getProperty( 192 CAD_PROPERTIES.AUDIO_LOCATION.name));233 CAD_PROPERTIES.CAD_RMI_PORT.name).trim())); 234 235 theSimulationCntrlMgr = new SimulationControlManager(theCoordinator); 236 237 theATMSMgr = new ATMSManager( 238 cadSimulatorProperties.getProperty( 239 CAD_PROPERTIES.ATMS_PROP_FILE.name)); 240 241 theMediaMgr = new MediaManager( 242 cadSimulatorProperties.getProperty( 243 CAD_PROPERTIES.MEDIA_PROP_FILE.name), 244 theATMSMgr, theModel); 245 246 theParamicsSimMgr = new ParamicsSimulationManager( 247 cadSimulatorProperties.getProperty( 248 CAD_PROPERTIES.PARAMICS_PROP_FILE.name), 249 theCoordinator, theMediaMgr); 250 251 theSoundPlayer = new SoundPlayer( 252 cadSimulatorProperties.getProperty( 253 CAD_PROPERTIES.AUDIO_LOCATION.name)); 193 254 theSoundPlayer.start(); 194 195 theIncidentMgr = new IncidentManager(theCoordinator, theSoundPlayer);196 255 256 theIncidentMgr = new IncidentManager(theCoordinator, theSoundPlayer); 257 197 258 198 259 //Begin accepting Client connections 199 260 CADSimulatorSocketHandler tmsh = new CADSimulatorSocketHandler( 200 261 Integer.parseInt(cadSimulatorProperties.getProperty( 201 CAD_PROPERTIES.CLIENT_PORT.name).trim()));202 tmsh.start(); 203 } 204 catch (RemoteException e){205 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 262 CAD_PROPERTIES.CLIENT_PORT.name).trim())); 263 tmsh.start(); 264 } catch (RemoteException e) 265 { 266 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 206 267 "Exception in starting Coordinator.", e); 207 268 208 269 throw new SimulationException(SimulationException.BINDING, e); 209 } 210 270 } 271 211 272 //Load CMS Diversion Information from the XML file 212 try { 213 if(cadSimulatorProperties.getProperty( 214 CAD_PROPERTIES.CMS_XML_FILE.name) != null) { 215 CMSDiversionDB.getInstance().loadFromXML( 273 try 274 { 275 if (cadSimulatorProperties.getProperty( 276 CAD_PROPERTIES.CMS_XML_FILE.name) != null) 277 { 278 CMSDiversionDB.getInstance().loadFromXML( 216 279 DocumentBuilderFactory.newInstance().newDocumentBuilder() 217 .parse(new File(cadSimulatorProperties.getProperty( 218 CAD_PROPERTIES.CMS_XML_FILE.name)))); 219 } 220 } 221 catch (Exception e) 222 { 223 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 280 .parse(new File(cadSimulatorProperties.getProperty( 281 CAD_PROPERTIES.CMS_XML_FILE.name)))); 282 } 283 } catch (Exception e) 284 { 285 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 224 286 "Exception in parsing CMSDiversion xml file.", e); 225 226 JOptionPane.showMessageDialog(new JWindow(), "Unable to open " + 227 cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name), 228 "Initialization Error", JOptionPane.WARNING_MESSAGE); 229 } 230 231 theViewer.addWindowListener(new WindowListener() { 232 public void windowClosed(WindowEvent e) {} 233 public void windowOpened(WindowEvent e) {} 234 public void windowIconified(WindowEvent e) {} 235 public void windowDeiconified(WindowEvent e) {} 236 public void windowActivated(WindowEvent e) {} 237 public void windowDeactivated(WindowEvent e) {} 238 public void windowClosing(WindowEvent e) { 239 System.exit(0); 240 } 241 }); 242 287 288 JOptionPane.showMessageDialog(new JWindow(), "Unable to open " 289 + cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name), 290 "Initialization Error", JOptionPane.WARNING_MESSAGE); 291 } 292 243 293 theViewer.setVisible(true); 244 294 245 } 246 247 /** 248 * Binds the Coordinator to an RMI port so that the SimulationManager 249 * c an communicate with it, and so that the Coordinator can perform RMI250 * callback method calls. The port numbers and RMI designators are parsed from251 * theproperties file file.295 } 296 297 /** 298 * Binds the Coordinator to an RMI port so that the SimulationManager can 299 * communicate with it, and so that the Coordinator can perform RMI callback 300 * method calls. The port numbers and RMI designators are parsed from the 301 * properties file file. 252 302 * 253 303 * @param theCoor A reference to the Coordinator object. 254 * @throws SimulationException if there are errors in binding the RMI to 255 * a port and name. 256 */ 257 private void startRegistry(Integer regPort) throws SimulationException { 258 259 try{ 260 LocateRegistry.createRegistry(regPort); 261 304 * @throws SimulationException if there are errors in binding the RMI to a 305 * port and name. 306 */ 307 private void startRegistry(Integer regPort) throws SimulationException 308 { 309 310 try 311 { 312 // if (LocateRegistry.getRegistry(regPort) == null) 313 // { 314 LocateRegistry.createRegistry(regPort); 262 315 String registryURL = "rmi://localhost:" + regPort + "/coordinator"; 263 316 Naming.rebind(registryURL, theCoordinator); 264 } 265 catch (Exception e) { 317 // } 318 } catch (Exception e) 319 { 266 320 throw new SimulationException(SimulationException.BINDING, e); 267 321 } … … 269 323 270 324 /** 271 * Method returns a String represe tnation of the current time.String format272 * is HHMM 325 * Method returns a String representation of the current time. String format 326 * is HHMM 273 327 * 274 328 * @return String representation of the current time. 275 329 */ 276 public static String getCADTime() { 277 String time = new String(); 330 public static String getCADTime() 331 { 332 String time = new String(); 278 333 279 334 Calendar rightNow = Calendar.getInstance(); 280 281 if(rightNow.get(Calendar.HOUR_OF_DAY) < 10) 335 336 if (rightNow.get(Calendar.HOUR_OF_DAY) < 10) 337 { 282 338 time += "0"; 283 339 } 340 284 341 time += (String.valueOf(rightNow.get(Calendar.HOUR_OF_DAY))); 285 286 if(rightNow.get(Calendar.MINUTE) < 10) 342 343 if (rightNow.get(Calendar.MINUTE) < 10) 344 { 287 345 time += "0"; 288 289 time += (String.valueOf(rightNow.get(Calendar.MINUTE))); 290 291 return time; 292 } 293 294 /** 295 * Returns a string representation of the current date. String format is: 346 } 347 348 time += (String.valueOf(rightNow.get(Calendar.MINUTE))); 349 350 return time; 351 } 352 353 /** 354 * Returns a string representation of the current date. String format is: 296 355 * MMDDYY 297 356 * 298 357 * @return String format of the date. 299 358 */ 300 public static String getCADDate() { 359 public static String getCADDate() 360 { 301 361 String date = new String(); 302 362 303 363 Calendar rightNow = Calendar.getInstance(); 304 364 305 365 //Months are zero referenced 306 if(rightNow.get(Calendar.MONTH) + 1 < 10) 366 if (rightNow.get(Calendar.MONTH) + 1 < 10) 367 { 307 368 date += "0"; 308 309 date += (String.valueOf(rightNow.get(Calendar.MONTH)+ 1)); 310 311 if(rightNow.get(Calendar.DAY_OF_MONTH) < 10) 369 } 370 371 date += (String.valueOf(rightNow.get(Calendar.MONTH) + 1)); 372 373 if (rightNow.get(Calendar.DAY_OF_MONTH) < 10) 374 { 312 375 date += "0"; 313 314 date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH))); 315 316 if(rightNow.get(Calendar.YEAR) % 1000 < 10) 376 } 377 378 date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH))); 379 380 if (rightNow.get(Calendar.YEAR) % 1000 < 10) 381 { 317 382 date += "0"; 318 319 date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000)); 320 321 return date; 322 383 } 384 385 date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000)); 386 387 return date; 388 323 389 } 324 325 /** 326 * Main class. Instantiate a CAD Simulator with the properties file390 391 /** 392 * Main class. Instantiate a CAD Simulator with the properties file 327 393 * specified on the command line or the default properties file 328 * 394 * 329 395 * @param args Command line arguments. 330 396 */ 331 public static void main(String[] args) { 332 if(System.getProperty("CONFIG_DIR") == null){ 333 System.setProperty("CONFIG_DIR", "config"); 334 } 335 try { 397 public static void main(String[] args) 398 { 399 if (System.getProperty("CONFIG_DIR") == null) 400 { 401 System.setProperty("CONFIG_DIR", "config"); 402 } 403 try 404 { 336 405 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 337 new CADSimulator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 338 } 339 catch (Exception e) { 340 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main", 406 String propFile = System.getProperty("CONFIG_DIR") 407 + System.getProperty("file.separator") 408 + CONFIG_FILE_NAME; 409 new CADSimulator(propFile); 410 } catch (Exception e) 411 { 412 cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main", 341 413 "Error initializing application.", e); 342 343 JOptionPane.showMessageDialog(new JWindow(), e.getMessage(), 344 "Error - Program Exiting", JOptionPane.ERROR_MESSAGE); 345 414 415 JOptionPane.showMessageDialog(new JWindow(), e.getMessage(), 416 "Error - Program Exiting", JOptionPane.ERROR_MESSAGE); 417 346 418 System.exit(-1); 347 419 } 348 420 349 421 } 350 } 422 } -
trunk/src/tmcsim/cadsimulator/Coordinator.java
r35 r44 28 28 import tmcsim.cadsimulator.managers.ParamicsSimulationManager; 29 29 import tmcsim.cadsimulator.managers.SimulationControlManager; 30 import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 30 31 import tmcsim.client.cadclientgui.CardfileReader; 31 32 import tmcsim.client.cadclientgui.ScriptHandler; … … 106 107 private static CADData cadData; 107 108 private static CardfileData cardfileData; 109 private CADSimulatorModel cadModel; 108 110 109 111 /** … … 113 115 * @throws RemoteException 114 116 */ 115 public Coordinator( ) throws RemoteException117 public Coordinator(CADSimulatorModel model) throws RemoteException 116 118 { 117 119 super(); 120 cadModel = model; 118 121 clientList = new LinkedList<CADClientInterface>(); 119 122 cadData = new CADData(); … … 133 136 { 134 137 clientList.add(client); 135 CADSimulator.theViewer.connectClient();138 cadModel.connectClient(); 136 139 } 137 140 … … 139 142 { 140 143 clientList.remove(client); 141 CADSimulator.theViewer.disconnectClient();144 cadModel.disconnectClient(); 142 145 } 143 146 … … 145 148 { 146 149 managerInt = simManInt; 147 CADSimulator.theViewer.setSimManagerStatus(true);150 cadModel.setSimManagerStatus(true); 148 151 } 149 152 … … 151 154 { 152 155 managerInt = null; 153 CADSimulator.theViewer.setSimManagerStatus(false);156 cadModel.setSimManagerStatus(false); 154 157 } 155 158 … … 157 160 { 158 161 159 coorLogger.logp(Level.INFO, "Coordinator", "startSimulation",160 "entering startSimulation()");161 162 if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 162 163 { 163 164 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 164 } else if (CADSimulator.theParamicsSimMgr.isConnected()) 165 } 166 else if (CADSimulator.theParamicsSimMgr.isConnected()) 165 167 { 166 168 Runnable startRun = new Runnable() … … 168 170 public void run() 169 171 { 170 // try 171 // { 172 // setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 173 // 174 // long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 175 // long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 176 // 172 try 173 { 174 setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 175 176 /* I have NO idea why this is needed. Why does it get the time from the remote 177 * ATMS server instead of just our system time? Why does it need to sleep? 178 * Is some process happening on the ATMS side that we need to wait for? 179 */ 180 long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 181 /* Seems like it waits 0-30 seconds, depending on what the time is on 182 * the ATMS server. Does something happen every 30 seconds over there? 183 * Was it trying to make the Paramics time the same? 184 */ 185 long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 186 177 187 // coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 178 188 // "Sleeping for " + sleepTime / 1000 + " seconds."); 179 // Thread.sleep(sleepTime); 180 // 181 // //currentATMSTime += sleepTime; 182 // //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 183 // } catch (Exception e) 184 // { 185 // setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 186 // 187 // coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 188 // "Unable to connect to ATMS server.", e); 189 // } finally 190 // { 191 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 192 "Starting WITH paramics connected "); 189 // not needed Thread.sleep(sleepTime); 190 191 //currentATMSTime += sleepTime; 192 //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 193 } catch (Exception e) 194 { 195 setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 196 197 coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 198 "Unable to connect to ATMS server.", e); 199 } finally 200 { 193 201 CADSimulator.theSimulationCntrlMgr.startSimulation(); 194 202 CADSimulator.theParamicsSimMgr.startSimulation(); 195 203 CADSimulator.theSoundPlayer.setAudioEnabled(true); 196 //}204 } 197 205 } 198 206 }; … … 200 208 Thread startThread = new Thread(startRun); 201 209 startThread.start(); 202 } else // Paramics isn't connected so start without it 203 { 204 coorLogger.logp(Level.INFO, "Coordinator", "startSimulation", 205 "starting without paramics connection. .."); 210 } 211 else 212 { 206 213 CADSimulator.theSimulationCntrlMgr.startSimulation(); 207 214 CADSimulator.theSoundPlayer.setAudioEnabled(true); 208 215 } 209 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation:run",210 "Simulation has started.");211 216 } 212 217 … … 226 231 CADSimulator.theSoundPlayer.deQueueAll(); 227 232 228 CADSimulator.theViewer.setTime(0);233 cadModel.setTime(0); 229 234 230 235 setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED); … … 262 267 public void run() 263 268 { 264 CADSimulator.theViewer.setTime(newSimTime);269 cadModel.setTime(newSimTime); 265 270 266 271 if (managerInt != null) … … 273 278 //Simulation Manager has disappeared 274 279 managerInt = null; 275 CADSimulator.theViewer.setSimManagerStatus(false);280 cadModel.setSimManagerStatus(false); 276 281 277 282 coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", … … 299 304 { 300 305 301 CADSimulator.theViewer.setScriptStatus(status);306 cadModel.setScriptStatus(status); 302 307 303 308 if (managerInt != null) … … 310 315 //Simulation Manager has disappeared 311 316 managerInt = null; 312 CADSimulator.theViewer.setSimManagerStatus(false);317 cadModel.setSimManagerStatus(false); 313 318 314 319 coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", … … 334 339 public void run() 335 340 { 336 CADSimulator.theViewer.setParamicsStatus(status); 341 cadModel.setParamicsStatus(status); 342 // Is the update for network loaded event? 343 // Fixes defect where network ID is never displayed. 344 if (status == PARAMICS_STATUS.LOADED) 345 { 346 try 347 { 348 // Then we need to tell the model it has a new network ID 349 int currentNetwork = getParamicsNetworkLoaded(); 350 cadModel.setParamicsNetworkLoaded("" + currentNetwork); 351 } catch (RemoteException ex) 352 { 353 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 354 "Unable to get current network loaded", ex); 355 } 356 } 337 357 338 358 if (managerInt != null) … … 345 365 //Simulation Manager has disappeared 346 366 managerInt = null; 347 CADSimulator.theViewer.setSimManagerStatus(false);367 cadModel.setSimManagerStatus(false); 348 368 349 369 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", … … 395 415 { 396 416 throw new ScriptException(ScriptException.SIM_NOT_STARTED); 397 } else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 417 } 418 else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 398 419 { 399 420 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); … … 422 443 //Simulation Manager has disappeared 423 444 managerInt = null; 424 CADSimulator.theViewer.setSimManagerStatus(false);445 cadModel.setSimManagerStatus(false); 425 446 426 447 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", … … 456 477 //Simulation Manager has disappeared 457 478 managerInt = null; 458 CADSimulator.theViewer.setSimManagerStatus(false);479 cadModel.setSimManagerStatus(false); 459 480 460 481 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", … … 507 528 { 508 529 return SCRIPT_STATUS.SCRIPT_RUNNING; 509 } else 530 } 531 else 510 532 { 511 533 for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) … … 620 642 public void run() 621 643 { 622 CADSimulator.theViewer.setTime(currentSimTime);644 cadModel.setTime(currentSimTime); 623 645 624 646 //send an update every 30 seconds … … 637 659 //Simulation Manager has disappeared 638 660 managerInt = null; 639 CADSimulator.theViewer.setSimManagerStatus(false);661 cadModel.setSimManagerStatus(false); 640 662 641 663 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", … … 680 702 //Simulation Manager has disappeared 681 703 managerInt = null; 682 CADSimulator.theViewer.setSimManagerStatus(false);704 cadModel.setSimManagerStatus(false); 683 705 684 706 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", … … 736 758 //Simulation Manager has disappeared 737 759 managerInt = null; 738 CADSimulator.theViewer.setSimManagerStatus(false);760 cadModel.setSimManagerStatus(false); 739 761 740 762 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", … … 861 883 { 862 884 return cadData.tableForAssignedIncidents(); 863 } else if (tag.equals(TABLE.UNIT_STATUS)) 885 } 886 else if (tag.equals(TABLE.UNIT_STATUS)) 864 887 { 865 888 return cadData.tableForUnitStatus(); 866 } else if (tag.equals(TABLE.PENDING_INCIDENTS)) 889 } 890 else if (tag.equals(TABLE.PENDING_INCIDENTS)) 867 891 { 868 892 return cadData.tableForPendingIncidents(); 869 } else if (tag.equals(TABLE.INCIDENT_EDITOR)) 893 } 894 else if (tag.equals(TABLE.INCIDENT_EDITOR)) 870 895 { 871 896 return cadData.tableForIncidentEditor(); 872 } else 897 } 898 else 873 899 { 874 900 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataTable"); … … 932 958 { 933 959 return cadData.getIncident(incidentId).getLogNum(); 934 } else if (tag.equals(INC_VAL.MASTER_INC)) 960 } 961 else if (tag.equals(INC_VAL.MASTER_INC)) 935 962 { 936 963 return cadData.getIncident(incidentId).getMasterInc(); 937 } else if (tag.equals(INC_VAL.OAU)) 964 } 965 else if (tag.equals(INC_VAL.OAU)) 938 966 { 939 967 return cadData.getIncident(incidentId).getOau(); 940 } else if (tag.equals(INC_VAL.P)) 968 } 969 else if (tag.equals(INC_VAL.P)) 941 970 { 942 971 return cadData.getIncident(incidentId).getP(); 943 } else if (tag.equals(INC_VAL.DESCRIPTION)) 972 } 973 else if (tag.equals(INC_VAL.DESCRIPTION)) 944 974 { 945 975 return cadData.getIncident(incidentId).getDescription(); 946 } else if (tag.equals(INC_VAL.RP)) 976 } 977 else if (tag.equals(INC_VAL.RP)) 947 978 { 948 979 return cadData.getIncident(incidentId).getRp(); 949 } else if (tag.equals(INC_VAL.RP_TYPE)) 980 } 981 else if (tag.equals(INC_VAL.RP_TYPE)) 950 982 { 951 983 return cadData.getIncident(incidentId).getRpType(); 952 } else if (tag.equals(INC_VAL.ALI)) 984 } 985 else if (tag.equals(INC_VAL.ALI)) 953 986 { 954 987 return cadData.getIncident(incidentId).getAli(); 955 } else if (tag.equals(INC_VAL.MEDIA)) 988 } 989 else if (tag.equals(INC_VAL.MEDIA)) 956 990 { 957 991 return cadData.getIncident(incidentId).getMedia(); 958 } else 992 } 993 else 959 994 { 960 995 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncVal"); … … 974 1009 { 975 1010 cadData.getIncident(incidentId).setOau(value); 976 } else if (tag.equals(INC_VAL.P)) 1011 } 1012 else if (tag.equals(INC_VAL.P)) 977 1013 { 978 1014 cadData.getIncident(incidentId).setP(value); 979 } else if (tag.equals(INC_VAL.DESCRIPTION)) 1015 } 1016 else if (tag.equals(INC_VAL.DESCRIPTION)) 980 1017 { 981 1018 cadData.getIncident(incidentId).setDescription(value); 982 } else if (tag.equals(INC_VAL.RP)) 1019 } 1020 else if (tag.equals(INC_VAL.RP)) 983 1021 { 984 1022 cadData.getIncident(incidentId).setRp(value); 985 } else if (tag.equals(INC_VAL.RP_TYPE)) 1023 } 1024 else if (tag.equals(INC_VAL.RP_TYPE)) 986 1025 { 987 1026 cadData.getIncident(incidentId).setRpType(value); 988 } else if (tag.equals(INC_VAL.ALI)) 1027 } 1028 else if (tag.equals(INC_VAL.ALI)) 989 1029 { 990 1030 cadData.getIncident(incidentId).setAli(value); 991 } else if (tag.equals(INC_VAL.MEDIA)) 1031 } 1032 else if (tag.equals(INC_VAL.MEDIA)) 992 1033 { 993 1034 cadData.getIncident(incidentId).setMedia(value); 994 } else 1035 } 1036 else 995 1037 { 996 1038 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncVal"); … … 1010 1052 { 1011 1053 return cadData.getIncident(incidentId).getIncidentLocation().getAddress(); 1012 } else if (tag.equals(INC_LOC.LOC)) 1054 } 1055 else if (tag.equals(INC_LOC.LOC)) 1013 1056 { 1014 1057 return cadData.getIncident(incidentId).getIncidentLocation().getLoc(); 1015 } else if (tag.equals(INC_LOC.CITY)) 1058 } 1059 else if (tag.equals(INC_LOC.CITY)) 1016 1060 { 1017 1061 return cadData.getIncident(incidentId).getIncidentLocation().getCity(); 1018 } else if (tag.equals(INC_LOC.COUNTY)) 1062 } 1063 else if (tag.equals(INC_LOC.COUNTY)) 1019 1064 { 1020 1065 return cadData.getIncident(incidentId).getIncidentLocation().getCounty(); 1021 } else if (tag.equals(INC_LOC.STATE)) 1066 } 1067 else if (tag.equals(INC_LOC.STATE)) 1022 1068 { 1023 1069 return cadData.getIncident(incidentId).getIncidentLocation().getState(); 1024 } else if (tag.equals(INC_LOC.ZIP)) 1070 } 1071 else if (tag.equals(INC_LOC.ZIP)) 1025 1072 { 1026 1073 return cadData.getIncident(incidentId).getIncidentLocation().getZip(); 1027 } else if (tag.equals(INC_LOC.BEAT)) 1074 } 1075 else if (tag.equals(INC_LOC.BEAT)) 1028 1076 { 1029 1077 return cadData.getIncident(incidentId).getIncidentLocation().getBeat(); 1030 } else if (tag.equals(INC_LOC.AREA)) 1078 } 1079 else if (tag.equals(INC_LOC.AREA)) 1031 1080 { 1032 1081 return cadData.getIncident(incidentId).getIncidentLocation().getArea(); 1033 } else if (tag.equals(INC_LOC.SECTOR)) 1082 } 1083 else if (tag.equals(INC_LOC.SECTOR)) 1034 1084 { 1035 1085 return cadData.getIncident(incidentId).getIncidentLocation().getSector(); 1036 } else if (tag.equals(INC_LOC.SECTOR_CODE)) 1086 } 1087 else if (tag.equals(INC_LOC.SECTOR_CODE)) 1037 1088 { 1038 1089 return cadData.getIncident(incidentId).getIncidentLocation().getSectorCode(); 1039 } else if (tag.equals(INC_LOC.DIVISION)) 1090 } 1091 else if (tag.equals(INC_LOC.DIVISION)) 1040 1092 { 1041 1093 return cadData.getIncident(incidentId).getIncidentLocation().getDivision(); 1042 } else if (tag.equals(INC_LOC.APT)) 1094 } 1095 else if (tag.equals(INC_LOC.APT)) 1043 1096 { 1044 1097 return cadData.getIncident(incidentId).getIncidentLocation().getApt(); 1045 } else if (tag.equals(INC_LOC.BUILDING)) 1098 } 1099 else if (tag.equals(INC_LOC.BUILDING)) 1046 1100 { 1047 1101 return cadData.getIncident(incidentId).getIncidentLocation().getBuilding(); 1048 } else if (tag.equals(INC_LOC.CROSS_ST)) 1102 } 1103 else if (tag.equals(INC_LOC.CROSS_ST)) 1049 1104 { 1050 1105 return cadData.getIncident(incidentId).getIncidentLocation().getCrossSt(); 1051 } else if (tag.equals(INC_LOC.LAW)) 1106 } 1107 else if (tag.equals(INC_LOC.LAW)) 1052 1108 { 1053 1109 return cadData.getIncident(incidentId).getIncidentLocation().getLaw(); 1054 } else if (tag.equals(INC_LOC.FIRE)) 1110 } 1111 else if (tag.equals(INC_LOC.FIRE)) 1055 1112 { 1056 1113 return cadData.getIncident(incidentId).getIncidentLocation().getFire(); 1057 } else if (tag.equals(INC_LOC.EMS)) 1114 } 1115 else if (tag.equals(INC_LOC.EMS)) 1058 1116 { 1059 1117 return cadData.getIncident(incidentId).getIncidentLocation().getEms(); 1060 } else 1118 } 1119 else 1061 1120 { 1062 1121 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncLoc"); … … 1076 1135 { 1077 1136 cadData.getIncident(incidentId).getIncidentLocation().setAddress(value); 1078 } else if (tag.equals(INC_LOC.LOC)) 1137 } 1138 else if (tag.equals(INC_LOC.LOC)) 1079 1139 { 1080 1140 cadData.getIncident(incidentId).getIncidentLocation().setLoc(value); 1081 } else if (tag.equals(INC_LOC.CITY)) 1141 } 1142 else if (tag.equals(INC_LOC.CITY)) 1082 1143 { 1083 1144 cadData.getIncident(incidentId).getIncidentLocation().setCity(value); 1084 } else if (tag.equals(INC_LOC.COUNTY)) 1145 } 1146 else if (tag.equals(INC_LOC.COUNTY)) 1085 1147 { 1086 1148 cadData.getIncident(incidentId).getIncidentLocation().setCounty(value); 1087 } else if (tag.equals(INC_LOC.STATE)) 1149 } 1150 else if (tag.equals(INC_LOC.STATE)) 1088 1151 { 1089 1152 cadData.getIncident(incidentId).getIncidentLocation().setState(value); 1090 } else if (tag.equals(INC_LOC.ZIP)) 1153 } 1154 else if (tag.equals(INC_LOC.ZIP)) 1091 1155 { 1092 1156 cadData.getIncident(incidentId).getIncidentLocation().setZip(value); 1093 } else if (tag.equals(INC_LOC.BEAT)) 1157 } 1158 else if (tag.equals(INC_LOC.BEAT)) 1094 1159 { 1095 1160 cadData.getIncident(incidentId).getIncidentLocation().setBeat(value); 1096 } else if (tag.equals(INC_LOC.AREA)) 1161 } 1162 else if (tag.equals(INC_LOC.AREA)) 1097 1163 { 1098 1164 cadData.getIncident(incidentId).getIncidentLocation().setArea(value); 1099 } else if (tag.equals(INC_LOC.SECTOR)) 1165 } 1166 else if (tag.equals(INC_LOC.SECTOR)) 1100 1167 { 1101 1168 cadData.getIncident(incidentId).getIncidentLocation().setSector(value); 1102 } else if (tag.equals(INC_LOC.SECTOR_CODE)) 1169 } 1170 else if (tag.equals(INC_LOC.SECTOR_CODE)) 1103 1171 { 1104 1172 cadData.getIncident(incidentId).getIncidentLocation().setSectorCode(value); 1105 } else if (tag.equals(INC_LOC.DIVISION)) 1173 } 1174 else if (tag.equals(INC_LOC.DIVISION)) 1106 1175 { 1107 1176 cadData.getIncident(incidentId).getIncidentLocation().setDivision(value); 1108 } else if (tag.equals(INC_LOC.APT)) 1177 } 1178 else if (tag.equals(INC_LOC.APT)) 1109 1179 { 1110 1180 cadData.getIncident(incidentId).getIncidentLocation().setApt(value); 1111 } else if (tag.equals(INC_LOC.BUILDING)) 1181 } 1182 else if (tag.equals(INC_LOC.BUILDING)) 1112 1183 { 1113 1184 cadData.getIncident(incidentId).getIncidentLocation().setBuilding(value); 1114 } else if (tag.equals(INC_LOC.CROSS_ST)) 1185 } 1186 else if (tag.equals(INC_LOC.CROSS_ST)) 1115 1187 { 1116 1188 cadData.getIncident(incidentId).getIncidentLocation().setCrossSt(value); 1117 } else if (tag.equals(INC_LOC.LAW)) 1189 } 1190 else if (tag.equals(INC_LOC.LAW)) 1118 1191 { 1119 1192 cadData.getIncident(incidentId).getIncidentLocation().setLaw(value); 1120 } else if (tag.equals(INC_LOC.FIRE)) 1193 } 1194 else if (tag.equals(INC_LOC.FIRE)) 1121 1195 { 1122 1196 cadData.getIncident(incidentId).getIncidentLocation().setFire(value); 1123 } else if (tag.equals(INC_LOC.EMS)) 1197 } 1198 else if (tag.equals(INC_LOC.EMS)) 1124 1199 { 1125 1200 cadData.getIncident(incidentId).getIncidentLocation().setEms(value); 1126 } else 1201 } 1202 else 1127 1203 { 1128 1204 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncLoc"); … … 1142 1218 { 1143 1219 return cadData.getIncident(incidentId).getIncidentCaller().getCallerType(); 1144 } else if (tag.equals(INC_CALLER.NAME)) 1220 } 1221 else if (tag.equals(INC_CALLER.NAME)) 1145 1222 { 1146 1223 return cadData.getIncident(incidentId).getIncidentCaller().getCallerName(); 1147 } else if (tag.equals(INC_CALLER.PHONE)) 1224 } 1225 else if (tag.equals(INC_CALLER.PHONE)) 1148 1226 { 1149 1227 return cadData.getIncident(incidentId).getIncidentCaller().getPhone(); 1150 } else if (tag.equals(INC_CALLER.EXT)) 1228 } 1229 else if (tag.equals(INC_CALLER.EXT)) 1151 1230 { 1152 1231 return cadData.getIncident(incidentId).getIncidentCaller().getExt(); 1153 } else 1232 } 1233 else 1154 1234 { 1155 1235 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCaller"); … … 1169 1249 { 1170 1250 cadData.getIncident(incidentId).getIncidentCaller().setCallerType(value); 1171 } else if (tag.equals(INC_CALLER.NAME)) 1251 } 1252 else if (tag.equals(INC_CALLER.NAME)) 1172 1253 { 1173 1254 cadData.getIncident(incidentId).getIncidentCaller().setCallerName(value); 1174 } else if (tag.equals(INC_CALLER.PHONE)) 1255 } 1256 else if (tag.equals(INC_CALLER.PHONE)) 1175 1257 { 1176 1258 cadData.getIncident(incidentId).getIncidentCaller().setPhone(value); 1177 } else if (tag.equals(INC_CALLER.EXT)) 1259 } 1260 else if (tag.equals(INC_CALLER.EXT)) 1178 1261 { 1179 1262 cadData.getIncident(incidentId).getIncidentCaller().setExt(value); 1180 } else 1263 } 1264 else 1181 1265 { 1182 1266 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncCaller"); … … 1196 1280 { 1197 1281 return cadData.getIncident(incidentId).getProblem().getProblem(); 1198 } else if (tag.equals(INC_PROBLEM.CODE)) 1282 } 1283 else if (tag.equals(INC_PROBLEM.CODE)) 1199 1284 { 1200 1285 return cadData.getIncident(incidentId).getProblem().getProblemCode(); 1201 } else if (tag.equals(INC_PROBLEM.PRIORITY)) 1286 } 1287 else if (tag.equals(INC_PROBLEM.PRIORITY)) 1202 1288 { 1203 1289 return cadData.getIncident(incidentId).getProblem().getPriority(); 1204 } else 1290 } 1291 else 1205 1292 { 1206 1293 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncProblem"); … … 1220 1307 { 1221 1308 cadData.getIncident(incidentId).getProblem().setProblem(value); 1222 } else if (tag.equals(INC_PROBLEM.CODE)) 1309 } 1310 else if (tag.equals(INC_PROBLEM.CODE)) 1223 1311 { 1224 1312 cadData.getIncident(incidentId).getProblem().setProblemCode(value); 1225 } else if (tag.equals(INC_PROBLEM.PRIORITY)) 1313 } 1314 else if (tag.equals(INC_PROBLEM.PRIORITY)) 1226 1315 { 1227 1316 cadData.getIncident(incidentId).getProblem().setPriority(value); 1228 } else 1317 } 1318 else 1229 1319 { 1230 1320 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncProblem"); … … 1244 1334 { 1245 1335 return cadData.getIncident(incidentId).getGenInfo().getJurisdiction(); 1246 } else if (tag.equals(INC_GEN_INFO.ALARM)) 1336 } 1337 else if (tag.equals(INC_GEN_INFO.ALARM)) 1247 1338 { 1248 1339 return cadData.getIncident(incidentId).getGenInfo().getAlarm(); 1249 } else if (tag.equals(INC_GEN_INFO.AGY)) 1340 } 1341 else if (tag.equals(INC_GEN_INFO.AGY)) 1250 1342 { 1251 1343 return cadData.getIncident(incidentId).getGenInfo().getAgy(); 1252 } else 1344 } 1345 else 1253 1346 { 1254 1347 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncGenInfo"); … … 1268 1361 { 1269 1362 cadData.getIncident(incidentId).getGenInfo().setJurisdiction(value); 1270 } else if (tag.equals(INC_GEN_INFO.ALARM)) 1363 } 1364 else if (tag.equals(INC_GEN_INFO.ALARM)) 1271 1365 { 1272 1366 cadData.getIncident(incidentId).getGenInfo().setAlarm(value); 1273 } else if (tag.equals(INC_GEN_INFO.AGY)) 1367 } 1368 else if (tag.equals(INC_GEN_INFO.AGY)) 1274 1369 { 1275 1370 cadData.getIncident(incidentId).getGenInfo().setAgy(value); 1276 } else 1371 } 1372 else 1277 1373 { 1278 1374 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncGenInfo"); … … 1292 1388 { 1293 1389 return cadData.getIncident(incidentId).getResponse().getPlan(); 1294 } else if (tag.equals(INC_RESP.AREA)) 1390 } 1391 else if (tag.equals(INC_RESP.AREA)) 1295 1392 { 1296 1393 return cadData.getIncident(incidentId).getResponse().getArea(); 1297 } else 1394 } 1395 else 1298 1396 { 1299 1397 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncResp"); … … 1313 1411 { 1314 1412 cadData.getIncident(incidentId).getResponse().setPlan(value); 1315 } else if (tag.equals(INC_RESP.AREA)) 1413 } 1414 else if (tag.equals(INC_RESP.AREA)) 1316 1415 { 1317 1416 cadData.getIncident(incidentId).getResponse().setArea(value); 1318 } else 1417 } 1418 else 1319 1419 { 1320 1420 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncResp"); … … 1334 1434 { 1335 1435 return cadData.getIncident(incidentId).getAdditionalInfo().getType(); 1336 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1436 } 1437 else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1337 1438 { 1338 1439 return cadData.getIncident(incidentId).getAdditionalInfo().getTypeCode(); 1339 } else if (tag.equals(INC_ADD_INFO.MACHINE)) 1440 } 1441 else if (tag.equals(INC_ADD_INFO.MACHINE)) 1340 1442 { 1341 1443 return cadData.getIncident(incidentId).getAdditionalInfo().getMachine(); 1342 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1444 } 1445 else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1343 1446 { 1344 1447 return cadData.getIncident(incidentId).getAdditionalInfo().getCallStatus(); 1345 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1448 } 1449 else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1346 1450 { 1347 1451 return cadData.getIncident(incidentId).getAdditionalInfo().getCallTakerExt(); 1348 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1452 } 1453 else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1349 1454 { 1350 1455 return cadData.getIncident(incidentId).getAdditionalInfo().getAlarmLevel(); 1351 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1456 } 1457 else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1352 1458 { 1353 1459 return cadData.getIncident(incidentId).getAdditionalInfo().getRotationProviderArea(); 1354 } else if (tag.equals(INC_ADD_INFO.COMMENT)) 1460 } 1461 else if (tag.equals(INC_ADD_INFO.COMMENT)) 1355 1462 { 1356 1463 return cadData.getIncident(incidentId).getAdditionalInfo().getComment(); 1357 } else 1464 } 1465 else 1358 1466 { 1359 1467 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncAddInfo"); … … 1373 1481 { 1374 1482 cadData.getIncident(incidentId).getAdditionalInfo().setType(value); 1375 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1483 } 1484 else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1376 1485 { 1377 1486 cadData.getIncident(incidentId).getAdditionalInfo().setTypeCode(value); 1378 } else if (tag.equals(INC_ADD_INFO.MACHINE)) 1487 } 1488 else if (tag.equals(INC_ADD_INFO.MACHINE)) 1379 1489 { 1380 1490 cadData.getIncident(incidentId).getAdditionalInfo().setMachine(value); 1381 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1491 } 1492 else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1382 1493 { 1383 1494 cadData.getIncident(incidentId).getAdditionalInfo().setCallStatus(value); 1384 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1495 } 1496 else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1385 1497 { 1386 1498 cadData.getIncident(incidentId).getAdditionalInfo().setCallTakerExt(value); 1387 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1499 } 1500 else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1388 1501 { 1389 1502 cadData.getIncident(incidentId).getAdditionalInfo().setAlarmLevel(value); 1390 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1503 } 1504 else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1391 1505 { 1392 1506 cadData.getIncident(incidentId).getAdditionalInfo().setRotationProviderArea(value); 1393 } else if (tag.equals(INC_ADD_INFO.COMMENT)) 1507 } 1508 else if (tag.equals(INC_ADD_INFO.COMMENT)) 1394 1509 { 1395 1510 cadData.getIncident(incidentId).getAdditionalInfo().setComment(value); 1396 } else 1511 } 1512 else 1397 1513 { 1398 1514 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncAddInfo"); … … 1412 1528 { 1413 1529 return cadData.getIncident(incidentId).getActivities().getVehicle(); 1414 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1530 } 1531 else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1415 1532 { 1416 1533 return cadData.getIncident(incidentId).getActivities().getActivity(); 1417 } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1534 } 1535 else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1418 1536 { 1419 1537 return cadData.getIncident(incidentId).getActivities().getLocation(); 1420 } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1538 } 1539 else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1421 1540 { 1422 1541 return cadData.getIncident(incidentId).getActivities().getComment(); 1423 } else if (tag.equals(INC_ACTIVITIES.DISP)) 1542 } 1543 else if (tag.equals(INC_ACTIVITIES.DISP)) 1424 1544 { 1425 1545 return cadData.getIncident(incidentId).getActivities().getDisp(); 1426 } else 1546 } 1547 else 1427 1548 { 1428 1549 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncActivities"); … … 1442 1563 { 1443 1564 cadData.getIncident(incidentId).getActivities().setVehicle(value); 1444 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1565 } 1566 else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1445 1567 { 1446 1568 cadData.getIncident(incidentId).getActivities().setActivity(value); 1447 } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1569 } 1570 else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1448 1571 { 1449 1572 cadData.getIncident(incidentId).getActivities().setLocation(value); 1450 } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1573 } 1574 else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1451 1575 { 1452 1576 cadData.getIncident(incidentId).getActivities().setComment(value); 1453 } else if (tag.equals(INC_ACTIVITIES.DISP)) 1577 } 1578 else if (tag.equals(INC_ACTIVITIES.DISP)) 1454 1579 { 1455 1580 cadData.getIncident(incidentId).getActivities().setDisp(value); 1456 } else 1581 } 1582 else 1457 1583 { 1458 1584 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncActivities"); … … 1472 1598 { 1473 1599 return cadData.getIncident(incidentId).getCallBacks().getInitial(); 1474 } else if (tag.equals(INC_CALLBACK.COMMENT)) 1600 } 1601 else if (tag.equals(INC_CALLBACK.COMMENT)) 1475 1602 { 1476 1603 return cadData.getIncident(incidentId).getCallBacks().getComment(); 1477 } else 1604 } 1605 else 1478 1606 { 1479 1607 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCallBack"); … … 1493 1621 { 1494 1622 return cadData.getIncident(incidentId).getEditLog().getEdit(); 1495 } else if (tag.equals(INC_EDIT_LOG.REASON)) 1623 } 1624 else if (tag.equals(INC_EDIT_LOG.REASON)) 1496 1625 { 1497 1626 return cadData.getIncident(incidentId).getEditLog().getReason(); 1498 } else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 1627 } 1628 else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 1499 1629 { 1500 1630 return cadData.getIncident(incidentId).getEditLog().getChangeBy(); 1501 } else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 1631 } 1632 else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 1502 1633 { 1503 1634 return cadData.getIncident(incidentId).getEditLog().getTerminal(); 1504 } else 1635 } 1636 else 1505 1637 { 1506 1638 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncEditLog"); … … 1520 1652 { 1521 1653 return cadData.getIncident(incidentId).getInfo().getCallInit(); 1522 } else if (tag.equals(INC_INFO.CALL_TAKEN)) 1654 } 1655 else if (tag.equals(INC_INFO.CALL_TAKEN)) 1523 1656 { 1524 1657 return cadData.getIncident(incidentId).getInfo().getCallTaken(); 1525 } else if (tag.equals(INC_INFO.TIME_IN_Q)) 1658 } 1659 else if (tag.equals(INC_INFO.TIME_IN_Q)) 1526 1660 { 1527 1661 return cadData.getIncident(incidentId).getInfo().getTimeInQ(); 1528 } else if (tag.equals(INC_INFO.LAST_UPDATED)) 1662 } 1663 else if (tag.equals(INC_INFO.LAST_UPDATED)) 1529 1664 { 1530 1665 return cadData.getIncident(incidentId).getInfo().getLastUpdated(); 1531 } else 1666 } 1667 else 1532 1668 { 1533 1669 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncInfo"); … … 1556 1692 { 1557 1693 return cardfileData.getCoastalDivisionUnitList(); 1558 } else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 1694 } 1695 else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 1559 1696 { 1560 1697 return cardfileData.getPoliceSheriffCoronerList(); 1561 } else if (tag.equals(CARDFILE.COURTS)) 1698 } 1699 else if (tag.equals(CARDFILE.COURTS)) 1562 1700 { 1563 1701 return cardfileData.getCourtsList(); 1564 } else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 1702 } 1703 else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 1565 1704 { 1566 1705 return cardfileData.getPublicTransportationList(); 1567 } else if (tag.equals(CARDFILE.GG_OTHER)) 1706 } 1707 else if (tag.equals(CARDFILE.GG_OTHER)) 1568 1708 { 1569 1709 return cardfileData.getGgOtherList(); 1570 } else if (tag.equals(CARDFILE.MY_MISC)) 1710 } 1711 else if (tag.equals(CARDFILE.MY_MISC)) 1571 1712 { 1572 1713 return cardfileData.getMyMiscList(); 1573 } else if (tag.equals(CARDFILE.SL_MISC)) 1714 } 1715 else if (tag.equals(CARDFILE.SL_MISC)) 1574 1716 { 1575 1717 return cardfileData.getSlMiscList(); 1576 } else if (tag.equals(CARDFILE.VT_MISC)) 1718 } 1719 else if (tag.equals(CARDFILE.VT_MISC)) 1577 1720 { 1578 1721 return cardfileData.getVlMiscList(); 1579 } else if (tag.equals(CARDFILE.CHP_OFFICES)) 1722 } 1723 else if (tag.equals(CARDFILE.CHP_OFFICES)) 1580 1724 { 1581 1725 return cardfileData.getChpOfficesList(); 1582 } else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 1726 } 1727 else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 1583 1728 { 1584 1729 return cardfileData.getStateAgenciesFacilitiesList(); 1585 } else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 1730 } 1731 else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 1586 1732 { 1587 1733 return cardfileData.getGovernmentOfficialsList(); 1588 } else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 1734 } 1735 else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 1589 1736 { 1590 1737 return cardfileData.getFederalAgenciesList(); 1591 } else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 1738 } 1739 else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 1592 1740 { 1593 1741 return cardfileData.getRanchesLivestockList(); 1594 } else if (tag.equals(CARDFILE.FIRE_EMS)) 1742 } 1743 else if (tag.equals(CARDFILE.FIRE_EMS)) 1595 1744 { 1596 1745 return cardfileData.getFireEmsList(); 1597 } else if (tag.equals(CARDFILE.JAILS)) 1746 } 1747 else if (tag.equals(CARDFILE.JAILS)) 1598 1748 { 1599 1749 return cardfileData.getJailsList(); 1600 } else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 1750 } 1751 else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 1601 1752 { 1602 1753 return cardfileData.getHospitalsMedCentersList(); 1603 } else if (tag.equals(CARDFILE.TOW_COMPANIES)) 1754 } 1755 else if (tag.equals(CARDFILE.TOW_COMPANIES)) 1604 1756 { 1605 1757 return cardfileData.getTowCompaniesList(); 1606 } else if (tag.equals(CARDFILE.CALTRANS)) 1758 } 1759 else if (tag.equals(CARDFILE.CALTRANS)) 1607 1760 { 1608 1761 return cardfileData.getCalTransList(); 1609 } else if (tag.equals(CARDFILE.COUNTY_ROADS)) 1762 } 1763 else if (tag.equals(CARDFILE.COUNTY_ROADS)) 1610 1764 { 1611 1765 return cardfileData.getCountyRoadsList(); 1612 } else if (tag.equals(CARDFILE.UTILITIES)) 1766 } 1767 else if (tag.equals(CARDFILE.UTILITIES)) 1613 1768 { 1614 1769 return cardfileData.getUtilitiesList(); 1615 } else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 1770 } 1771 else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 1616 1772 { 1617 1773 return cardfileData.getAnimalControlList(); 1618 } else if (tag.equals(CARDFILE.AIRPORTS)) 1774 } 1775 else if (tag.equals(CARDFILE.AIRPORTS)) 1619 1776 { 1620 1777 return cardfileData.getAirportsList(); 1621 } else if (tag.equals(CARDFILE.CREDIT_CARDS)) 1778 } 1779 else if (tag.equals(CARDFILE.CREDIT_CARDS)) 1622 1780 { 1623 1781 return cardfileData.getCreditCardsList(); 1624 } else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 1782 } 1783 else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 1625 1784 { 1626 1785 return cardfileData.getGgCrisisSheltersList(); 1627 } else if (tag.equals(CARDFILE.RANGES)) 1786 } 1787 else if (tag.equals(CARDFILE.RANGES)) 1628 1788 { 1629 1789 return cardfileData.getRangesList(); 1630 } else if (tag.equals(CARDFILE.HOTLINES)) 1790 } 1791 else if (tag.equals(CARDFILE.HOTLINES)) 1631 1792 { 1632 1793 return cardfileData.getHotlinesList(); 1633 } else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 1794 } 1795 else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 1634 1796 { 1635 1797 return cardfileData.getHwyPatrolsOosList(); 1636 } else if (tag.equals(CARDFILE.PARKS_RECREATION)) 1798 } 1799 else if (tag.equals(CARDFILE.PARKS_RECREATION)) 1637 1800 { 1638 1801 return cardfileData.getParksRecreationList(); 1639 } else if (tag.equals(CARDFILE.SHELTERS)) 1802 } 1803 else if (tag.equals(CARDFILE.SHELTERS)) 1640 1804 { 1641 1805 return cardfileData.getSheltersList(); 1642 } else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 1806 } 1807 else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 1643 1808 { 1644 1809 return cardfileData.getSlCountyServicesList(); 1645 } else if (tag.equals(CARDFILE.SL_RESOURCES)) 1810 } 1811 else if (tag.equals(CARDFILE.SL_RESOURCES)) 1646 1812 { 1647 1813 return cardfileData.getSlResourcesList(); 1648 } else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 1814 } 1815 else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 1649 1816 { 1650 1817 return cardfileData.getTruckTireRepairList(); 1651 } else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 1818 } 1819 else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 1652 1820 { 1653 1821 return cardfileData.getMccEmployeesList(); 1654 } else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 1822 } 1823 else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 1655 1824 { 1656 1825 return cardfileData.getGateAccessCodesList(); 1657 } else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 1826 } 1827 else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 1658 1828 { 1659 1829 return cardfileData.getVtCallSignsList(); 1660 } else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 1830 } 1831 else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 1661 1832 { 1662 1833 return cardfileData.getSlccEmployeesList(); 1663 } else 1834 } 1835 else 1664 1836 { 1665 1837 throw new RemoteException("Wrong Enum sent into Coordinator.getCardfileList"); … … 1679 1851 { 1680 1852 selectedList = cardfileData.getCoastalDivisionUnitList(); 1681 } else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 1853 } 1854 else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 1682 1855 { 1683 1856 selectedList = cardfileData.getPoliceSheriffCoronerList(); 1684 } else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 1857 } 1858 else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 1685 1859 { 1686 1860 selectedList = cardfileData.getCourtsList(); 1687 } else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 1861 } 1862 else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 1688 1863 { 1689 1864 selectedList = cardfileData.getPublicTransportationList(); 1690 } else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 1865 } 1866 else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 1691 1867 { 1692 1868 selectedList = cardfileData.getGgOtherList(); 1693 } else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 1869 } 1870 else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 1694 1871 { 1695 1872 selectedList = cardfileData.getMyMiscList(); 1696 } else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 1873 } 1874 else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 1697 1875 { 1698 1876 selectedList = cardfileData.getSlMiscList(); 1699 } else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 1877 } 1878 else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 1700 1879 { 1701 1880 selectedList = cardfileData.getVlMiscList(); 1702 } else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 1881 } 1882 else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 1703 1883 { 1704 1884 selectedList = cardfileData.getChpOfficesList(); 1705 } else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 1885 } 1886 else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 1706 1887 { 1707 1888 selectedList = cardfileData.getStateAgenciesFacilitiesList(); 1708 } else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 1889 } 1890 else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 1709 1891 { 1710 1892 selectedList = cardfileData.getGovernmentOfficialsList(); 1711 } else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 1893 } 1894 else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 1712 1895 { 1713 1896 selectedList = cardfileData.getFederalAgenciesList(); 1714 } else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 1897 } 1898 else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 1715 1899 { 1716 1900 selectedList = cardfileData.getRanchesLivestockList(); 1717 } else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 1901 } 1902 else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 1718 1903 { 1719 1904 selectedList = cardfileData.getFireEmsList(); 1720 } else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 1905 } 1906 else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 1721 1907 { 1722 1908 selectedList = cardfileData.getJailsList(); 1723 } else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 1909 } 1910 else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 1724 1911 { 1725 1912 selectedList = cardfileData.getHospitalsMedCentersList(); 1726 } else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 1913 } 1914 else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 1727 1915 { 1728 1916 selectedList = cardfileData.getTowCompaniesList(); 1729 } else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 1917 } 1918 else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 1730 1919 { 1731 1920 selectedList = cardfileData.getCalTransList(); 1732 } else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 1921 } 1922 else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 1733 1923 { 1734 1924 selectedList = cardfileData.getCountyRoadsList(); 1735 } else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 1925 } 1926 else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 1736 1927 { 1737 1928 selectedList = cardfileData.getUtilitiesList(); 1738 } else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 1929 } 1930 else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 1739 1931 { 1740 1932 selectedList = cardfileData.getAnimalControlList(); 1741 } else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 1933 } 1934 else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 1742 1935 { 1743 1936 selectedList = cardfileData.getAirportsList(); 1744 } else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 1937 } 1938 else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 1745 1939 { 1746 1940 selectedList = cardfileData.getCreditCardsList(); 1747 } else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 1941 } 1942 else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 1748 1943 { 1749 1944 selectedList = cardfileData.getGgCrisisSheltersList(); 1750 } else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 1945 } 1946 else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 1751 1947 { 1752 1948 selectedList = cardfileData.getRangesList(); 1753 } else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 1949 } 1950 else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 1754 1951 { 1755 1952 selectedList = cardfileData.getHotlinesList(); 1756 } else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 1953 } 1954 else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 1757 1955 { 1758 1956 selectedList = cardfileData.getHwyPatrolsOosList(); 1759 } else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 1957 } 1958 else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 1760 1959 { 1761 1960 selectedList = cardfileData.getParksRecreationList(); 1762 } else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 1961 } 1962 else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 1763 1963 { 1764 1964 selectedList = cardfileData.getSheltersList(); 1765 } else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 1965 } 1966 else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 1766 1967 { 1767 1968 selectedList = cardfileData.getSlCountyServicesList(); 1768 } else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 1969 } 1970 else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 1769 1971 { 1770 1972 selectedList = cardfileData.getSlResourcesList(); 1771 } else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 1973 } 1974 else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 1772 1975 { 1773 1976 selectedList = cardfileData.getTruckTireRepairList(); 1774 } else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 1977 } 1978 else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 1775 1979 { 1776 1980 selectedList = cardfileData.getMccEmployeesList(); 1777 } else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 1981 } 1982 else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 1778 1983 { 1779 1984 selectedList = cardfileData.getGateAccessCodesList(); 1780 } else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 1985 } 1986 else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 1781 1987 { 1782 1988 selectedList = cardfileData.getVtCallSignsList(); 1783 } else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 1989 } 1990 else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 1784 1991 { 1785 1992 selectedList = cardfileData.getSlccEmployeesList(); 1786 } else 1993 } 1994 else 1787 1995 { 1788 1996 throw new RemoteException("Wrong Enum sent into Coordinator.editCardfileDataObject"); … … 1794 2002 cfdo.setName(log.newValue); 1795 2003 selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id)); 1796 } else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 2004 } 2005 else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 1797 2006 { 1798 2007 cfdo.setAddress(log.newValue); 1799 } else if (cfdo != null && log.command.equals(EditCommand.CITY)) 2008 } 2009 else if (cfdo != null && log.command.equals(EditCommand.CITY)) 1800 2010 { 1801 2011 cfdo.setCity(log.newValue); 1802 } else if (cfdo != null && log.command.equals(EditCommand.STATE)) 2012 } 2013 else if (cfdo != null && log.command.equals(EditCommand.STATE)) 1803 2014 { 1804 2015 cfdo.setState(log.newValue); 1805 } else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 2016 } 2017 else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 1806 2018 { 1807 2019 cfdo.setZip(log.newValue); 1808 } else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 2020 } 2021 else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 1809 2022 { 1810 2023 cfdo.setPhone1(log.newValue); 1811 } else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 2024 } 2025 else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 1812 2026 { 1813 2027 cfdo.setPhone2(log.newValue); 1814 } else if (cfdo != null && log.command.equals(EditCommand.FAX)) 2028 } 2029 else if (cfdo != null && log.command.equals(EditCommand.FAX)) 1815 2030 { 1816 2031 cfdo.setFax(log.newValue); 1817 } else if (log.command.equals(EditCommand.OBJECT_DELETE)) 2032 } 2033 else if (log.command.equals(EditCommand.OBJECT_DELETE)) 1818 2034 { 1819 2035 selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList, log.id)); 1820 } else if (log.command.equals(EditCommand.OBJECT_ADD)) 2036 } 2037 else if (log.command.equals(EditCommand.OBJECT_ADD)) 1821 2038 { 1822 2039 selectedList.addDataObject(log.newCardfileObject); 1823 } else if (log.command.equals(EditCommand.TABLE_ADD)) 2040 } 2041 else if (log.command.equals(EditCommand.TABLE_ADD)) 1824 2042 { 1825 2043 if (cfdo != null) … … 1827 2045 cfdo.addComment(log.tableFields); 1828 2046 } 1829 } else if (log.command.equals(EditCommand.TABLE_DELETE)) 2047 } 2048 else if (log.command.equals(EditCommand.TABLE_DELETE)) 1830 2049 { 1831 2050 if (cfdo != null) … … 1833 2052 cfdo.removeComment(log.timeStamp); 1834 2053 } 1835 } else 2054 } 2055 else 1836 2056 { 1837 2057 } … … 1872 2092 { 1873 2093 return cadData.getUnit(unitNum).getMasterInc(); 1874 } else if (tag.equals(UNIT_TAGS.STATUS)) 2094 } 2095 else if (tag.equals(UNIT_TAGS.STATUS)) 1875 2096 { 1876 2097 return cadData.getUnit(unitNum).getStatus(); 1877 } else if (tag.equals(UNIT_TAGS.OOS)) 2098 } 2099 else if (tag.equals(UNIT_TAGS.OOS)) 1878 2100 { 1879 2101 return cadData.getUnit(unitNum).getOos(); 1880 } else if (tag.equals(UNIT_TAGS.TYPE)) 2102 } 2103 else if (tag.equals(UNIT_TAGS.TYPE)) 1881 2104 { 1882 2105 return cadData.getUnit(unitNum).getType(); 1883 } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 2106 } 2107 else if (tag.equals(UNIT_TAGS.CURR_LOC)) 1884 2108 { 1885 2109 return cadData.getUnit(unitNum).getCurrentLocation(); 1886 } else if (tag.equals(UNIT_TAGS.DESTINATION)) 2110 } 2111 else if (tag.equals(UNIT_TAGS.DESTINATION)) 1887 2112 { 1888 2113 return cadData.getUnit(unitNum).getDestination(); 1889 } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 2114 } 2115 else if (tag.equals(UNIT_TAGS.MISC_INFO)) 1890 2116 { 1891 2117 return cadData.getUnit(unitNum).getMisc(); 1892 } else if (tag.equals(UNIT_TAGS.STACK)) 2118 } 2119 else if (tag.equals(UNIT_TAGS.STACK)) 1893 2120 { 1894 2121 return cadData.getUnit(unitNum).getStack(); 1895 } else if (tag.equals(UNIT_TAGS.AREA)) 2122 } 2123 else if (tag.equals(UNIT_TAGS.AREA)) 1896 2124 { 1897 2125 return cadData.getUnit(unitNum).getArea(); 1898 } else if (tag.equals(UNIT_TAGS.OFFICER)) 2126 } 2127 else if (tag.equals(UNIT_TAGS.OFFICER)) 1899 2128 { 1900 2129 return cadData.getUnit(unitNum).getOfficer(); 1901 } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 2130 } 2131 else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 1902 2132 { 1903 2133 return cadData.getUnit(unitNum).getBadge(); 1904 } else if (tag.equals(UNIT_TAGS.TIMER)) 2134 } 2135 else if (tag.equals(UNIT_TAGS.TIMER)) 1905 2136 { 1906 2137 return cadData.getUnit(unitNum).getTimerInString(); 1907 } else if (tag.equals(UNIT_TAGS.OFFICE)) 2138 } 2139 else if (tag.equals(UNIT_TAGS.OFFICE)) 1908 2140 { 1909 2141 return cadData.getUnit(unitNum).getOffice(); 1910 } else if (tag.equals(UNIT_TAGS.P)) 2142 } 2143 else if (tag.equals(UNIT_TAGS.P)) 1911 2144 { 1912 2145 return cadData.getUnit(unitNum).getP(); 1913 } else if (tag.equals(UNIT_TAGS.AGY)) 2146 } 2147 else if (tag.equals(UNIT_TAGS.AGY)) 1914 2148 { 1915 2149 return cadData.getUnit(unitNum).getAgy(); 1916 } else if (tag.equals(UNIT_TAGS.ALIAS)) 2150 } 2151 else if (tag.equals(UNIT_TAGS.ALIAS)) 1917 2152 { 1918 2153 return cadData.getUnit(unitNum).getAlias(); 1919 } else 2154 } 2155 else 1920 2156 { 1921 2157 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataUnitValue"); … … 1936 2172 { 1937 2173 cadData.getUnit(unitNum).setMasterInc((String) value); 1938 } else if (tag.equals(UNIT_TAGS.STATUS)) 2174 } 2175 else if (tag.equals(UNIT_TAGS.STATUS)) 1939 2176 { 1940 2177 cadData.getUnit(unitNum).setStatus((String) value); 1941 } else if (tag.equals(UNIT_TAGS.OOS)) 2178 } 2179 else if (tag.equals(UNIT_TAGS.OOS)) 1942 2180 { 1943 2181 cadData.getUnit(unitNum).setOos((String) value); 1944 } else if (tag.equals(UNIT_TAGS.TYPE)) 2182 } 2183 else if (tag.equals(UNIT_TAGS.TYPE)) 1945 2184 { 1946 2185 cadData.getUnit(unitNum).setType((String) value); 1947 } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 2186 } 2187 else if (tag.equals(UNIT_TAGS.CURR_LOC)) 1948 2188 { 1949 2189 cadData.getUnit(unitNum).setCurrentLocation((String) value); 1950 } else if (tag.equals(UNIT_TAGS.DESTINATION)) 2190 } 2191 else if (tag.equals(UNIT_TAGS.DESTINATION)) 1951 2192 { 1952 2193 cadData.getUnit(unitNum).setDestination((String) value); 1953 } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 2194 } 2195 else if (tag.equals(UNIT_TAGS.MISC_INFO)) 1954 2196 { 1955 2197 cadData.getUnit(unitNum).setMisc((String) value); 1956 } else if (tag.equals(UNIT_TAGS.STACK)) 2198 } 2199 else if (tag.equals(UNIT_TAGS.STACK)) 1957 2200 { 1958 2201 cadData.getUnit(unitNum).setStack((String) value); 1959 } else if (tag.equals(UNIT_TAGS.AREA)) 2202 } 2203 else if (tag.equals(UNIT_TAGS.AREA)) 1960 2204 { 1961 2205 cadData.getUnit(unitNum).setArea((String) value); 1962 } else if (tag.equals(UNIT_TAGS.OFFICER)) 2206 } 2207 else if (tag.equals(UNIT_TAGS.OFFICER)) 1963 2208 { 1964 2209 cadData.getUnit(unitNum).setOfficer((String) value); 1965 } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 2210 } 2211 else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 1966 2212 { 1967 2213 cadData.getUnit(unitNum).setBadge((String) value); 1968 } else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 2214 } 2215 else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 1969 2216 { 1970 2217 cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums) value); 1971 } else if (tag.equals(UNIT_TAGS.OFFICE)) 2218 } 2219 else if (tag.equals(UNIT_TAGS.OFFICE)) 1972 2220 { 1973 2221 cadData.getUnit(unitNum).setOffice((String) value); 1974 } else if (tag.equals(UNIT_TAGS.P)) 2222 } 2223 else if (tag.equals(UNIT_TAGS.P)) 1975 2224 { 1976 2225 cadData.getUnit(unitNum).setP((String) value); 1977 } else if (tag.equals(UNIT_TAGS.AGY)) 2226 } 2227 else if (tag.equals(UNIT_TAGS.AGY)) 1978 2228 { 1979 2229 cadData.getUnit(unitNum).setAgy((String) value); 1980 } else if (tag.equals(UNIT_TAGS.ALIAS)) 2230 } 2231 else if (tag.equals(UNIT_TAGS.ALIAS)) 1981 2232 { 1982 2233 cadData.getUnit(unitNum).setAlias((String) value); 1983 } else 2234 } 2235 else 1984 2236 { 1985 2237 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataUnitValue"); … … 2095 2347 { 2096 2348 cadData.unitAssignedToIncident(unit.beat, incidentNumber, unit.isPrimary); 2097 } else if (unit.statusType.equals("1097")) 2349 } 2350 else if (unit.statusType.equals("1097")) 2098 2351 { 2099 2352 cadData.unitArrivedAtIncidentScene(unit.beat, incidentNumber, unit.isPrimary); 2100 } else if (unit.statusType.equals("1098")) 2353 } 2354 else if (unit.statusType.equals("1098")) 2101 2355 { 2102 2356 cadData.unitAvailable(unit.beat); -
trunk/src/tmcsim/cadsimulator/managers/MediaManager.java
r2 r44 19 19 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 20 20 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 21 import tmcsim.cadsimulator.viewer. CADSimulatorViewer;21 import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 22 22 import tmcsim.common.CCTVDirections; 23 23 import tmcsim.common.CCTVInfo; … … 73 73 private StillImagesDB theImage_DB = null; 74 74 75 /** Reference to the CADSimulator Viewer. */76 private CADSimulator Viewer theViewer;75 /** Reference to the CADSimulatorModel. */ 76 private CADSimulatorModel theModel; 77 77 78 78 /** Properties object for the Media portion of the CAD. */ … … 90 90 */ 91 91 public MediaManager(String propertiesFile, ATMSManager theATMSManager, 92 CADSimulator Viewer viewer) {92 CADSimulatorModel model) { 93 93 theDVD_DB = new DVDPlayerDB(); 94 94 theImage_DB = new StillImagesDB(); 95 95 96 the Viewer = viewer;96 theModel = model; 97 97 98 98 try { … … 166 166 ((DVDStatusUpdate)arg).exception); 167 167 } 168 the Viewer.updateDVDStatus((DVDStatusUpdate)arg);168 theModel.updateDVDStatus((DVDStatusUpdate)arg); 169 169 } 170 170 else if(arg instanceof DVDTitleUpdate) { 171 the Viewer.updateDVDTitle((DVDTitleUpdate)arg);171 theModel.updateDVDTitle((DVDTitleUpdate)arg); 172 172 } 173 173 } -
trunk/src/tmcsim/cadsimulator/managers/ParamicsSimulationManager.java
r20 r44 6 6 import java.util.logging.Level; 7 7 import java.util.logging.Logger; 8 9 8 import tmcsim.cadmodels.CMSInfo; 10 9 import tmcsim.cadsimulator.Coordinator; … … 13 12 import tmcsim.cadsimulator.paramicscontrol.ParamicsIncidentWriter; 14 13 import tmcsim.cadsimulator.paramicscontrol.ParamicsStatusReader; 14 import tmcsim.common.CADEnums.PARAMICS_STATUS; 15 15 import tmcsim.common.SimulationException; 16 16 import tmcsim.common.XMLIncident; 17 import tmcsim.common.CADEnums.PARAMICS_STATUS;18 17 19 18 /** … … 22 21 * Upon construction all ParamicsReaders and ParamicsWriters are initialized 23 22 * with data parsed from the Properties file. When a connection is established 24 * the ParamicsStatusReader is registered to read Paramics Status updates. 25 * These updates are received through the updateParamicsStatus() method, which26 * notifies the Coordinator of the new status. The loadParamicsNetwork() must27 * becalled to register the ParamicsIncidentWriter which will write the28 * information to cause Paramics to begin loading a traffic network. When the23 * the ParamicsStatusReader is registered to read Paramics Status updates. These 24 * updates are received through the updateParamicsStatus() method, which 25 * notifies the Coordinator of the new status. The loadParamicsNetwork() must be 26 * called to register the ParamicsIncidentWriter which will write the 27 * information to cause Paramics to begin loading a traffic network. When the 29 28 * status becomes LOADED, the ParamicsCameraStatusReader is registered and 30 * begins reading. All camera speed updates are received through the31 * updateCameraInfo() method. The startSimulation(), resetSimulation(), and32 * sendIncidentUpdate() methods are used to control the flow of Incident 33 * update information to Paramics. The updateIncident() and updateDiversion()34 * methodsare used to update the information that is sent to Paramics.35 * 36 * 29 * begins reading. All camera speed updates are received through the 30 * updateCameraInfo() method. The startSimulation(), resetSimulation(), and 31 * sendIncidentUpdate() methods are used to control the flow of Incident update 32 * information to Paramics. The updateIncident() and updateDiversion() methods 33 * are used to update the information that is sent to Paramics. 34 * 35 * 37 36 * @see PARAMICS_STATUS 38 37 * @author Matthew Cechini 39 38 * @version 40 39 */ 41 public class ParamicsSimulationManager { 42 43 /** Error logger. */ 40 public class ParamicsSimulationManager 41 { 42 43 /** 44 * Error logger. 45 */ 44 46 private static Logger paramLogger = Logger.getLogger("tmcsim.cadsimulator.paramicscontrol"); 45 47 46 48 /** 47 49 * Enumeration containing property names for Properties parsing. 50 * 48 51 * @author Matthew Cechini 49 52 */ 50 private static enum PROPERTIES { 51 PARAMICS_HOST ("ParamicsCommHost"), 52 PARAMICS_PORT ("ParamicsCommPort"), 53 INCIDENT_UPDATE_INT ("IncidentUpdateInterval"), 54 INCIDENT_UPDATE_FILE ("IncidentUpdateFile"), 55 PARAMICS_STATUS_INT ("ParamicsStatusInterval"), 56 PARAMICS_STATUS_FILE ("ParamicsStatusFile"), 57 CAMERA_STATUS_INT ("CameraStatusInterval"), 58 CAMERA_STATUS_FILE ("CameraStatusFile"); 59 53 private static enum PROPERTIES 54 { 55 56 PARAMICS_HOST("ParamicsCommHost"), 57 PARAMICS_PORT("ParamicsCommPort"), 58 INCIDENT_UPDATE_INT("IncidentUpdateInterval"), 59 INCIDENT_UPDATE_FILE("IncidentUpdateFile"), 60 PARAMICS_STATUS_INT("ParamicsStatusInterval"), 61 PARAMICS_STATUS_FILE("ParamicsStatusFile"), 62 CAMERA_STATUS_INT("CameraStatusInterval"), 63 CAMERA_STATUS_FILE("CameraStatusFile"); 60 64 String name; 61 62 private PROPERTIES(String n) { 65 66 private PROPERTIES(String n) 67 { 63 68 name = n; 64 69 } 65 70 }; 66 67 /** ParamicsCommunicator Object used for communication. */ 71 /** 72 * ParamicsCommunicator Object used for communication. 73 */ 68 74 private ParamicsCommunicator theCommunicator; 69 70 /** Reference to the Coordinator Object. */ 75 /** 76 * Reference to the Coordinator Object. 77 */ 71 78 private Coordinator theCoordinator; 72 73 /** Reference to the MediaManager Object. */ 79 /** 80 * Reference to the MediaManager Object. 81 */ 74 82 private MediaManager theMediaMgr; 75 76 /** ParamicsIncidentWriter used to send incident updates to Paramics. */ 77 private ParamicsIncidentWriter paramicsIncidentWriter; 78 79 /** ParamicsStatusReader used to read status information from Paramics. */ 83 /** 84 * ParamicsIncidentWriter used to send incident updates to Paramics. 85 */ 86 private ParamicsIncidentWriter paramicsIncidentWriter; 87 /** 88 * ParamicsStatusReader used to read status information from Paramics. 89 */ 80 90 private ParamicsStatusReader paramicsStatusReader; 81 82 /** ParamicsCameraStatusReader used to read speed information from Paramics. */ 91 /** 92 * ParamicsCameraStatusReader used to read speed information from Paramics. 93 */ 83 94 private ParamicsCameraStatusReader paramicsCameraStatusReader; 84 85 /** Properties file. */ 95 /** 96 * Properties file. 97 */ 86 98 private Properties paramicsProperties; 87 88 89 /** 90 * Constructor. Loads the Properties file and initializes all Paramics 99 100 /** 101 * Constructor. Loads the Properties file and initializes all Paramics 91 102 * Writers and Readers with the parsed data. 92 * 103 * 93 104 * @param propertiesFile Target file path of properties file. 94 105 * @param coor Coordinator Object. 95 106 * @param mediaMgr MediaManager Object. 96 107 */ 97 public ParamicsSimulationManager(String propertiesFile, Coordinator coor, MediaManager mediaMgr) { 98 99 try { 108 public ParamicsSimulationManager(String propertiesFile, Coordinator coor, MediaManager mediaMgr) 109 { 110 111 try 112 { 100 113 paramicsProperties = new Properties(); 101 114 paramicsProperties.load(new FileInputStream(propertiesFile)); 102 115 103 116 theCoordinator = coor; 104 theMediaMgr = mediaMgr;105 106 theCommunicator = new ParamicsCommunicator(this, 117 theMediaMgr = mediaMgr; 118 119 theCommunicator = new ParamicsCommunicator(this, 107 120 paramicsProperties.getProperty(PROPERTIES.PARAMICS_HOST.name), 108 121 Integer.parseInt(paramicsProperties.getProperty( 109 PROPERTIES.PARAMICS_PORT.name).trim()));110 122 PROPERTIES.PARAMICS_PORT.name).trim())); 123 111 124 paramicsIncidentWriter = new ParamicsIncidentWriter(Integer.parseInt( 112 paramicsProperties.getProperty(PROPERTIES.INCIDENT_UPDATE_INT.name).trim())); 113 paramicsIncidentWriter.writerID = theCommunicator.nextID();125 paramicsProperties.getProperty(PROPERTIES.INCIDENT_UPDATE_INT.name).trim())); 126 paramicsIncidentWriter.writerID = theCommunicator.nextID(); 114 127 paramicsIncidentWriter.targetFile = paramicsProperties.getProperty( 115 PROPERTIES.INCIDENT_UPDATE_FILE.name); 116 128 PROPERTIES.INCIDENT_UPDATE_FILE.name); 129 117 130 paramicsStatusReader = new ParamicsStatusReader(this); 118 paramicsStatusReader.readerID = theCommunicator.nextID();119 paramicsStatusReader.interval = paramicsProperties.getProperty(131 paramicsStatusReader.readerID = theCommunicator.nextID(); 132 paramicsStatusReader.interval = paramicsProperties.getProperty( 120 133 PROPERTIES.PARAMICS_STATUS_INT.name).trim(); 121 134 paramicsStatusReader.targetFile = paramicsProperties.getProperty( 122 135 PROPERTIES.PARAMICS_STATUS_FILE.name); 123 136 124 137 paramicsCameraStatusReader = new ParamicsCameraStatusReader(this); 125 paramicsCameraStatusReader.readerID = theCommunicator.nextID();126 paramicsCameraStatusReader.interval = paramicsProperties.getProperty(138 paramicsCameraStatusReader.readerID = theCommunicator.nextID(); 139 paramicsCameraStatusReader.interval = paramicsProperties.getProperty( 127 140 PROPERTIES.CAMERA_STATUS_INT.name).trim(); 128 141 paramicsCameraStatusReader.targetFile = paramicsProperties.getProperty( 129 PROPERTIES.CAMERA_STATUS_FILE.name); 130 } 131 catch (Exception e){132 paramLogger.logp(Level.SEVERE, "ParamicsSimulationManager", 142 PROPERTIES.CAMERA_STATUS_FILE.name); 143 } catch (Exception e) 144 { 145 paramLogger.logp(Level.SEVERE, "ParamicsSimulationManager", 133 146 "Constructor", "Exception in parsing properties file.", e); 134 147 } 135 136 } 137 148 149 } 150 138 151 /** 139 152 * Returns whether a connection exists to the remote ParamicsCommunicator. 153 * 140 154 * @return true if a connection exists, false if not. 141 155 */ 142 public boolean isConnected() { 156 public boolean isConnected() 157 { 143 158 return theCommunicator.isConnected(); 144 159 } 145 160 146 161 /** 147 162 * Returns the integer Network ID that has been loaded into Paramics. 163 * 148 164 * @return Network ID. 149 165 */ 150 public int getParamicsNetworkLoaded() { 166 public int getParamicsNetworkLoaded() 167 { 151 168 return paramicsStatusReader.getNetworkID(); 152 169 } 153 170 154 171 /** 155 172 * Returns the current status of the Paramics traffic modeler. 156 * @return Current PARAMICS_STATUS 157 */ 158 public PARAMICS_STATUS getParamicsStatus() { 173 * 174 * @return Current PARAMICS_STATUS 175 */ 176 public PARAMICS_STATUS getParamicsStatus() 177 { 159 178 return paramicsStatusReader.getStatus(); 160 179 } 161 180 162 181 /** 163 182 * Updates the ParamicsIncidentWriter with new Incident information. 183 * 164 184 * @param xmlInc Updated Incident information. 165 185 */ 166 public void updateIncident(XMLIncident xmlInc) { 186 public void updateIncident(XMLIncident xmlInc) 187 { 167 188 paramicsIncidentWriter.updateIncident(xmlInc); 168 189 } 169 190 170 191 /** 171 192 * Updates the ParamicsIncidentWriter with the new Diversion information. 193 * 172 194 * @param theDiversion Updated diversion information. 173 195 */ 174 public void updateDiversion(CMSInfo theDiversion) { 196 public void updateDiversion(CMSInfo theDiversion) 197 { 175 198 paramicsIncidentWriter.updateDiversion(theDiversion); 176 199 } 177 200 178 201 /** 179 202 * Notifies the ParamicsIncidentWriter to start the simulation. 180 203 */ 181 public void startSimulation() { 204 public void startSimulation() 205 { 182 206 paramicsIncidentWriter.startSimulation(); 183 207 } 184 208 185 209 /** 186 210 * Notifies the ParamicsIncidentWriter to reset the simulation. 187 211 */ 188 public void resetSimulation() { 212 public void resetSimulation() 213 { 189 214 paramicsIncidentWriter.resetSimulation(); 190 215 } … … 192 217 /** 193 218 * Notifies the ParamicsIncidentWriter to send an Incident update. 219 * 194 220 * @param currentSimTime Current simulation time (in seconds). 195 221 */ 196 public void sendIncidentUpdate(long currentSimTime) { 222 public void sendIncidentUpdate(long currentSimTime) 223 { 197 224 paramicsIncidentWriter.sendUpdate(currentSimTime); 198 225 } 199 200 /** 201 * Establish a connection to the remote ParamicsCommunicator. Register 202 * the ParamicsStatusReader and update the current status to CONNECTED. 203 * If an exception occurs in connecting to the ParamicsCommunicator, 204 * update the current status to UNREACHABLE. 205 */ 206 public void connectToParamics() { 207 try { 208 theCommunicator.connect(); 226 227 /** 228 * Establish a connection to the remote ParamicsCommunicator. Register the 229 * ParamicsStatusReader and update the current status to CONNECTED. If an 230 * exception occurs in connecting to the ParamicsCommunicator, update the 231 * current status to UNREACHABLE. 232 */ 233 public void connectToParamics() 234 { 235 try 236 { 237 theCommunicator.connect(); 209 238 theCommunicator.registerReader(paramicsStatusReader); 210 239 211 240 updateParamicsStatus(PARAMICS_STATUS.CONNECTED); 212 } 213 catch (IOException ioe){214 paramLogger.logp(Level.SEVERE, "Coordinator", "connectToParamics", 241 } catch (IOException ioe) 242 { 243 paramLogger.logp(Level.SEVERE, "Coordinator", "connectToParamics", 215 244 "Communication error in connecting to Paramics.", ioe); 216 245 217 246 updateParamicsStatus(PARAMICS_STATUS.UNREACHABLE); 218 } 219 } 220 221 /** 222 * Close the connection to the remote ParamicsCommunicator. Unregister223 * all Readers and Wrtiers from the ParamicsCommunicator.Reset the status224 * information in the ParamicsStatusReader. Update the current status to247 } 248 } 249 250 /** 251 * Close the connection to the remote ParamicsCommunicator. Unregister all 252 * Readers and Wrtiers from the ParamicsCommunicator. Reset the status 253 * information in the ParamicsStatusReader. Update the current status to 225 254 * DISCONNECTED. 226 255 */ 227 public void disconnectFromParamics() { 228 256 public void disconnectFromParamics() 257 { 258 229 259 theCommunicator.disconnect(); 230 260 theCommunicator.unregisterReader(paramicsStatusReader); 231 theCommunicator.unregisterWriter(paramicsIncidentWriter); 261 theCommunicator.unregisterWriter(paramicsIncidentWriter); 232 262 theCommunicator.unregisterReader(paramicsCameraStatusReader); 233 263 234 264 paramicsStatusReader.resetStatusInfo(); 235 265 236 266 updateParamicsStatus(PARAMICS_STATUS.DISCONNECTED); 237 267 } 238 239 /** 240 * Updates the current paramics status. If the new status is LOADED,241 * then notify the ParamicsIncidentWriter that the network has been loaded242 * andregister the ParamicsCameraStatusReader with the ParamicsCommunicator.268 269 /** 270 * Updates the current paramics status. If the new status is LOADED, then 271 * notify the ParamicsIncidentWriter that the network has been loaded and 272 * register the ParamicsCameraStatusReader with the ParamicsCommunicator. 243 273 * Notify the Coordinator of all Paramics status updates. 244 274 * 245 * @param newStatus New Paramics status. 246 */ 247 public void updateParamicsStatus(PARAMICS_STATUS newStatus) { 248 275 * @param newStatus New Paramics status. 276 */ 277 public void updateParamicsStatus(PARAMICS_STATUS newStatus) 278 { 279 249 280 //the network has finished loading 250 if(newStatus == PARAMICS_STATUS.LOADED) { 251 281 if (newStatus == PARAMICS_STATUS.LOADED) 282 { 283 252 284 paramicsIncidentWriter.networkLoaded(); 253 254 theCommunicator.registerReader(paramicsCameraStatusReader); 255 } 256 else if(newStatus == PARAMICS_STATUS.DROPPED) { 257 paramLogger.logp(Level.WARNING, "Coordinator", "updateParamicsStatus", 285 286 theCommunicator.registerReader(paramicsCameraStatusReader); 287 288 } else if (newStatus == PARAMICS_STATUS.DROPPED) 289 { 290 paramLogger.logp(Level.WARNING, "Coordinator", "updateParamicsStatus", 258 291 "Connection to Paramics has been dropped."); 259 }else 260 { 261 paramLogger.logp(Level.INFO, "ParamicsSimulationManager", "updateParamicsStatus", 262 "Received: " + newStatus); 263 } 264 265 theCoordinator.setParamicsStatus(newStatus); 266 267 } 268 269 /** 270 * If a connection has been made, register the ParamicsIncidentWriter 271 * and use it to notify Paramics of the Network ID to load. 272 * 292 } 293 294 theCoordinator.setParamicsStatus(newStatus); 295 296 } 297 298 /** 299 * If a connection has been made, register the ParamicsIncidentWriter and 300 * use it to notify Paramics of the Network ID to load. 301 * 273 302 * @param networkID Network ID to load. 274 * @throws SimulationException if a connection has not been made to the 275 * remote ParamicsCommunicator. 276 */ 277 public void loadParamicsNetwork(int networkID) throws SimulationException { 278 279 if(theCommunicator.isConnected()) { 303 * @throws SimulationException if a connection has not been made to the 304 * remote ParamicsCommunicator. 305 */ 306 public void loadParamicsNetwork(int networkID) throws SimulationException 307 { 308 309 if (theCommunicator.isConnected()) 310 { 280 311 theCommunicator.registerWriter(paramicsIncidentWriter); 281 312 paramicsIncidentWriter.loadNetwork(networkID); 282 } 283 else313 } else 314 { 284 315 throw new SimulationException(SimulationException.PARAMICS_NOT_CONNECTED); 285 } 286 287 /** 288 * Receive updated camera speed information. Notify the MediaManager with 289 * the updated data. 290 * 316 } 317 } 318 319 /** 320 * Receive updated camera speed information. Notify the MediaManager with 321 * the updated data. 322 * 291 323 * @param cameraID CCTV camera ID 292 324 * @param avgSpeed_NE Average speed of traffic flowing N or E 293 325 * @param avgSpeed_SW Average speed of traffic flowing S or W 294 326 */ 295 public void updateCameraInfo(Integer cameraID, float avgSpeed_NE, float avgSpeed_SW) { 327 public void updateCameraInfo(Integer cameraID, float avgSpeed_NE, float avgSpeed_SW) 328 { 296 329 theMediaMgr.updateCameraInfo(cameraID, avgSpeed_NE, avgSpeed_SW); 297 330 } -
trunk/src/tmcsim/cadsimulator/stillimagecontrol/ATMSCommunicator.java
r2 r44 7 7 8 8 /** 9 * ATMSCommunicator handles communication between the CAD Simulator and the 10 * ATMS Server. The funcationality provided includes querying the current time11 * on the ATMS server and replacing images on the ATMS to model12 * traffic flow changes. The ATMSCommunicator uses the plink.exe external13 * application to establish an SSH communication with the ATMS server, which is14 * used to execute commands remotely.15 * 9 * ATMSCommunicator handles communication between the CAD Simulator and the ATMS 10 * Server. The funcationality provided includes querying the current time on the 11 * ATMS server and replacing images on the ATMS to model traffic flow changes. 12 * The ATMSCommunicator uses the plink.exe external application to establish an 13 * SSH communication with the ATMS server, which is used to execute commands 14 * remotely. 15 * 16 16 * @author Matthew Cechini 17 17 * @version 18 18 */ 19 public class ATMSCommunicator { 20 21 /** Connection user name. */ 19 public class ATMSCommunicator 20 { 21 22 /** 23 * Connection user name. 24 */ 22 25 protected String username; 23 24 /** Connection password. */ 26 /** 27 * Connection password. 28 */ 25 29 protected String password; 26 27 /** ATMS Server Host name. */ 30 /** 31 * ATMS Server Host name. 32 */ 28 33 protected String viewerHost; 29 30 /** Absolute directory path for images. */ 34 /** 35 * Absolute directory path for images. 36 */ 31 37 protected String image_dir; 32 33 /** Base plink command string. */ 38 /** 39 * Base plink command string. 40 */ 34 41 protected String plinkBaseCMD; 35 36 /** Constructor. */ 37 public ATMSCommunicator(String host, String user, String pwd, String dir) { 42 protected String remoteShellCmd; 43 44 /** 45 * Constructor. 46 */ 47 public ATMSCommunicator(String host, String user, String pwd, String dir) 48 { 38 49 viewerHost = host; 39 username = user; 40 password = pwd; 41 image_dir = dir; 42 43 plinkBaseCMD = "plink -l " + username + " -pw " + password + " " + viewerHost + " "; 50 username = user; 51 password = pwd; 52 image_dir = dir; 53 String osname = System.getProperty("os.name"); 54 if (osname.startsWith("Windows")) 55 { 56 remoteShellCmd = "plink -l " + username + " -pw " + password + " " + viewerHost + " \"date\""; 57 } 58 else 59 { 60 remoteShellCmd = "date"; //sshpass -p " + password + " " + "ssh -t -l " + username + viewerHost + " date &"; 61 } 44 62 } 45 63 46 64 /** 47 * Get the current ATMS server time as the number of seconds since Jan 1, 1970. 48 * 65 * Get the current ATMS server time as the number of seconds since Jan 1, 66 * 1970. 67 * 49 68 * @return Current time in seconds. 50 69 * @throws RemoteException If there is an exception in RMI communication. 51 */ 52 public long getCurrentTime() throws Exception { 53 70 */ 71 public long getCurrentTime() throws Exception 72 { 73 54 74 Calendar currentCal = Calendar.getInstance(); 55 75 56 Process timeProc = Runtime.getRuntime().exec( plinkBaseCMD + " \"date\"");76 Process timeProc = Runtime.getRuntime().exec(remoteShellCmd); 57 77 timeProc.waitFor(); 58 59 if(timeProc.exitValue() == 0) { 78 // System.out.println("timeProc exit = " + timeProc.exitValue()); 79 // byte[] procBytes = new byte[timeProc.getInputStream().available()]; 80 // timeProc.getInputStream().read(procBytes); 81 // String returnString = new String(procBytes); 82 // System.out.println("timeProc returned: " + returnString); 83 84 if (timeProc.exitValue() == 0) 85 { 60 86 String tempToken = null; 61 87 byte[] dateBytes = new byte[timeProc.getInputStream().available()]; 62 88 timeProc.getInputStream().read(dateBytes); 63 89 64 90 StringTokenizer spaceTok = new StringTokenizer(new String(dateBytes), " "); 65 while(spaceTok.hasMoreTokens()) { 91 while (spaceTok.hasMoreTokens()) 92 { 66 93 tempToken = spaceTok.nextToken(); 67 68 if(tempToken.indexOf(":") != -1) { 94 95 if (tempToken.indexOf(":") != -1) 96 { 69 97 StringTokenizer colonTok = new StringTokenizer(new String(tempToken), ":"); 70 98 71 99 currentCal.set(Calendar.HOUR, Integer.parseInt(colonTok.nextToken())); 72 100 currentCal.set(Calendar.MINUTE, Integer.parseInt(colonTok.nextToken())); 73 101 currentCal.set(Calendar.SECOND, Integer.parseInt(colonTok.nextToken())); 74 75 System.out.println("Time retreieved from ATRMS server: " +76 DateFormat.getDateTimeInstance().format(currentCal.getTime()));77 102 103 System.out.println("Time retreieved from ATRMS server: " 104 + DateFormat.getDateTimeInstance().format(currentCal.getTime())); 105 78 106 } 79 107 } 80 } 81 82 return currentCal.getTimeInMillis(); 108 } 109 110 return currentCal.getTimeInMillis(); 83 111 84 112 } 85 113 86 114 /** 87 * Show a new image for an ATMS camera. The ATMS camera files are named88 * <ATMS_Camera_ID>.xpm. If a camera file exists, delete it. Then copy89 * the parameter file name to <ATMS_Camera_ID>.xpm. If the camera ID or90 * new file does not exist, throw an exception.91 * 115 * Show a new image for an ATMS camera. The ATMS camera files are named 116 * <ATMS_Camera_ID>.xpm. If a camera file exists, delete it. Then copy the 117 * parameter file name to <ATMS_Camera_ID>.xpm. If the camera ID or new file 118 * does not exist, throw an exception. 119 * 92 120 * @param ATMS_cameraID ATMS indexed camera ID. 93 121 * @param fileName Filename to show. 94 122 * @throws RemoteException If there is an exception in RMI communication. 95 */ 96 public void showImage(Integer ATMS_cameraID, String fileName) throws RemoteException { 97 123 */ 124 public void showImage(Integer ATMS_cameraID, String fileName) throws RemoteException 125 { 126 98 127 System.out.println("Showing CameraID " + ATMS_cameraID + ", with filename: " + fileName); 99 128 /* 100 Process imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 101 imageProc.waitFor(); 102 103 if(imageProc.exitValue() != 0) { 104 throw new Exception(image_dir + "/cctvImage" + ATMS_cameraID + ".xpm does not exist"); 105 } 106 107 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/" + fileName + ".xpm\""); 108 imageProc.waitFor(); 129 Process imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 130 imageProc.waitFor(); 109 131 110 if(imageProc.exitValue() != 0) { 111 throw new Exception(image_dir + "/" + fileName + ".xpm does not exist"); 112 } 113 114 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"rm " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 115 imageProc.waitFor(); 116 117 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"cp " + image_dir + "/" + fileName + ".xpm" + 118 " " + image_dir + "/" + "cctvImage" + ATMS_cameraID + ".xpm\""); 119 imageProc.waitFor(); 120 */ 121 122 } 132 if(imageProc.exitValue() != 0) { 133 throw new Exception(image_dir + "/cctvImage" + ATMS_cameraID + ".xpm does not exist"); 134 } 135 136 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/" + fileName + ".xpm\""); 137 imageProc.waitFor(); 138 139 if(imageProc.exitValue() != 0) { 140 throw new Exception(image_dir + "/" + fileName + ".xpm does not exist"); 141 } 142 143 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"rm " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 144 imageProc.waitFor(); 145 146 imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"cp " + image_dir + "/" + fileName + ".xpm" + 147 " " + image_dir + "/" + "cctvImage" + ATMS_cameraID + ".xpm\""); 148 imageProc.waitFor(); 149 */ 150 151 } 123 152 } -
trunk/src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java
r36 r44 6 6 import java.awt.event.KeyEvent; 7 7 import java.awt.event.WindowEvent; 8 import java.io.IOException; 9 import java.util.Observable; 10 import java.util.Properties; 11 import java.util.logging.Level; 12 import java.util.logging.Logger; 8 13 import javax.swing.JFrame; 9 14 import javax.swing.JMenu; … … 13 18 import javax.swing.JTabbedPane; 14 19 import javax.swing.KeyStroke; 15 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;16 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;17 20 import tmcsim.cadsimulator.viewer.actions.ExitAction; 18 import tmcsim.c ommon.CADEnums.PARAMICS_STATUS;19 import tmcsim.c ommon.CADEnums.SCRIPT_STATUS;20 import tmcsim. common.RevisionNumber;21 import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 22 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 23 import tmcsim.interfaces.CADViewer; 21 24 22 25 /** … … 30 33 */ 31 34 @SuppressWarnings("serial") 32 public class CADSimulatorViewer extends JFrame 35 public class CADSimulatorViewer extends JFrame implements CADViewer 33 36 { 34 37 … … 45 48 */ 46 49 private ConfigStatusPanel configPanel; 50 47 51 /** 48 52 * Constructor. 49 53 */ 50 51 54 public CADSimulatorViewer() 52 55 { 53 super("CAD Simulator"); 56 super(); 57 setTitle("CAD Simulator " + getAppVersion()); 54 58 55 59 initComponents(); … … 57 61 58 62 /** 59 * @see SimulationStatusPanel 63 * Read the version number from the application properties. The file 64 * 'application.properties' is generated by build.xml. 65 * 66 * @return a version string obtained from application.properties file, or 67 * "Version: unknown" if an IOerror prevents us from reading the file. 60 68 */ 61 p ublic void connectClient()69 private String getAppVersion() 62 70 { 63 simulationPanel.connectClient(); 64 } 65 66 /** 67 * @see SimulationStatusPanel 68 */ 69 public void disconnectClient() 70 { 71 simulationPanel.disconnectClient(); 72 } 73 74 /** 75 * @see SimulationStatusPanel 76 */ 77 public void setSimManagerStatus(boolean connection) 78 { 79 simulationPanel.setSimManagerStatus(connection); 80 } 81 82 /** 83 * @see SimulationStatusPanel 84 */ 85 public void setTime(long seconds) 86 { 87 simulationPanel.setTime(seconds); 88 } 89 90 /** 91 * @see SimulationStatusPanel 92 */ 93 public void setScriptStatus(SCRIPT_STATUS newStatus) 94 { 95 simulationPanel.setScriptStatus(newStatus); 96 } 97 98 /** 99 * @see SimulationStatusPanel 100 */ 101 public void setParamicsStatus(PARAMICS_STATUS newStatus) 102 { 103 simulationPanel.setParamicsStatus(newStatus); 104 } 105 106 /** 107 * @see SimulationStatusPanel 108 */ 109 public void setParamicsNetworkLoaded(String networkID) 110 { 111 simulationPanel.setParamicsNetworkLoaded(networkID); 112 } 113 114 /** 115 * @see MediaStatusPanel 116 */ 117 public void updateDVDStatus(DVDStatusUpdate update) 118 { 119 mediaPanel.updateDVDStatus(update); 120 } 121 122 /** 123 * @see MediaStatusPanel 124 */ 125 public void updateDVDTitle(DVDTitleUpdate update) 126 { 127 mediaPanel.updateDVDTitle(update); 71 String propfilename = "/tmcsim/application.properties"; 72 String propKey = "Application.revision"; 73 String version = "unknown"; 74 try 75 { 76 Properties props = new Properties(); 77 props.load(this.getClass().getResourceAsStream(propfilename)); 78 version = (String) props.get(propKey); 79 } catch (IOException ex) 80 { 81 Logger.getLogger("tmcsim/cadsimulator").log(Level.SEVERE, 82 "CADSimulatorView.getAppVersion()", 83 "IOError reading " + propfilename); 84 } 85 return "revision: " + version; 128 86 } 129 87 … … 147 105 if (evt.getID() == WindowEvent.WINDOW_CLOSING) 148 106 { 149 int option = JOptionPane.showConfirmDialog(null,150 "Closing the CAD Simulator will stop the current "151 + "simulation. Do you wish to continue exiting?",152 "Confirm Exit",153 JOptionPane.YES_NO_OPTION);154 155 if (option != JOptionPane.NO_OPTION)156 {157 System.exit(0);158 }107 // int option = JOptionPane.showConfirmDialog(null, 108 // "Closing the CAD Simulator will stop the current " 109 // + "simulation. Do you wish to continue exiting?", 110 // "Confirm Exit", 111 // JOptionPane.YES_NO_OPTION); 112 // 113 // if (option != JOptionPane.NO_OPTION) 114 // { 115 System.exit(0); 116 // } 159 117 } 160 118 } … … 196 154 public void actionPerformed(java.awt.event.ActionEvent evt) 197 155 { 198 String ver = RevisionNumber.getString();156 String ver = "";//RevisionNumber.getString(); 199 157 JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE); 200 158 } … … 208 166 pack(); 209 167 setResizable(true); 168 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 210 169 } 211 170 private JTabbedPane cadSimTabbedPane; … … 213 172 private JMenu fileMenu; 214 173 private JMenuItem exitMenuItem; 174 175 @Override 176 public void update(Observable obs, Object obj) 177 { 178 if (obs instanceof CADSimulatorStatus) 179 { 180 simulationPanel.refresh(obs); 181 } 182 if (obs instanceof CADMediaStatus) 183 { 184 mediaPanel.refresh(obs); 185 } 186 } 215 187 } -
trunk/src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java
r2 r44 2 2 3 3 import java.awt.Dimension; 4 5 4 import javax.swing.BorderFactory; 6 5 import javax.swing.Box; … … 10 9 import javax.swing.JTable; 11 10 import javax.swing.JTextField; 12 13 11 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 14 12 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; … … 17 15 18 16 /** 19 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel20 * displays information regarding the DVD player's connection information. 21 * One table on the panel shows all DVD title that have been played or22 * repeated. A second table shows all DVD status updates that have been23 * received from the controller.24 * 17 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel 18 * displays information regarding the DVD player's connection information. One 19 * table on the panel shows all DVD title that have been played or repeated. A 20 * second table shows all DVD status updates that have been received from the 21 * controller. 22 * 25 23 * @author Matthew Cechini 26 * @version 24 * @version 27 25 */ 28 26 @SuppressWarnings("serial") 29 public class DVDInfoPanel extends JPanel { 27 public class DVDInfoPanel extends JPanel 28 { 30 29 31 /** DVD player connection info. */ 32 private String connInfo = null; 33 34 /** Table model for the title table. */ 30 /** 31 * DVD player connection info. 32 */ 33 public final String connInfo; 34 /** 35 * Table model for the title table. 36 */ 35 37 private DVDTitleTableModel titleTableModel; 38 /** 39 * Table to display DVD title plays and repeats. 40 */ 41 private JTable titleTable; 42 /** 43 * Table model for the Status table. 44 */ 45 private DVDStatusTableModel statusTableModel; 46 /** 47 * Table to display DVD status updates. 48 */ 49 private JTable statusTable; 36 50 37 /** Table to display DVD title plays and repeats. */38 private JTable titleTable;39 40 /** Table model for the Status table. */41 private DVDStatusTableModel statusTableModel;42 43 /** Table to display DVD status updates. */44 private JTable statusTable;45 46 47 51 /** 48 * Constructor. Initialize the panel GUI components.49 * 52 * Constructor. Initialize the panel GUI components. 53 * 50 54 * @param connectionInfo DVD player connection info. 51 55 */ 52 public DVDInfoPanel(String connectionInfo) { 56 public DVDInfoPanel(String connectionInfo) 57 { 53 58 connInfo = connectionInfo; 54 59 55 60 initComponents(); 56 } 57 61 } 62 58 63 /** 59 64 * This method updates the DVD status table with the new update object. 65 * 60 66 * @param update Update DVD Status update. 61 67 */ 62 public void updateDVDStatus(DVDStatusUpdate update) { 68 public void updateDVDStatus(DVDStatusUpdate update) 69 { 63 70 statusTableModel.addStatusUpdate(update); 64 71 } … … 66 73 /** 67 74 * This method updates the DVD title table with the new update object. 75 * 68 76 * @param update Update DVD Status update. 69 77 */ 70 public void updateDVDTitle(DVDTitleUpdate update) { 78 public void updateDVDTitle(DVDTitleUpdate update) 79 { 71 80 titleTableModel.addTitleUpdate(update); 72 81 } 73 82 74 83 /** 75 84 * Initialize the GUI components. 76 85 */ 77 private void initComponents() { 86 private void initComponents() 87 { 78 88 79 89 connInfoLbl = new JLabel("Connection Info:"); 80 90 connInfoLbl.setAlignmentX(Box.LEFT_ALIGNMENT); 81 connInfoTF = new JTextField(connInfo);91 connInfoTF = new JTextField(connInfo); 82 92 connInfoTF.setColumns(30); 83 93 connInfoTF.setAlignmentX(Box.LEFT_ALIGNMENT); 84 94 connInfoTF.setEditable(false); 85 95 86 96 Box connInfoBox = Box.createVerticalBox(); 87 97 connInfoBox.add(connInfoLbl); 88 98 connInfoBox.add(connInfoTF); 89 99 connInfoBox.setAlignmentX(Box.CENTER_ALIGNMENT); 90 100 91 101 titleTableModel = new DVDTitleTableModel(); 92 titleTable = new JTable(titleTableModel); 93 titleTable.getTableHeader().setReorderingAllowed(false); 94 95 for(int c = 0; c < titleTable.getColumnCount(); c++) { 102 titleTable = new JTable(titleTableModel); 103 titleTable.getTableHeader().setReorderingAllowed(false); 104 105 for (int c = 0; c < titleTable.getColumnCount(); c++) 106 { 96 107 titleTable.getColumnModel().getColumn(c).setMinWidth( 97 108 titleTableModel.getColumnMinWidth(c)); … … 102 113 titleTable.getColumnModel().getColumn(c).setResizable(true); 103 114 } 104 105 titlePane = new JScrollPane();115 116 titlePane = new JScrollPane(); 106 117 titlePane.setAlignmentX(Box.CENTER_ALIGNMENT); 107 118 //titlePane.setMinimumSize(new Dimension(,)); 108 titlePane.setPreferredSize(new Dimension(425, 225)); 119 titlePane.setPreferredSize(new Dimension(425, 225)); 109 120 titlePane.setViewportView(titleTable); 110 121 titlePane.setBorder(BorderFactory.createTitledBorder( 111 BorderFactory.createRaisedBevelBorder(), "Title Updates"));122 BorderFactory.createRaisedBevelBorder(), "Title Updates")); 112 123 113 124 statusTableModel = new DVDStatusTableModel(); 114 statusTable = new JTable(statusTableModel); 115 statusTable.getTableHeader().setReorderingAllowed(false); 116 117 for(int c = 0; c < statusTable.getColumnCount(); c++) { 125 statusTable = new JTable(statusTableModel); 126 statusTable.getTableHeader().setReorderingAllowed(false); 127 128 for (int c = 0; c < statusTable.getColumnCount(); c++) 129 { 118 130 statusTable.getColumnModel().getColumn(c).setMinWidth( 119 131 statusTableModel.getColumnMinWidth(c)); … … 124 136 statusTable.getColumnModel().getColumn(c).setResizable(true); 125 137 } 126 127 statusPane = new JScrollPane();138 139 statusPane = new JScrollPane(); 128 140 statusPane.setAlignmentX(Box.CENTER_ALIGNMENT); 129 141 //statusPane.setMinimumSize(new Dimension(,)); 130 statusPane.setPreferredSize(new Dimension(425, 150)); 142 statusPane.setPreferredSize(new Dimension(425, 150)); 131 143 statusPane.setViewportView(statusTable); 132 144 statusPane.setBorder(BorderFactory.createTitledBorder( 133 145 BorderFactory.createRaisedBevelBorder(), "Status Updates")); 134 146 135 147 Box panelBox = Box.createVerticalBox(); 136 148 panelBox.add(connInfoBox); … … 139 151 panelBox.add(Box.createVerticalStrut(10)); 140 152 panelBox.add(statusPane); 141 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5));142 153 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 154 143 155 add(panelBox); 144 156 } 145 146 157 private JScrollPane titlePane; 147 158 private JScrollPane statusPane; 148 149 159 private JLabel connInfoLbl; 150 151 160 private JTextField connInfoTF; 152 161 } -
trunk/src/tmcsim/cadsimulator/viewer/MediaStatusPanel.java
r2 r44 1 1 package tmcsim.cadsimulator.viewer; 2 2 3 import java.util.Iterator; 4 import java.util.Observable; 3 5 import java.util.TreeMap; 4 5 6 import javax.swing.JPanel; 6 7 import javax.swing.JTabbedPane; 7 8 8 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 9 9 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 10 import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 10 11 11 12 /** 12 * MediaStatusPanel is a GUI object used for displaying information 13 * for DVD connections created by the CAD Simulator. Tabs for each 14 * DVD are created and information is displayed on a DVDInfoPanel. 15 * All status and title updates are sent to the corresponding 16 * DVDInfoPanel. The DVDs are referenced by connection info, which 17 * is unique to each DVD player. 18 * 19 * @author Matthew Cechini 20 * @version 13 * MediaStatusPanel is a GUI object used for displaying information for DVD 14 * connections created by the CAD Simulator. Tabs for each DVD are created and 15 * information is displayed on a DVDInfoPanel. All status and title updates are 16 * sent to the corresponding DVDInfoPanel. The DVDs are referenced by connection 17 * info, which is unique to each DVD player. 18 * 19 * @author jdalbey 21 20 */ 22 21 @SuppressWarnings("serial") 23 public class MediaStatusPanel extends JPanel { 24 25 /** Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). */ 22 public class MediaStatusPanel extends JPanel 23 { 24 25 /** 26 * Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). 27 */ 26 28 private TreeMap<String, DVDInfoPanel> dvdPanels = null; 27 29 28 30 /** 29 * Constructor. Initialize data and GUI components.31 * Constructor. Initialize data and GUI components. 30 32 */ 31 public MediaStatusPanel() { 33 public MediaStatusPanel() 34 { 32 35 33 dvdPanels = new TreeMap<String, DVDInfoPanel>();34 36 dvdPanels = new TreeMap<String, DVDInfoPanel>(); 37 35 38 initComponents(); 36 39 } 37 40 41 public void refresh(Observable obs) 42 { 43 CADMediaStatus status = (CADMediaStatus) obs; 44 Iterator<DVDInfoPanel> iter = status.getDVDlist(); 45 // Remove existing tabs before adding them all back 46 mediaTabs.removeAll(); 47 // add a new tab for each dvd panel 48 while (iter.hasNext()) 49 { 50 DVDInfoPanel item = iter.next(); 51 mediaTabs.addTab( 52 "DVD " + (Integer.parseInt(item.connInfo 53 .substring(item.connInfo 54 .indexOf(":") + 1)) % 3000), 55 dvdPanels.get(item.connInfo)); 56 } 57 // mediaTabs.addTab( 58 // "DVD " + (Integer.parseInt(update.connectionInfo 59 // .substring(update.connectionInfo 60 // .indexOf(":") + 1)) % 3000), 61 // dvdPanels.get(update.connectionInfo)); 62 63 } 64 38 65 /** 39 * Updates the current DVDInfoPanel with the status update. 40 * If a panel does not current exist, create one and add 41 * a new tab. 42 * 66 * Updates the current DVDInfoPanel with the status update. If a panel does 67 * not current exist, create one and add a new tab. 68 * 43 69 * @param update DVD status update. 44 70 */ 45 public void updateDVDStatus(DVDStatusUpdate update) { 46 if(dvdPanels.get(update.connectionInfo) == null) { 71 public void updateDVDStatus(DVDStatusUpdate update) 72 { 73 if (dvdPanels.get(update.connectionInfo) == null) 74 { 47 75 dvdPanels.put(update.connectionInfo, new DVDInfoPanel( 48 76 update.connectionInfo)); … … 50 78 mediaTabs.addTab( 51 79 "DVD " + (Integer.parseInt(update.connectionInfo 52 .substring(update.connectionInfo53 .indexOf(":")+1)) % 3000),80 .substring(update.connectionInfo 81 .indexOf(":") + 1)) % 3000), 54 82 dvdPanels.get(update.connectionInfo)); 55 83 } 56 57 84 85 58 86 dvdPanels.get(update.connectionInfo).updateDVDStatus(update); 59 87 } 60 88 61 89 /** 62 * Updates the current DVDInfoPanel with the title update. 63 * If a panel does not current exist, create one and add 64 * a new tab. 65 * 90 * Updates the current DVDInfoPanel with the title update. If a panel does 91 * not current exist, create one and add a new tab. 92 * 66 93 * @param update DVD title update. 67 94 */ 68 public void updateDVDTitle(DVDTitleUpdate update) { 69 if(dvdPanels.get(update.connectionInfo) == null) { 95 public void updateDVDTitle(DVDTitleUpdate update) 96 { 97 if (dvdPanels.get(update.connectionInfo) == null) 98 { 70 99 dvdPanels.put(update.connectionInfo, new DVDInfoPanel(update.connectionInfo)); 71 72 mediaTabs.addTab("DVD " + dvdPanels.size(), 100 101 mediaTabs.addTab("DVD " + dvdPanels.size(), 73 102 dvdPanels.get(update.connectionInfo)); 74 103 } 75 104 76 105 dvdPanels.get(update.connectionInfo).updateDVDTitle(update); 77 106 } 78 107 79 108 /** 80 109 * Initialize GUI components. 81 110 */ 82 private void initComponents() { 111 private void initComponents() 112 { 83 113 mediaTabs = new JTabbedPane(); 84 114 85 115 add(mediaTabs); 86 116 } 87 88 117 private JTabbedPane mediaTabs; 89 90 118 } -
trunk/src/tmcsim/cadsimulator/viewer/SimulationStatusPanel.java
r36 r44 5 5 import java.awt.Dimension; 6 6 import java.awt.Font; 7 import java.util.logging.Handler; 8 import java.util.logging.Level; 9 import java.util.logging.LogRecord; 10 import java.util.logging.Logger; 7 import java.util.Observable; 11 8 import javax.swing.BorderFactory; 12 9 import javax.swing.Box; … … 19 16 import javax.swing.border.EtchedBorder; 20 17 import javax.swing.border.TitledBorder; 18 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 21 19 import tmcsim.common.CADEnums.PARAMICS_STATUS; 22 20 import tmcsim.common.CADEnums.SCRIPT_STATUS; … … 37 35 * </ul> 38 36 * 39 * @author Matthew Cechini 37 * @author Matthew Cechini, jdalbey 40 38 * @version 41 39 */ … … 45 43 46 44 /** 47 * Logging Handler to listen for Information and Error messages logged for 48 * the CAD Simulator. Received LogRecords are displayed in the info or error 49 * message Text Area. 50 * 51 * @author Matthew Cechini 52 */ 53 private class SimulatorErrorHandler extends Handler 54 { 55 56 public void close() throws SecurityException 57 { 58 } 59 60 public void flush() 61 { 62 } 63 64 public void publish(LogRecord rec) 65 { 66 StringBuffer msgBuffer = new StringBuffer(); 67 68 msgBuffer.append(rec.getSourceClassName() + "." 69 + rec.getSourceMethodName() + " = " 70 + rec.getMessage()); 71 72 if (rec.getLevel() == Level.INFO) 73 { 74 infoMessagesTA.setText(infoMessagesTA.getText() 75 + msgBuffer.toString() + "\n"); 76 } else 77 { 78 errorMessagesTA.setText(errorMessagesTA.getText() 79 + msgBuffer.toString() + "\n"); 80 } 81 } 45 * Refresh this view 46 * 47 * @param obs the Observable we are watching 48 */ 49 public void refresh(Observable obs) 50 { 51 CADSimulatorStatus status = (CADSimulatorStatus) obs; 52 termConnectedTF.setText(String.valueOf(status.getNumClients())); 53 String yesno = "No"; 54 // Should we show yes or no? 55 if (status.isSimManagerConnected()) 56 { 57 yesno = "Yes"; 58 } 59 managerConnectedTF.setText(yesno); 60 simulationClockLabel.setText(status.getCurrentTime()); 61 setScriptStatus(status.getScriptStatus()); 62 setParamicsStatus(status.getParamicsStatus()); 63 64 String netText = status.getParmicsNetworkID(); 65 if (netText.length() == 0) 66 { 67 netText = "None"; 68 } 69 setParamicsNetworkLoaded(netText); 70 71 String msgOut = status.getInfoMessages(); 72 infoMessagesTA.setText(msgOut); 73 errorMessagesTA.setText(status.getErrorMessages()); 82 74 } 83 75 /** … … 85 77 */ 86 78 private int numClientsConnected = 0; 87 /**88 * Logging ErrorHandler.89 */90 private SimulatorErrorHandler errorHandler;91 79 92 80 /** … … 102 90 initMessagesPanes(); 103 91 104 errorHandler = new SimulatorErrorHandler(); 105 Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 106 107 CADSimulatorViewerBox = Box.createVerticalBox(); 108 CADSimulatorViewerBox.add(simulationTimeAndStatusBox); 109 CADSimulatorViewerBox.add(additionalInfoBox); 110 CADSimulatorViewerBox.add(infoMessagesPane); 111 CADSimulatorViewerBox.add(errorMessagesPane); 112 113 add(CADSimulatorViewerBox); 114 } 115 116 /** 117 * Method is called when a CAD Client disconnects from the CAD Simulator. 118 * The displayed number of connected clients is incremented by one. 119 */ 120 public void connectClient() 121 { 122 123 numClientsConnected++; 124 125 termConnectedTF.setText(String.valueOf(numClientsConnected)); 126 } 127 128 /** 129 * Method is called when a CAD Client disconnects from the CAD Simulator. 130 * The displayed number of connected clients is decremented by one. 131 */ 132 public void disconnectClient() 133 { 134 135 if (numClientsConnected > 0) 136 { 137 numClientsConnected--; 138 } 139 140 termConnectedTF.setText(String.valueOf(numClientsConnected)); 141 } 142 143 /** 144 * Method is called when Simulation Manager connects or disconnects. 145 * 146 * @param connection True if simulation manager is connected, false if not. 147 */ 148 public void setSimManagerStatus(boolean connection) 149 { 150 151 if (connection) 152 { 153 managerConnectedTF.setText("Yes"); 154 } else 155 { 156 managerConnectedTF.setText("No"); 157 } 158 159 } 160 161 /** 162 * Method called to convert current simulation time (parameter long value) 163 * to a string of format H:MM:SS. Time is then updated on GUI. 164 * 165 * @param seconds Long value of current time 166 */ 167 public void setTime(long seconds) 168 { 169 String time = new String(); 170 long timeSegment; 171 172 timeSegment = seconds / 3600; 173 time += String.valueOf(timeSegment) + ":"; 174 175 seconds = seconds % 3600; 176 177 timeSegment = seconds / 60; 178 if (timeSegment < 10) 179 { 180 time += "0"; 181 } 182 183 time += String.valueOf(timeSegment) + ":"; 184 seconds = seconds % 60; 185 186 timeSegment = seconds; 187 if (timeSegment < 10) 188 { 189 time += "0"; 190 } 191 192 time += String.valueOf(timeSegment); 193 194 simulationClockLabel.setText(time); 195 92 // errorHandler = new SimulatorErrorHandler(); 93 // Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 94 95 cadSimulatorViewerBox = Box.createVerticalBox(); 96 cadSimulatorViewerBox.add(simulationTimeAndStatusBox); 97 cadSimulatorViewerBox.add(additionalInfoBox); 98 cadSimulatorViewerBox.add(infoMessagesPane); 99 cadSimulatorViewerBox.add(errorMessagesPane); 100 101 add(cadSimulatorViewerBox); 196 102 } 197 103 … … 206 112 protected void displayError(String errorMessage) 207 113 { 114 // Do we clear or append? 208 115 if (errorMessage == null) 209 116 { 210 117 errorMessagesTA.setText(""); 211 } else 118 } 119 else 212 120 { 213 121 errorMessagesTA.append(errorMessage + "\n"); … … 253 161 * </table> 254 162 */ 255 p ublicvoid setScriptStatus(SCRIPT_STATUS newStatus)256 { 257 163 private void setScriptStatus(SCRIPT_STATUS newStatus) 164 { 165 // Display text based on status value 258 166 switch (newStatus) 259 167 { … … 291 199 * or dropped. 292 200 */ 293 p ublicvoid setParamicsStatus(PARAMICS_STATUS newStatus)294 { 295 201 private void setParamicsStatus(PARAMICS_STATUS newStatus) 202 { 203 // Display text based on status value 296 204 switch (newStatus) 297 205 { … … 310 218 * @param networkID Unique ID for Paramics network that has been loaded. 311 219 */ 312 p ublicvoid setParamicsNetworkLoaded(String networkID)220 private void setParamicsNetworkLoaded(String networkID) 313 221 { 314 222 networkLoadedTF.setText(networkID); … … 325 233 simulationStatus = new JLabel("Simulation Status"); 326 234 simulationStatusText = new JLabel("No Script"); 235 simulationStatusText.setName("simulationStatusText"); 327 236 328 237 simulationTime.setLayout(new BorderLayout()); … … 470 379 private Box paramicsConnectedBox; 471 380 private Box networkLoadedBox; 472 private Box CADSimulatorViewerBox;381 private Box cadSimulatorViewerBox; 473 382 private Box simulationTimeAndStatusBox; 474 383 private Box simulationStatusBox; -
trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java
r43 r44 55 55 } catch (Exception e) 56 56 { 57 e.printStackTrace(); 57 58 fail("Couldn't launch CADSimulator"); 58 59 }
Note: See TracChangeset
for help on using the changeset viewer.
