Print

Print


Author: [log in to unmask]
Date: Sat Mar  7 12:34:24 2015
New Revision: 2338

Log:
Undo r2286 to r2289 for now.

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java	Sat Mar  7 12:34:24 2015
@@ -24,6 +24,7 @@
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
+// TODO: Add detector name and run number as arguments on the basic tool rather than sub-commands.
 public class CommandLineTool {
 
     Options options = new Options();
@@ -99,19 +100,17 @@
         if (commandLine.hasOption("x")) {
             File xmlConfigFile = new File(commandLine.getOptionValue("x"));
             conditionsManager.setXmlConfig(xmlConfigFile);
+            if (verbose)
+                System.out.println("using XML config file " + xmlConfigFile.getPath());
         }         
         
-        String detectorName = null;
+        String detectorName = DatabaseConditionsManager.getDefaultEngRunDetectorName();
         if (commandLine.hasOption("d")) {
             detectorName = commandLine.getOptionValue("d");
-        } else {
-            throw new RuntimeException("Missing -d argument with name of detector.");
         }
-        int runNumber = 0;
+        int runNumber = 2000;
         if (commandLine.hasOption("r")) {
             runNumber = Integer.parseInt(commandLine.getOptionValue("r"));
-        } else {
-            throw new RuntimeException("Missing -r argument with run number.");
         }
         try {
             DatabaseConditionsManager.getInstance().setDetector(detectorName, runNumber);
@@ -143,16 +142,15 @@
     static CommandLineTool create() {
         CommandLineTool cli = new CommandLineTool();
         cli.options.addOption(new Option("h", false, "Print help and exit"));
-        cli.options.addOption(new Option("d", true, "Set the detector name (required)"));
-        cli.options.getOption("d").setRequired(true);
-        cli.options.addOption(new Option("r", true, "Set the run number (required)"));
-        cli.options.getOption("r").setRequired(true);
-        cli.options.addOption(new Option("v", false, "Enable verbose print output"));
-        cli.options.addOption(new Option("p", true, "Set the database connection properties file"));
-        cli.options.addOption(new Option("x", true, "Set the conditions XML configuration file"));
+        cli.options.addOption(new Option("v", false, "Enable verbose terminal output"));
+        cli.options.addOption(new Option("p", true, "Set the connection properties file"));
+        cli.options.addOption(new Option("x", true, "Set the conditions database XML configuration file"));
+        cli.options.addOption(new Option("d", true, "Set the detector name"));
+        cli.options.addOption(new Option("r", true, "Set the run number"));
         cli.registerCommand(new LoadCommand());
         cli.registerCommand(new PrintCommand());
         cli.registerCommand(new AddCommand());
         return cli;
     }
+
 }