public class Main {
private static Messages messages = new Messages(Main.class);
public static void main(String args[]) throws SystemExitException {
CommandLineParser parser = new PosixParser();
// create the Options
Options options = new Options();
options.addOption(option("v", "version", "cmd.start.opt.version"));
options.addOption(option("h", "help", "cmd.start.opt.help"));
options.addOption(option(null, "conf", "file", "cmd.start.opt.conf"));
options.addOption(option(null, "local-copy", "boolean", "cmd.start.opt.localCopy"));
options.addOption(option(null, "examples", "cmd.start.opt.examples"));
ResourceFinder finder = new ResourceFinder("META-INF/");
Set<String> services = null;
try {
Map<String, Properties> serviceEntries = finder.mapAvailableProperties(ServerService.class.getName());
services = serviceEntries.keySet();
for (String service : services) {
options.addOption(option(null, service+"-port", "int", "cmd.start.opt.port", service));
options.addOption(option(null, service+"-bind", "host", "cmd.start.opt.bind", service));
}
} catch (IOException e) {
services = Collections.EMPTY_SET;
}
CommandLine line = null;
try {
// parse the command line arguments
line = parser.parse(options, args);
} catch (ParseException exp) {
help(options);
throw new SystemExitException(-1);
}