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();
}
}
|