LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  July 2015

HPS-SVN July 2015

Subject:

r3226 - /java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 6 Jul 2015 21:37:41 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (65 lines)

Author: [log in to unmask]
Date: Mon Jul  6 14:37:29 2015
New Revision: 3226

Log:
Add option for using space as field delimiter.  Throw an error if TableMetaData is not found.

Modified:
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java	Mon Jul  6 14:37:29 2015
@@ -17,11 +17,10 @@
 import org.lcsim.util.log.MessageOnlyLogFormatter;
 
 /**
- * This is a sub-command to add conditions data using an input text file. The file should be ASCII text that is comma
- * delimited with the first row containing headers that exactly match the table column names. The user must supply a
- * table name as the target for the SQL insert. An optional collection ID can be supplied, which is not allowed to exist
- * already in the table. Otherwise, the command will fail. By default, the next collection ID will be found by the
- * conditions manager.
+ * This is a sub-command to add conditions data using an input text file. The file should be ASCII text that is
+ * delimited consistently by a single character. The user must supply a table name as the target for the SQL insert. An
+ * optional collection ID can be supplied, which is not allowed to exist already in the table. Otherwise, the command
+ * will fail. By default, the next collection ID will be found by the conditions manager.
  * <p>
  *
  * <pre>
@@ -54,7 +53,8 @@
         OPTIONS.addOption(new Option("f", true, "input data file path (required)"));
         OPTIONS.getOption("f").setRequired(true);
         OPTIONS.addOption(new Option("d", true, "description of the collection for log"));
-        OPTIONS.addOption(new Option("c", true, "field delimiter (default is tabs)"));
+        OPTIONS.addOption(new Option("c", true, "field delimiter character (default is tab-delimited)"));
+        OPTIONS.addOption(new Option("s", false, "use space as field delimiter"));
     }
 
     /**
@@ -102,13 +102,22 @@
         String separator = DEFAULT_FIELD_SEPARATOR;
         if (commandLine.hasOption("c")) {
             separator = commandLine.getOptionValue("c");
+            LOGGER.info("using column separator <" + separator + ">");
             if (separator.length() > 1) {
                 throw new IllegalArgumentException("Separator must be a single character.");
             }
-            LOGGER.info("using separator character <" + separator + ">");
+        }
+
+        if (commandLine.hasOption("s")) {
+            separator = " ";
+            LOGGER.info("using space for column separator");
         }
 
         final TableMetaData tableMetaData = conditionsManager.findTableMetaData(tableName);
+        if (tableMetaData == null) {
+            throw new IllegalArgumentException("No table meta data found for " + tableName);
+        }
+        LOGGER.info("found tableMetaData for " + tableMetaData.getTableName());
         final BaseConditionsObjectCollection<ConditionsObject> newCollection = new BaseConditionsObjectCollection<ConditionsObject>(
                 conditionsManager.getConnection(), tableMetaData);
 

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use