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  April 2015

HPS-SVN April 2015

Subject:

r2832 - in /java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli: AbstractCommand.java AddCommand.java LoadCommand.java PrintCommand.java

From:

[log in to unmask]

Reply-To:

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

Date:

Mon, 27 Apr 2015 22:59:44 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (219 lines)

Author: [log in to unmask]
Date: Mon Apr 27 15:59:36 2015
New Revision: 2832

Log:
Remove the verbose option and use logging instead.

Modified:
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java
    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/PrintCommand.java

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java	Mon Apr 27 15:59:36 2015
@@ -34,11 +34,6 @@
      * The parser for the options.
      */
     private final Parser parser = new PosixParser();
-
-    /**
-     * Verbose setting.
-     */
-    private boolean verbose = false;
 
     /**
      * Class constructor.
@@ -85,22 +80,6 @@
     }
 
     /**
-     * Set whether verbose output is enabled.
-     * @param verbose <code>true</code> to enable verbose output
-     */
-    final void setVerbose(final boolean verbose) {
-        this.verbose = verbose;
-    }
-
-    /**
-     * Get verbose flag.
-     * @return the verbose flag
-     */
-    protected boolean getVerbose() {
-        return verbose;
-    }
-
-    /**
      * Parse the sub-command's options.
      * @param arguments the sub-command's arguments
      * @return the parsed command line

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java	Mon Apr 27 15:59:36 2015
@@ -20,7 +20,7 @@
  *
  * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
-public class AddCommand extends AbstractCommand {
+final class AddCommand extends AbstractCommand {
 
     /**
      * Setup logger.
@@ -32,17 +32,17 @@
      */
     private static final Options OPTIONS = new Options();
     static {
-        OPTIONS.addOption(new Option("h", false, "Show help for add command"));
-        OPTIONS.addOption("r", true, "The starting run number (required)");
+        OPTIONS.addOption(new Option("h", false, "print help for add command"));
+        OPTIONS.addOption("r", true, "starting run number (required)");
         OPTIONS.getOption("r").setRequired(true);
-        OPTIONS.addOption("e", true, "The ending run number (default is starting run number)");
-        OPTIONS.addOption("t", true, "The table name (required)");
+        OPTIONS.addOption("e", true, "ending run number (default is starting run number)");
+        OPTIONS.addOption("t", true, "table name (required)");
         OPTIONS.getOption("t").setRequired(true);
-        OPTIONS.addOption("c", true, "The collection ID (required)");
+        OPTIONS.addOption("c", true, "collection ID (required)");
         OPTIONS.getOption("c").setRequired(true);
-        OPTIONS.addOption("T", true, "A tag value (optional)");
-        OPTIONS.addOption("u", true, "Your user name (optional)");
-        OPTIONS.addOption("m", true, "The notes about this conditions set (optional)");
+        OPTIONS.addOption("T", true, "tag value (optional)");
+        OPTIONS.addOption("u", true, "user name (optional)");
+        OPTIONS.addOption("m", true, "notes about this conditions set (optional)");
     }
 
     /**

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 Apr 27 15:59:36 2015
@@ -32,7 +32,7 @@
  *
  * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
-class LoadCommand extends AbstractCommand {
+final class LoadCommand extends AbstractCommand {
 
     /**
      * Setup logger.
@@ -44,10 +44,10 @@
      */
     private static final Options OPTIONS = new Options();
     static {
-        OPTIONS.addOption(new Option("h", false, "Show help for load command"));
-        OPTIONS.addOption(new Option("t", true, "Name of the target table in the database"));
-        OPTIONS.addOption(new Option("f", true, "Input data file"));
-        OPTIONS.addOption(new Option("d", true, "Description of collection data"));
+        OPTIONS.addOption(new Option("h", false, "print help for load command"));
+        OPTIONS.addOption(new Option("t", true, "name of the target table in the database"));
+        OPTIONS.addOption(new Option("f", true, "input data file"));
+        OPTIONS.addOption(new Option("d", true, "description of collection data"));
     }
 
     /**
@@ -105,9 +105,8 @@
         this.parseFile(fileName, columnNames, rows);
 
         final String insertSql = QueryBuilder.buildInsert(tableName, collectionId, columnNames, rows);
-        if (this.getVerbose()) {
-            LOGGER.info(insertSql);
-        }
+        LOGGER.info(insertSql);
+        
         // FIXME: This call should go through an object API like ConditionsObjectCollection.insert rather than the
         // manager directly.
         final List<Integer> ids = conditionsManager.updateQuery(insertSql);

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	Mon Apr 27 15:59:36 2015
@@ -26,7 +26,7 @@
  *
  * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
-class PrintCommand extends AbstractCommand {
+final class PrintCommand extends AbstractCommand {
 
     /**
      * Setup logger.
@@ -39,13 +39,12 @@
     static Options options = new Options();
 
     static {
-        options.addOption(new Option("h", false, "Show help for print command"));
-        options.addOption(new Option("t", true, "Set the table name"));
-        options.addOption(new Option("i", false, "Print the ID for the records (off by default)"));
-        options.addOption(new Option("f", true, "Write print output to a file (must be used with -t option)"));
-        options.addOption(new Option("H", false, "Suppress printing of conditions record and table info"));
-        options.addOption(new Option("d", false, "Use tabs for field delimiter instead of spaces"));
-        options.addOption(new Option("T", true, "Specify a conditions tag to use for filtering records"));
+        options.addOption(new Option("h", false, "print help for print command"));
+        options.addOption(new Option("t", true, "table name"));
+        options.addOption(new Option("i", false, "print the ID for the records (off by default)"));
+        options.addOption(new Option("f", true, "write print output to a file (must be used with -t option)"));
+        options.addOption(new Option("H", false, "suppress printing of conditions record and table info"));
+        options.addOption(new Option("d", false, "use tabs for field delimiter instead of spaces"));
     }
 
     /**
@@ -94,11 +93,6 @@
 
         if (!conditionsManager.isInitialized()) {
             throw new RuntimeException("conditions system is not initialized");
-        }
-
-        // User specified tag of conditions records.
-        if (commandLine.hasOption("T")) {
-            conditionsManager.setTag(commandLine.getOptionValue("T"));
         }
 
         // Print conditions sets matching a specific conditions key.
@@ -178,8 +172,10 @@
         final StringBuffer buffer = new StringBuffer();
         for (final Object object : collection) {
             for (final String columnName : collection.getTableMetaData().getFieldNames()) {
-                buffer.append(((ConditionsObject) object).getFieldValue(columnName));
-                buffer.append(this.fieldDelimiter);
+            	if (!"collection_id".equals(columnName)) {
+            		buffer.append(((ConditionsObject) object).getFieldValue(columnName));
+            		buffer.append(this.fieldDelimiter);
+            	}
             }
             buffer.setLength(buffer.length() - 1);
             buffer.append('\n');
@@ -195,8 +191,10 @@
      * @param collection the collection
      */
     private void printCollectionHeader(final ConditionsObjectCollection<?> collection) {
-        // LOGGER.info('\n' + "--------------------------------------" + '\n' + collection.getConditionsRecord()
-        // + "--------------------------------------");
+        LOGGER.info('\n' + "--------------------------------------" + '\n' 
+        		+ "table: " + collection.getTableMetaData().getTableName() + '\n'
+        		+ "collection ID: " + collection.getCollectionId() + '\n'
+        		+ "--------------------------------------");
     }
 
     /**
@@ -228,8 +226,10 @@
             this.ps.print(this.fieldDelimiter);
         }
         for (final String columnName : tableMetaData.getFieldNames()) {
-            this.ps.print(columnName);
-            this.ps.print(this.fieldDelimiter);
+        	if (!"collection_id".equals(columnName)) {
+        		this.ps.print(columnName);
+        		this.ps.print(this.fieldDelimiter);
+        	}
         }
         this.ps.println();
     }

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