static Configuration parseConfiguration(String[] args) throws ParseException { assert args != null; LOG.debug("Analyzing YAESS Explain arguments: {}", Arrays.toString(args)); CommandLineParser parser = new BasicParser(); CommandLine cmd = parser.parse(OPTIONS, args); String script = cmd.getOptionValue(OPT_SCRIPT.getOpt()); LOG.debug("Script: {}", script); Configuration result = new Configuration(); LOG.debug("Loading script: {}", script); try { Properties properties = CommandLineUtil.loadProperties(new File(script)); result.script = BatchScript.load(properties); } catch (Exception e) { throw new IllegalArgumentException(MessageFormat.format( "Invalid script \"{0}\".", script), e); } LOG.debug("Analyzed YAESS Explain arguments"); return result; }
BatchScript batch = BatchScript.load(script);