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:

r2323 - in /java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application: DataSourceComboBox.java EventProcessing.java MonitoringApplication.java MonitoringApplicationFrame.java

From:

[log in to unmask]

Reply-To:

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

Date:

Sat, 7 Mar 2015 05:58:13 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (454 lines)

Author: [log in to unmask]
Date: Fri Mar  6 21:58:08 2015
New Revision: 2323

Log:
Stability fixes merged by hand from branch to trunk.  Includes trigger diagnostics which are not working yet.

Modified:
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java	Fri Mar  6 21:58:08 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/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	Fri Mar  6 21:58:08 2015
@@ -40,6 +40,7 @@
     Logger logger;
     SessionState sessionState;
     List<CompositeRecordProcessor> processors;
+    List<Driver> drivers;
     
     /**
      * This class is used to organize the objects for an event processing session.
@@ -62,11 +63,13 @@
      */
     EventProcessing(
             MonitoringApplication application, 
-            List<CompositeRecordProcessor> processors) {
+            List<CompositeRecordProcessor> processors,
+            List<Driver> drivers) {
         this.application = application;
-        this.sessionState = new SessionState();
+        this.sessionState = new SessionState();        
+        this.logger = MonitoringApplication.logger;
         this.processors = processors;
-        this.logger = MonitoringApplication.logger;
+        this.drivers = drivers;
     }
     
     /**
@@ -173,8 +176,7 @@
             .setProcessingStage(configurationModel.getProcessingStage())
             .setEtConnection(sessionState.connection)
             .setFilePath(configurationModel.getDataSourcePath())
-            .setLCSimEventBuilder(sessionState.eventBuilder)
-            .setDetectorName(configurationModel.getDetectorName());
+            .setLCSimEventBuilder(sessionState.eventBuilder);
 
         if (configurationModel.hasValidProperty(ConfigurationModel.MAX_EVENTS_PROPERTY)) {
             long maxEvents = configurationModel.getMaxEvents();
@@ -202,6 +204,11 @@
         // Add extra CompositeRecordProcessors to the loop config.
         for (CompositeRecordProcessor processor : processors) {
             loopConfig.add(processor);   
+        }
+        
+        // Add extra Drivers to the loop config.
+        for (Driver driver : drivers) {
+            loopConfig.add(driver);
         }
                 
         // Enable conditions system activation from EVIO event information.
@@ -240,6 +247,11 @@
      */
     synchronized void stop() {
 
+        logger.info("event processing is stopping");
+        
+        // Disconnect from ET system.
+        disconnect();
+        
         // Is the event processing thread not null?
         if (sessionState.processingThread != null) {
 
@@ -250,8 +262,10 @@
                 sessionState.loop.execute(Command.STOP);
 
                 try {
+                    logger.info("waiting for event processing thread to finish");
                     // This should always work, because the ET system is disconnected before this.
                     sessionState.processingThread.join();
+                    logger.info("event processing thread finished");
                 } catch (InterruptedException e) {
                     // Don't know when this would ever happen.
                     e.printStackTrace();
@@ -269,6 +283,8 @@
 
         // Set the loop to null as a new one will be created for next session.
         sessionState.loop = null;
+        
+        logger.info("event processing stopped");
     }    
            
     /**
@@ -364,7 +380,7 @@
     /**
      * Connect to the ET system using the current connection settings.
      */
-    void connect() throws IOException {
+    synchronized void connect() throws IOException {
 
         // Setup the network connection if using an ET server.
         if (usingEtServer()) {
@@ -409,14 +425,14 @@
      * Disconnect from the current ET session with a particular status.
      * @param status The connection status.
      */
-    void disconnect() {
+    synchronized void disconnect() {
         
         // Kill the session watch dog thread.
         killWatchdogThread();
 
         // Cleanup the ET connection.
         closeEtConnection();
-
+                              
         // Change application state to disconnected.
         application.connectionModel.setConnectionStatus(ConnectionStatus.DISCONNECTED);
     }    
@@ -446,4 +462,4 @@
             }            
         }
     }
-}
+}

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java	Fri Mar  6 21:58:08 2015
@@ -32,6 +32,7 @@
 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;
@@ -50,6 +51,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;
 
@@ -156,10 +158,7 @@
                                       
         // Load the configuration.
         loadConfiguration(this.configuration);
-        
-        // Setup the data source combo box.
-        frame.dataSourceComboBox.initialize();
-        
+                
         logger.info("application initialized successfully");
     }
     
@@ -189,19 +188,9 @@
 
         String cmd = e.getActionCommand();
         if (Commands.CONNECT.equals(cmd)) {
-            // Run the start session method on a separate thread.
-            new Thread() {
-                public void run() {
-                    startSession();
-                }
-            }.start();
+            startSession();
         } else if (Commands.DISCONNECT.equals(cmd)) {
-            // Run the stop session method on a separate thread.
-            new Thread() {
-                public void run() {
-                    stopSession();
-                }
-            }.start();
+            processing.stop();
         } else if (Commands.SAVE_PLOTS.equals(cmd)) {
             savePlots();
         } else if (Commands.EXIT.equals(cmd)) {
@@ -357,18 +346,14 @@
     }
     
     /**
-     * <p>
      * Start a new monitoring session.
-     * <p> 
-     * This method is executed in a separate thread from the EDT within {@link #actionPerformed(ActionEvent)} 
-     * so that GUI updates are not blocked while the session is being setup.
-     */
-    void startSession() {
+     */
+    synchronized void startSession() {
         
         logger.info("starting new session");
 
         try {
-            
+                        
             // Reset the plot panel and global AIDA state.
             resetPlots();
 
@@ -381,8 +366,11 @@
             List<CompositeRecordProcessor> processors = new ArrayList<CompositeRecordProcessor>();
             processors.add(frame.runPanel.new RunPanelUpdater());
             
+            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();
@@ -412,31 +400,13 @@
             logger.severe("failed to start new session");
         }
     }
-    
-    /**
-     * Stop the session by disconnecting from the ET system and stopping the event processing.
-     */
-    void stopSession() {
-        
-        logger.info("stopping the session");
-        
-        // Disconnect from ET system, if using the ET server, and set the proper disconnected GUI state.
-        processing.disconnect();
-
-        // Stop the event processing, which is called after the ET system goes down to avoid hanging in calls to ET system.
-        processing.stop(); 
-        
-        logger.info("session was stopped");
-    }
-    
+           
     /**
      * Exit from the application.
      */
     void exit() {        
-        // Cleanup ET system if necessary.
         if (processing != null && processing.isActive()) {
-            logger.info("killing active ET connection");
-            processing.closeEtConnection();
+            processing.stop();
         }
         frame.setVisible(false);
         logger.info("exiting the application");

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java	Fri Mar  6 21:58:08 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);
@@ -132,11 +137,12 @@
         // Create the right panel vertical split pane for displaying plots and their information and statistics.
         rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, plotPanel, plotInfoPanel);
         setProportionalSize(rightSplitPane, RIGHT_PANEL_WIDTH, FULL_SIZE);
-        rightSplitPane.setResizeWeight(0.9);
+        rightSplitPane.setResizeWeight(0.8);
         rightPanel.add(rightSplitPane, BorderLayout.CENTER);
                        
         // 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.
@@ -174,9 +180,13 @@
         component.setPreferredSize(scaledDimension);
     }           
     
+    /**
+     * Restore default window settings.
+     */
     void restoreDefaults() {
+        setExtendedState(JFrame.MAXIMIZED_BOTH);
         mainSplitPane.resetToPreferredSizes();
         leftSplitPane.resetToPreferredSizes();
-        rightSplitPane.resetToPreferredSizes();
+        rightSplitPane.resetToPreferredSizes();        
     }    
 }

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