Author: [log in to unmask]
Date: Fri Mar 6 00:54:25 2015
New Revision: 2295
Log:
Minor changes on monitoring-app branch.
Removed:
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/SessionState.java
Modified:
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java Fri Mar 6 00:54:25 2015
@@ -13,7 +13,6 @@
import org.hps.monitoring.application.model.ConfigurationModel;
import org.hps.monitoring.application.model.ConnectionStatus;
import org.hps.monitoring.application.model.SteeringType;
-import org.hps.monitoring.application.util.ErrorHandler;
import org.hps.monitoring.application.util.EtSystemUtil;
import org.hps.monitoring.subsys.et.EtSystemMonitor;
import org.hps.monitoring.subsys.et.EtSystemStripCharts;
@@ -30,9 +29,10 @@
import org.lcsim.util.Driver;
/**
+ * This class encapsulates all of the logic involved with processing events
+ * and managing the related state and objects within the monitoring application.
*
* @author Jeremy McCormick <[log in to unmask]>
- *
*/
class EventProcessing {
@@ -42,7 +42,7 @@
List<CompositeRecordProcessor> processors;
/**
- *
+ * This class is used to organize the objects for an event processing session.
*/
class SessionState {
JobManager jobManager;
@@ -54,9 +54,11 @@
}
/**
- *
- * @param application
- * @param processors
+ * Initialize with reference to the current monitoring application
+ * and a list of extra processors to add to the loop after
+ * configuration.
+ * @param application The current monitoring application.
+ * @param processors A list of processors to add after configuration is performed.
*/
EventProcessing(
MonitoringApplication application,
@@ -68,16 +70,8 @@
}
/**
- *
- * @return
- */
- SessionState getSessionState() {
- return sessionState;
- }
-
- /**
- *
- * @param configurationModel
+ * Setup this class from the global configuration.
+ * @param configurationModel The global configuration.
*/
void setup(ConfigurationModel configurationModel) {
MonitoringApplication.logger.info("setting up LCSim");
@@ -136,14 +130,14 @@
}
}
- logger.info("LCSim setup was successful.");
+ logger.info("lcsim setup was successful");
} catch (Throwable t) {
// Catch all errors and rethrow them as RuntimeExceptions.
application.errorHandler.setError(t).setMessage("Error setting up LCSim.").printStackTrace().raiseException();
}
- // Setup the CompositeLoop.
+ // Now setup the CompositeLoop.
setupLoop(configurationModel);
}
@@ -154,8 +148,6 @@
// Get the class for the event builder.
String eventBuilderClassName = configurationModel.getEventBuilderClassName();
-
- //logger.config("initializing event builder: " + eventBuilderClassName);
try {
// Create a new instance of the builder class.
@@ -166,13 +158,11 @@
// Add the builder as a listener so it is notified when conditions change.
ConditionsManager.defaultInstance().addConditionsListener(sessionState.eventBuilder);
-
- //logger.config("successfully initialized event builder: " + eventBuilderClassName);
- }
-
- /**
- *
- * @param configurationModel
+ }
+
+ /**
+ * Setup the loop from the global configuration.
+ * @param configurationModel The global configuration.
*/
void setupLoop(ConfigurationModel configurationModel) {
@@ -222,17 +212,17 @@
}
/**
- *
- * @param steering
+ * Setup a steering file on disk.
+ * @param steering The steering file.
*/
void setupSteeringFile(String steering) {
sessionState.jobManager.setup(new File(steering));
}
/**
- *
- * @param steering
- * @throws IOException
+ * Setup a steering resource.
+ * @param steering The steering resource.
+ * @throws IOException if there is a problem setting up or accessing the resource.
*/
void setupSteeringResource(String steering) throws IOException {
InputStream is = this.getClass().getClassLoader().getResourceAsStream(steering);
@@ -282,7 +272,8 @@
}
/**
- *
+ * Start event processing on the event processing thread
+ * and start the watchdog thread.
*/
synchronized void start() {
@@ -296,7 +287,7 @@
}
/**
- * Notify the event processor to pause.
+ * Notify the event processor to pause processing.
*/
synchronized void pause() {
if (!application.connectionModel.getPaused()) {
@@ -306,7 +297,7 @@
}
/**
- *
+ * Get next event if in pause mode.
*/
synchronized void next() {
if (application.connectionModel.getPaused()) {
@@ -317,7 +308,7 @@
}
/**
- * Notify the event processor to resume processing events, if paused.
+ * Resume processing events from pause mode.
*/
synchronized void resume() {
if (application.connectionModel.getPaused()) {
@@ -328,7 +319,7 @@
}
/**
- *
+ * Interrupt and join to the processing watchdog thread.
*/
synchronized void killWatchdogThread() {
// Is the session watchdog thread not null?
@@ -363,21 +354,17 @@
}
/**
- *
- * @return
+ * True if the processing thread is active.
+ * @return True if processing thread is active.
*/
boolean isActive() {
- return sessionState.processingThread.isAlive();
+ return sessionState.processingThread != null && sessionState.processingThread.isAlive();
}
/**
* Connect to the ET system using the current connection settings.
*/
void connect() throws IOException {
-
- // Make sure applicable menu items are enabled or disabled.
- // This applies whether or not using an ET server or file source.
- //setConnectedGuiState();
// Setup the network connection if using an ET server.
if (usingEtServer()) {
@@ -394,8 +381,8 @@
}
/**
- *
- * @return
+ * True if using an ET server.
+ * @return True if using an ET server.
*/
boolean usingEtServer() {
return application.configurationModel.getDataSourceType().equals(DataSourceType.ET_SERVER);
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java Fri Mar 6 00:54:25 2015
@@ -155,7 +155,7 @@
// Setup the data source combo box.
frame.dataSourceComboBox.initialize();
- logger.info("initialized successfully");
+ logger.info("application initialized successfully");
}
/**
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java Fri Mar 6 00:54:25 2015
@@ -1,6 +1,9 @@
package org.hps.monitoring.application.model;
+import java.awt.event.ActionListener;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Level;
import org.hps.record.enums.DataSourceType;
@@ -13,7 +16,7 @@
*/
public final class ConfigurationModel extends AbstractModel {
- Configuration configuration;
+ Configuration configuration;
// Job setting properties.
public static final String DETECTOR_NAME_PROPERTY = "DetectorName";
@@ -65,7 +68,7 @@
this.configuration = configuration;
fireModelChanged();
}
-
+
public Configuration getConfiguration() {
return this.configuration;
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java Fri Mar 6 00:54:25 2015
@@ -1,16 +1,9 @@
-/**
- *
- */
package org.hps.monitoring.application.util;
import java.io.File;
import javax.swing.filechooser.FileFilter;
-/**
- * @author Jeremy McCormick <[log in to unmask]>
- *
- */
/**
* This is a simple file filter that will accept files with ".evio" anywhere in their name.
*/
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java Fri Mar 6 00:54:25 2015
@@ -37,7 +37,7 @@
URL url = ResourceUtil.class.getResource("ResourceUtil.class");
String scheme = url.getProtocol();
if (!"jar".equals(scheme)) {
- throw new IllegalArgumentException("Unsupported scheme. Only jar is allowed.");
+ throw new RuntimeException("Unsupported URL protocol: " + url.getProtocol());
}
try {
JarURLConnection con = (JarURLConnection) url.openConnection();
|