Print

Print


Author: [log in to unmask]
Date: Sat Mar 14 19:49:52 2015
New Revision: 2457

Log:
Minor updates and comment changes to monitoring dev branch.

Modified:
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConditionsPanel.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventDashboard.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventProcessing.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/LogLevelFilterComboBox.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java
    java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/model/RunModel.java

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConditionsPanel.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConditionsPanel.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConditionsPanel.java	Sat Mar 14 19:49:52 2015
@@ -53,7 +53,6 @@
             }            
         });
         
-        //conditionsTable.setAutoCreateRowSorter(true);
         conditionsTable.setModel(new DefaultTableModel());
                
         JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, conditionsList, new JScrollPane(conditionsTable));

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java	Sat Mar 14 19:49:52 2015
@@ -45,7 +45,6 @@
         setMinimumSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
 
         setLayout(new GridBagLayout());
-        // setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
 
         GridBagConstraints c = new GridBagConstraints();
         c.weightx = c.weighty = 1.0;

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventDashboard.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventDashboard.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventDashboard.java	Sat Mar 14 19:49:52 2015
@@ -39,7 +39,7 @@
 
     RunModel runModel;
     
-    static final NumberFormat formatter = new DecimalFormat("#0.00"); 
+    static final NumberFormat formatter = new DecimalFormat("#0.0000"); 
 
     public EventDashboard() {
         build();

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventProcessing.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventProcessing.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/EventProcessing.java	Sat Mar 14 19:49:52 2015
@@ -108,7 +108,7 @@
      * @param configurationModel
      */
     private void setupLcsim(ConfigurationModel configurationModel) {
-        MonitoringApplication.logger.info("setting up LCSim");
+        MonitoringApplication.logger.info("setting up lcsim");
 
         // Get steering resource or file as a String parameter.
         String steering = null;
@@ -119,7 +119,7 @@
             steering = configurationModel.getSteeringResource();
         }
 
-        MonitoringApplication.logger.config("Set steering to " + steering + " with type " + (steeringType == SteeringType.RESOURCE ? "RESOURCE" : "FILE"));
+        MonitoringApplication.logger.config("set steering " + steering + " with type " + (steeringType == SteeringType.RESOURCE ? "RESOURCE" : "FILE"));
 
         try {
             // Create and the job manager. The conditions manager is instantiated from this call but
@@ -167,7 +167,7 @@
                 conditionsManager.setDetector(configurationModel.getDetectorName(), userRunNumber);
                 if (configurationModel.hasPropertyKey(ConfigurationModel.FREEZE_CONDITIONS_PROPERTY)) {
                     // Freeze the conditions system to ignore run numbers from the events.
-                    logger.config("user configured to freeze conditions system from monitoring app");
+                    logger.config("user configured to freeze conditions system");
                     conditionsManager.freeze();
                 } else {
                     // Allow run numbers to be picked up from the events.
@@ -179,7 +179,7 @@
             logger.info("lcsim setup was successful");
 
         } catch (Throwable t) {
-            // Catch all errors and rethrow them as RuntimeExceptions.
+            // Catch all errors and re-throw them as RuntimeExceptions.
             application.errorHandler.setError(t).setMessage("Error setting up LCSim.").printStackTrace().raiseException();
         }
     }
@@ -209,7 +209,14 @@
      */
     private void setupLoop(ConfigurationModel configurationModel) {
 
-        CompositeLoopConfiguration loopConfig = new CompositeLoopConfiguration().setStopOnEndRun(configurationModel.getDisconnectOnEndRun()).setStopOnErrors(configurationModel.getDisconnectOnError()).setDataSourceType(configurationModel.getDataSourceType()).setProcessingStage(configurationModel.getProcessingStage()).setEtConnection(sessionState.connection).setFilePath(configurationModel.getDataSourcePath()).setLCSimEventBuilder(sessionState.eventBuilder);
+        CompositeLoopConfiguration loopConfig = new CompositeLoopConfiguration()
+            .setStopOnEndRun(configurationModel.getDisconnectOnEndRun())
+            .setStopOnErrors(configurationModel.getDisconnectOnError())
+            .setDataSourceType(configurationModel.getDataSourceType())
+            .setProcessingStage(configurationModel.getProcessingStage())
+            .setEtConnection(sessionState.connection)
+            .setFilePath(configurationModel.getDataSourcePath())
+            .setLCSimEventBuilder(sessionState.eventBuilder);
 
         if (configurationModel.hasValidProperty(ConfigurationModel.MAX_EVENTS_PROPERTY)) {
             long maxEvents = configurationModel.getMaxEvents();
@@ -294,10 +301,7 @@
         try {
             logger.fine("waiting for event processing thread to end ...");
             sessionState.processingThread.join();
-            logger.fine("event processing thread ended");
-
-            // Invalidate event processing thread.
-            sessionState.processingThread = null;
+            logger.fine("event processing thread ended");   
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
@@ -477,12 +481,13 @@
     /**
      * Connect to the ET system using the current connection settings.
      */
-    synchronized void connect() throws IOException {
-        logger.fine("connecting to ET system");
+    synchronized void connect() throws IOException {        
         // Setup the network connection if using an ET server.
         if (usingEtServer()) {
             // Create a connection to the ET server.
             try {
+                logger.fine("connecting to ET system ...");
+                
                 // Create the main ET system connection.
                 createEtConnection();
 
@@ -495,11 +500,13 @@
             } catch (Exception e) {
                 throw new IOException(e);
             }
+            
+            logger.fine("ET system is connected");
         } else {
             // This is when a direct file source is used and ET is not needed.
             application.connectionModel.setConnectionStatus(ConnectionStatus.CONNECTED);
         }
-        logger.fine("ET system is connected");
+        
     }
 
     /**
@@ -511,8 +518,7 @@
     }
 
     /**
-     * Create a connection to an ET system using current parameters from the GUI. If successful, the
-     * application's ConnectionStatus is changed to CONNECTED.
+     * Create a connection to an ET system using current parameters from the GUI. 
      */
     synchronized void createEtConnection() {
         // Setup connection to ET system.
@@ -560,7 +566,7 @@
     }
 
     /**
-     * Disconnect from the current ET session with a particular status.
+     * Disconnect from the current ET session.
      * @param status The connection status.
      */
     synchronized void disconnect() {
@@ -585,19 +591,16 @@
 
         public void run() {
             try {
-                // When the event processing thread finishes, the session should be stopped and a
-                // disconnect should occur.
+                // This thread waits on the event processing thread to die.
                 processingThread.join();
 
-                // Activate a disconnect using the ActionEvent which is used by the disconnect
-                // button.
+                // Activate a disconnect using the ActionEvent which is used by the disconnect button.
                 logger.finest("processing thread ended so automatic disconnect is happening");
                 application.actionPerformed(new ActionEvent(Thread.currentThread(), 0, Commands.DISCONNECT));
 
             } catch (InterruptedException e) {
                 logger.finest("SessionWatchdogThread got interrupted");
-                // This happens when the thread is interrupted by the user pressing the disconnect
-                // button.
+                // This happens when the thread is interrupted by the user pressing the disconnect button.
             }
         }
     }

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/LogLevelFilterComboBox.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/LogLevelFilterComboBox.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/LogLevelFilterComboBox.java	Sat Mar 14 19:49:52 2015
@@ -13,7 +13,7 @@
 import org.hps.monitoring.application.model.ConfigurationModel;
 
 /**
- * 
+ * This is a combo box used to filter the log table messages by level.
  * @author Jeremy McCormick <[log in to unmask]>
  */
 class LogLevelFilterComboBox extends JComboBox<Level> implements ActionListener, PropertyChangeListener {

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	Sat Mar 14 19:49:52 2015
@@ -34,7 +34,6 @@
 import javax.swing.filechooser.FileFilter;
 import javax.swing.filechooser.FileNameExtensionFilter;
 
-import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.monitoring.application.DataSourceComboBox.DataSourceItem;
 import org.hps.monitoring.application.LogTable.LogRecordModel;
 import org.hps.monitoring.application.model.Configuration;
@@ -61,8 +60,7 @@
 /**
  * This is the primary class that implements the monitoring GUI application.
  * It should not be used directly.  Instead the {@link Main} class should be
- * used from the command line or via the supplied script built automatically 
- * by Maven.
+ * used from the command line.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
@@ -247,13 +245,7 @@
         logger.setLevel(DEFAULT_LEVEL);
         logger.info("logging initialized");
     }
-    
-    void flushLogger() {
-        for (Handler handler : logger.getHandlers()) {
-            handler.flush();
-        }
-    }
-    
+        
     /**
      * Static utility method for creating new instance.
      * @param configuration The application settings.
@@ -269,7 +261,9 @@
      */
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
-        // TODO: Handle log level configuration change here.
+        if (evt.getPropertyName().equals(ConfigurationModel.LOG_LEVEL_PROPERTY)) {
+            setLogLevel();
+        }
     }
     
     /**
@@ -318,8 +312,6 @@
             closeFile();
         } else if (Commands.SAVE_SCREENSHOT.equals(command)) {
             saveScreenshot();
-        } else if (Commands.LOG_LEVEL_CHANGED.equals(command)) {
-            setLogLevel();
         } else if (Commands.SAVE_LOG_TABLE.equals(command)) {
             saveLogTable();
         } else if (Commands.CLEAR_LOG_TABLE.equals(command)) {

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	Sat Mar 14 19:49:52 2015
@@ -5,8 +5,6 @@
 import java.awt.FlowLayout;
 import java.awt.GraphicsEnvironment;
 import java.awt.Rectangle;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
 
 import javax.swing.JFrame;
 import javax.swing.JPanel;

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java	Sat Mar 14 19:49:52 2015
@@ -14,7 +14,6 @@
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 
-import org.hps.monitoring.application.model.SystemStatusTableModel;
 import org.hps.monitoring.subsys.StatusCode;
 import org.hps.monitoring.subsys.Subsystem;
 import org.hps.monitoring.subsys.SystemStatus;

Modified: java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/model/RunModel.java
 =============================================================================
--- java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/model/RunModel.java	(original)
+++ java/branches/monitoring-app-dev/src/main/java/org/hps/monitoring/application/model/RunModel.java	Sat Mar 14 19:49:52 2015
@@ -3,7 +3,7 @@
 import java.util.Date;
 
 /**
- * Backing model for run information that shows in the {@link org.hps.monitoring.application.RunPanel}.
+ * Backing model for run information that shows in the {@link org.hps.monitoring.application.EventDashboard}.
  */
 public final class RunModel extends AbstractModel {