public boolean hasInfoOption() throws ToolException { commandDocument = getCommandDocument(); if (commandDocument == null) { return false; } return commandDocument.hasParameter("help") || commandDocument.hasParameter("version"); }
public void execute(boolean exitOnFinish) throws ToolException { super.execute(exitOnFinish); if (hasInfoOption()) { outputInfo(); } else { if (commandDocument.hasParameter(ToolConstants.CFG_VERBOSE)) { verbose = true; outputFullCommandLine(); outputVersion(); } checkParams(errors); } }
public void outputFullCommandLine() { out.print(name); for (int i = 0; i < getArgument().length; i++) { out.print(" " + getArgument()[i]); } out.println(); }
private void outputInfo() { CommandLineParser parser = getCommandLineParser(); if (commandDocument.hasParameter("help")) { try { out.println(name + " " + getUsage()); out.println(); out.println("Options: "); out.println(); out.println(parser.getFormattedDetailedUsage()); String toolUsage = parser.getToolUsage(); if (toolUsage != null) { out.println(toolUsage); } } catch (Exception ex) { err.println("Error: Could not output detailed usage"); err.println(); } } if (commandDocument.hasParameter("version")) { outputVersion(); } }
public void execute(boolean exitOnFinish) { try { super.execute(exitOnFinish); if (!hasInfoOption()) { ToolContext env = getContext();
super.execute(exitOnFinish); if (!hasInfoOption()) { env = new ProcessorEnvironment(); CommandDocument doc = super.getCommandDocument(); if (doc.hasParameter("corba")) { env.put(ToolCorbaConstants.CFG_CORBA, Boolean.TRUE);
public void checkParams(ErrorVisitor errs) throws ToolException { super.checkParams(errs); CommandDocument doc = super.getCommandDocument();
public void checkParams(ErrorVisitor errors) throws ToolException { super.checkParams(errors); if (errors.getErrors().size() > 0) { Message msg = new Message("PARAMETER_MISSING", LOG); throw new ToolException(msg, new BadUsageException(getUsage(), errors)); } } }
public Properties loadProperties(String propertyFile) { Properties p = new Properties(); try { InputStream ins = getResourceAsStream(propertyFile); p.load(ins); ins.close(); } catch (IOException ex) { // ignore, use defaults } return p; }
public String getUsage() { if (usage == null) { try { CommandLineParser parser = getCommandLineParser(); if (parser != null) { usage = parser.getUsage(); } } catch (Exception ex) { usage = "Could not get usage for the tool"; } } return usage; }
public void execute(boolean exitOnFinish) { try { super.execute(exitOnFinish); if (!hasInfoOption()) { ToolContext env = getContext();
public void checkParams(ErrorVisitor errs) throws ToolException { super.checkParams(errs); CommandDocument doc = super.getCommandDocument();
private void outputInfo() { CommandLineParser parser = getCommandLineParser(); if (commandDocument.hasParameter("help")) { try { out.println(name + " " + getUsage()); out.println(); out.println("Options: "); out.println(); out.println(parser.getFormattedDetailedUsage()); String toolUsage = parser.getToolUsage(); if (toolUsage != null) { out.println(toolUsage); } } catch (Exception ex) { err.println("Error: Could not output detailed usage"); err.println(); } } if (commandDocument.hasParameter("version")) { outputVersion(); } }
public void checkParams(ErrorVisitor errors) throws ToolException { super.checkParams(errors); if (errors.getErrors().size() > 0) { Message msg = new Message("PARAMETER_MISSING", LOG); throw new ToolException(msg, new BadUsageException(getUsage(), errors)); } } }
public Properties loadProperties(String propertyFile) { Properties p = new Properties(); try { InputStream ins = getResourceAsStream(propertyFile); p.load(ins); ins.close(); } catch (IOException ex) { // ignore, use defaults } return p; }
public String getUsage() { if (usage == null) { try { CommandLineParser parser = getCommandLineParser(); if (parser != null) { usage = parser.getUsage(); } } catch (Exception ex) { usage = "Could not get usage for the tool"; } } return usage; }
public boolean hasInfoOption() throws ToolException { commandDocument = getCommandDocument(); if (commandDocument == null) { return false; } return commandDocument.hasParameter("help") || commandDocument.hasParameter("version"); }
super.execute(exitOnFinish); if (!hasInfoOption()) { env = new ProcessorEnvironment();
public void execute(boolean exitOnFinish) throws ToolException { super.execute(exitOnFinish); if (hasInfoOption()) { outputInfo(); } else { if (commandDocument.hasParameter(ToolConstants.CFG_VERBOSE)) { verbose = true; outputFullCommandLine(); outputVersion(); } checkParams(errors); } }
public void outputFullCommandLine() { out.print(name); for (int i = 0; i < getArgument().length; i++) { out.print(" " + getArgument()[i]); } out.println(); }