LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2015

HPS-SVN March 2015

Subject:

r2319 - in /java/branches/monitoring-app-HPSJAVA-332: ./ src/main/java/org/hps/monitoring/application/ src/main/java/org/hps/monitoring/application/model/ src/main/resources/org/hps/monitoring/config/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sat, 7 Mar 2015 03:58:29 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (845 lines)

Author: [log in to unmask]
Date: Fri Mar  6 19:58:22 2015
New Revision: 2319

Log:
Work in progress on adding trigger diagnostics to monitoring app.

Added:
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationListener.java
Modified:
    java/branches/monitoring-app-HPSJAVA-332/pom.xml
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/Commands.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/EventProcessing.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/LogTable.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
    java/branches/monitoring-app-HPSJAVA-332/src/main/resources/org/hps/monitoring/config/default_config.prop

Modified: java/branches/monitoring-app-HPSJAVA-332/pom.xml
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/pom.xml	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/pom.xml	Fri Mar  6 19:58:22 2015
@@ -115,6 +115,10 @@
         </dependency>       
         <dependency>
             <groupId>org.hps</groupId>
+            <artifactId>hps-monitoring-util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hps</groupId>
             <artifactId>hps-steering-files</artifactId>
         </dependency>
         <dependency>
@@ -127,4 +131,4 @@
             <version>1.0</version>
         </dependency>
     </dependencies>
-</project>
+</project>

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/Commands.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/Commands.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/Commands.java	Fri Mar  6 19:58:22 2015
@@ -42,7 +42,10 @@
     
     static final String LOG_LEVEL_FILTER_CHANGED = "logLevelFilterChanged";
         
-    ////////////////////////////////////////////    
+    ////////////////////////////////////////////
+    
+    static final String LOG_LEVEL_CHANGED = "logLevelChanged";
+    
     static final String BLOCKING_CHANGED = "blockingChanged";
     static final String CHOOSE_COMPACT_FILE = "chooseCompactFile";
     static final String CHOOSE_LOG_FILE = "chooseLogFile";
@@ -57,12 +60,7 @@
     static final String DISCONNECT_ON_END_RUN_CHANGED = "disconnectOnEndRunChanged";
     static final String EVENT_BUILDER_CHANGED = "eventBuilderChanged";
     static final String FREEZE_CONDITIONS_CHANGED = "freezeConditionsChanged";
-    
-    static final String LOG_LEVEL_CHANGED = "logLevelChanged";
-    static final String LOG_TO_FILE = "logToFile";
-    static final String LOG_TO_FILE_CHANGED = "logToFileChanged";
-    static final String LOG_TO_TERMINAL = "logToTerminal";
-
+        
     static final String PROCESSING_STAGE_CHANGED = "processingStageChanged";    
     static final String SAVE_LOG_TABLE = "saveLogTable";            
     static final String SELECT_LOG_FILE = "logToFile";

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java	Fri Mar  6 19:58:22 2015
@@ -11,6 +11,7 @@
 import javax.swing.JComboBox;
 
 import org.hps.monitoring.application.DataSourceComboBox.DataSourceItem;
+import org.hps.monitoring.application.model.ConfigurationListener;
 import org.hps.monitoring.application.model.ConfigurationModel;
 import org.hps.monitoring.application.model.ConnectionStatus;
 import org.hps.monitoring.application.model.ConnectionStatusModel;
@@ -27,7 +28,7 @@
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
-class DataSourceComboBox extends JComboBox<DataSourceItem> implements PropertyChangeListener, ActionListener {
+class DataSourceComboBox extends JComboBox<DataSourceItem> implements PropertyChangeListener, ActionListener, ConfigurationListener {
 
     ConnectionStatusModel connectionModel;
     ConfigurationModel configurationModel;
@@ -62,29 +63,13 @@
         setActionCommand(Commands.DATA_SOURCE_CHANGED);
         setPreferredSize(new Dimension(400, this.getPreferredSize().height));
         setEditable(false);
-        connectionModel.addPropertyChangeListener(this);        
         this.configurationModel = configurationModel;
-    }
-    
-    void initialize() {
-        
-        // Add the default ET item.
-        addItem(new DataSourceItem(configurationModel.getEtPath(), DataSourceType.ET_SERVER));
-        
-        // Add a file source if one has been provided.
-        if (configurationModel.getDataSourcePath() != null) {
-            addItem(new DataSourceItem(configurationModel.getDataSourcePath(), getDataSourceType(configurationModel.getDataSourcePath())));
-        }
-        
-        // Set the initially selected item.
-        setSelectedItem();
-        
-        // Don't add as the property listener until after initialization.
-        configurationModel.addPropertyChangeListener(this);
-    }
-    
+        connectionModel.addPropertyChangeListener(this);                
+        configurationModel.addConfigurationListener(this);
+    }
+            
     void setSelectedItem() {
-        DataSourceItem item = findItem(configurationModel.getDataSourcePath(), configurationModel.getDataSourceType());
+        DataSourceItem item = findItem(configurationModel.getDataSourcePath(), getDataSourceType(configurationModel.getDataSourcePath()));
         if (item != null) {
             setSelectedItem(item);
         }
@@ -96,26 +81,31 @@
 
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
-        if (evt.getPropertyName().equals(ConnectionStatusModel.CONNECTION_STATUS_PROPERTY)) {
-            ConnectionStatus status = (ConnectionStatus) evt.getNewValue();
-            if (status.equals(ConnectionStatus.DISCONNECTED)) {
-                setEnabled(true);
-            } else {
-                setEnabled(false);
-            }
-        } else if (evt.getPropertyName().equals(ConfigurationModel.DATA_SOURCE_PATH_PROPERTY)) {
-            String path = configurationModel.getDataSourcePath();
-            DataSourceType type = getDataSourceType(path);
-            addDataSourceItem(path, type);
-            setSelectedItem();
-        } else if (evt.getPropertyName().equals(ConfigurationModel.DATA_SOURCE_TYPE_PROPERTY)) {
-            setSelectedItem();
-        } else if (evt.getPropertyName().equals(ConfigurationModel.HOST_PROPERTY)) {
-            updateEtItem();
-        } else if (evt.getPropertyName().equals(ConfigurationModel.ET_NAME_PROPERTY)) {
-            updateEtItem();
-        } else if (evt.getPropertyName().equals(ConfigurationModel.PORT_PROPERTY)) {
-            updateEtItem();
+        configurationModel.removePropertyChangeListener(this);
+        try {
+            if (evt.getPropertyName().equals(ConnectionStatusModel.CONNECTION_STATUS_PROPERTY)) {
+                ConnectionStatus status = (ConnectionStatus) evt.getNewValue();
+                if (status.equals(ConnectionStatus.DISCONNECTED)) {
+                    setEnabled(true);
+                } else {
+                    setEnabled(false);
+                }
+            } else if (evt.getPropertyName().equals(ConfigurationModel.DATA_SOURCE_PATH_PROPERTY)) {
+                String path = configurationModel.getDataSourcePath();
+                DataSourceType type = getDataSourceType(path);
+                addDataSourceItem(path, type);
+                setSelectedItem();
+            } else if (evt.getPropertyName().equals(ConfigurationModel.DATA_SOURCE_TYPE_PROPERTY)) {
+                setSelectedItem();
+            } else if (evt.getPropertyName().equals(ConfigurationModel.HOST_PROPERTY)) {
+                updateEtItem();
+            } else if (evt.getPropertyName().equals(ConfigurationModel.ET_NAME_PROPERTY)) {
+                updateEtItem();
+            } else if (evt.getPropertyName().equals(ConfigurationModel.PORT_PROPERTY)) {
+                updateEtItem();
+            }
+        } finally {
+            configurationModel.addPropertyChangeListener(this);
         }
     }
     
@@ -142,7 +132,37 @@
             } finally {
                 configurationModel.addPropertyChangeListener(this);
             }
-        }
+        } 
+    }
+    
+    public void configurationChanged(ConfigurationModel configurationModel) {
+               
+        // Clear the data source list.
+        removeAllItems();
+        
+        // Add the default ET item.
+        this.removeActionListener(this);
+        try {
+            addItem(new DataSourceItem(configurationModel.getEtPath(), DataSourceType.ET_SERVER));
+                
+            // Add a file source if one has been provided.
+            if (configurationModel.getDataSourcePath() != null) {
+                // Add an item for this data source.
+                DataSourceItem newItem = new DataSourceItem(configurationModel.getDataSourcePath(), configurationModel.getDataSourceType());
+                //System.out.println("adding new item " + newItem.name + " " + newItem.type);
+                addItem(newItem);            
+                if (configurationModel.getDataSourceType().isFile()) {
+                    //System.out.println("setting selected");
+                    setSelectedItem(newItem);
+                }
+            }
+        } finally {
+            this.addActionListener(this);    
+        }
+        
+        // Don't add as property change listener until after configuration has been initialized.
+        configurationModel.removePropertyChangeListener(this);
+        configurationModel.addPropertyChangeListener(this);
     }
 
     public void addItem(DataSourceItem item) {

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/EventProcessing.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/EventProcessing.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/EventProcessing.java	Fri Mar  6 19:58:22 2015
@@ -36,10 +36,11 @@
  */
 class EventProcessing {
     
+    SessionState sessionState = new SessionState();
     MonitoringApplication application;
-    Logger logger;
-    SessionState sessionState;
+    Logger logger;    
     List<CompositeRecordProcessor> processors;
+    List<Driver> drivers;
     
     /**
      * This class is used to organize the objects for an event processing session.
@@ -62,11 +63,12 @@
      */
     EventProcessing(
             MonitoringApplication application, 
-            List<CompositeRecordProcessor> processors) {
+            List<CompositeRecordProcessor> processors,
+            List<Driver> drivers) {
         this.application = application;
-        this.sessionState = new SessionState();
+        this.logger = MonitoringApplication.logger;
         this.processors = processors;
-        this.logger = MonitoringApplication.logger;
+        this.drivers = drivers;
     }
     
     /**
@@ -157,7 +159,8 @@
         }
 
         // Add the builder as a listener so it is notified when conditions change.
-        ConditionsManager.defaultInstance().addConditionsListener(sessionState.eventBuilder);
+        logger.config("adding " + sessionState.eventBuilder.getClass().getSimpleName() + " as conditions listener");
+        DatabaseConditionsManager.getInstance().addConditionsListener(sessionState.eventBuilder);
     }
     
     /**
@@ -165,7 +168,7 @@
      * @param configurationModel The global configuration.
      */
     void setupLoop(ConfigurationModel configurationModel) {
-
+       
         CompositeLoopConfiguration loopConfig = new CompositeLoopConfiguration()
             .setStopOnEndRun(configurationModel.getDisconnectOnEndRun())
             .setStopOnErrors(configurationModel.getDisconnectOnError())
@@ -179,36 +182,47 @@
         if (configurationModel.hasValidProperty(ConfigurationModel.MAX_EVENTS_PROPERTY)) {
             long maxEvents = configurationModel.getMaxEvents();
             if (maxEvents > 0L) {
-                //logger.config("processing will stop after max events: " + maxEvents);
                 loopConfig.setMaxRecords(maxEvents);
-            }
-        }
-        
-        // Add all Drivers from the JobManager.
+                logger.config("set max events to " + maxEvents);
+            }
+        }
+        
+        // Add all Drivers from the JobManager.        
         for (Driver driver : sessionState.jobManager.getDriverExecList()) {
-            loopConfig.add(driver);
-        }
+            logger.config("added Driver " + driver.getName());
+        }        
 
         // Using ET server?
         if (configurationModel.getDataSourceType().equals(DataSourceType.ET_SERVER)) {
 
-            // ET system monitor.
+            // ET system monitor.            
             loopConfig.add(new EtSystemMonitor());
+            logger.config("added EtSystemMonitor");
 
             // ET system strip charts.
             loopConfig.add(new EtSystemStripCharts());
-        }
-
-        // Add extra CompositeRecordProcessors to the loop config.
+            logger.config("added EtSystemStripCharts");
+        }
+
+        // Add extra CompositeRecordProcessors to the loop configuration.
         for (CompositeRecordProcessor processor : processors) {
+            logger.config("added extra processor " + processor.getClass().getName());
             loopConfig.add(processor);   
         }
-                
+        
+        // Add extra Drivers to the loop configuration.
+        for (Driver driver : drivers) {
+            logger.config("added extra Driver " + driver.getName());
+            loopConfig.add(driver);
+        }
+
         // Enable conditions system activation from EVIO event information.
+        logger.config("adding EvioDetectorConditionsProcessor");
         loopConfig.add(new EvioDetectorConditionsProcessor(configurationModel.getDetectorName()));
 
         // Create the CompositeLoop with the configuration.
-        sessionState.loop = new CompositeLoop(loopConfig);        
+        sessionState.loop = new CompositeLoop(loopConfig); 
+        logger.fine("record loop setup complete");
     }    
     
     /**
@@ -240,6 +254,8 @@
      */
     synchronized void stop() {
 
+        logger.fine("event processing is stopping");
+        
         // Is the event processing thread not null?
         if (sessionState.processingThread != null) {
 
@@ -269,6 +285,8 @@
 
         // Set the loop to null as a new one will be created for next session.
         sessionState.loop = null;
+        
+        logger.fine("event processing stopped");
     }    
            
     /**
@@ -276,6 +294,8 @@
      * and start the watchdog thread.
      */
     synchronized void start() {
+        
+        logger.fine("event processing starting");
         
         // Start the event processing thread.
         sessionState.processingThread = new EventProcessingThread(sessionState.loop);
@@ -283,45 +303,54 @@
         
         // Start the watchdog thread which will auto-disconnect when event processing is done.
         sessionState.sessionWatchdogThread = new SessionWatchdogThread(sessionState.processingThread);
-        sessionState.sessionWatchdogThread.start();        
+        sessionState.sessionWatchdogThread.start();
+        
+        logger.fine("event processing started");
     }
     
     /**
      * Notify the event processor to pause processing.
      */
     synchronized void pause() {
+        logger.finest("event processing pausing");
         if (!application.connectionModel.getPaused()) {
             sessionState.loop.pause();
             application.connectionModel.setPaused(true);
         }
+        logger.finest("event processing paused");
     }
     
     /**
      * Get next event if in pause mode.
      */
     synchronized void next() {
+        logger.finest("event processing getting next event");
         if (application.connectionModel.getPaused()) {
             application.connectionModel.setPaused(false);
             sessionState.loop.execute(Command.GO_N, 1L, true);
             application.connectionModel.setPaused(true);
         }
+        logger.finest("event processing got next event");
     }
     
     /**
      * Resume processing events from pause mode.
      */
     synchronized void resume() {
+        logger.finest("event processing resuming");
         if (application.connectionModel.getPaused()) {
             // Notify event processor to continue.
             sessionState.loop.resume();        
             application.connectionModel.setPaused(false);
         }
+        logger.finest("event processing resumed");
     }
     
     /**
      * Interrupt and join to the processing watchdog thread.
      */
     synchronized void killWatchdogThread() {
+        logger.finest("session watchdog thread being killed");
         // Is the session watchdog thread not null?
         if (sessionState.sessionWatchdogThread != null) {
             // Is the thread still alive?
@@ -339,18 +368,21 @@
             // Set the thread object to null.
             sessionState.sessionWatchdogThread = null;
         }
+        logger.finest("session watchdog thread is killed");
     }
     
     /**
      * Cleanup the ET connection.
      */
     synchronized void closeEtConnection() {
+        logger.finest("closing ET connection");
         if (sessionState.connection != null) {
             if (sessionState.connection.getEtSystem().alive()) {
                 sessionState.connection.cleanup();
             }
             sessionState.connection = null;
         }        
+        logger.finest("ET connection closed");
     }
     
     /**
@@ -365,19 +397,21 @@
      * Connect to the ET system using the current connection settings.
      */
     void connect() throws IOException {
-
+                
         // Setup the network connection if using an ET server.
         if (usingEtServer()) {
+            logger.finest("connecting to ET system");
             // Create a connection to the ET server.
             try {
                 createEtConnection();
+                logger.finest("connected to ET system");
             } catch (Exception e) {
                 throw new IOException(e);
             }
         } else {
             // This is when a direct file source is used and ET is not needed.
             application.connectionModel.setConnectionStatus(ConnectionStatus.CONNECTED);
-        }
+        }        
     }
     
     /**
@@ -411,6 +445,8 @@
      */
     void disconnect() {
         
+        logger.finest("disconnecting from session");
+        
         // Kill the session watch dog thread.
         killWatchdogThread();
 
@@ -419,6 +455,8 @@
 
         // Change application state to disconnected.
         application.connectionModel.setConnectionStatus(ConnectionStatus.DISCONNECTED);
+        
+        logger.finest("disconnected from session");
     }    
                
     /**

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java	Fri Mar  6 19:58:22 2015
@@ -45,9 +45,7 @@
     private JTextField maxEventsField;
     private JCheckBox disconnectOnErrorCheckBox;
     private JCheckBox disconnectOnEndRunCheckBox;
-    private JTextField logFileNameField;
     private JComboBox<?> logLevelComboBox;
-    private JCheckBox logToFileCheckbox;
            
     // The package where steering resources must be located.
     static final String STEERING_PACKAGE = "org/hps/steering/monitoring/";
@@ -132,15 +130,7 @@
 
         logLevelComboBox = addComboBox("Log Level", LOG_LEVELS);
         logLevelComboBox.setActionCommand(Commands.LOG_LEVEL_CHANGED);
-        logLevelComboBox.addActionListener(this);
-                                            
-        logToFileCheckbox = addCheckBox("Log to File", false, false);
-        logToFileCheckbox.setEnabled(false);
-        logToFileCheckbox.setActionCommand(LOG_TO_FILE_CHANGED);
-        logToFileCheckbox.addActionListener(this);
-
-        logFileNameField = addField("Log File", "", "Full path to log file.", 30, false);
-        logFileNameField.addPropertyChangeListener("value", this);
+        logLevelComboBox.addActionListener(this);                                            
     }
 
     @Override
@@ -152,8 +142,6 @@
      * Attaches the ActionListener from the main app to specific GUI components in this class.
      */
     public void addActionListener(ActionListener listener) {
-        logFileNameField.addActionListener(listener);
-        logToFileCheckbox.addActionListener(listener);
         steeringResourcesComboBox.addActionListener(listener);
         freezeConditionsCheckBox.addActionListener(listener);
     }
@@ -252,8 +240,6 @@
                 configurationModel.setSteeringType(SteeringType.valueOf((String) steeringTypeComboBox.getSelectedItem()));
             } else if (STEERING_RESOURCE_CHANGED.equals(event.getActionCommand())) {
                 configurationModel.setSteeringResource((String) steeringResourcesComboBox.getSelectedItem());
-            } else if (LOG_TO_FILE_CHANGED.equals(event.getActionCommand())) {
-                configurationModel.setLogToFile(logToFileCheckbox.isSelected());
             } else if (LOG_LEVEL_CHANGED.equals(event.getActionCommand())) {
                 configurationModel.setLogLevel(Level.parse((String) logLevelComboBox.getSelectedItem()));
             } else if (EVENT_BUILDER_CHANGED.equals(event.getActionCommand())) {
@@ -289,8 +275,6 @@
             Object source = evt.getSource();            
             if (source == steeringFileField) {
                 configurationModel.setSteeringFile(steeringFileField.getText());
-            } else if (source == logFileNameField) {
-                configurationModel.setLogFileName(logFileNameField.getText());
             } else if (source == userRunNumberField) {
                 // Is run number being reset to null or empty?
                 if (userRunNumberField.getText() == null || userRunNumberField.getText().isEmpty()) {
@@ -348,12 +332,8 @@
                         disconnectOnEndRunCheckBox.setSelected((Boolean) value);
                     } else if (evt.getPropertyName().equals(EVENT_BUILDER_PROPERTY)) {
                         eventBuilderComboBox.setSelectedItem((String) value);
-                    } else if (evt.getPropertyName().equals(LOG_FILE_NAME_PROPERTY)) {
-                        logFileNameField.setText((String) value);
                     } else if (evt.getPropertyName().equals(LOG_LEVEL_PROPERTY)) {
                         logLevelComboBox.setSelectedItem(value.toString());
-                    } else if (evt.getPropertyName().equals(LOG_TO_FILE_PROPERTY)) {
-                        logToFileCheckbox.setSelected((Boolean) value);
                     } else if (evt.getPropertyName().equals(STEERING_TYPE_PROPERTY)) {
                         steeringTypeComboBox.setSelectedIndex(((SteeringType) value).ordinal());
                     } else if (evt.getPropertyName().equals(STEERING_FILE_PROPERTY)) {

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/LogTable.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/LogTable.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/LogTable.java	Fri Mar  6 19:58:22 2015
@@ -105,7 +105,7 @@
             case 0:
                 return Date.class;
             case 1:
-                return String.class;
+                return Level.class;
             case 2:
                 return String.class;
             default:

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	Fri Mar  6 19:58:22 2015
@@ -50,6 +50,7 @@
 import org.hps.monitoring.subsys.SystemStatusRegistry;
 import org.hps.record.composite.CompositeRecordProcessor;
 import org.hps.record.enums.DataSourceType;
+import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.util.log.DefaultLogFormatter;
 
@@ -157,9 +158,9 @@
         // Load the configuration.
         loadConfiguration(this.configuration);
         
-        // Setup the data source combo box.
-        frame.dataSourceComboBox.initialize();
-        
+        // We want to know when a new data source is selected to log it.
+        frame.dataSourceComboBox.addActionListener(this);
+                
         logger.info("application initialized successfully");
     }
     
@@ -187,6 +188,8 @@
      */
     public void actionPerformed(ActionEvent e) {
 
+        logger.finer("action performed - " + e.getActionCommand());
+        
         String cmd = e.getActionCommand();
         if (Commands.CONNECT.equals(cmd)) {
             // Run the start session method on a separate thread.
@@ -240,7 +243,10 @@
             saveLogTable();
         } else if (Commands.CLEAR_LOG_TABLE.equals(cmd)) {
             getLogRecordModel().clear();
-        }        
+        } else if (Commands.DATA_SOURCE_CHANGED.equals(cmd)) {
+            DataSourceItem currentItem = (DataSourceItem) frame.dataSourceComboBox.getSelectedItem();
+            logger.config("data source changed to " + currentItem.name + " " + currentItem.type);
+        }
     }    
     
     /**
@@ -381,14 +387,18 @@
             List<CompositeRecordProcessor> processors = new ArrayList<CompositeRecordProcessor>();
             processors.add(frame.runPanel.new RunPanelUpdater());
             
+            // List of extra Drivers.
+            List<Driver> drivers = new ArrayList<Driver>();
+            drivers.add(frame.triggerPanel.new TriggerDiagnosticGUIDriver());
+            
             // Initialize event processing with the list of processors and reference to the application.
-            processing = new EventProcessing(this, processors);
+            processing = new EventProcessing(this, processors, drivers);
             
             // Connect to the ET system, if applicable.
             processing.connect();
             
             // Configure event processing from the global application settings, including setup of record loop.
-            logger.info("setting up event processing on source " + configurationModel.getDataSourcePath() 
+            logger.info("setting up event processing on " + configurationModel.getDataSourcePath() 
                     + " with type " + configurationModel.getDataSourceType());
             processing.setup(configurationModel);
                                   

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	Fri Mar  6 19:58:22 2015
@@ -29,6 +29,7 @@
     LogPanel logPanel;
     SystemStatusTable systemStatusTable;
     JPanel buttonsPanel;
+    TriggerDiagnosticsPanel triggerPanel;
     
     JSplitPane mainSplitPane;
     JSplitPane rightSplitPane;
@@ -113,6 +114,10 @@
         systemStatusTable = new SystemStatusTable();
         tableTabbedPane.addTab("System Status Monitor", new JScrollPane(systemStatusTable));
         
+        // Add the trigger diagnostics tables.
+        triggerPanel = new TriggerDiagnosticsPanel();
+        tableTabbedPane.addTab("Trigger Diagnostics", triggerPanel);
+        
         // Vertical split pane in left panel.
         leftSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, runPanel, tableTabbedPane);
         leftPanel.add(leftSplitPane, BorderLayout.CENTER);
@@ -137,6 +142,7 @@
                        
         // Create the main horizontal split pane for dividing the left and right panels.
         mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
+        mainSplitPane.setResizeWeight(0.15);
         bottomPanel.add(mainSplitPane, BorderLayout.CENTER);
         
         // Create the menu bar.

Added: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java	(added)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java	Fri Mar  6 19:58:22 2015
@@ -0,0 +1,82 @@
+package org.hps.monitoring.application;
+
+import java.awt.BorderLayout;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+import org.hps.analysis.trigger.DiagSnapshot;
+import org.hps.monitoring.trigger.ClusterTablePanel;
+import org.hps.monitoring.trigger.DiagnosticUpdatable;
+import org.hps.monitoring.trigger.EfficiencyTablePanel;
+import org.hps.monitoring.trigger.PairTablePanel;
+import org.hps.monitoring.trigger.SinglesTablePanel;
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * This is a panel containing the trigger diagnostics tables.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class TriggerDiagnosticsPanel extends JPanel {
+
+    JTabbedPane tabs = new JTabbedPane();
+    ClusterTablePanel clusterPanel = new ClusterTablePanel();
+    SinglesTablePanel singlesPanel = new SinglesTablePanel();
+    PairTablePanel pairsPanel = new PairTablePanel();
+    EfficiencyTablePanel efficiencyPanel = new EfficiencyTablePanel();
+    
+    List<DiagnosticUpdatable> updateList = new ArrayList<DiagnosticUpdatable>();
+    
+    TriggerDiagnosticsPanel() {
+        setLayout(new BorderLayout());
+                       
+        tabs.addTab("Clusters", clusterPanel);
+        tabs.addTab("Singles", singlesPanel);
+        tabs.addTab("Pairs", pairsPanel);
+        tabs.addTab("Efficiency", efficiencyPanel);
+        
+        updateList.add(clusterPanel);
+        updateList.add(singlesPanel);
+        updateList.add(pairsPanel);
+        updateList.add(efficiencyPanel);
+        
+        add(tabs, BorderLayout.CENTER);
+    }
+        
+    /**
+     * Driver for updating the tables.
+     */
+    class TriggerDiagnosticGUIDriver extends Driver {
+
+        // FIXME: Hard-coded collection name.
+        private String diagnosticCollectionName = "DiagnosticSnapshot";
+        
+        @Override
+        public void process(EventHeader event) {
+            // Updates are only performed if a diagnostic snapshot object
+            // exists. Otherwise, do nothing.
+            if(event.hasCollection(DiagSnapshot.class, diagnosticCollectionName)) {
+                // Get the snapshot collection.
+                List<DiagSnapshot> snapshotList = event.get(DiagSnapshot.class, diagnosticCollectionName);
+                
+                // Get the snapshot. There will only ever be one.
+                DiagSnapshot snapshot = snapshotList.get(0);
+                
+                // Update the GUI panels.
+                for (DiagnosticUpdatable update : updateList) {
+                    update.updatePanel(snapshot);
+                }
+            } else {
+                getLogger().finest("no trigger diagnostics in event");
+            }
+        }
+        
+        void setDiagnosticCollectionName(String name) {
+            diagnosticCollectionName = name;
+        }
+    }  
+}

Added: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationListener.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationListener.java	(added)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationListener.java	Fri Mar  6 19:58:22 2015
@@ -0,0 +1,6 @@
+package org.hps.monitoring.application.model;
+
+public interface ConfigurationListener {
+    
+    public void configurationChanged(ConfigurationModel model);
+}

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java	Fri Mar  6 19:58:22 2015
@@ -1,6 +1,5 @@
 package org.hps.monitoring.application.model;
 
-import java.awt.event.ActionListener;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
@@ -17,6 +16,8 @@
 public final class ConfigurationModel extends AbstractModel {
 
     Configuration configuration;    
+    
+    List<ConfigurationListener> listeners = new ArrayList<ConfigurationListener>();
     
     // Job setting properties.
     public static final String DETECTOR_NAME_PROPERTY = "DetectorName";
@@ -53,6 +54,9 @@
     public static final String WAIT_MODE_PROPERTY = "WaitMode";
     public static final String WAIT_TIME_PROPERTY = "WaitTime";
     public static final String PRESCALE_PROPERTY = "Prescale";
+    
+    // Action command to get notified after configuration change is performed.
+    public static final String CONFIGURATION_CHANGED = "configurationChanged";
 
     static final String[] CONFIG_PROPERTIES = AbstractModel.getPropertyNames(ConfigurationModel.class);
 
@@ -64,10 +68,21 @@
         this.configuration = configuration;
         fireModelChanged();
     }
+    
+    public void addConfigurationListener(ConfigurationListener listener) {
+        listeners.add(listener);
+    }
 
     public void setConfiguration(Configuration configuration) {
         this.configuration = configuration;
         fireModelChanged();
+        fireConfigurationChanged();
+    }
+    
+    void fireConfigurationChanged() {        
+        for (ConfigurationListener listener : listeners) {
+            listener.configurationChanged(this);
+        }
     }
     
     public Configuration getConfiguration() {

Modified: java/branches/monitoring-app-HPSJAVA-332/src/main/resources/org/hps/monitoring/config/default_config.prop
 =============================================================================
--- java/branches/monitoring-app-HPSJAVA-332/src/main/resources/org/hps/monitoring/config/default_config.prop	(original)
+++ java/branches/monitoring-app-HPSJAVA-332/src/main/resources/org/hps/monitoring/config/default_config.prop	Fri Mar  6 19:58:22 2015
@@ -9,7 +9,6 @@
 #LogFileName=
 LogLevel=ALL
 LogLevelFilter=ALL
-LogToFile=false
 MaxEvents=-1
 #SteeringFile=
 SteeringResource=org/hps/steering/monitoring/DummyMonitoring.lcsim
@@ -33,6 +32,4 @@
 StationName=MY_STATION
 Verbose=false
 WaitMode=TIMED
-WaitTime=1000000000
-
-SaveLayout=false;
+WaitTime=1000000000

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use