1 added + 15 removed + 4 modified, total 20 files
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,276 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-
-import org.hps.monitoring.record.etevent.EtConnectionParameters;
-import org.jlab.coda.et.enums.Mode;
-
-/**
- * @author Jeremy McCormick <[log in to unmask]>
- */
-class ConnectionPanel extends FieldsPanel {
-
- private JTextField etNameField;
- private JTextField hostField;
- private JTextField portField;
- private JCheckBox blockingCheckBox;
- private JCheckBox verboseCheckBox;
- private JTextField statNameField;
- private JTextField chunkField;
- private JTextField qSizeField;
- private JTextField positionField;
- private JTextField ppositionField;
- private JComboBox<?> waitComboBox;
- private JTextField waitTimeField;
- private JTextField prescaleField;
- private EtConnectionParameters connectionParameters;
- static final String[] waitModes = {
- Mode.SLEEP.toString(),
- Mode.TIMED.toString(),
- Mode.ASYNC.toString()
- };
-
- /**
- * Class constructor.
- */
- ConnectionPanel() {
-
- //super(new Insets(1, 1, 1, 1), true);
- super(new Insets(5, 5, 5, 5), true);
-
- setLayout(new GridBagLayout());
-
- // Define fields.
- etNameField = addField("ET Name", "", 20);
- hostField = addField("Host", 20);
- portField = addField("Port", 5);
- blockingCheckBox = addCheckBox("Blocking", false, true);
- verboseCheckBox = addCheckBox("Verbose", false, true);
- statNameField = addField("Station Name", 10);
- chunkField = addField("Chunk Size", 3);
- qSizeField = addField("Queue Size", 3);
- positionField = addField("Station Position", 3);
- ppositionField = addField("Station Parallel Position", 3);
- waitComboBox = addComboBox("Wait Mode", waitModes);
- waitTimeField = addField("Wait Time [microseconds]", 8);
- prescaleField = addField("Prescale", 8);
-
- // Set default connection parameters which are pushed to GUI.
- setConnectionParameters(new EtConnectionParameters());
- }
-
- /**
- * Get the connection parameters.
- * @return The connection parameters.
- */
- EtConnectionParameters getConnectionParameters() {
- connectionParameters = new EtConnectionParameters();
- connectionParameters.setBufferName(etNameField.getText());
- connectionParameters.setHost(hostField.getText());
- connectionParameters.setPort(Integer.parseInt(portField.getText()));
- connectionParameters.setBlocking(blockingCheckBox.isSelected());
- connectionParameters.setVerbose(verboseCheckBox.isSelected());
- connectionParameters.setStationName(statNameField.getText());
- connectionParameters.setChunkSize(Integer.parseInt(chunkField.getText()));
- connectionParameters.setQueueSize(Integer.parseInt(qSizeField.getText()));
- connectionParameters.setStationPosition(Integer.parseInt(positionField.getText()));
- connectionParameters.setStationsParallelPosition(Integer.parseInt(ppositionField.getText()));
- connectionParameters.setWaitMode(getWaitMode());
- connectionParameters.setWaitTime(Integer.parseInt(waitTimeField.getText()));
- connectionParameters.setPreScale(Integer.parseInt(prescaleField.getText()));
- return connectionParameters;
- }
-
- /**
- * Get the current wait mode from the GUI selection.
- * @return The wait mode.
- */
- private Mode getWaitMode() {
- Mode mode = null;
- String sel = (String) waitComboBox.getSelectedItem();
- if (Mode.TIMED.toString().equalsIgnoreCase(sel)) {
- mode = Mode.TIMED;
- } else if (Mode.ASYNC.toString().equalsIgnoreCase(sel)) {
- mode = Mode.ASYNC;
- } else if (Mode.SLEEP.toString().equalsIgnoreCase(sel)) {
- mode = Mode.SLEEP;
- }
- return mode;
- }
-
- /**
- * Set the wait mode and push to the GUI.
- * @param waitMode The wait mode.
- */
- private void setWaitMode(Mode waitMode) {
- if (waitMode == Mode.SLEEP) {
- waitComboBox.setSelectedIndex(0);
- } else if (waitMode == Mode.TIMED) {
- waitComboBox.setSelectedIndex(1);
- } else if (waitMode == Mode.ASYNC) {
- waitComboBox.setSelectedIndex(2);
- }
- }
-
- /**
- * Set the connection parameters and push into the GUI.
- * @param cn The connection parameters.
- */
- private void setConnectionParameters(EtConnectionParameters connectionParameters) {
- etNameField.setText(connectionParameters.getBufferName());
- hostField.setText(connectionParameters.getHost());
- portField.setText(Integer.toString(connectionParameters.getPort()));
- blockingCheckBox.setSelected(connectionParameters.getBlocking());
- verboseCheckBox.setSelected(connectionParameters.getVerbose());
- statNameField.setText(connectionParameters.getStationName());
- chunkField.setText(Integer.toString(connectionParameters.getChunkSize()));
- qSizeField.setText(Integer.toString(connectionParameters.getQueueSize()));
- positionField.setText(Integer.toString(connectionParameters.getStationPosition()));
- ppositionField.setText(Integer.toString(connectionParameters.getStationParallelPosition()));
- setWaitMode(connectionParameters.getWaitMode());
- waitTimeField.setText(Integer.toString(connectionParameters.getWaitTime()));
- prescaleField.setText(Integer.toString(connectionParameters.getPrescale()));
- this.connectionParameters = connectionParameters;
- }
-
- /**
- * Enable or disable the connection panel GUI elements.
- * @param e Set to true for enabled; false to disable.
- */
- void enableConnectionPanel(boolean e) {
- etNameField.setEnabled(e);
- hostField.setEnabled(e);
- portField.setEnabled(e);
- blockingCheckBox.setEnabled(e);
- verboseCheckBox.setEnabled(e);
- statNameField.setEnabled(e);
- chunkField.setEnabled(e);
- qSizeField.setEnabled(e);
- positionField.setEnabled(e);
- ppositionField.setEnabled(e);
- waitComboBox.setEnabled(e);
- waitTimeField.setEnabled(e);
- prescaleField.setEnabled(e);
- }
-
- /**
- * Save connection parameters to selected output file.
- */
- void save() {
- JFileChooser fc = new JFileChooser();
- int r = fc.showSaveDialog(ConnectionPanel.this);
- if (r == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- writePropertiesFile(file);
- }
- }
-
- /**
- * Load connection parameters from a selected file.
- */
- void load() {
- JFileChooser fc = new JFileChooser();
- int r = fc.showOpenDialog(ConnectionPanel.this);
- if (r == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- loadPropertiesFile(file);
- }
- }
-
- /**
- * Reset the connection parameters.
- */
- void reset() {
- setConnectionParameters(new EtConnectionParameters());
- }
-
- /**
- * Write connection parameters to a file.
- * @param file The output properties file.
- */
- private void writePropertiesFile(File file) {
- Properties prop = new Properties();
- prop.setProperty("etName", etNameField.getText());
- prop.setProperty("host", hostField.getText());
- prop.setProperty("port", portField.getText());
- prop.setProperty("blocking", Boolean.toString(blockingCheckBox.isSelected()));
- prop.setProperty("verbose", Boolean.toString(verboseCheckBox.isSelected()));
- prop.setProperty("statName", statNameField.getText());
- prop.setProperty("chunk", chunkField.getText());
- prop.setProperty("qSize", qSizeField.getText());
- prop.setProperty("position", positionField.getText());
- prop.setProperty("pposition", ppositionField.getText());
- prop.setProperty("waitMode", (String) waitComboBox.getSelectedItem());
- prop.setProperty("waitTime", waitTimeField.getText());
- prop.setProperty("prescale", prescaleField.getText());
- try {
- prop.store(new FileOutputStream(file), null);
- } catch (Exception e) {
- showErrorDialog(e.getLocalizedMessage());
- }
- }
-
- /**
- * Show an error dialog.
- * @param mesg The dialog message.
- */
- private void showErrorDialog(String mesg) {
- JOptionPane.showMessageDialog(this, mesg);
- }
-
- /**
- * Set the wait mode.
- * @param waitMode The wait mode.
- */
- private void setWaitMode(String waitMode) {
- if (Mode.SLEEP.toString().equalsIgnoreCase(waitMode)) {
- waitComboBox.setSelectedIndex(0);
- } else if (Mode.TIMED.toString().equalsIgnoreCase(waitMode)) {
- waitComboBox.setSelectedIndex(1);
- } else if (Mode.ASYNC.toString().equalsIgnoreCase(waitMode)) {
- waitComboBox.setSelectedIndex(2);
- }
- }
-
- /**
- * Load connection parameters from properties file.
- * @param file The properties file.
- */
- void loadPropertiesFile(File file) {
- Properties prop = new Properties();
- try {
- prop.load(new FileInputStream(file));
- etNameField.setText(prop.getProperty("etName"));
- hostField.setText(prop.getProperty("host"));
- portField.setText(prop.getProperty("port"));
- blockingCheckBox.setSelected(Boolean.parseBoolean(prop.getProperty("blocking")));
- verboseCheckBox.setSelected(Boolean.parseBoolean(prop.getProperty("verbose")));
- statNameField.setText(prop.getProperty("statName"));
- chunkField.setText(prop.getProperty("chunk"));
- qSizeField.setText(prop.getProperty("qSize"));
- positionField.setText(prop.getProperty("position"));
- ppositionField.setText(prop.getProperty("pposition"));
- setWaitMode(prop.getProperty("waitMode"));
- waitTimeField.setText(prop.getProperty("waitTime"));
- prescaleField.setText(prop.getProperty("prescale"));
- } catch (FileNotFoundException e) {
- showErrorDialog(e.getLocalizedMessage());
- } catch (IOException e) {
- showErrorDialog(e.getLocalizedMessage());
- }
- this.connectionParameters = getConnectionParameters();
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionStatus.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionStatus.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,50 +0,0 @@
-package org.hps.monitoring;
-
-/**
- * Connection status setting.
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConnectionStatus.java,v 1.3 2013/11/05 17:15:04 jeremy Exp $
- */
-final class ConnectionStatus
-{
- /**
- * The status codes.
- */
- static final int DISCONNECTED = 0;
- static final int CONNECTED = 1;
- static final int CONNECTING = 2;
- static final int TIMED_OUT = 3;
- static final int SLEEPING = 4;
- static final int DISCONNECTING = 5;
- static final int ERROR = 6;
- static final int CONNECTION_REQUESTED = 7;
- static final int DISCONNECT_REQUESTED = 8;
-
- /**
- * The string descriptions for connection statuses.
- */
- private static final String[] statuses = {
- "DISCONNECTED",
- "CONNECTED",
- "CONNECTING",
- "TIMED OUT",
- "SLEEPING",
- "DISCONNECTING",
- "ERROR",
- "CONNECTION REQUESTED",
- "DISCONNECT REQUESTED" };
-
- /**
- * Total number of statuses.
- */
- static final int NUMBER_STATUSES = statuses.length;
-
- /**
- * Convert status setting to string.
- * @param status The status setting.
- * @return The status string.
- */
- static String toString(int status) {
- return statuses[status].toUpperCase();
- }
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionStatusPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ConnectionStatusPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,125 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-
-/**
- * This is the panel for showing the current connection status (connected, disconnected, etc.).
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConnectionStatusPanel.java,v 1.11 2013/11/05 17:15:04 jeremy Exp $
- */
-class ConnectionStatusPanel extends JPanel {
-
- JTextField statusField;
- JTextField dateField;
-
- // Format for date field.
- private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss");
-
- /**
- * Class constructor.
- */
- ConnectionStatusPanel() {
-
- setLayout(new GridBagLayout());
- //setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
- Font font = new Font("Arial", Font.PLAIN, 14);
-
- GridBagConstraints c = new GridBagConstraints();
- c.weightx = c.weighty = 1.0;
-
- // Bottom separator.
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridwidth = GridBagConstraints.REMAINDER;
- add(new JSeparator(SwingConstants.HORIZONTAL), c);
-
- // Connection status label.
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 1;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(0, 10, 0, 10);
- JLabel statusLabel = new JLabel("Connection Status:");
- statusLabel.setHorizontalAlignment(JLabel.LEFT);
- add(statusLabel, c);
-
- // Connection status field.
- c.gridx = 1;
- c.gridy = 1;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.insets = new Insets(0, 0, 0, 10);
- statusField = new JTextField("", 15);
- statusField.setHorizontalAlignment(JTextField.LEFT);
- statusField.setEditable(false);
- statusField.setBackground(Color.WHITE);
- statusField.setFont(font);
- statusField.setMinimumSize(new Dimension(300, 50));
- add(statusField, c);
-
- // The "@" label.
- c.gridx = 2;
- c.gridy = 1;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(0, 0, 0, 10);
- JLabel atLabel = new JLabel("@");
- add(atLabel, c);
-
- // The date field.
- c = new GridBagConstraints();
- c.gridx = 3;
- c.gridy = 1;
- c.anchor = GridBagConstraints.WEST;
- dateField = new JTextField("", 20);
- dateField.setEditable(false);
- dateField.setBackground(Color.WHITE);
- dateField.setHorizontalAlignment(JTextField.LEFT);
- dateField.setFont(font);
- dateField.setMinimumSize(new Dimension(200, 50));
- add(dateField, c);
-
- // Bottom separator.
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 2;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.insets = new Insets(10, 0, 0, 0);
- add(new JSeparator(SwingConstants.HORIZONTAL), c);
-
- // Set default status.
- setStatus(ConnectionStatus.DISCONNECTED);
- }
-
- /**
- * Set the connection status.
- * @param status The status code.
- */
- void setStatus(final int status) {
- if (status < 0 || status > (ConnectionStatus.NUMBER_STATUSES - 1)) {
- throw new IllegalArgumentException("Invalid status argument: " + status);
- }
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- statusField.setText(ConnectionStatus.toString(status));
- dateField.setText(dateFormat.format(new Date()));
- }
- });
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventButtonsPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventButtonsPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,110 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-
-/**
- * This is the panel for controlling the application when it is in pause mode,
- * e.g. to step to the next event, etc.
- */
-public class EventButtonsPanel extends JPanel {
-
- JButton nextEventsButton;
- JButton pauseButton;
- JButton connectButton;
-
- /**
- * Class constructor.
- */
- EventButtonsPanel() {
-
- GridBagLayout layout = new GridBagLayout();
- setLayout(layout);
-
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.insets = new Insets(0, 0, 0, 10);
- connectButton = new JButton("Connect");
- connectButton.setEnabled(true);
- connectButton.setActionCommand(MonitoringCommands.CONNECT);
- add(connectButton, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 0;
- c.insets = new Insets(0, 0, 0, 10);
- pauseButton = new JButton("Pause");
- pauseButton.setActionCommand(MonitoringCommands.PAUSE);
- pauseButton.setEnabled(false);
- add(pauseButton, c);
-
- c = new GridBagConstraints();
- c.gridx = 2;
- c.gridy = 0;
- nextEventsButton = new JButton("Next Event");
- nextEventsButton.setEnabled(false);
- nextEventsButton.setActionCommand(MonitoringCommands.NEXT);
- add(nextEventsButton, c);
- }
-
- /**
- * Toggle the connect button from its current state. If it is in "Connect" state
- * then it will be toggled to "Disconnect" and vice versa.
- */
- void toggleConnectButton() {
- if (connectButton.getText().equals("Connect")) {
- connectButton.setText("Disconnect");
- connectButton.setActionCommand(MonitoringCommands.DISCONNECT);
- } else {
- connectButton.setText("Connect");
- connectButton.setActionCommand(MonitoringCommands.CONNECT);
- }
- }
-
- /**
- * Add an ActionListener to this component.
- * @param listener The ActionListener.
- */
- void addActionListener(ActionListener listener) {
- nextEventsButton.addActionListener(listener);
- pauseButton.addActionListener(listener);
- connectButton.addActionListener(listener);
- }
-
- /**
- * Eanble the pause button.
- * @param e Set to true to enable the pause button; false to disable.
- */
- void enablePauseButton(boolean e) {
- this.pauseButton.setEnabled(e);
- }
-
- /**
- * Enable the "next events" button.
- * @param e Set to true to enable; false to disable.
- */
- void enableNextEventsButton(boolean e) {
- this.nextEventsButton.setEnabled(e);
- }
-
- /**
- * Set the pause mode state.
- * @param enable Set to true to enable pause mode; false to disable.
- */
- void setPauseModeState(boolean enable) {
- this.nextEventsButton.setEnabled(enable);
- if (enable) {
- pauseButton.setText("Resume");
- pauseButton.setActionCommand(MonitoringCommands.RESUME);
- } else {
- pauseButton.setText("Pause");
- pauseButton.setActionCommand(MonitoringCommands.PAUSE);
- }
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,292 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-
-/**
- * This is the GUI component for displaying event information in real time.
- * @author Jeremy McCormick <[log in to unmask]>
- */
-class EventPanel extends FieldsPanel {
-
- private JTextField eventCounterField; // number of events in this job
- private JTextField elapsedTimeField; // elapsed time between job start
- private JTextField avgEventRateField; // average event rate in this job
- private JTextField refreshField; // number of events to wait before updating GUI
- private JTextField sessionSuppliedField; // number of events supplied in this session; ignored by reset command
- private JTextField totalSuppliedField; // number of events supplied since the application started
- /*private JTextField maxEventsField;*/ // maximum number of events to process before disconenct
- private JTextField runNumberField; // Run number from CODA Pre Start event.
- private JTextField runStartField; // Start of run date from CODA Pre Start event.
- private JTextField runEventsField; // Number of events in run.
- private JTextField runStopField; // End of run date from CODA End Event.
-
- private static final int defaultEventRefresh = 1;
- private int eventRefresh = defaultEventRefresh;
- private int eventCount;
- private int sessionSupplied;
- private int totalSupplied;
- private boolean updateEvent = true;
- private long jobStartTime;
-
- private final static DecimalFormat rateFormat = new DecimalFormat("#.##");
-
- final static SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss");
-
- /**
- * Class constructor.
- */
- EventPanel() {
-
- super(new Insets(5, 5, 5, 5), false);
-
- setLayout(new GridBagLayout());
-
- elapsedTimeField = addField("Elapsed Time [seconds]", "0", 10);
- eventCounterField = addField("Events Processed", "0", 10);
- avgEventRateField = addField("Average Events Per Second", "0", 6);
- runNumberField = addField("Run Number", "", 8);
- runStartField = addField("Run Started", "", 22);
- runStopField = addField("Run Stopped", "", 22);
- runEventsField = addField("Events in Run", "", 10);
- sessionSuppliedField = addField("Session Supplied Events", "0", 8);
- totalSuppliedField = addField("Total Supplied Events", "0", 8);
- refreshField = addField("Event Refresh", Integer.toString(eventRefresh), 8);
- //maxEventsField = addField("Max Events", "-1", 8);
- }
-
- /**
- * Get the event refresh rate.
- * @return The event refresh rate.
- */
- int getEventRefresh() {
- return eventRefresh;
- }
-
- /**
- * Get the max events setting from its GUI component.
- * @return The max events.
- */
- /*
- int getMaxEvents() {
- return Integer.parseInt(maxEventsField.getText());
- }
- */
-
- /**
- * Set the max events.
- * @param maxEvents The max events.
- */
- /*
- void setMaxEvents(final int maxEvents) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- maxEventsField.setText(Integer.toString(maxEvents));
- }
- });
- }
- */
-
- /**
- * Set the run number.
- * @param runNumber The run number.
- */
- void setRunNumber(final int runNumber) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- runNumberField.setText(Integer.toString(runNumber));
- }
- });
- }
-
- void setJobStartTime(long jobStartTime) {
- this.jobStartTime = jobStartTime;
- }
-
- /**
- * Set the number of events in the run.
- * @param eventCount The number of events in the run.
- */
- void setRunEventCount(final int eventCount) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- runEventsField.setText(Integer.toString(eventCount));
- }
- });
- }
-
- /**
- * Set the run start time in milliseconds since the epoch (Unix time).
- * @param millis The run start time.
- */
- void setRunStartTime(final long millis) {
- final Date d = new Date(millis);
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- runStartField.setText(dateFormat.format(d));
- }
- });
- }
-
- /**
- * Set the run end time in milliseconds.
- * @param millis The run end time.
- */
- void setRunEndTime(final long millis) {
- final Date d = new Date(millis);
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- runStopField.setText(dateFormat.format(d));
- }
- });
- }
-
- /**
- * Check if the panel should be updated for this event.
- */
- private void checkUpdateEvent() {
- updateEvent = ((eventCount % getEventRefresh()) == 0);
- }
-
- /**
- * At end of job, final event totals are pushed to the GUI.
- */
- void endJob() {
- incrementEventCounts();
- }
-
- /**
- * Update the event counters.
- */
- void updateEventCount() {
- ++eventCount;
- ++sessionSupplied;
- ++totalSupplied;
- checkUpdateEvent();
- if (updateEvent) {
- incrementEventCounts();
- }
- }
-
- /**
- * Increment the event counts in the GUI. This happens when the event
- * is flagged for updating.
- */
- private void incrementEventCounts() {
- Runnable r = new Runnable() {
- public void run() {
- eventCounterField.setText(Integer.toString(eventCount));
- sessionSuppliedField.setText(Integer.toString(sessionSupplied));
- totalSuppliedField.setText(Integer.toString(totalSupplied));
- }
- };
- SwingUtilities.invokeLater(r);
- }
-
- /**
- * Update the average event rate.
- * @param jobStartTime The start time of the job in milliseconds.
- */
- void updateAverageEventRate() {
- if (updateEvent) {
- if (eventCount > 0) {
- final double elapsedTime = System.currentTimeMillis() - jobStartTime;
- if (elapsedTime > 0) {
- final double jobSeconds = elapsedTime / 1000;
- final double eventsPerSecond = eventCount / jobSeconds;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- avgEventRateField.setText(rateFormat.format(eventsPerSecond));
- }
- });
- }
- }
- }
- }
-
- /**
- * Set the elapsed time for the session in milliseconds.
- * @param time The elapsed time.
- */
- void setElapsedTime(final long time) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- elapsedTimeField.setText(Long.toString(time));
- }
- });
- }
-
- /**
- * Set the event refresh rate.
- * @param eventRefresh The event refresh rate.
- */
- void setEventRefresh(final int eventRefresh) {
- this.eventRefresh = eventRefresh;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- refreshField.setText(Integer.toString(eventRefresh));
- }
- });
- }
-
- /**
- * Reset all the event counts.
- */
- synchronized void reset() {
- resetEventCount();
- resetAverageEventRate();
- resetElapsedTime();
- }
-
- /**
- * Reset the event counter.
- */
- private void resetEventCount() {
- eventCount = 0;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- eventCounterField.setText("0");
- }
- });
- }
-
- /**
- * Reset the elapsed time field.
- */
- private void resetElapsedTime() {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- elapsedTimeField.setText("0");
- }
- });
- }
-
- /**
- * Reset the average event rate.
- */
- private void resetAverageEventRate() {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- avgEventRateField.setText("0");
- }
- });
- }
-
- /**
- * Reset the session supplied events.
- */
- void resetSessionSupplied() {
- this.sessionSupplied = 0;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- sessionSuppliedField.setText("0");
- }
- });
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventPanelUpdater.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EventPanelUpdater.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,69 +0,0 @@
-package org.hps.monitoring;
-
-import org.hps.monitoring.record.evio.EvioEventProcessor;
-import org.jlab.coda.jevio.EvioEvent;
-
-/**
- * This class is an {@link org.hps.monitoring.record.evio.EvioEventProcessor}
- * that updates the {@link EventPanel} as EVIO events are processed.
- *
- * @author Jeremy McCormick <[log in to unmask]>
- */
-public class EventPanelUpdater extends EvioEventProcessor {
-
- EventPanel eventPanel;
-
- long jobStartTime;
-
- EventPanelUpdater(EventPanel eventPanel) {
- this.eventPanel = eventPanel;
- }
-
- public void startJob() {
-
- // Reset event GUI.
- eventPanel.reset();
-
- // This is only reset between different jobs.
- eventPanel.resetSessionSupplied();
-
- eventPanel.setJobStartTime(System.currentTimeMillis());
- }
-
- public void processEvent(EvioEvent evioEvent) {
- eventPanel.updateEventCount();
- eventPanel.updateAverageEventRate();
- }
-
- public void endJob() {
- // Push final event counts to the GUI.
- eventPanel.endJob();
- }
-
- public void startRun(EvioEvent event) {
-
- // Get start of run data.
- int[] data = event.getIntData();
- int seconds = data[0];
- int runNumber = data[1];
- final long millis = ((long) seconds) * 1000;
-
- // Update the GUI.
- eventPanel.setRunNumber(runNumber);
- eventPanel.setRunStartTime(millis);
- }
-
- public void endRun(EvioEvent event) {
-
- // Get end run data.
- int[] data = event.getIntData();
- int seconds = data[0];
- int eventCount = data[2];
- final long millis = ((long) seconds) * 1000;
-
- // Update the GUI.
- eventPanel.setRunEndTime(millis);
- eventPanel.setRunEventCount(eventCount);
- }
-
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EvioFileProducer.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/EvioFileProducer.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,270 +0,0 @@
-package org.hps.monitoring;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jlab.coda.et.EtAttachment;
-import org.jlab.coda.et.EtConstants;
-import org.jlab.coda.et.EtEvent;
-import org.jlab.coda.et.EtStation;
-import org.jlab.coda.et.EtSystem;
-import org.jlab.coda.et.EtSystemOpenConfig;
-import org.jlab.coda.et.enums.Mode;
-import org.jlab.coda.jevio.EventWriter;
-import org.jlab.coda.jevio.EvioEvent;
-import org.jlab.coda.jevio.EvioReader;
-
-/**
- *
- * This is copied and modified from the EvioProducer class in the ET 12.0 CODA module.
- * @author Jeremy McCormick <[log in to unmask]>
- *
- */
-// TODO: Add option to set number of events in the put array.
-// TODO: Move to a sub-package.
-public class EvioFileProducer {
-
- private List<File> evioFiles = new ArrayList<File>();
- private EvioReader reader;
- private ByteBuffer byteBuffer;
- private String etName, host;
- private int port = EtConstants.serverPort;
- private int group = 1;
- private int size = 10000; // Default event size.
- private int delay = 0;
- private static final boolean debug = false;
-
- EvioFileProducer() {
- }
-
- private static void usage() {
- System.out.println("\nUsage: java Producer -f <et name> -e <evio file> [-p <server port>] [-host <host>]"
- + " [-d <delay in millisec>] [-g <group #>]\n\n"
- + " -f ET system's name\n"
- + " -s size in bytes for requested events\n"
- + " -p port number for a udp broadcast\n"
- + " -g group number of new events to get\n"
- + " -host host the ET system resides on (defaults to anywhere)\n\n"
- + " This consumer works by making a connection to the\n"
- + " ET system's tcp server port.\n");
- System.exit(1);
- }
-
- public void copyToEtEvent(EtEvent event) {
- event.getDataBuffer().put(byteBuffer);
- }
-
- public static void main(String[] args) {
- (new EvioFileProducer()).doMain(args); // call wrapper method
- }
-
- public void doMain(String[] args) {
- try {
- for (int i = 0; i < args.length; i++) {
- if (args[i].equalsIgnoreCase("-e")) {
- //evioFileName = new String(args[++i]);
- evioFiles.add(new File(args[++i]));
- } else if (args[i].equalsIgnoreCase("-f")) {
- etName = args[++i];
- } else if (args[i].equalsIgnoreCase("-host")) {
- host = args[++i];
- } else if (args[i].equalsIgnoreCase("-p")) {
- try {
- port = Integer.parseInt(args[++i]);
- if ((port < 1024) || (port > 65535)) {
- System.out.println("Port number must be between 1024 and 65535.");
- usage();
- return;
- }
- } catch (NumberFormatException ex) {
- System.out.println("Did not specify a proper port number.");
- usage();
- return;
- }
- } else if (args[i].equalsIgnoreCase("-s")) {
- try {
- size = Integer.parseInt(args[++i]);
- if (size < 1) {
- System.out.println("Size needs to be positive int.");
- usage();
- return;
- }
- } catch (NumberFormatException ex) {
- System.out.println("Did not specify a proper size.");
- usage();
- return;
- }
- } else if (args[i].equalsIgnoreCase("-g")) {
- try {
- group = Integer.parseInt(args[++i]);
- if ((group < 1) || (group > 10)) {
- System.out.println("Group number must be between 0 and 10.");
- usage();
- return;
- }
- } catch (NumberFormatException ex) {
- System.out.println("Did not specify a proper group number.");
- usage();
- return;
- }
- } else if (args[i].equalsIgnoreCase("-d")) {
- try {
- delay = Integer.parseInt(args[++i]);
- if (delay < 1) {
- System.out.println("delay must be > 0.");
- usage();
- return;
- }
- } catch (NumberFormatException ex) {
- System.out.println("Did not specify a proper delay.");
- usage();
- return;
- }
- } else {
- usage();
- return;
- }
- }
-
- if (host == null) {
- //host = EtConstants.hostAnywhere;
- host = InetAddress.getLocalHost().getHostName();
- }
-
- // ET name is required.
- if (etName == null) {
- System.out.println("EVIO file name argument is required");
- usage();
- return;
- }
-
- if (this.evioFiles.size() == 0) {
- System.out.println("At least one input EVIO file is required.");
- usage();
- return;
- }
-
- // Check existence of EVIO files.
- System.out.println("EVIO input files ...");
- for (File evioFile : evioFiles) {
- System.out.println(evioFile.getPath());
- if (!evioFile.exists()) {
- System.err.println("EVIO file does not exist: " + evioFile.getPath());
- throw new RuntimeException("EVIO input file does not exist.");
- }
- }
-
- // Setup ET system with the command line config.
- EtSystemOpenConfig config = new EtSystemOpenConfig(etName, host, port);
- EtSystem sys = new EtSystem(config, EtConstants.debugInfo);
- sys.open();
- EtStation gc = sys.stationNameToObject("GRAND_CENTRAL");
- EtAttachment att = sys.attach(gc);
-
- // array of events
- EtEvent[] mevs;
-
- // Loop over input EVIO file list.
- for (File evioFile : evioFiles) {
-
- // Open EVIO reader.
- System.out.println("Opening next EVIO file: " + evioFile.getPath());
- reader = new EvioReader(evioFile.getPath(), false);
-
- // Print number of events.
- if (debug) {
- System.out.println("EVIO file opened with " + reader.getEventCount() + " events.");
- }
-
- // Ref to current EVIO event.
- EvioEvent event;
-
- // Event sequence number; starts with 1.
- int eventCount = 0;
-
- // Loop until event source is exhausted.
- while (true) {
-
- // Get next event.
- event = reader.nextEvent();
- ++eventCount;
- if (eventCount % 1000 == 0) {
- System.out.println("EvioFileProducer - event <" + eventCount + ">");
- }
- if (event == null) {
- break;
- }
-
- // Try to parse the next event.
- try {
- reader.parseEvent(event);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Error making EVIO event with sequence number <" + eventCount + "> in file <" + evioFile.getPath() + ">.");
- // Attempt to recover from errors by skipping to next event if there are exceptions.
- continue;
- }
-
- if (debug) {
- System.out.println("new events - size=" + size + "; group=" + group);
- }
-
- // Create a new array of ET events. This always has one event.
- mevs = sys.newEvents(
- att, // attachment
- Mode.SLEEP, // wait mode
- false, // create a buffer
- 0, // delay
- 1, // number of events
- size, // size of event but overwritten later
- group); // group number; default value is arbitrary
-
- // Delay for X millis if applicable.
- if (delay > 0) {
- Thread.sleep(delay);
- }
-
- // Write the next EVIO event to the EtEvent's buffer.
- ByteBuffer buf = mevs[0].getDataBuffer();
- buf.order(ByteOrder.nativeOrder());
- EventWriter writer = new EventWriter(buf, 100000, 100, null, null);
- writer.writeEvent(event);
- try {
- writer.close();
- } catch (Exception e) {
- System.out.println("Caught exception while closing writer.");
- e.printStackTrace();
- }
- mevs[0].setLength(buf.position());
- mevs[0].setByteOrder(ByteOrder.nativeOrder());
- if (debug) {
- for (EtEvent mev : mevs) {
- System.out.println("event length = " + mev.getLength() + ", remaining bytes: " + mev.getDataBuffer().remaining());
- }
- }
-
- // Put events onto the ET ring.
- sys.putEvents(att, mevs);
-
- if (debug) {
- System.out.println("Wrote event #" + eventCount + " to ET");
- System.out.println("-------------------------------");
- ++eventCount;
- }
- }
-
- reader.close();
- }
-
- // Cleanup.
- sys.close();
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/FieldsPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/FieldsPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,235 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.Insets;
-import java.awt.event.ActionListener;
-
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-/**
- * This class is used to provide utility methods for the data panels in the application tabs.
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: FieldsPanel.java,v 1.3 2013/11/05 17:15:04 jeremy Exp $
- */
-public class FieldsPanel extends JPanel {
-
- private int currY = 0;
- private Insets insets;
- private boolean editable = false;
-
- /**
- * Class constructor.
- * @param insets The insets for the panel.
- * @param editable Editable setting.
- */
- FieldsPanel(Insets insets, boolean editable) {
- this.insets = insets;
- this.editable = editable;
- }
-
- /**
- * Class constructor.
- */
- FieldsPanel() {
- this.insets = new Insets(1, 1, 1, 1);
- }
-
- /**
- * Add a field.
- * @param name The name of the field.
- * @param size The size of the field.
- * @return The JTextField component.
- */
- protected final JTextField addField(String name, int size) {
- return addField(name, "", size, this.editable);
- }
-
- /**
- * Add a field.
- * @param name The name of the field.
- * @param value The default value of the field.
- * @param size The size of the field.
- * @return The JTextField component.
- */
- protected final JTextField addField(String name, String value, int size) {
- return addField(name, value, size, this.editable);
- }
-
- /**
- * Add a field.
- * @param name The name of the field.
- * @param value The default value of the field.
- * @param tooltip The tooltip text.
- * @param size The size of the field.
- * @param editable The editable setting.
- * @return The JTextField component.
- */
- protected final JTextField addField(String name, String value, String tooltip, int size, boolean editable) {
- JTextField f = addField(name, value, size, editable);
- f.setToolTipText(tooltip);
- return f;
- }
-
- /**
- * Add a field.
- * @param name The name of the field.
- * @param value The default value of the field.
- * @param size The size of the field.
- * @param editable The editable setting.
- * @return The JTextField component.
- */
- protected final JTextField addField(String name, String value, int size, boolean editable) {
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.WEST;
- JLabel label = new JLabel(name + ":");
- add(label, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.EAST;
- JTextField field = new JTextField(value, size);
- field.setHorizontalAlignment(JTextField.RIGHT);
- field.setEditable(editable);
- field.setBackground(Color.WHITE);
- add(field, c);
-
- ++currY;
-
- return field;
- }
-
- /**
- * Add a combo box.
- * @param name The name of the combo box.
- * @param values The set of values for the combo box.
- * @return The JComboBox component.
- */
- protected final JComboBox addComboBox(String name, String[] values) {
-
- //System.out.println("addComboBox = " + name);
-
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.WEST;
- JLabel waitModeLabel = new JLabel(name + ":");
- waitModeLabel.setHorizontalAlignment(JLabel.LEFT);
- add(waitModeLabel, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.EAST;
- JComboBox combo = new JComboBox(values);
- //System.out.println("combo width = " + combo.getWidth());
- //System.out.println("combo width = " + combo.getSize().getWidth());
- combo.setEditable(editable);
- add(combo, c);
-
- ++currY;
-
- return combo;
- }
-
- /**
- * Add a multiline combo box.
- * @param name The name of the combo box.
- * @param values The values for the combo box.
- * @return The JComboBox component.
- */
- protected final JComboBox addComboBoxMultiline(String name, String[] values) {
-
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.WEST;
- JLabel waitModeLabel = new JLabel(name + ":");
- waitModeLabel.setHorizontalAlignment(JLabel.LEFT);
- add(waitModeLabel, c);
- ++currY;
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.WEST;
- JComboBox combo = new JComboBox(values);
- //System.out.println("combo width = " + combo.getWidth());
- //System.out.println("combo width = " + combo.getSize().getWidth());
- combo.setEditable(editable);
- add(combo, c);
-
- ++currY;
-
- return combo;
- }
-
- /**
- * Add a check box.
- * @param name The name of the check box.
- * @param tooltip The tooltip text.
- * @param selected Whether the box is selected or not.
- * @param enabled Whether it is enabled or not.
- * @return The JCheckBox component.
- */
- protected final JCheckBox addCheckBox(String name, String tooltip, boolean selected, boolean enabled) {
- JCheckBox c = addCheckBox(name, selected, enabled);
- c.setToolTipText(tooltip);
- return c;
- }
-
- /**
- * Add a check box.
- * @param name The name of the check box.
- * @param selected Whether the check box is selected or not.
- * @param enabled Whether it is enabled or not.
- * @return The JCheckBox component.
- */
- protected final JCheckBox addCheckBox(String name, boolean selected, boolean enabled) {
-
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.WEST;
- JLabel label = new JLabel(name + ":");
- add(label, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = currY;
- c.insets = insets;
- c.anchor = GridBagConstraints.EAST;
- JCheckBox checkbox = new JCheckBox();
- checkbox.setSelected(selected);
- checkbox.setEnabled(enabled);
- add(checkbox, c);
-
- ++currY;
-
- return checkbox;
- }
-
- /**
- * Add an ActionListener to this component. By default this does nothing, but
- * individual sub-components should attach this to individual components.
- * @param listener The AcitonListener to add.
- */
- void addActionListener(ActionListener listener) {
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/JobPanel.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/JobPanel.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,541 +0,0 @@
-package org.hps.monitoring;
-
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.InputStream;
-import java.util.logging.Level;
-
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-
-/**
- * The panel for setting job parameters.
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: JobPanel.java,v 1.17 2013/11/05 17:15:04 jeremy Exp $
- */
-class JobPanel extends FieldsPanel {
-
- private JTextField detectorNameField;
- private JCheckBox disconnectWarningCheckBox;
- private JCheckBox disconnectOnErrorCheckBox;
- private JTextField eventBuilderField;
- private JComboBox<?> steeringTypeComboBox;
- private JTextField steeringFileField;
- private JComboBox<?> steeringResourcesComboBox;
- private JCheckBox logCheckBox;
- private JTextField logFileField;
- private JCheckBox pauseModeCheckBox;
- private JComboBox<?> logLevelComboBox;
- private JTextField aidaSaveField;
- private JCheckBox aidaSaveCheckBox;
-
- private String steeringPackage = "org/hps/steering/monitoring/";
-
- private String defaultEventBuilderClassName = (new JobSettings()).eventBuilderClassName;
-
- private final static String[] steeringTypes = {"RESOURCE", "FILE"};
- final static int RESOURCE = 0;
- final static int FILE = 1;
-
- /**
- * The available LogLevel settings.
- */
- String[] logLevels = new String[] {
- Level.ALL.toString(),
- Level.FINEST.toString(),
- Level.FINER.toString(),
- Level.FINE.toString(),
- Level.CONFIG.toString(),
- Level.INFO.toString(),
- Level.WARNING.toString(),
- Level.SEVERE.toString(),
- Level.OFF.toString()};
-
- /**
- * Class constructor.
- */
- JobPanel() {
-
- super(new Insets(4, 2, 2, 4), true);
- setLayout(new GridBagLayout());
-
- pauseModeCheckBox = addCheckBox("Pause mode", false, true);
- disconnectOnErrorCheckBox = addCheckBox("Disconnect on error", false, true);
- disconnectWarningCheckBox = addCheckBox("Warn before disconnect", true, true);
- logLevelComboBox = addComboBox("Log Level", this.logLevels);
- logLevelComboBox.setActionCommand(MonitoringCommands.SET_LOG_LEVEL);
- steeringTypeComboBox = addComboBox("Steering Type", steeringTypes);
- steeringFileField = addField("Steering File", 35);
- steeringResourcesComboBox = addComboBoxMultiline("Steering File Resource",
- SteeringFileUtil.getAvailableSteeringFileResources(steeringPackage));
- steeringResourcesComboBox.setActionCommand(MonitoringCommands.SET_STEERING_RESOURCE);
- detectorNameField = addField("Detector Name", 20);
- eventBuilderField = addField("Event Builder Class", 30);
- eventBuilderField.setActionCommand(MonitoringCommands.SET_EVENT_BUILDER);
- logCheckBox = addCheckBox("Log to File", false, false);
- logFileField = addField("Log File", "", "Full path to log file.", 30, false);
- aidaSaveCheckBox = addCheckBox("Save AIDA at End of Job", false, false);
- aidaSaveField = addField("AIDA Auto Save File Name", "", 30, false);
-
- // Set default job settings.
- setJobSettings(new JobSettings());
- }
-
- /**
- * Enable this component.
- * @param enable Whether to enable or not.
- */
- void enableJobPanel(boolean enable) {
- detectorNameField.setEnabled(enable);
- eventBuilderField.setEnabled(enable);
- pauseModeCheckBox.setEnabled(enable);
- steeringTypeComboBox.setEnabled(enable);
- steeringFileField.setEnabled(enable);
- steeringResourcesComboBox.setEnabled(enable);
- }
-
- /**
- * Attaches the ActionListener from the main app to GUI components in this class.
- */
- void addActionListener(ActionListener listener) {
- steeringResourcesComboBox.addActionListener(listener);
- logLevelComboBox.addActionListener(listener);
- eventBuilderField.addActionListener(listener);
- }
-
- /**
- * Choose a file name for the automatic AIDA save file.
- */
- void chooseAidaAutoSaveFile() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Choose AIDA Auto Save File");
- int r = fc.showSaveDialog(this);
- if (r == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- String fileName = file.getPath();
- int extIndex = fileName.lastIndexOf(".");
- if ((extIndex == -1) || !(fileName.substring(extIndex + 1, fileName.length())).toLowerCase().equals("aida")) {
- fileName = fileName + ".aida";
- }
- final String fileName2 = fileName;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- aidaSaveCheckBox.setSelected(true);
- aidaSaveField.setText(fileName2);
- }
- });
- }
- }
-
- /**
- * Check that the steering file or resource is valid.
- * @return True if steering is valid; false if not.
- */
- boolean checkSteering() {
- String steering = steeringFileField.getText();
- int steeringType = steeringTypeComboBox.getSelectedIndex();
- if (RESOURCE == steeringType) {
- // Check that steering resource exists.
- InputStream is = getClass().getResourceAsStream(steering);
- if (is == null) {
- return false;
- } else {
- return true;
- }
- } else if (FILE == steeringType) {
- // Check that steering file exists.
- File f = new File(steering);
- if (!f.exists()) {
- return false;
- } else {
- return true;
- }
- } else {
- throw new IllegalArgumentException("The steeringType is invalid: " + steeringType);
- }
- }
-
- /**
- * Setup the event builder from the field setting.
- * @return True if builder is setup successfully; false if not.
- */
- void editEventBuilder() {
- String eventBuilderClassName = eventBuilderField.getText();
- boolean okay = true;
- try {
- // Test that the event builder can be created without throwing any exceptions.
- Class<?> eventBuilderClass = Class.forName(eventBuilderClassName);
- eventBuilderClass.newInstance();
- }
- catch (ClassNotFoundException e) {
- JOptionPane.showMessageDialog(this, "The event builder class does not exist.");
- okay = false;
- }
- catch (InstantiationException e) {
- JOptionPane.showMessageDialog(this, "Failed to instantiate instance of event builder class.");
- okay = false;
- }
- catch (IllegalAccessException e) {
- JOptionPane.showMessageDialog(this, "Couldn't access event builder class.");
- okay = false;
- }
-
- if (!okay)
- resetEventBuilder();
- }
-
- /**
- * Reset the event builder to the default.
- */
- private void resetEventBuilder() {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- eventBuilderField.setText(defaultEventBuilderClassName);
- }
- });
- }
-
- /**
- * Get the event builder class name.
- * @return The event builder class name.
- */
- String getEventBuilderClassName() {
- return eventBuilderField.getText();
- }
-
- /**
- * Set the steering file field.
- * @param steeringFile The path to the file.
- */
- void setSteeringFile(final String steeringFile) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- steeringFileField.setText(steeringFile);
- }
- });
- }
-
- /**
- * Set the steering file resource.
- * @param s The resource path.
- */
- void setSteeringResource(final String s) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- steeringResourcesComboBox.setSelectedItem(s);
- }
- });
- }
-
- /**
- * Set the name of the detector.
- * @param detectorName The name of the detector.
- */
- void setDetectorName(final String detectorName) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- detectorNameField.setText(detectorName);
- }
- });
- }
-
- /**
- * Get the steering file or resource path from the field setting.
- * @return The steering file or resource path.
- */
- String getSteering() {
- if (getSteeringType() == FILE) {
- return steeringFileField.getText();
- }
- else if (getSteeringType() == RESOURCE) {
- return (String) steeringResourcesComboBox.getSelectedItem();
- }
- else {
- return null;
- }
- }
-
- /**
- * Get the type of steering, file or resource.
- * @return The type of steering.
- */
- int getSteeringType() {
- return steeringTypeComboBox.getSelectedIndex();
- }
-
- /**
- * Get the name of the detector.
- * @return The name of the detector.
- */
- String getDetectorName() {
- return detectorNameField.getText();
- }
-
- /**
- *
- * @param defaultEventBuilderClassName
- */
- void setDefaultEventBuilder(final String defaultEventBuilderClassName) {
- this.defaultEventBuilderClassName = defaultEventBuilderClassName;
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- eventBuilderField.setText(defaultEventBuilderClassName);
- }
- });
- }
-
- /**
- * Check if pause mode is selected.
- * @return True if pause mode is enabled; false if not.
- */
- boolean pauseMode() {
- return this.pauseModeCheckBox.isSelected();
- }
-
- /**
- * Set the pause mode.
- * @param p The pause mode; true for on; false for off.
- */
- void enablePauseMode(final boolean p) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- pauseModeCheckBox.setSelected(p);
- }
- });
- }
-
- /**
- * Get the log level from the combo box.
- * @return The log level.
- */
- Level getLogLevel() {
- return Level.parse((String) logLevelComboBox.getSelectedItem());
- }
-
- /**
- * Get the disconnect on error setting from the check box.
- * @return The disconnect on error setting.
- */
- boolean disconnectOnError() {
- return disconnectOnErrorCheckBox.isSelected();
- }
-
- /**
- * Get the warn on disconnect setting.
- * @return The warn on disconnect setting.
- */
- boolean warnOnDisconnect() {
- return disconnectWarningCheckBox.isSelected();
- }
-
- /**
- * Get the log to file setting.
- * @return The log to file setting.
- */
- boolean logToFile() {
- return logCheckBox.isSelected();
- }
-
- /**
- * Get the log file name.
- * @return The log file name.
- */
- String getLogFileName() {
- return logFileField.getText();
- }
-
- /**
- * Get whether AIDA autosave is enabled.
- * @return True if AIDA autosave is enabled; false if not.
- */
- boolean isAidaAutoSaveEnabled() {
- return aidaSaveCheckBox.isSelected();
- }
-
- /**
- * Get the AIDA autosave file name.
- * @return The AIDA autosave file name.
- */
- String getAidaAutoSaveFileName() {
- return aidaSaveField.getText();
- }
-
- /**
- * Set whether to disconnect if errors occur.
- * @param b The disconnect on error setting.
- */
- private void setDisconnectOnError(final boolean b) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- disconnectOnErrorCheckBox.setSelected(b);
- }
- });
- }
-
- /**
- * Set whether to warn before a disconnect occurs.
- * @param b The warn before disconnect setting.
- */
- private void setWarnBeforeDisconnect(final boolean b) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- disconnectWarningCheckBox.setSelected(b);
- }
- });
- }
-
- /**
- * Set the steering type.
- * @param t The steering type.
- */
- void setSteeringType(final int t) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- steeringTypeComboBox.setSelectedIndex(t);
- }
- });
- }
-
- /**
- * Set the log level.
- * @param level The log level.
- */
- private void setLogLevel(final Level level) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- logLevelComboBox.setSelectedItem(level.toString());
- }
- });
- }
-
- /**
- * Set the fully qualified class name of the event builder.
- * @param c The class name of the event builder.
- */
- private void setEventBuilder(final String c) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- eventBuilderField.setText(c);
- }
- });
- }
-
- /**
- * Set whether to log to a file.
- * @param b The log to file setting.
- */
- void setLogToFile(final boolean b) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- logCheckBox.setSelected(b);
- }
- });
- }
-
- /**
- * Set the log file name.
- * @param s The log file name.
- */
- void setLogFile(final String s) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- logFileField.setText(s);
- }
- });
- }
-
- /**
- * Set AIDA autosave.
- * @param b The AIDA autosave setting.
- */
- private void enableAidaAutoSave(final boolean b) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- aidaSaveCheckBox.setSelected(b);
- }
- });
- }
-
- /**
- * Set the AIDA autosave file name.
- * @param s The AIDA autosave file name.
- */
- private void setAidaAutoSaveFileName(final String s) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- aidaSaveField.setText(s);
- }
- });
- }
-
- /**
- * Get the resource path for the steering file.
- * @return The resource path for the steering file.
- */
- private String getSelectedSteeringResource() {
- return (String) steeringResourcesComboBox.getSelectedItem();
- }
-
- /**
- * Get the path to the steering file path.
- * @return The steering file path.
- */
- private String getSteeringFile() {
- return steeringFileField.getText();
- }
-
- /**
- * Gather {@link JobSettings} parameters from GUI and return a JobSettings object.
- * @return The JobSettings from the JobPanel.
- */
- JobSettings getJobSettings() {
- JobSettings settings = new JobSettings();
- settings.pauseMode = pauseMode();
- settings.disconnectOnError = disconnectOnError();
- settings.warnBeforeDisconnect = warnOnDisconnect();
- settings.logLevel = getLogLevel();
- settings.steeringType = getSteeringType();
- settings.steeringFile = getSteeringFile();
- settings.steeringResource = getSelectedSteeringResource();
- settings.detectorName = getDetectorName();
- settings.eventBuilderClassName = getEventBuilderClassName();
- settings.logToFile = logToFile();
- settings.logFileName = getLogFileName();
- settings.autoSaveAida = isAidaAutoSaveEnabled();
- settings.autoSaveAidaFileName = getAidaAutoSaveFileName();
- return settings;
- }
-
- /**
- * Set the JobPanel parameters from a JobSettings object.
- * @param settings The JobSettings to load.
- */
- void setJobSettings(JobSettings settings) {
- enablePauseMode(settings.pauseMode);
- setDisconnectOnError(settings.disconnectOnError);
- setWarnBeforeDisconnect(settings.warnBeforeDisconnect);
- setLogLevel(settings.logLevel);
- setSteeringType(settings.steeringType);
- setSteeringFile(settings.steeringFile);
- setSteeringResource(settings.steeringResource);
- setDetectorName(settings.detectorName);
- setEventBuilder(settings.eventBuilderClassName);
- setLogToFile(settings.logToFile);
- setLogFile(settings.logFileName);
- enableAidaAutoSave(settings.autoSaveAida);
- setAidaAutoSaveFileName(settings.autoSaveAidaFileName);
- }
-
- /**
- * Reset the JobPanel to its defaults.
- */
- void resetJobSettings() {
- setJobSettings(new JobSettings());
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/JobSettings.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/JobSettings.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,79 +0,0 @@
-package org.hps.monitoring;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.logging.Level;
-
-/**
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: JobSettings.java,v 1.6 2013/10/30 17:05:17 jeremy Exp $
- */
-final class JobSettings {
-
- // Default job settings.
- boolean pauseMode = false;
- boolean disconnectOnError = false;
- boolean warnBeforeDisconnect = true;
- Level logLevel = Level.ALL;
- int steeringType = 0; // resource = 0; file = 1
- String steeringResource = "org/hps/steering/monitoring/TestRunMonitoring.lcsim";
- String steeringFile = "";
- String detectorName = "HPS-TestRun-v5";
- String eventBuilderClassName = "org.hps.evio.LCSimTestRunEventBuilder";
- boolean logToFile = false;
- String logFileName = "";
- boolean autoSaveAida = false;
- String autoSaveAidaFileName = "";
- boolean enableRemoteAida = false;
- String remoteAidaName = "hps";
-
- JobSettings() {
- }
-
- JobSettings(File f) throws IOException {
- load(f);
- }
-
- void save(File file) throws IOException {
- Properties prop = new Properties();
- prop.setProperty("pauseMode", Boolean.toString(pauseMode));
- prop.setProperty("disconnectOnError", Boolean.toString(disconnectOnError));
- prop.setProperty("warnBeforeDisconnect", Boolean.toString(warnBeforeDisconnect));
- prop.setProperty("logLevel", logLevel.toString());
- prop.setProperty("steeringType", Integer.toString(steeringType));
- prop.setProperty("steeringFile", steeringFile);
- prop.setProperty("steeringResource", steeringResource);
- prop.setProperty("detectorName", detectorName);
- prop.setProperty("eventBuilderClassName", eventBuilderClassName);
- prop.setProperty("logToFile", Boolean.toString(logToFile));
- prop.setProperty("logFileName", logFileName);
- prop.setProperty("autoSaveAida", Boolean.toString(autoSaveAida));
- prop.setProperty("autoSaveAidaFileName", autoSaveAidaFileName);
- prop.setProperty("enableRemoteAida", Boolean.toString(enableRemoteAida));
- prop.setProperty("remoteAidaName", remoteAidaName);
- prop.store(new FileOutputStream(file), null);
- }
-
- void load(File file) throws IOException {
- Properties prop = new Properties();
- prop.load(new FileInputStream(file));
- pauseMode = Boolean.parseBoolean(prop.getProperty("pauseMode"));
- disconnectOnError = Boolean.parseBoolean(prop.getProperty("disconnectOnError"));
- warnBeforeDisconnect = Boolean.parseBoolean(prop.getProperty("warnBeforeDisconnect"));
- logLevel = Level.parse(prop.getProperty("logLevel"));
- steeringType = Integer.parseInt(prop.getProperty("steeringType"));
- steeringFile = prop.getProperty("steeringFile");
- steeringResource = prop.getProperty("steeringResource");
- detectorName = prop.getProperty("detectorName");
- eventBuilderClassName = prop.getProperty("eventBuilderClassName");
- logToFile = Boolean.parseBoolean(prop.getProperty("logToFile"));
- logFileName = prop.getProperty("logFileName");
- autoSaveAida = Boolean.parseBoolean(prop.getProperty("autoSaveAida"));
- autoSaveAidaFileName = prop.getProperty("autoSaveAidaFileName");
- enableRemoteAida = Boolean.parseBoolean(prop.getProperty("enableRemoteAida"));
- remoteAidaName = prop.getProperty("remoteAidaName");
- }
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringAnalysisFactory.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringAnalysisFactory.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,51 +0,0 @@
-package org.hps.monitoring;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.renderer.xy.XYBarRenderer;
-
-import hep.aida.IPlotterFactory;
-import hep.aida.jfree.chart.DefaultChartTheme;
-import hep.aida.ref.AnalysisFactory;
-
-/**
- * This class implements the AIDA <code>IAnalysisFactory</code> for the monitoring application,
- * so that plots are automatically rendered into its tabs. Its primary function is overriding
- * {@link #createPlotterFactory()} and {@link #createPlotterFactory(String)} to return a custom
- * <code>IPlotterFactory</code> object.
- *
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: MonitoringAnalysisFactory.java,v 1.4 2013/12/10 07:36:40 jeremy Exp $
- */
-// FIXME: Move to plotting package.
-public class MonitoringAnalysisFactory extends AnalysisFactory {
-
- public MonitoringAnalysisFactory() {
- }
-
- /**
- * Register this class as the default AnalysisFactory for AIDA by setting
- * the magic property string.
- */
- final static void register() {
- System.setProperty("hep.aida.IAnalysisFactory", MonitoringAnalysisFactory.class.getName());
- }
-
- public static void configure() {
- ChartFactory.setChartTheme(new DefaultChartTheme());
- XYBarRenderer.setDefaultShadowsVisible(false);
- }
-
- /**
- * Create a named plotter factory for the monitoring application.
- */
- public IPlotterFactory createPlotterFactory(String name) {
- return new MonitoringPlotFactory(name);
- }
-
- /**
- * Create an unnamed plotter factory for the monitoring application.
- */
- public IPlotterFactory createPlotterFactory() {
- return new MonitoringPlotFactory(null);
- }
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplication.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplication.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,1642 +0,0 @@
-package org.hps.monitoring;
-
-import static org.hps.monitoring.MonitoringCommands.AIDA_AUTO_SAVE;
-import static org.hps.monitoring.MonitoringCommands.CLEAR_LOG_TABLE;
-import static org.hps.monitoring.MonitoringCommands.CONNECT;
-import static org.hps.monitoring.MonitoringCommands.DISCONNECT;
-import static org.hps.monitoring.MonitoringCommands.EDIT_EVENT_REFRESH;
-import static org.hps.monitoring.MonitoringCommands.EXIT;
-import static org.hps.monitoring.MonitoringCommands.LOAD_CONNECTION;
-import static org.hps.monitoring.MonitoringCommands.LOAD_JOB_SETTINGS;
-import static org.hps.monitoring.MonitoringCommands.LOG_TO_FILE;
-import static org.hps.monitoring.MonitoringCommands.LOG_TO_TERMINAL;
-import static org.hps.monitoring.MonitoringCommands.NEXT;
-import static org.hps.monitoring.MonitoringCommands.PAUSE;
-import static org.hps.monitoring.MonitoringCommands.RESET_CONNECTION_SETTINGS;
-import static org.hps.monitoring.MonitoringCommands.RESET_JOB_SETTINGS;
-import static org.hps.monitoring.MonitoringCommands.RESUME;
-import static org.hps.monitoring.MonitoringCommands.SAVE_CONNECTION;
-import static org.hps.monitoring.MonitoringCommands.SAVE_JOB_SETTINGS;
-import static org.hps.monitoring.MonitoringCommands.SAVE_LOG_TABLE;
-import static org.hps.monitoring.MonitoringCommands.SAVE_PLOTS;
-import static org.hps.monitoring.MonitoringCommands.SCREENSHOT;
-import static org.hps.monitoring.MonitoringCommands.SET_EVENT_BUILDER;
-import static org.hps.monitoring.MonitoringCommands.SET_LOG_LEVEL;
-import static org.hps.monitoring.MonitoringCommands.SET_STEERING_FILE;
-import static org.hps.monitoring.MonitoringCommands.SET_STEERING_RESOURCE;
-
-import java.awt.AWTException;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.image.BufferedImage;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-import javax.imageio.ImageIO;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.table.DefaultTableModel;
-
-import org.hps.evio.LCSimEventBuilder;
-import org.hps.monitoring.record.EventProcessingChain;
-import org.hps.monitoring.record.EventProcessingThread;
-import org.hps.monitoring.record.etevent.EtConnection;
-import org.hps.monitoring.record.etevent.EtConnectionParameters;
-import org.hps.monitoring.record.etevent.EtEventSource;
-import org.hps.monitoring.subsys.et.EtSystemStripCharts;
-import org.lcsim.job.JobControlManager;
-import org.lcsim.util.aida.AIDA;
-
-/**
- * Monitoring application for HPS Test Run, which can run LCSim steering files on data converted
- * from the ET ring. This class is accessible to users by calling its main() method.
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: MonitoringApplication.java,v 1.61 2013/12/10 07:36:40 jeremy Exp $
- */
-// FIXME: The tabs panel isn't filling the full available space even when fill is set to both.
-// TODO: Remove minimum GUI component size settings where they are redundant.
-// TODO: Refactor this class into multiple classes.
-// TODO: Log the messages from all Exceptions.
-// TODO: Capture std err and out and redirect to a text panel within the application.
-// TODO: Report state of event processing at the end of the job in a new GUI component.
-// TODO: Check if the complex logic used to disconnect/cleanup the ET system is necessary anymore.
-public class MonitoringApplication {
-
- // Top-level Swing components.
- private JPanel mainPanel;
- private JPanel leftPanel;
- private JPanel rightPanel;
- private JTabbedPane plotPane;
- private JTabbedPane tabs;
- private ConnectionPanel connectionPanel;
- private ConnectionStatusPanel connectionStatusPanel;
- private EventPanel eventPanel;
- private JobPanel jobPanel;
- private JMenuBar menuBar;
- private EventButtonsPanel buttonsPanel;
- private JFrame frame;
-
- // References to menu items that will be enabled/disabled depending on application state.
- private JMenuItem connectItem;
- private JMenuItem disconnectItem;
- private JMenuItem resetConnectionItem;
- private JMenuItem connectionLoadItem;
- private JMenuItem savePlotsItem;
- private JMenuItem logItem;
- private JMenuItem terminalItem;
- private JMenuItem steeringItem;
- private JMenuItem aidaAutoSaveItem;
- private JMenuItem saveJobSettingsItem;
- private JMenuItem loadJobSettingsItem;
- private JMenuItem resetJobSettingsItem;
-
- // Saved references to System.out and System.err in case need to reset.
- private final PrintStream sysOut = System.out;
- private final PrintStream sysErr = System.err;
-
- // ET connection parameters and state.
- private EtConnectionParameters connectionParameters;
- private EtConnection connection;
- private int connectionStatus = ConnectionStatus.DISCONNECTED;
-
- // Event processing objects.
- private JobControlManager jobManager;
- private LCSimEventBuilder eventBuilder;
- private EventProcessingThread eventProcessingThread;
-
- // Job timing.
- private Timer timer;
- private TimerTask updateTimeTask;
- private long jobStartTime;
-
- // ActionListener for GUI event dispatching.
- private ActionListener actionListener;
-
- // Logging objects.
- private static Logger logger;
- private Handler logHandler;
- private DefaultTableModel logTableModel;
- //static final String[] logTableColumns = { "Source", "Message", "Date", "Level" };
- static final String[] logTableColumns = { "Message", "Date", "Level" };
- private JTable logTable;
- private Level defaultLogMessageLevel = Level.INFO;
-
- // Some default GUI size parameters.
- private final int logTableWidth = 700;
- private final int logTableHeight = 270;
-
- // Format for screenshots. Hard-coded to PNG.
- private static final String screenshotFormat = "png";
-
- // Maximum time in millis to wait for the ET system to disconnect.
- // TODO: Make this an option in the JobPanel.
- private int maxCleanupTime = 5000;
-
- // Format of date field for log.
- private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss.SSS");
- private static final String LCSIM_FAIL_MESSAGE = "Failed to setup LCSim.";
-
- private static final int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
- private static final int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
-
- private static final int leftPanelWidth = (int) (screenWidth * 0.33);
- private static final int rightPanelWidth = (int) (screenWidth * 0.40);
-
- private static final int connectionStatusPanelHeight = 50;
- private static final int connectionStatusPanelWidth = 400;
-
- EventProcessingChain eventProcessing;
-
- /**
- * Constructor for the monitoring application.
- */
- private MonitoringApplication() {
-
- // Create and configure the logger.
- setupLogger();
-
- // Create the ActionEventListener for event dispatching.
- actionListener = new MonitoringApplicationActionListener();
-
- // Setup the application menus.
- createMenu();
-
- // Create the GUI panels.
- createPanels();
-
- // Create the log table GUI component.
- createLogTable();
-
- // Setup AIDA.
- setupAida();
-
- // Log that the application started successfully.
- log("Application initialized successfully.");
- }
-
- /**
- * Setup and configure the AIDA plotting backend.
- */
- private void setupAida() {
- MonitoringAnalysisFactory.register();
- MonitoringAnalysisFactory.configure();
- MonitoringPlotFactory.setRootPane(plotPane);
- }
-
- /**
- * Creates all the JPanels for the monitoring GUI.
- */
- private void createPanels() {
- mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- createLeftPanel();
- createRightPanel();
- }
-
- /**
- * Create the left panel.
- */
- private void createLeftPanel() {
-
- // Lefthand panel containing the three application tabs.
- leftPanel = new JPanel();
- // set border ex.
- // leftPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
- // leftPanel.setBorder(BorderFactory.createEmptyBorder());
- leftPanel.setMinimumSize(new Dimension(leftPanelWidth, screenHeight - 30));
- leftPanel.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
-
- // Event processing buttons.
- //c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.anchor = GridBagConstraints.CENTER;
- c.insets = new Insets(10, 0, 0, 10);
- buttonsPanel = new EventButtonsPanel();
- buttonsPanel.addActionListener(actionListener);
- leftPanel.add(buttonsPanel, c);
-
- // Connection status panel.
- c.gridx = 0;
- c.gridy = 1;
- c.anchor = GridBagConstraints.NORTH;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = c.weighty = 1.0;
- c.insets = new Insets(10, 0, 5, 0);
- connectionStatusPanel = new ConnectionStatusPanel();
- connectionStatusPanel.setMinimumSize(new Dimension(connectionStatusPanelWidth, connectionStatusPanelHeight));
- leftPanel.add(connectionStatusPanel, c);
-
- // Contents of the tabs panel.
- connectionPanel = new ConnectionPanel();
- eventPanel = new EventPanel();
- jobPanel = new JobPanel();
- jobPanel.addActionListener(actionListener);
-
- // Create the container for the tabbed pane.
- //JPanel tabsPanel = new JPanel();
- //c = new GridBagConstraints();
- //c.gridx = 0;
- //c.gridy = 2;
- //c.fill = GridBagConstraints.BOTH;
- //c.weightx = c.weighty = 1.0;
- //c.insets = new Insets(0, 0, 0, 10);
- //leftPanel.add(tabsPanel, c);
-
- // Tab panels.
- c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = c.weighty = 1.0;
- c.gridx = 0;
- c.gridy = 2;
- tabs = new JTabbedPane();
- tabs.addTab("Connection Settings", connectionPanel);
- tabs.addTab("Event Monitor", eventPanel);
- tabs.addTab("Job Settings", jobPanel);
- //tabsPanel.add(tabs, c);
- leftPanel.add(tabs, c);
-
- // Layout attributes for the entire left panel.
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 1.0;
- c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(0, 5, 0, 0);
- mainPanel.add(leftPanel, c);
- }
-
- /**
- * Create the right panel.
- */
- private void createRightPanel() {
-
- // Create right-hand panel.
- rightPanel = new JPanel();
- rightPanel.setPreferredSize(new Dimension(rightPanelWidth, screenHeight - 30));
- rightPanel.setMinimumSize(new Dimension(rightPanelWidth, screenHeight - 30));
- rightPanel.setLayout(new BorderLayout());
-
- // Create plot pane with empty tabs.
- plotPane = new JTabbedPane();
- rightPanel.add(plotPane, BorderLayout.CENTER);
-
- // Set layout of right panel.
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.CENTER;
- c.weightx = 1.0;
- c.weighty = 1.0;
- mainPanel.add(rightPanel, c);
- }
-
- /**
- * Create the menu items.
- */
- private void createMenu() {
-
- menuBar = new JMenuBar();
-
- JMenu connectionMenu = new JMenu("Connection");
- connectionMenu.setMnemonic(KeyEvent.VK_C);
- menuBar.add(connectionMenu);
-
- connectItem = addMenuItem("Connect", KeyEvent.VK_C, CONNECT, true, "Connect to ET system using parameters from connection panel.", connectionMenu);
- disconnectItem = addMenuItem("Disconnect", KeyEvent.VK_D, DISCONNECT, false, "Disconnect from the current ET session.", connectionMenu);
- resetConnectionItem = addMenuItem("Reset Connection Settings", KeyEvent.VK_R, RESET_CONNECTION_SETTINGS, true, "Reset connection settings to defaults.", connectionMenu);
- connectionLoadItem = addMenuItem("Load Connection...", KeyEvent.VK_L, LOAD_CONNECTION, true, "Load connection settings from a saved properties file.", connectionMenu);
- addMenuItem("Save Connection...", KeyEvent.VK_S, SAVE_CONNECTION, true, "Save connection settings to a properties file.", connectionMenu);
- addMenuItem("Exit", KeyEvent.VK_X, EXIT, true, "Exit from the application.", connectionMenu);
-
- JMenu eventMenu = new JMenu("Event");
- eventMenu.setMnemonic(KeyEvent.VK_E);
- menuBar.add(eventMenu);
-
- //addMenuItem("Reset Event Monitor", KeyEvent.VK_E, RESET_EVENTS, true, "Reset timer and counters in the event monitor tab.", eventMenu);
-
- /**
- * FIXME: Rest of these should be converted to use the addMenuItem() helper method...
- */
-
- JMenuItem eventRefreshItem = new JMenuItem("Set Event Refresh...");
- eventRefreshItem.setMnemonic(KeyEvent.VK_V);
- eventRefreshItem.setActionCommand(EDIT_EVENT_REFRESH);
- eventRefreshItem.addActionListener(actionListener);
- eventRefreshItem.setToolTipText("Set the number of events between GUI updates.");
- eventMenu.add(eventRefreshItem);
-
- /*
- JMenuItem maxEventsItem = new JMenuItem("Set Max Events...");
- maxEventsItem.setMnemonic(KeyEvent.VK_M);
- maxEventsItem.setActionCommand(SET_MAX_EVENTS);
- maxEventsItem.addActionListener(actionListener);
- maxEventsItem.setToolTipText("Set the maximum number of events to process in one session.");
- eventMenu.add(maxEventsItem);
- */
-
- JMenu jobMenu = new JMenu("Job");
- jobMenu.setMnemonic(KeyEvent.VK_J);
- menuBar.add(jobMenu);
-
- saveJobSettingsItem = new JMenuItem("Save Job Settings...");
- saveJobSettingsItem.setMnemonic(KeyEvent.VK_J);
- saveJobSettingsItem.setActionCommand(SAVE_JOB_SETTINGS);
- saveJobSettingsItem.addActionListener(actionListener);
- saveJobSettingsItem.setToolTipText("Save Job Settings configuration to a properties file.");
- jobMenu.add(saveJobSettingsItem);
-
- loadJobSettingsItem = new JMenuItem("Load Job Settings...");
- loadJobSettingsItem.setMnemonic(KeyEvent.VK_L);
- loadJobSettingsItem.setActionCommand(LOAD_JOB_SETTINGS);
- loadJobSettingsItem.addActionListener(actionListener);
- loadJobSettingsItem.setToolTipText("Load Job Settings from a properties file.");
- jobMenu.add(loadJobSettingsItem);
-
- resetJobSettingsItem = new JMenuItem("Reset Job Settings");
- resetJobSettingsItem.setMnemonic(KeyEvent.VK_R);
- resetJobSettingsItem.setActionCommand(RESET_JOB_SETTINGS);
- resetJobSettingsItem.addActionListener(actionListener);
- resetJobSettingsItem.setToolTipText("Reset Job Settings to the defaults.");
- jobMenu.add(resetJobSettingsItem);
-
- steeringItem = new JMenuItem("Set Steering File...");
- steeringItem.setMnemonic(KeyEvent.VK_S);
- steeringItem.setActionCommand(SET_STEERING_FILE);
- steeringItem.addActionListener(actionListener);
- steeringItem.setToolTipText("Set the job's LCSim steering file.");
- jobMenu.add(steeringItem);
-
- aidaAutoSaveItem = new JMenuItem("AIDA Auto Save File...");
- aidaAutoSaveItem.setMnemonic(KeyEvent.VK_A);
- aidaAutoSaveItem.setActionCommand(AIDA_AUTO_SAVE);
- aidaAutoSaveItem.addActionListener(actionListener);
- aidaAutoSaveItem.setToolTipText("Select name of file to auto save AIDA plots at end of job.");
- jobMenu.add(aidaAutoSaveItem);
-
- savePlotsItem = new JMenuItem("Save Plots to AIDA File...");
- savePlotsItem.setMnemonic(KeyEvent.VK_P);
- savePlotsItem.setActionCommand(SAVE_PLOTS);
- savePlotsItem.addActionListener(actionListener);
- savePlotsItem.setEnabled(false);
- savePlotsItem.setToolTipText("Save plots from default AIDA tree to an output file.");
- jobMenu.add(savePlotsItem);
-
- logItem = new JMenuItem("Redirect to File...");
- logItem.setMnemonic(KeyEvent.VK_F);
- logItem.setActionCommand(LOG_TO_FILE);
- logItem.addActionListener(actionListener);
- logItem.setEnabled(true);
- logItem.setToolTipText("Redirect job's standard out and err to a file.");
- jobMenu.add(logItem);
-
- terminalItem = new JMenuItem("Redirect to Terminal");
- terminalItem.setMnemonic(KeyEvent.VK_T);
- terminalItem.setActionCommand(LOG_TO_TERMINAL);
- terminalItem.addActionListener(actionListener);
- terminalItem.setEnabled(false);
- terminalItem.setToolTipText("Redirect job's standard out and err back to the terminal.");
- jobMenu.add(terminalItem);
-
- JMenuItem screenshotItem = new JMenuItem("Take a screenshot...");
- screenshotItem.setMnemonic(KeyEvent.VK_N);
- screenshotItem.setActionCommand(SCREENSHOT);
- screenshotItem.addActionListener(actionListener);
- screenshotItem.setToolTipText("Save a full screenshot to a " + screenshotFormat + " file.");
- jobMenu.add(screenshotItem);
-
- JMenu logMenu = new JMenu("Log");
- jobMenu.setMnemonic(KeyEvent.VK_L);
- menuBar.add(logMenu);
-
- JMenuItem saveLogItem = new JMenuItem("Save log to file...");
- saveLogItem.setMnemonic(KeyEvent.VK_S);
- saveLogItem.setActionCommand(SAVE_LOG_TABLE);
- saveLogItem.addActionListener(actionListener);
- saveLogItem.setToolTipText("Save the log records to a tab delimited text file.");
- logMenu.add(saveLogItem);
-
- addMenuItem("Clear log", KeyEvent.VK_C, CLEAR_LOG_TABLE, true, "Clear the log table of all messages.", logMenu);
- }
-
- /**
- * Add a menu item.
- * @param label The label.
- * @param mnemonic The single letter shortcut.
- * @param cmd The command.
- * @param enabled Whether it is enabled.
- * @param tooltip The tooltip text.
- * @param menu The menu to which it should be added.
- * @return
- */
- private JMenuItem addMenuItem(String label, int mnemonic, String cmd, boolean enabled, String tooltip, JMenu menu) {
- JMenuItem item = new JMenuItem(label);
- item.setMnemonic(mnemonic);
- item.setActionCommand(cmd);
- item.setEnabled(enabled);
- item.setToolTipText(tooltip);
- item.addActionListener(actionListener);
- menu.add(item);
- return item;
- }
-
- /**
- * Log handler for inserting messages into the log table.
- */
- private class MonitoringApplicationLogHandler extends Handler {
-
- /**
- * Puts log messages into the application's log table GUI component.
- */
- public void publish(LogRecord record) {
- Object[] row = new Object[] { /*record.getLoggerName(),*/ // source
- record.getMessage(), // message
- dateFormat.format(new Date(record.getMillis())), // date
- record.getLevel() }; // level
- logTableModel.insertRow(logTable.getRowCount(), row);
- }
-
- public void close() throws SecurityException {
- }
-
- public void flush() {
- }
- }
-
- /**
- * Creates the application's log table GUI component, which is a JTable containing messages
- * from the logger.
- */
- private void createLogTable() {
-
- String data[][] = new String[0][0];
- logTableModel = new DefaultTableModel(data, logTableColumns);
- logTable = new JTable(logTableModel);
- logTable.setEnabled(false);
-
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 3;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = c.weighty = 1.0;
- c.insets = new Insets(0, 0, 5, 3);
- JScrollPane logPane = new JScrollPane(logTable);
- logPane.setPreferredSize(new Dimension(logTableWidth, logTableHeight));
- logPane.setMinimumSize(new Dimension(logTableWidth, logTableHeight));
- leftPanel.add(logPane, c);
- }
-
- /**
- * Setup the application's Logger object for writing messages to the log table.
- */
- private void setupLogger() {
- logger = Logger.getLogger(this.getClass().getSimpleName());
- logHandler = new MonitoringApplicationLogHandler();
- logger.setUseParentHandlers(false);
- logger.addHandler(logHandler);
- logger.setLevel(Level.ALL);
- }
-
- /**
- * Create the monitoring application frame and run it on a separate thread.
- * @return Reference to the created application.
- */
- static final MonitoringApplication createMonitoringApplication() {
- final MonitoringApplication app = new MonitoringApplication();
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- app.createApplicationFrame();
- }
- });
- return app;
- }
-
- /**
- * Load connection settings from a file.
- * @param file The properties file.
- */
- void loadConnectionSettings(File file) {
- connectionPanel.loadPropertiesFile(file);
- }
-
- /**
- * Load job settings from a file.
- * @param file The properties file.
- */
- void loadJobSettings(File file) {
- try {
- jobPanel.setJobSettings(new JobSettings(file));
- // Need to check here if System.out and err have been redirected.
- if (jobPanel.logToFile()) {
- redirectStdOutAndErrToFile(new File(jobPanel.getLogFileName()));
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * The ActionListener implementation for handling all GUI events.
- */
- private class MonitoringApplicationActionListener implements ActionListener {
-
- /**
- * Action handler method for the app.
- * @param e The event to handle.
- */
- public void actionPerformed(ActionEvent e) {
- String cmd = e.getActionCommand();
- if (CONNECT.equals(cmd)) {
- //startSessionThread();
- startSession();
- } else if (DISCONNECT.equals(cmd)) {
- //startDisconnectThread();
- stopSession();
- } else if (EDIT_EVENT_REFRESH.equals(cmd)) {
- setEventRefresh();
- } else if (SAVE_PLOTS.equals(cmd)) {
- savePlots();
- } else if (LOG_TO_FILE.equals(cmd)) {
- logToFile();
- } else if (LOG_TO_TERMINAL.equals(cmd)) {
- logToTerminal();
- } else if (SCREENSHOT.equals(cmd)) {
- chooseScreenshot();
- } else if (EXIT.equals(cmd)) {
- exit();
- } else if (SAVE_CONNECTION.equals(cmd)) {
- connectionPanel.save();
- } else if (LOAD_CONNECTION.equals(cmd)) {
- connectionPanel.load();
- } else if (RESET_CONNECTION_SETTINGS.equals(cmd)) {
- connectionPanel.reset();
- } /*else if (SET_MAX_EVENTS.equals(cmd)) {
- setMaxEvents();
- }*/ else if (SAVE_LOG_TABLE.equals(cmd)) {
- saveLogToFile();
- } else if (CLEAR_LOG_TABLE.equals(cmd)) {
- clearLog();
- } else if (SET_EVENT_BUILDER.equals(cmd)) {
- jobPanel.editEventBuilder();
- } else if (PAUSE.equals(cmd)) {
- pauseEventProcessing();
- } else if (NEXT.equals(cmd)) {
- nextEvent();
- } else if (RESUME.equals(cmd)) {
- resumeEventProcessing();
- } else if (SET_LOG_LEVEL.equals(cmd)) {
- setLogLevel();
- } else if (AIDA_AUTO_SAVE.equals(cmd)) {
- jobPanel.chooseAidaAutoSaveFile();
- } else if (SAVE_JOB_SETTINGS.equals(cmd)) {
- saveJobSettings();
- } else if (LOAD_JOB_SETTINGS.equals(cmd)) {
- loadJobSettings();
- } else if (RESET_JOB_SETTINGS.equals(cmd)) {
- resetJobSettings();
- } else if (SET_STEERING_RESOURCE.equals(cmd)) {
- steeringResourceSelected();
- } else if (SET_STEERING_FILE.equals(cmd)) {
- selectSteeringFile();
- }
- }
- }
-
- /**
- * This fires when a steering resource file is selected from the combo box. The Job Settings
- * are changed to use a resource type.
- */
- private void steeringResourceSelected() {
- jobPanel.setSteeringType(JobPanel.RESOURCE);
- }
-
- /**
- * Save the job settings to a selected file.
- */
- private void saveJobSettings() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Save Job Settings");
- fc.setCurrentDirectory(new File("."));
- int r = fc.showSaveDialog(leftPanel);
- if (r == JFileChooser.APPROVE_OPTION) {
- File f = fc.getSelectedFile();
- JobSettings settings = jobPanel.getJobSettings();
- try {
- settings.save(f);
- log(Level.INFO, "Saved Job Settings to properties file <" + f.getPath() + ">.");
- } catch (IOException e) {
- e.printStackTrace();
- log(Level.SEVERE, "Error saving Job Settings to properties file <" + f.getPath() + ">.");
- showDialog("Error saving Job Settings to properties file.");
- }
- }
- }
-
- /**
- * Load job settings from a selected file.
- */
- private void loadJobSettings() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Load Job Settings");
- fc.setCurrentDirectory(new File("."));
- int r = fc.showOpenDialog(leftPanel);
- if (r == JFileChooser.APPROVE_OPTION) {
- File f = fc.getSelectedFile();
- try {
- jobPanel.setJobSettings(new JobSettings(f));
- log(Level.INFO, "Loaded Job Settings from properties file <" + f.getPath() + ">.");
- } catch (IOException e) {
- e.printStackTrace();
- log(Level.SEVERE, "Error loading Job Settings from properties file <" + f.getPath() + ">.");
- showDialog("Error loading Job Settings from properties file.");
- }
- }
- }
-
- /**
- * Reset the job settings to the defaults.
- */
- private void resetJobSettings() {
- jobPanel.resetJobSettings();
- // Redirect System.out and err back to the terminal.
- logToTerminal();
- }
-
- /**
- * Set a new log level for the application and also forward to the event processor.
- */
- private void setLogLevel() {
- Level newLevel = jobPanel.getLogLevel();
- logger.setLevel(newLevel);
- //if (eventProcessor != null) {
- // eventProcessor.setLogLevel(newLevel);
- //}
-
- log(Level.INFO, "Log Level was changed to <" + jobPanel.getLogLevel().toString() + ">.");
- }
-
- /**
- * Set the connection status.
- * @param status The connection status.
- */
- private void setConnectionStatus(int status) {
- connectionStatus = status;
- connectionStatusPanel.setStatus(status);
- log(Level.FINE, "Connection status changed to <" + ConnectionStatus.toString(status) + ">.");
- logHandler.flush();
- }
-
- /**
- * Get the current connection status.
- * @return The connection status.
- */
- private int getConnectionStatus() {
- return connectionStatus;
- }
-
- /**
- * Pop-up a modal dialog.
- * @param m The message to display in the dialog box.
- */
- private void showDialog(String m) {
- JOptionPane.showMessageDialog(leftPanel, m);
- }
-
- /**
- * Setup the frame to run the application.
- */
- private void createApplicationFrame() {
- mainPanel.setOpaque(true);
- frame = new JFrame(getApplicationTitle());
- frame.setContentPane(mainPanel);
- frame.setJMenuBar(menuBar);
- frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- // frame.setMinimumSize(new Dimension(600, 850));
- frame.setResizable(true);
- frame.pack();
- frame.setVisible(true);
- }
-
- /**
- * Save plots to a selected output file.
- */
- private void savePlots() {
- JFileChooser fc = new JFileChooser();
- int r = fc.showSaveDialog(mainPanel);
- if (r == JFileChooser.APPROVE_OPTION) {
- File fileName = fc.getSelectedFile();
- try {
- AIDA.defaultInstance().saveAs(fileName);
- logger.log(Level.INFO, "Plots saved to <" + fileName + ">.");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Select an LCSim steering file.
- */
- private void selectSteeringFile() {
- JFileChooser fc = new JFileChooser();
- int r = fc.showOpenDialog(mainPanel);
- if (r == JFileChooser.APPROVE_OPTION) {
- File fileName = fc.getSelectedFile();
- try {
- (new JobControlManager()).setup(fileName);
- jobPanel.setSteeringFile(fileName.getPath());
- jobPanel.setSteeringType(JobPanel.FILE);
- log("Steering file set to <" + fileName.getPath() + ">.");
- } catch (Exception e) {
- e.printStackTrace();
- log(Level.SEVERE, "Failed to read steering file <" + fileName.getPath() + ">.");
- showDialog("Failed to read the LCSim XML file.");
- }
- }
- }
-
- /**
- * Get the full title of the application.
- * @return The application title.
- */
- private static String getApplicationTitle() {
- return "HPS Monitoring - " + getUserName() + "@" + getHostname();
- }
-
- /**
- * Get the hostname, which is used in the application title.
- * @return The hostname.
- */
- private static String getHostname() {
- try {
- return InetAddress.getLocalHost().getHostName();
- } catch (Exception e) {
- return "UNKNOWN_HOST";
- }
- }
-
- /**
- * Get the user name, which is used in the application title.
- * @return The user name.
- */
- private static String getUserName() {
- if (System.getProperty("user.name") == null) {
- return "UNKNOWN_USER";
- } else {
- return System.getProperty("user.name");
- }
- }
-
- /**
- * Call the reset() method on Drivers which implement {@link Resettable}. They must implement
- * the {@link Resettable} interface for this to work.
- */
- /*
- private synchronized void resetDrivers() {
- if (jobManager != null) {
- for (Driver driver : jobManager.getDriverExecList()) {
- if (driver instanceof Resettable) {
- try {
- ((Resettable) driver).reset();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- log(Level.INFO, "LCSim drivers were reset.");
- }
- */
-
- /**
- * Redirect System.out and System.err to a file. This is primarily used to capture lengthy
- * debug output from event processing. Messages sent to the Logger are unaffected.
- */
- private void logToFile() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Log File");
- fc.setCurrentDirectory(new File("."));
- int fcs = fc.showSaveDialog(mainPanel);
- if (fcs == JFileChooser.APPROVE_OPTION) {
- final File logFile = fc.getSelectedFile();
- if (logFile.exists()) {
- showDialog("Log file already exists.");
- } else {
- try {
- if (!logFile.createNewFile()) {
- throw new IOException();
- }
-
- redirectStdOutAndErrToFile(logFile);
-
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- jobPanel.setLogToFile(true);
- jobPanel.setLogFile(logFile.getPath());
-
- terminalItem.setEnabled(true);
- logItem.setEnabled(false);
- }
- });
-
- log("Redirected System output to file <" + logFile.getPath() + ">.");
- } catch (IOException e) {
- e.printStackTrace();
- log(Level.SEVERE, "Error redirecting System output to file <" + logFile.getPath() + ">.");
- showDialog("Error redirecting System output to log file.");
- }
- }
- }
- }
-
- /**
- * Redirect <code>System.out</code> and <code>System.err</code> to a file.
- * @param file The output log file.
- * @throws FileNotFoundException if the file does not exist.
- */
- private void redirectStdOutAndErrToFile(File file) throws FileNotFoundException {
- PrintStream ps = new PrintStream(new FileOutputStream(file.getPath()));
- System.setOut(ps);
- System.setErr(ps);
- }
-
- /**
- * Redirect <code>System.out</code> and <code>System.err</code> back to the terminal, e.g. if
- * they were previously sent to a file. This is independent of messages that are sent to the
- * application's log table.
- */
- private void logToTerminal() {
- System.setOut(sysOut);
- System.setErr(sysErr);
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- jobPanel.setLogFile("");
- jobPanel.setLogToFile(false);
- terminalItem.setEnabled(false);
- logItem.setEnabled(true);
- }
- });
- log("Redirected print output to terminal.");
- }
-
- /**
- * Set the event refresh rate using a modal dialog.
- */
- private void setEventRefresh() {
- String inputValue = JOptionPane.showInputDialog("Event Refresh Rate:", eventPanel.getEventRefresh());
- try {
- int newEventRefresh = Integer.parseInt(inputValue);
- if (newEventRefresh < 1) {
- throw new RuntimeException("Event Refresh must be > 0.");
- }
- eventPanel.setEventRefresh(newEventRefresh);
- log("Event refresh set to <" + newEventRefresh + ">.");
- } catch (Exception e) {
- e.printStackTrace();
- log(Level.WARNING, "Ignored invalid event refresh setting.");
- showDialog("The value " + inputValue + " is not valid for Event Refresh Rate.");
- }
- }
-
- /**
- * Using a modal dialog, set the maximum number of events to process before an automatic
- * disconnect.
- */
- /*
- private void setMaxEvents() {
- String inputValue = JOptionPane.showInputDialog("Max Events:", eventPanel.getMaxEvents());
- try {
- int newMaxEvents = Integer.parseInt(inputValue);
- if (newMaxEvents < 0) {
- showDialog("Max Events is set to unlimited.");
- newMaxEvents = -1;
- }
- // Set max events in panel.
- eventPanel.setMaxEvents(newMaxEvents);
- // Set max events in event processor.
- //if (eventProcessor != null) {
- // eventProcessor.setMaxEvents(newMaxEvents);
- //}
- log("Max events set to <" + newMaxEvents + ">.");
- } catch (Exception e) {
- e.printStackTrace();
- log(Level.WARNING, "Ignored invalid max events setting <" + inputValue + ">.");
- showDialog("The value " + inputValue + " is not valid for Max Events.");
- }
- }
- */
-
- /**
- * Set the GUI state to disconnected, which will enable/disable applicable GUI components and
- * menu items.
- */
- private void setDisconnectedGuiState() {
-
- // Enable or disable appropriate menu items.
- connectItem.setEnabled(true);
- disconnectItem.setEnabled(false);
- resetConnectionItem.setEnabled(true);
- connectionLoadItem.setEnabled(true);
- savePlotsItem.setEnabled(false);
- //resetDriversItem.setEnabled(false);
- logItem.setEnabled(true);
- terminalItem.setEnabled(true);
- steeringItem.setEnabled(true);
-
- // Re-enable the ConnectionPanel.
- connectionPanel.enableConnectionPanel(true);
-
- // Re-enable the JobPanel.
- jobPanel.enableJobPanel(true);
-
- // Set relevant event panel buttons to disabled.
- buttonsPanel.enablePauseButton(false);
- buttonsPanel.enableNextEventsButton(false);
-
- // Toggle connection button to proper setting.
[truncated at 1000 lines; 645 more skipped]
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplicationMain.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplicationMain.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -9,8 +9,8 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.hps.monitoring.gui.MonitoringApplication;
-
public class MonitoringApplicationMain {
/**
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringCommands.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringCommands.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,34 +0,0 @@
-package org.hps.monitoring;
-
-/**
- * These strings are used to identify ActionEvents in the MonitoringApplication.
- *
- * @author Jeremy McCormick <[log in to unmask]>
- */
-final class MonitoringCommands {
- static final String AIDA_AUTO_SAVE = "aidaAutoSave";
- static final String CLEAR_LOG_TABLE = "clearLogTable";
- static final String CONNECT = "connect";
- static final String DISCONNECT = "disconnect";
- static final String EDIT_EVENT_REFRESH = "editEventRefresh";
- static final String EXIT = "exit";
- static final String LOAD_CONNECTION = "loadConnection";
- static final String LOAD_JOB_SETTINGS = "loadJobSettings";
- static final String LOG_TO_FILE = "logToFile";
- static final String LOG_TO_TERMINAL = "logToTerminal";
- static final String NEXT = "next";
- static final String PAUSE = "pause";
- static final String RESUME = "resume";
- static final String RESET_CONNECTION_SETTINGS = "resetConnectionSettings";
- static final String RESET_JOB_SETTINGS = "resetJobSettings";
- static final String SAVE_CONNECTION = "saveConnection";
- static final String SAVE_JOB_SETTINGS = "saveJobSettings";
- static final String SAVE_LOG_TABLE = "saveLogTable";
- static final String SAVE_PLOTS = "savePlots";
- static final String SCREENSHOT = "screenshot";
- static final String SET_EVENT_BUILDER = "setEventBuilder";
- static final String SET_EVENT_REFRESH = "setEventRefresh";
- static final String SET_LOG_LEVEL = "setLogLevel";
- static final String SET_STEERING_FILE = "setSteeringFile";
- static final String SET_STEERING_RESOURCE = "setSteeringResource";
-}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringPlotFactory.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringPlotFactory.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,134 +0,0 @@
-package org.hps.monitoring;
-
-import hep.aida.IPlotter;
-import hep.aida.jfree.plotter.PlotterFactory;
-import hep.aida.ref.plotter.PlotterUtilities;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-
-import org.hps.monitoring.plotting.StripChartBuilder;
-import org.hps.monitoring.plotting.StripChartUpdater;
-import org.jfree.chart.ChartPanel;
-import org.jfree.chart.JFreeChart;
-
-/**
- * This class implements an AIDA IPlotterFactory for the monitoring application.
- * It extends the JFree plotter by putting plots into tabs. Each plotter factory
- * is given its own top-level tab in a root tabbed pane, under which are separate tabs
- * for each plotter. The root pane is static and shared across all plotter factories.
- * It is set externally by the MonitoringApplication before any calls to AIDA are made
- * from Drivers.
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: MonitoringPlotFactory.java,v 1.6 2013/12/10 07:36:40 jeremy Exp $
- */
-// FIXME: Move to plotting package.
-public class MonitoringPlotFactory extends PlotterFactory {
-
- /* The name of the factory which will be used in naming tabs in the monitoring app. */
- String name = null;
-
- /* The GUI tabs for this factory's plots. */
- private JTabbedPane tabs = new JTabbedPane();
-
- /* Root pane where this factory's top-level tab will be inserted. */
- private static JTabbedPane rootPane = null;
-
- /**
- * Class constructor.
- */
- MonitoringPlotFactory() {
- super();
-
- /* Enable embedded mode. */
- setEmbedded(true);
-
- /* Setup the root pane by adding a tab for this factory. */
- setupRootPane(" ");
- }
-
- /**
- * Class constructor.
- * @param name The name of the factory.
- */
- MonitoringPlotFactory(String name) {
- super();
- this.name = name;
-
- setEmbedded(true);
-
- setupRootPane(name);
- }
-
- private void setupRootPane(String name) {
- // FIXME: hack
- if (!(new RuntimeException()).getStackTrace()[2].getClassName()
- .equals("hep.aida.ref.plotter.style.registry.StyleStoreXMLReader")) {
- rootPane.addTab(name, tabs);
- rootPane.setTabComponentAt(rootPane.getTabCount() - 1, new JLabel(name));
- }
- }
-
- /**
- * Create a named plotter.
- * @param plotterName The name of the plotter.
- * @return The plotter.
- */
- public IPlotter create(String plotterName) {
- IPlotter plotter = super.create(plotterName);
- setupPlotterTab(plotterName, plotter);
- return plotter;
- }
-
- /**
- * Create an unnamed plotter.
- * @return The plotter.
- */
- public IPlotter create() {
- return create((String) null);
- }
-
- /**
- * Set the reference to the root tab pane where this factory's GUI tabs will be inserted.
- * @param rootPane The root tabbed pane.
- */
- static void setRootPane(JTabbedPane rootPane) {
- MonitoringPlotFactory.rootPane = rootPane;
- }
-
- private void setupPlotterTab(String plotterName, IPlotter plotter) {
- JPanel plotterPanel = new JPanel(new BorderLayout());
- plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER);
- tabs.addTab(plotterName, plotterPanel);
- tabs.setTabComponentAt(tabs.getTabCount() - 1, new JLabel(plotterName));
- }
-
- private void addChart(JFreeChart chart) {
- ChartPanel panel = new ChartPanel(chart);
- tabs.addTab(chart.getTitle().getText(), panel);
- tabs.setTabComponentAt(tabs.getTabCount() - 1, new JLabel(chart.getTitle().getText()));
- }
-
- /**
- * Create a strip chart with a pure JFreeChart implementation.
- * It will be automatically updated from a {@link StripChartUpdater}.
- * Similar to AIDA plots, the chart will be given a sub-tab in the tab
- * of this factory.
- *
- * @param title The title of the chart.
- * @param yAxisLabel The y axis label.
- * @param size The buffer size of the series which determines how much data displays.
- * @param updater The updater which will update the chart in real time.
- * @return The modified <tt>StripChartUpdater</tt> which points to the new chart.
- */
- public StripChartUpdater createStripChart(String title, String yAxisLabel, int size, StripChartUpdater updater) {
- JFreeChart stripChart = StripChartBuilder.createDynamicTimeSeriesChart(title, yAxisLabel, size);
- stripChart.getLegend().setVisible(false); /* Legend turned off for now. */
- addChart(stripChart);
- updater.setChart(stripChart);
- return updater;
- }
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/SteeringFileUtil.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/SteeringFileUtil.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,53 +0,0 @@
-package org.hps.monitoring;
-
-import java.io.IOException;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-/**
- * This class provides a static utility method to get a list of steering file resources from the package in hps-java that contains these files.
- *
- * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: SteeringFileUtil.java,v 1.2 2013/11/05 17:15:04 jeremy Exp $
- */
-public class SteeringFileUtil {
-
- /**
- * Get the files that end in .lcsim from all loaded jar files.
- * @return A list of embedded steering file resources.
- */
- public static String[] getAvailableSteeringFileResources(String packageName) {
- List<String> resources = new ArrayList<String>();
- URL url = SteeringFileUtil.class.getResource("SteeringFileUtil.class");
- String scheme = url.getProtocol();
- if (!"jar".equals(scheme)) {
- throw new IllegalArgumentException("Unsupported scheme: " + scheme);
- }
- try {
- JarURLConnection con = (JarURLConnection) url.openConnection();
- JarFile archive = con.getJarFile();
- Enumeration<JarEntry> entries = archive.entries();
- while (entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- if (entry.getName().endsWith(".lcsim") && entry.getName().contains(packageName)) {
- resources.add(entry.getName());
- }
- }
- archive.close();
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- java.util.Collections.sort(resources);
- String[] arr = new String[resources.size()];
- for (int i=0; i<arr.length; i++) {
- arr[i] = resources.get(i);
- }
- return arr;
- }
-}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/plotting
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/plotting/StripChartBuilder.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/plotting/StripChartBuilder.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -5,7 +5,6 @@
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.time.DynamicTimeSeriesCollection;
import org.jfree.data.time.Second;
@@ -32,15 +31,14 @@
final JFreeChart result = ChartFactory.createTimeSeriesChart(title, "hh:mm:ss", yAxisLabel, dataset, true, true, false);
final XYPlot plot = result.getXYPlot();
plot.getDomainAxis().setAutoRange(true);
- NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
- rangeAxis.setRange(0., 1.);
+ NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setAutoRange(true);
rangeAxis.setAutoRangeIncludesZero(true);
return result;
}
/**
- * This should be used when the time period for updating is variable. (I think???)
+ * This should be used when the time period for updating is variable.
* @param title
* @param yAxisLabel
* @param maxAge
@@ -52,19 +50,21 @@
sensorSeries.add(new Minute(new Date()), newData);
*/
// TODO: test case
- public static JFreeChart createTimeSeriesChart(String title, String yAxisLabel, int maxAge, int maxCount) {
+ public static JFreeChart createTimeSeriesChart(String title, String yAxisLabel, int maxAge, int maxCount, int rangeSize) {
TimeSeriesCollection dataset = new TimeSeriesCollection();
TimeSeries timeSeries = new TimeSeries("Default Dataset");
timeSeries.setMaximumItemAge(maxAge);
timeSeries.setMaximumItemCount(maxCount);
+ dataset.addSeries(timeSeries);
final JFreeChart result = ChartFactory.createTimeSeriesChart(title, "hh:mm:ss", yAxisLabel, dataset, true, true, false);
final XYPlot plot = result.getXYPlot();
- plot.getDomainAxis().setAutoRange(true);
- ValueAxis rangeAxis = plot.getRangeAxis();
- rangeAxis.setAutoRange(true);
- rangeAxis.setAutoRangeMinimumSize(1.0);
+ plot.getDomainAxis().setAutoRange(true);
+ plot.getDomainAxis().setAutoRangeMinimumSize(rangeSize);
+ NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
+ rangeAxis.setAutoRange(true);
+ rangeAxis.setAutoRangeIncludesZero(true);
return result;
}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalStripChartTestDriver.java (rev 0)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalStripChartTestDriver.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -0,0 +1,59 @@
+package org.hps.monitoring.subsys.ecal;
+
+import java.util.Date;
+import java.util.TimerTask;
+
+import org.hps.monitoring.plotting.MonitoringPlotFactory;
+import org.hps.monitoring.plotting.StripChartUtil;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.time.Millisecond;
+import org.jfree.data.time.TimeSeries;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * Proof of principle Driver for plotting a sub-system's data using a strip chart.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class EcalStripChartTestDriver extends Driver {
+
+ int eventInterval = 1000;
+ static String collectionName = "EcalReadoutHits";
+
+ MonitoringPlotFactory plotFactory = (MonitoringPlotFactory)
+ AIDA.defaultInstance().analysisFactory().createPlotterFactory("ECAL System Monitoring");
+ TimeSeries series;
+ JFreeChart stripChart;
+ TimerTask updateTask;
+ EventHeader currentEvent;
+ int hits;
+ int events;
+
+ public void startOfData() {
+ stripChart = plotFactory.createStripChart(
+ "Average ECAL Hits per " + eventInterval + " Events",
+ "Hits",
+ 99999999, /* max age */
+ 1000, /* max count */
+ 100000 /* range size */);
+ series = StripChartUtil.getTimeSeries(stripChart);
+ }
+
+ public void process(EventHeader event) {
+ int size = event.get(RawCalorimeterHit.class, collectionName).size();
+ ++events;
+ hits += size;
+ if (event.getEventNumber() % eventInterval == 0) {
+ double averageHits = (double)hits / (double)events;
+ series.add(new Millisecond(new Date()), averageHits);
+ hits = 0;
+ events = 0;
+ }
+
+ //long millis = (long) ((double) event.getTimeStamp() / 1e6);
+ //series.addOrUpdate(new Second(new Date(timestamp)), size);
+ //series.addOrUpdate(new Millisecond(new Date(millis)), size);
+ }
+}
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/et
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/et/EtSystemStripCharts.java 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/et/EtSystemStripCharts.java 2014-06-11 23:33:15 UTC (rev 700)
@@ -1,6 +1,6 @@
package org.hps.monitoring.subsys.et;
-import org.hps.monitoring.MonitoringPlotFactory;
+import org.hps.monitoring.plotting.MonitoringPlotFactory;
import org.hps.monitoring.record.etevent.EtEventProcessor;
import org.hps.monitoring.subsys.SystemStatisticsImpl;
import org.jlab.coda.et.EtEvent;
java/trunk/monitoring-app/src/main/scripts
--- java/trunk/monitoring-app/src/main/scripts/evio_file_producer.sh 2014-06-11 21:12:13 UTC (rev 699)
+++ java/trunk/monitoring-app/src/main/scripts/evio_file_producer.sh 2014-06-11 23:33:15 UTC (rev 700)
@@ -14,6 +14,6 @@
# Run the file producer, sending any additional arguments to the command.
#prod="java -classpath $classpath org.hps.evio.EvioFileProducer -e ${eviofile} -f ETBuffer -host localhost -s 10000 -d 100 $@"
-prod="java -classpath $classpath org.hps.monitoring.EvioFileProducer -e ${eviofile} -f ETBuffer -host localhost -s 10000 $@"
+prod="java -classpath $classpath org.hps.monitoring.record.evio.EvioFileProducer -e ${eviofile} -f ETBuffer -host localhost -s 10000 $@"
echo $prod
-exec $prod
\ No newline at end of file
+exec $prod
SVNspam 0.1