public void doRun(final String[] arguments) throws Exception { try { startServices(); doRunInternal(); } finally { stopServices(); } }
protected Class<? extends AbstractCommandLineHandler> getCommandLineHandlerClass() { return (getOperatingMode(PropertyUtil.getValue(getProperties(), getOperatingModeClass())) .getInitiatorClass()); }
/** TODO: set a property to this value to eliminate the dependency on reflection. */ private static AbstractCommandLineModule getCommandLineModule(final String[] arguments) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Class<? extends AbstractCommandLineModule> commandLineModuleClass = getCommandLineModuleClass(); final Constructor<? extends AbstractCommandLineModule> commandLineModuleConstructor = commandLineModuleClass.getDeclaredConstructor(); AbstractCommandLineModule module = commandLineModuleConstructor.newInstance(); module.setArguments(arguments); return (module); }
public static void main(final String[] arguments) throws Exception { COMMAND_LINE_MODULE = getCommandLineModule(arguments); GuiceHelper.addModule(COMMAND_LINE_MODULE); GuiceHelper.setup(); try { COMMAND_LINE_MODULE.doRun(arguments); doExit("Finished execution, exiting ...", 0); } catch (Exception e) { LOGGER.error("Error running", e); doExit("Error running", 1); } }
protected void doRunInternal() throws Exception { abstractCommandLineHandler = GuiceHelper.getGuiceInjector().getInstance(getCommandLineHandlerClass()); if (CommandLineDaemon.class.isAssignableFrom(abstractCommandLineHandler.getClass())) { doRunDaemon(abstractCommandLineHandler); } else abstractCommandLineHandler.run(arguments); }
@Override protected final void configure() { CLIUtil.loadFromCommandLine(properties, arguments); super.configure(); doConfigure(); }