public Module makeModuleFor(String name, String version) throws ResolveError {
return makeModuleFor(name, version, true);
}
public Module makeModuleFor(String name, String version, boolean resolve) throws ResolveError {
Module module;
if(parent!=null) {
module = parent.makeModuleFor(name,version, resolve);
if(module!=null) return module;
}
module = modules.get(AbstractFactory.getInstance().createModuleId(name, version));
if (module == null && version == null) {
Collection<Module> matchingModules = getModules(name);
if (!matchingModules.isEmpty()) {
module = matchingModules.iterator().next();
}
}
if (module==null) {
module = loadFromRepository(name, version);
if (module!=null) {
add(module);
}
}
if (module!=null && resolve) {
try {
module.resolve();
} catch(Throwable e) {
module.uninstall();
throw new ResolveError(e);
}
}
return module;
}