Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-17027 Use Apache CLI in tools
  3. HBASE-16982

Better integrate Apache CLI in AbstractHBaseTool

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • None
    • None

    Description

      Problem

      1. Inconsistencies in our user facing tools.

      • options:
        start with single/double dash
        words separated by dash or underscore or just joined together
        someplace use '=' to separate value, other use space (ExportSnapshot vs HashTable)
      • Description
        Manually formatting options and their descriptions in printUsage()
        Inconsistant formatting, sometimes even weird.
        Incomplete. Sometimes people forget to add new option to description

      2. Manual parsing of options (those huge if-else loops iterating over args)

      Solution
      Use Apache CLI

      • It has various validations for option names which'll fix first set of issues.
      • using AbstractHBaseTool's print usage function will ensure consistent formatting (although we loose the power to order the options)
      • If we enforce the method of defining options as in patch, it's highly unlikely to forget adding description.
      • CLI parses the options for us.

      Using Apache CLI when writing new tools is straight forward, but it's not easy when porting exiting tools since some option names are not valid as per CLI's validation.
      New method, processOldArgs(), will allow to port these tools in a backward compatible manner.

      Attachments

        1. HBASE-16982.master.005.patch
          29 kB
          Apekshit Sharma
        2. HBASE-16982.master.004.patch
          29 kB
          Apekshit Sharma
        3. HBASE-16982.master.003.patch
          30 kB
          Apekshit Sharma
        4. HBASE-16982.master.002.patch
          30 kB
          Apekshit Sharma
        5. HBASE-16982.master.001.patch
          29 kB
          Apekshit Sharma

        Issue Links

          Activity

            People

              appy Apekshit Sharma
              appy Apekshit Sharma
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: