Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN | |||
ConnectionParameters.java | +10 | -126 | 1.11 -> 1.12 |
EtEventProcessor.java | +91 | -16 | 1.3 -> 1.4 |
JobPanel.java | +159 | -3 | 1.16 -> 1.17 |
FieldsPanel.java | +72 | -4 | 1.2 -> 1.3 |
SteeringFileUtil.java | +5 | -1 | 1.1 -> 1.2 |
ConnectionStatus.java | +19 | 1.2 -> 1.3 | |
ConnectionPanel.java | +49 | -1 | 1.23 -> 1.24 |
EventPanel.java | +83 | -3 | 1.15 -> 1.16 |
ConnectionStatusPanel.java | +12 | 1.10 -> 1.11 | |
EventButtonsPanel.java | +27 | 1.3 -> 1.4 | |
EtConnection.java | +31 | 1.10 -> 1.11 | |
+558 | -154 |
add javadoc
diff -u -r1.11 -r1.12 --- ConnectionParameters.java 27 Apr 2012 21:59:57 -0000 1.11 +++ ConnectionParameters.java 5 Nov 2013 17:15:04 -0000 1.12 @@ -11,6 +11,9 @@
*/ class ConnectionParameters {
+ /** + * Parameters that are externally settable from within the package. + */
String etName = "ETBuffer"; String host = null; int port = EtConstants.serverPort;
@@ -26,6 +29,9 @@
int waitTime = 10000000; // wait time in microseconds int prescale = 1;
+ /** + * Class constructor. + */
public ConnectionParameters() { // Set the default host to this machine. try {
@@ -36,140 +42,18 @@
} }
- public static final void usage() { - System.out.println("\nUsage: java Consumer -f <et name> -host <ET host> -s <station name> [-h] [-v] [-nb]\n" + - " [-p <ET server port>] [-c <chunk size>] [-q <queue size>]\n" + - " [-pos <station position>] [-ppos <parallel station position>]\n\n" + - " -host ET system's host\n" + - " -f ET system's (memory-mapped file) name\n" + - " -s create station of this name\n" + - " -h help\n" + - " -v verbose output\n" + - " -nb make station non-blocking\n" + - " -p ET server port\n" + - " -c number of events in one get/put array\n" + - " -q queue size if creating nonblocking station\n" + - " -pos position of created station in station list (1,2,...)\n" + - " -ppos position of created station within a group of parallel stations (-1=end, -2=head)\n" + - " -a run in async mode which looks for immediate connection to ET system\n" + - " -x run in sleep mode\n" + - " -t time to wait for events before timing out\n\n" + - " -e set event prescaling where argument is every N events to read\n" + - " This consumer works by making a direct connection\n" + - " to the ET system's tcp server port.\n"); - } - - /* - public void loadPropertiesFile(File propFile) { - } - */ -
/**
- * Setup this ConnectionParameters object from command line arguments. - * - * @param args - * @return
+ * This is thrown from the constructor if there a problem setting up the default host.
*/
- /* - public void setup(String[] args) { - for (int i = 0; i < args.length; i++) { - if (args[i].equalsIgnoreCase("-f")) { - etName = args[++i]; - } else if (args[i].equalsIgnoreCase("-host")) { - host = args[++i]; - } else if (args[i].equalsIgnoreCase("-nb")) { - blocking = false; - } else if (args[i].equalsIgnoreCase("-v")) { - verbose = true; - } else if (args[i].equalsIgnoreCase("-s")) { - statName = args[++i]; - } else if (args[i].equalsIgnoreCase("-p")) { - try { - port = Integer.parseInt(args[++i]); - if ((port < 1024) || (port > 65535)) { - throw new ConnectionParametersException("Port number must be between 1024 and 65535."); - } - } catch (NumberFormatException ex) { - throw new ConnectionParametersException("Did not specify a proper port number."); - } - } else if (args[i].equalsIgnoreCase("-c")) { - try { - chunk = Integer.parseInt(args[++i]); - if ((chunk < 1) || (chunk > 1000)) { - throw new ConnectionParametersException("Chunk size must be 1 - 1000."); - } - } catch (NumberFormatException ex) { - throw new ConnectionParametersException("Did not specify a proper chunk size."); - } - } else if (args[i].equalsIgnoreCase("-q")) { - try { - qSize = Integer.parseInt(args[++i]); - if (qSize < 1) { - throw new ConnectionParametersException("Queue size must be > 0."); - } - } catch (NumberFormatException ex) { - throw new ConnectionParametersException("Did not specify a proper queue size number."); - } - } else if (args[i].equalsIgnoreCase("-pos")) { - try { - position = Integer.parseInt(args[++i]); - if (position < 1) { - throw new ConnectionParametersException("Position must be > 0."); - } - } catch (NumberFormatException ex) { - throw new ConnectionParametersException("Did not specify a proper position number."); - } - } else if (args[i].equalsIgnoreCase("-ppos")) { - try { - pposition = Integer.parseInt(args[++i]); - if (pposition < -2 || pposition == 0) { - throw new ConnectionParametersException("Parallel position must be > -3 and != 0."); - } - System.out.println("FLOW moDE is ||"); - flowMode = EtConstants.stationParallel; - if (pposition == -2) { - pposition = EtConstants.newHead; - } else if (pposition == -1) { - pposition = EtConstants.end; - } - - } catch (NumberFormatException ex) { - throw new ConnectionParametersException("Did not specify a proper parallel position number."); - } - } else if (args[i].equalsIgnoreCase("-a")) { - waitMode = Mode.ASYNC; - if (waitTime != 0) { - throw new ConnectionParametersException("Can't specify wait time and async mode at the same time."); - } - - } else if (args[i].equalsIgnoreCase("-t")) { - waitMode = Mode.TIMED; - waitTime = Integer.parseInt(args[++i]); - if (waitTime < 0) { - throw new ConnectionParametersException("Invalid wait time specified."); - } - } else if (args[i].equalsIgnoreCase("-e")) { - prescale = Integer.parseInt(args[++i]); - if (prescale < 0) { - throw new ConnectionParametersException("Prescale value is invalid."); - } - } else { - throw new ConnectionParametersException("Arguments included invalid command line parameter:" + args[i]); - } - } - - if (host == null || etName == null || statName == null) { - throw new ConnectionParametersException("Missing required arguments."); - } - } - */ -
public class ConnectionParametersException extends RuntimeException { ConnectionParametersException(String msg) { super(msg); } }
+ /** + * Convert this class to a readable string (properties format). + */
public String toString() { StringBuffer buf = new StringBuffer(); buf.append("etName: " + etName + '\n');
diff -u -r1.3 -r1.4 --- EtEventProcessor.java 4 Oct 2013 06:02:19 -0000 1.3 +++ EtEventProcessor.java 5 Nov 2013 17:15:04 -0000 1.4 @@ -5,70 +5,145 @@
import org.jlab.coda.et.EtEvent; import org.jlab.coda.et.exception.EtTimeoutException;
+/** + * This is an interface for processing EtEvent objects and receiving callbacks + * via an {@link EtEventListener}. + * @author Jeremy McCormick <[log in to unmask]> + * @version $Id: EtEventProcessor.java,v 1.4 2013/11/05 17:15:04 jeremy Exp $ + */
interface EtEventProcessor {
- // Process a single EtEvent.
+ /** + * Process a single EtEvent. + * @param event The ET event. + * @throws EventProcessingException if there was an error processing the event. + * @throws MaxEventsException if the maximum number of events was reached or exceeded. + */
void processEtEvent(EtEvent event) throws EventProcessingException, MaxEventsException;
- // Process the next array of EtEvents. This method may block for a long time or forever. - // The default implementation calls processEtEvent() on each event, but this is not required.
+ /** + * Process the next array of EtEvents. This method may block for a long time or forever. + * The default implementation calls processEtEvent() on each event, but this is not required. + * @throws EtTimeoutException if the connection times out. + * @throws MaxEventsException if the maximum number of events was reached or exceeded. + * @throws EventProcessingException if there was an error processing events. + * @throws Exception if some other exception occurs. + */
void processEtEvents() throws EtTimeoutException, MaxEventsException, EventProcessingException, Exception;
- // Process all incoming EtEvents until ET system goes down or stop is requested.
+ /** + * Process all incoming EtEvents until ET system goes down or stop is requested. + */
void process();
- // Get the current status.
+ /** + * Get the current status as a {@link ConnectionStatus} code. + */
int getStatus();
- // Total number of events processed, including those with errors.
+ /** + * Get the total number of events processing thusfar, including those with errors. + * @return The number of events processed. + */
int getNumberOfEventsProcessed();
- // Max events to process.
+ /** + * Get the maximum number of event to process before automatically disconnecting. + * @return The maximum number of events to process. + */
int getMaxEvents();
- // Reset the number of events processed.
+ /** + * Reset the number of events processed to zero. + */
void resetNumberOfEventsProcessed();
- // Add a callback object that will receive notification of start, end, and error.
+ /** + * Add a listener that will receive notifications during event processing. + * @param callme The ET event listener. + */
void addListener(EtEventListener callme);
- // Request that the processor stop processing events.
+ /** + * Request that the processor stop processing events. + */
void stop();
- // Set maximum number of events to process.
+ /** + * Set the maximum number of events to process before disconnecting. + * @param maxEvents The maximum number of events to process. + */
void setMaxEvents(int maxEvents);
- // Change to pause mode which allows pausing between events.
+ /** + * Turn pause mode on or off. + * @param p The pause mode setting; true for on; false for off. + */
void pauseMode(boolean p);
- // Continue with next events if in pause mode.
+ /** + * If using pause mode, this will get the next set of events and then pause again. + */
void nextEvents();
- // Set the log level.
+ /** + * Set the log level of this object. + * @param level The log level. + */
void setLogLevel(Level level);
+ /** + * Check if the processor is done. + * @return True if processer is done processing events; false if not. + */
boolean done();
+ /** + * Check if the processor is in the blocked state, e.g. if it is waiting + * for events from the ET ring. + * @return True if blocked; false if not. + */
boolean blocked();
- // Exception that is thrown when an error occurs during event processing.
+ /** + * Exception that is thrown when an error occurs during event processing. + */
static class EventProcessingException extends Exception {
+ /** + * Class constructor. + * @param e Another Exception object. + */
EventProcessingException(Exception e) { super(e); }
+ /** + * Class constructor. + * @param m The error message. + * @param e Another Exception object. + */
EventProcessingException(String m, Exception e) { super(m, e); }
+ /** + * Class constructor. + * @param m The error message. + */
EventProcessingException(String m) { super(m); } }
- // Exception that is thrown when max number of events is reached or exceeded.
+ /** + * Exception that is throw when the {@link EtEventProcessor#getMaxEvents()} is exceeded. + */
static final class MaxEventsException extends Exception {
+ + /** + * Class constructor + */
MaxEventsException() { super("Maximum number of events was reached."); }
diff -u -r1.16 -r1.17 --- JobPanel.java 5 Jun 2013 16:00:30 -0000 1.16 +++ JobPanel.java 5 Nov 2013 17:15:04 -0000 1.17 @@ -14,6 +14,11 @@
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;
@@ -38,6 +43,9 @@
final static int RESOURCE = 0; final static int FILE = 1;
+ /** + * The available LogLevel settings. + */
String[] logLevels = new String[] { Level.ALL.toString(), Level.FINEST.toString(),
@@ -49,6 +57,9 @@
Level.SEVERE.toString(), Level.OFF.toString()};
+ /** + * Class constructor. + */
JobPanel() { super(new Insets(4, 2, 2, 4), true);
@@ -78,6 +89,10 @@
setJobSettings(new JobSettings()); }
+ /** + * Enable this component. + * @param enable Whether to enable or not. + */
void enableJobPanel(boolean enable) { detectorNameField.setEnabled(enable); eventBuilderField.setEnabled(enable);
@@ -98,6 +113,9 @@
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");
@@ -119,6 +137,10 @@
} }
+ /** + * 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();
@@ -143,6 +165,10 @@
} }
+ /** + * 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;
@@ -168,7 +194,9 @@
resetEventBuilder(); }
-
+ /** + * Reset the event builder to the default. + */
private void resetEventBuilder() { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -177,10 +205,18 @@
}); }
+ /** + * 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() {
@@ -189,6 +225,10 @@
}); }
+ /** + * Set the steering file resource. + * @param s The resource path. + */
void setSteeringResource(final String s) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -197,6 +237,10 @@
}); }
+ /** + * 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() {
@@ -205,6 +249,10 @@
}); }
+ /** + * 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();
@@ -217,14 +265,26 @@
} }
+ /** + * 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() {
@@ -234,10 +294,18 @@
}); }
+ /** + * 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() {
@@ -246,42 +314,82 @@
}); }
+ /** + * 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 the AIDA server is enabled. + * @return True if the AIDA server is enabled; false if not. + */
boolean isAidaServerEnabled() { return remoteAidaCheckBox.isSelected(); }
+ /** + * 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(); }
+ /** + * Get the name of the remote AIDA server. + * @return The remote AIDA server name. + */
String getRemoteAidaName() { return remoteAidaNameField.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() {
@@ -290,6 +398,10 @@
}); }
+ /** + * 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() {
@@ -298,6 +410,10 @@
}); }
+ /** + * Set the steering type. + * @param t The steering type. + */
void setSteeringType(final int t) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -306,6 +422,10 @@
}); }
+ /** + * Set the log level. + * @param level The log level. + */
private void setLogLevel(final Level level) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -314,6 +434,10 @@
}); }
+ /** + * 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() {
@@ -322,6 +446,10 @@
}); }
+ /** + * 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() {
@@ -330,6 +458,10 @@
}); }
+ /** + * Set the log file name. + * @param s The log file name. + */
void setLogFile(final String s) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -338,6 +470,10 @@
}); }
+ /** + * Set AIDA autosave. + * @param b The AIDA autosave setting. + */
private void enableAidaAutoSave(final boolean b) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -346,6 +482,10 @@
}); }
+ /** + * 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() {
@@ -354,6 +494,10 @@
}); }
+ /** + * Enable remote AIDA. + * @param b The remote AIDA setting; true to enable; false to disable. + */
private void enableRemoteAida(final boolean b) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -362,6 +506,10 @@
}); }
+ /** + * Set the name of the remote AIDA server. + * @param s The name of the remote AIDA server. + */
private void setRemoteAidaName(final String s) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -370,16 +518,24 @@
}); }
+ /** + * 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 JobSettings parameters from GUI and return a JobSettings object.
+ * Gather {@link JobSettings} parameters from GUI and return a JobSettings object.
* @return The JobSettings from the JobPanel. */ JobSettings getJobSettings() {
diff -u -r1.2 -r1.3 --- FieldsPanel.java 5 Jun 2013 15:59:57 -0000 1.2 +++ FieldsPanel.java 5 Nov 2013 17:15:04 -0000 1.3 @@ -14,8 +14,7 @@
/** * 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.2 2013/06/05 15:59:57 jeremy Exp $ - *
+ * @version $Id: FieldsPanel.java,v 1.3 2013/11/05 17:15:04 jeremy Exp $
*/ public class FieldsPanel extends JPanel {
@@ -23,29 +22,67 @@
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;
@@ -71,6 +108,12 @@
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);
@@ -100,6 +143,12 @@
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();
@@ -130,12 +179,27 @@
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();
@@ -161,7 +225,11 @@
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) {
- // By default this does nothing. Sub-classes can assign the listener to individual components.
} }
\ No newline at end of file
diff -u -r1.1 -r1.2 --- SteeringFileUtil.java 10 May 2012 21:14:53 -0000 1.1 +++ SteeringFileUtil.java 5 Nov 2013 17:15:04 -0000 1.2 @@ -13,12 +13,16 @@
* 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.1 2012/05/10 21:14:53 jeremy Exp $
+ * @version $Id: SteeringFileUtil.java,v 1.2 2013/11/05 17:15:04 jeremy Exp $
*/ public class SteeringFileUtil { private static final String path = "org/lcsim/hps/steering/";
+ /** + * Get the files that end in .lcsim from all loaded jar files. + * @return + */
public static String[] getAvailableSteeringFileResources() { List<String> resources = new ArrayList<String>(); URL url = SteeringFileUtil.class.getResource("SteeringFileUtil.class");
diff -u -r1.2 -r1.3 --- ConnectionStatus.java 18 Apr 2012 21:06:54 -0000 1.2 +++ ConnectionStatus.java 5 Nov 2013 17:15:04 -0000 1.3 @@ -1,7 +1,15 @@
package org.lcsim.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;
@@ -12,6 +20,9 @@
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",
@@ -23,8 +34,16 @@
"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(); }
diff -u -r1.23 -r1.24 --- ConnectionPanel.java 10 May 2012 21:14:53 -0000 1.23 +++ ConnectionPanel.java 5 Nov 2013 17:15:04 -0000 1.24 @@ -19,7 +19,7 @@
/** * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConnectionPanel.java,v 1.23 2012/05/10 21:14:53 jeremy Exp $
+ * @version $Id: ConnectionPanel.java,v 1.24 2013/11/05 17:15:04 jeremy Exp $
*/ class ConnectionPanel extends FieldsPanel {
@@ -43,6 +43,9 @@
Mode.ASYNC.toString() };
+ /** + * Class constructor. + */
ConnectionPanel() { //super(new Insets(1, 1, 1, 1), true);
@@ -69,6 +72,10 @@
setConnectionParameters(new ConnectionParameters()); }
+ /** + * Get the connection parameters. + * @return The connection parameters. + */
ConnectionParameters getConnectionParameters() { connectionParameters = new ConnectionParameters(); connectionParameters.etName = etNameField.getText();
@@ -87,6 +94,10 @@
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();
@@ -100,6 +111,10 @@
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);
@@ -110,6 +125,10 @@
} }
+ /** + * Set the connection parameters and push into the GUI. + * @param cn The connection parameters. + */
private void setConnectionParameters(ConnectionParameters cn) { etNameField.setText(cn.etName); hostField.setText(cn.host);
@@ -127,6 +146,10 @@
this.connectionParameters = cn; }
+ /** + * 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);
@@ -143,6 +166,9 @@
prescaleField.setEnabled(e); }
+ /** + * Save connection parameters to selected output file. + */
void save() { JFileChooser fc = new JFileChooser(); int r = fc.showSaveDialog(ConnectionPanel.this);
@@ -152,6 +178,9 @@
} }
+ /** + * Load connection parameters from a selected file. + */
void load() { JFileChooser fc = new JFileChooser(); int r = fc.showOpenDialog(ConnectionPanel.this);
@@ -161,10 +190,17 @@
} }
+ /** + * Reset the connection parameters. + */
void reset() { setConnectionParameters(new ConnectionParameters()); }
+ /** + * 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());
@@ -187,10 +223,18 @@
} }
+ /** + * 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);
@@ -201,6 +245,10 @@
} }
+ /** + * Load connection parameters from properties file. + * @param file The properties file. + */
void loadPropertiesFile(File file) { Properties prop = new Properties(); try {
diff -u -r1.15 -r1.16 --- EventPanel.java 10 May 2012 21:14:53 -0000 1.15 +++ EventPanel.java 5 Nov 2013 17:15:04 -0000 1.16 @@ -9,6 +9,11 @@
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]> + * @version $Id: EventPanel.java,v 1.16 2013/11/05 17:15:04 jeremy Exp $ + */
class EventPanel extends FieldsPanel { private JTextField eventCounterField; // number of events in this job
@@ -33,8 +38,12 @@
private boolean updateEvent = true; 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);
@@ -55,14 +64,26 @@
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() {
@@ -71,6 +92,10 @@
}); }
+ /** + * Set the run number. + * @param runNumber The run number. + */
void setRunNumber(final int runNumber) { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -79,6 +104,10 @@
}); }
+ /** + * 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() {
@@ -87,6 +116,10 @@
}); }
+ /** + * 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() {
@@ -96,6 +129,10 @@
}); }
+ /** + * 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() {
@@ -105,6 +142,9 @@
}); }
+ /** + * Check if the panel should be updated for this event. + */
private void checkUpdateEvent() { updateEvent = ((eventCount % getEventRefresh()) == 0); }
@@ -116,6 +156,9 @@
incrementEventCounts(); }
+ /** + * Update the event counters. + */
void updateEventCount() { ++eventCount; ++sessionSupplied;
@@ -126,6 +169,10 @@
} }
+ /** + * 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() {
@@ -136,7 +183,10 @@
}; SwingUtilities.invokeLater(r); }
-
+ + /** + * Increment the number of bad events. + */
void updateBadEventCount() { ++badEventCount; SwingUtilities.invokeLater(new Runnable() {
@@ -146,6 +196,10 @@
}); }
+ /** + * Update the average event rate. + * @param jobStartTime The start time of the job in milliseconds. + */
void updateAverageEventRate(long jobStartTime) { if (updateEvent) { final double jobTime = System.currentTimeMillis() - jobStartTime;
@@ -160,7 +214,11 @@
} } }
-
+ + /** + * 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() {
@@ -168,7 +226,11 @@
} }); }
-
+ + /** + * Set the event refresh rate. + * @param eventRefresh The event refresh rate. + */
void setEventRefresh(final int eventRefresh) { this.eventRefresh = eventRefresh; SwingUtilities.invokeLater(new Runnable() {
@@ -178,6 +240,9 @@
}); }
+ /** + * Reset all the event counts. + */
synchronized void reset() { resetEventCount(); resetBadEventCount();
@@ -185,6 +250,9 @@
resetElapsedTime(); }
+ /** + * Reset the event counter. + */
private void resetEventCount() { eventCount = 0; SwingUtilities.invokeLater(new Runnable() {
@@ -194,6 +262,9 @@
}); }
+ /** + * Reset the elapsed time field. + */
private void resetElapsedTime() { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -202,6 +273,9 @@
}); }
+ /** + * Reset the average event rate. + */
private void resetAverageEventRate() { SwingUtilities.invokeLater(new Runnable() { public void run() {
@@ -210,6 +284,9 @@
}); }
+ /** + * Reset the bad event count. + */
private void resetBadEventCount() { this.badEventCount = 0; SwingUtilities.invokeLater(new Runnable() {
@@ -219,6 +296,9 @@
}); }
+ /** + * Reset the session supplied events. + */
void resetSessionSupplied() { this.sessionSupplied = 0; SwingUtilities.invokeLater(new Runnable() {
diff -u -r1.10 -r1.11 --- ConnectionStatusPanel.java 25 Oct 2013 23:10:06 -0000 1.10 +++ ConnectionStatusPanel.java 5 Nov 2013 17:15:04 -0000 1.11 @@ -16,6 +16,11 @@
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;
@@ -24,6 +29,9 @@
// Format for date field. private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss");
+ /** + * Class constructor. + */
ConnectionStatusPanel() { setLayout(new GridBagLayout());
@@ -99,6 +107,10 @@
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);
diff -u -r1.3 -r1.4 --- EventButtonsPanel.java 25 Oct 2013 23:15:23 -0000 1.3 +++ EventButtonsPanel.java 5 Nov 2013 17:15:04 -0000 1.4 @@ -8,12 +8,19 @@
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();
@@ -46,6 +53,10 @@
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");
@@ -56,20 +67,36 @@
} }
+ /** + * 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) {
diff -u -r1.10 -r1.11 --- EtConnection.java 3 May 2012 16:59:28 -0000 1.10 +++ EtConnection.java 5 Nov 2013 17:15:04 -0000 1.11 @@ -18,6 +18,13 @@
EtAttachment att; EtStation stat;
+ /** + * Class constructor. + * @param param The connection parameters. + * @param sys The ET system. + * @param att The ET attachment. + * @param stat The ET station. + */
private EtConnection(ConnectionParameters param, EtSystem sys, EtAttachment att, EtStation stat) { this.param = param; this.sys = sys;
@@ -25,22 +32,41 @@
this.stat = stat; }
+ /** + * Get the ET system. + * @return The ET system. + */
EtSystem getEtSystem() { return sys; }
+ /** + * Get the ET attachment. + * @return The ET attachment. + */
EtAttachment getEtAttachment() { return att; }
+ /** + * Get the ET station. + * @return The ET station. + */
EtStation getEtStation() { return stat; }
+ /** + * Get the connection parameters. + * @return The connection parameters. + */
ConnectionParameters getConnectionParameters() { return param; }
+ /** + * Cleanup the ET connection. + */
void cleanup() { boolean debug = false; try {
@@ -61,6 +87,11 @@
} }
+ /** + * Create an ET connection from connection parameters. + * @param cn The connection parameters. + * @return The ET connection. + */
static EtConnection createEtConnection(ConnectionParameters cn) { try {
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1