hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.1 -r1.2
--- ConnectionParameters.java 22 Mar 2012 02:21:16 -0000 1.1
+++ ConnectionParameters.java 22 Mar 2012 03:55:03 -0000 1.2
@@ -1,31 +1,37 @@
package org.lcsim.hps.monitoring;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
import org.jlab.coda.et.EtConstants;
/**
- * Connection parameters for ET system.
+ * Connection parameters for ET system consumer.
*/
public class ConnectionParameters {
- public String etName = null;
+ public String etName = "ETBuffer";
public String host = null;
public int port = EtConstants.serverPort;
public boolean blocking = true;
public boolean verbose = false;
- public String statName = null;
+ public String statName = "MY_STATION";
public int chunk = 1;
- public int neventsPerArray;
public int qSize = 0;
public int position = 1;
public int pposition = 0;
public int flowMode = EtConstants.stationSerial;
- public class ConnectionParametersException extends RuntimeException {
- ConnectionParametersException(String msg) {
- super(msg);
- }
+ public ConnectionParameters() {
+ // Set the default host.
+ try {
+ InetAddress addr = InetAddress.getLocalHost();
+ host = addr.getHostName();
+ } catch (UnknownHostException e) {
+ throw new ConnectionParametersException("Unable to assign default host.");
+ }
}
-
+
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" +
@@ -120,9 +126,15 @@
throw new ConnectionParametersException("Arguments included invalid command line parameter.");
}
}
-
+
if (host == null || etName == null || statName == null) {
throw new ConnectionParametersException("Missing required arguments.");
}
}
+
+ public class ConnectionParametersException extends RuntimeException {
+ ConnectionParametersException(String msg) {
+ super(msg);
+ }
+ }
}
\ No newline at end of file