* @return the status of the execution
*/
protected int start(String configLocation, String masterIdentifier,
String childConfigLocation, String[] parameters, Set<String> opts) {
ConfigurableApplicationContext context = null;
ExitStatus exitStatus = ExitStatus.COMPLETED;
try {
context = getApplicationContext(configLocation);
getChildApplicationContext(childConfigLocation, context);
@SuppressWarnings("unchecked")
T bean = (T) context.getBean(masterIdentifier);
if (log.isDebugEnabled()) {
log.debug("Passing bean=" + bean + " from context=" + context + " for beanId=" + masterIdentifier);
}
exitStatus = handleBeanRun(bean, parameters, opts);
} catch (Throwable e) {
e.printStackTrace();
String message = "Terminated in error: " + e.getMessage();
log.error(message, e);
AbstractCommandLineRunner.message = message;
return exitCodeMapper.intValue(ExitStatus.FAILED.getExitCode());
} finally {
if (context != null) {
context.close();
}
}
return exitCodeMapper.intValue(exitStatus.getExitCode());
}