@SuppressWarnings("static-access")
private void init() {
System.out.println("Initializing HiveMetaTool..");
Option help = new Option("help", "print this message");
Option listFSRoot = new Option("listFSRoot", "print the current FS root locations");
Option executeJDOQL =
OptionBuilder.withArgName("query-string")
.hasArgs()
.withDescription("execute the given JDOQL query")
.create("executeJDOQL");
/* Ideally we want to specify the different arguments to updateLocation as separate argNames.
* However if we did that, HelpFormatter swallows all but the last argument. Note that this is
* a know issue with the HelpFormatter class that has not been fixed. We specify all arguments
* with a single argName to workaround this HelpFormatter bug.
*/
Option updateFSRootLoc =
OptionBuilder
.withArgName("new-loc> " + "<old-loc")
.hasArgs(2)
.withDescription(
"Update FS root location in the metastore to new location.Both new-loc and " +
"old-loc should be valid URIs with valid host names and schemes." +
"When run with the dryRun option changes are displayed but are not " +
"persisted. When run with the serdepropKey/tablePropKey option " +
"updateLocation looks for the serde-prop-key/table-prop-key that is " +
"specified and updates its value if found.")
.create("updateLocation");
Option dryRun = new Option("dryRun" , "Perform a dry run of updateLocation changes.When " +
"run with the dryRun option updateLocation changes are displayed but not persisted. " +
"dryRun is valid only with the updateLocation option.");
Option serdePropKey =
OptionBuilder.withArgName("serde-prop-key")
.hasArgs()
.withValueSeparator()
.withDescription("Specify the key for serde property to be updated. serdePropKey option " +
"is valid only with updateLocation option.")
.create("serdePropKey");
Option tablePropKey =
OptionBuilder.withArgName("table-prop-key")
.hasArg()
.withValueSeparator()
.withDescription("Specify the key for table property to be updated. tablePropKey option " +
"is valid only with updateLocation option.")