// Init the configuration manager
ConfManager confManager = settings.getConfManager();
confManager.initRuntimeConfig();
ConfRegistry confRegistry = confManager.getRuntimeConfRegistry();
this.model = buildModel(confRegistry);
// Validate the config
List<ConfigError> configErrors = new ArrayList<ConfigError>();
model.validate(configErrors);
if (configErrors.size() > 0) {
StringBuilder errorMsg = new StringBuilder();
String subject = configErrors.size() == 1 ? "error" : "errors";
errorMsg.append("Encountered the following ").append(subject).append(" in the runtime configuration: ");
for (int i = 0; i < configErrors.size(); i++) {
if (i > 0) {
errorMsg.append(", ");
}
errorMsg.append(configErrors.get(i).getMessage());
}
throw new LilyRTException(errorMsg.toString());
}
moduleConfigs = new ArrayList<ModuleConfig>();
// First read the configuration of each module, and do some classpath checks
if (infolog.isInfoEnabled()) {
infolog.info("Reading module configurations of " + model.getModules().size() + " modules.");
}
for (ModuleDefinition entry : model.getModules()) {
if (infolog.isInfoEnabled()) {
infolog.debug("Reading module config " + entry.getId() + " - " + entry.getFile().getAbsolutePath());
}
ModuleConfig moduleConf = ModuleConfigBuilder.build(entry, this);
moduleConfigs.add(moduleConf);
}
// Check / build class path configurations
Conf classLoadingConf = confRegistry.getConfiguration("classloading");
List<ClasspathEntry> sharedClasspath = ClassLoaderConfigurer.configureClassPaths(moduleConfigs,
settings.getEnableArtifactSharing(), classLoadingConf);
// Construct the shared classloader
infolog.debug("Creating shared classloader");