use of org.kohsuke.args4j.CmdLineParser 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.CmdLineParser in project ORCID-Source by ORCID.
the class MigrateNamesAndBioToTheirOwnTables method init.
@SuppressWarnings("resource")
private void init(String[] args) throws CmdLineException {
CmdLineParser parser = new CmdLineParser(this);
parser.parseArgument(args);
if (batchSize == 0) {
batchSize = 10000;
}
if (numberOfBatches == 0) {
numberOfBatches = -1;
}
ApplicationContext context = new ClassPathXmlApplicationContext("orcid-persistence-context.xml");
profileDao = (ProfileDao) context.getBean("profileDao");
recordNameDao = (RecordNameDao) context.getBean("recordNameDao");
biographyDao = (BiographyDao) context.getBean("biographyDao");
transactionTemplate = (TransactionTemplate) context.getBean("transactionTemplate");
}
use of org.kohsuke.args4j.CmdLineParser 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.CmdLineParser 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.CmdLineParser in project ORCID-Source by ORCID.
the class AddScopesToExistingClients method main.
public static void main(String[] args) {
AddScopesToExistingClients addScopesToExistingClients = new AddScopesToExistingClients();
CmdLineParser parser = new CmdLineParser(addScopesToExistingClients);
try {
parser.parseArgument(args);
addScopesToExistingClients.validateParameters(parser);
addScopesToExistingClients.init();
addScopesToExistingClients.process();
System.out.println();
System.out.println();
System.out.println(addScopesToExistingClients.getClientsUpdated() + " clients were updated");
System.out.println();
System.out.println();
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.exit(1);
}
System.exit(0);
}
Aggregations