use of org.kohsuke.args4j.CmdLineException in project ORCID-Source by ORCID.
the class SendBadOrgsEmail method main.
public static void main(String[] args) throws IOException {
SendBadOrgsEmail sendBadOrgsEmail = new SendBadOrgsEmail();
CmdLineParser parser = new CmdLineParser(sendBadOrgsEmail);
try {
parser.parseArgument(args);
sendBadOrgsEmail.validateArgs(parser);
sendBadOrgsEmail.init();
sendBadOrgsEmail.execute();
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.exit(1);
} catch (Throwable t) {
t.printStackTrace(System.err);
System.exit(2);
}
System.exit(0);
}
use of org.kohsuke.args4j.CmdLineException in project ORCID-Source by ORCID.
the class UpdateSalesForceMember method main.
public static void main(String[] args) throws IOException {
UpdateSalesForceMember thisObject = new UpdateSalesForceMember();
CmdLineParser parser = new CmdLineParser(thisObject);
try {
parser.parseArgument(args);
thisObject.validateArgs(parser);
thisObject.init();
thisObject.execute();
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.exit(1);
} catch (Throwable t) {
t.printStackTrace(System.err);
System.exit(2);
}
System.exit(0);
}
use of org.kohsuke.args4j.CmdLineException in project opennms by OpenNMS.
the class Starter method main.
public static void main(String[] args) {
Starter starter = new Starter();
CmdLineParser parser = new CmdLineParser(starter, ParserProperties.defaults().withUsageWidth(120));
try {
parser.parseArgument(args);
if (starter.cmd == null) {
// no command specified, we have to use StarterCommand
starter.cmd = starter;
}
starter.cmd.run(parser);
} catch (CmdLineException e) {
starter.LOG.error(e.getMessage());
starter.LOG.error("");
starter.cmd.printUsage();
System.exit(1);
} catch (CmdRunException ex) {
handleException(ex, starter.LOG);
System.exit(2);
} catch (Exception e) {
handleException(e, starter.LOG);
System.exit(3);
}
}
use of org.kohsuke.args4j.CmdLineException in project opennms by OpenNMS.
the class CLIPinger method doMain.
public void doMain(String[] args) throws CmdLineException {
setPropertiesIfPossible();
CmdLineParser parser = new CmdLineParser(this);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
parser.printUsage(System.err);
System.exit(1);
}
InetAddress host;
double rttMs;
if (s_arguments.isEmpty()) {
parser.printUsage(System.err);
System.exit(1);
}
try {
host = InetAddress.getByName(s_arguments.get(0));
final PingerFactory pf = new BestMatchPingerFactory();
final Pinger p = pf.getInstance(Integer.decode(s_dscp), s_allowFragmentation);
for (int i = 0; i < s_count; i++) {
Number rtt = p.ping(host, s_timeout, s_retries);
if (rtt == null) {
System.out.println("request timed out");
} else {
rttMs = rtt.doubleValue() / 1000.0;
System.out.println("Reply from " + host.getHostName() + " (" + host.getHostAddress() + "): time=" + rttMs + " ms");
}
if (i < s_count - 1) {
Thread.sleep(s_interval);
}
}
} catch (UnknownHostException ex) {
System.out.println("Unknown host " + args[0]);
System.exit(1);
} catch (Throwable ex) {
System.out.println("Unexpected exception while pinging " + args[0] + ": " + ex.getMessage());
ex.printStackTrace();
System.exit(1);
} finally {
System.exit(0);
}
}
use of org.kohsuke.args4j.CmdLineException in project opennms by OpenNMS.
the class Newts method main.
public static void main(String[] args) throws Exception {
// NMS-8051: opennms_bootstrap.jar in versions < 18.0.0 does not load
// all of the system properties, so we need to do this ourselves
loadOpenNMSProperties();
Newts cli = new Newts();
CmdLineParser parser = new CmdLineParser(cli);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.out.println("Usage: $OPENNMS_HOME/bin/newts <command>");
System.out.println();
System.out.println("Supported commands are:");
System.out.println("\tinit");
System.out.println();
System.out.println("Run $OPENNMS_HOME/bin/newts <command> -h for command specific options.");
return;
}
cli.cmd.execute();
}
Aggregations