use of org.walkmod.conf.providers.ExecutionModeProvider in project walkmod-core by walkmod.
the class WalkModFacade method run.
private void run(List<File> result, WalkmodCommand command, ExecutionModeEnum execMode, String... chains) throws InvalidConfigurationException {
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
Configuration config = null;
if (cfg.exists()) {
if (options.isVerbose()) {
log.info(cfg.getAbsoluteFile() + " [ok]");
}
config = readConfig(locateConfigurationProvider(), new ExecutionModeProvider(execMode));
} else {
config = createConfig(chains, locateConfigurationProvider(), new ExecutionModeProvider(execMode));
}
try {
config.executeModuleChains(options, command, chains);
} catch (Exception e) {
System.setProperty("user.dir", userDir);
if (options.isVerbose()) {
if (!options.isPrintErrors()) {
log.error(cfg.getAbsolutePath() + " is invalid. Please, execute walkmod with -e to see the details.");
} else {
log.error("Invalid configuration", e);
}
if (options.isThrowException()) {
RuntimeException re = new RuntimeException();
re.setStackTrace(e.getStackTrace());
throw re;
}
} else {
throw new InvalidConfigurationException(e);
}
}
config.execute(userDir, options, chains);
result.addAll(Summary.getInstance().getWrittenFiles());
System.setProperty("user.dir", userDir);
}
Aggregations