@Override public void parse(String[] args) { super.parse(args); // support the old syntax "hivemetastore [port]" but complain args = commandLine.getArgs(); if (args.length > 0) { // complain about the deprecated syntax -- but still run System.err.println( "This usage has been deprecated, consider using the new command " + "line syntax (run with -h to see usage information)"); this.port = new Integer(args[0]); } // notice that command line options take precedence over the // deprecated (old style) naked args... if (commandLine.hasOption('p')) { this.port = Integer.parseInt(commandLine.getOptionValue('p')); } else { // legacy handling String metastorePort = System.getenv("METASTORE_PORT"); if (metastorePort != null) { this.port = Integer.parseInt(metastorePort); } } }
/** * Parse the arguments. * @param args */ public void parse(String[] args) { try { commandLine = new GnuParser().parse(OPTIONS, args); if (commandLine.hasOption('h')) { printUsage(); System.exit(1); } if (commandLine.hasOption('v')) { verbose = true; } } catch (ParseException e) { System.err.println(e.getMessage()); printUsage(); System.exit(1); } }
/** * Add the hiveconf properties to the Java system properties, override * anything therein. * * @return a copy of the properties specified in hiveconf */ public Properties addHiveconfToSystemProperties() { Properties confProps = commandLine.getOptionProperties("hiveconf"); for (String propKey : confProps.stringPropertyNames()) { if (verbose) { System.err.println( "hiveconf: " + propKey + "=" + confProps.getProperty(propKey)); } if (propKey.equalsIgnoreCase("hive.root.logger")) { splitAndSetLogger(propKey, confProps); } else { System.setProperty(propKey, confProps.getProperty(propKey)); } } return confProps; }
@Override public void parse(String[] args) { super.parse(args); // support the old syntax "hivemetastore [port]" but complain args = commandLine.getArgs(); if (args.length > 0) { // complain about the deprecated syntax -- but still run System.err.println( "This usage has been deprecated, consider using the new command " + "line syntax (run with -h to see usage information)"); this.port = new Integer(args[0]); } // notice that command line options take precedence over the // deprecated (old style) naked args... if (commandLine.hasOption('p')) { this.port = Integer.parseInt(commandLine.getOptionValue('p')); } else { // legacy handling String metastorePort = System.getenv("METASTORE_PORT"); if (metastorePort != null) { this.port = Integer.parseInt(metastorePort); } } }