log.trace("Processing classworld realm: " + name);
}
// Get or create a new realm for this name
ClassWorld world = getTwiddle().getClassWorld();
ClassRealm realm = null;
try {
realm = world.getRealm(name);
}
catch (NoSuchRealmException e) {
realm = world.newRealm(name);
}
String[] constituents = config.getLoadURLConfig();
if (constituents != null) {
log.trace("Processing constituents...");
for (int i=0; i<constituents.length; i++) {
assert constituents[i] != null;
String urlspec = valueParser.parse(constituents[i], true);
URL[] urls = parseGlobURLs(urlspec);
for (int j=0; j<urls.length; j++) {
if (trace) {
log.trace("Adding constituent: " + urls[j]);
}
realm.addConstituent(urls[j]);
}
}
}
ImportPackageConfig[] imports = config.getImportPackageConfig();
if (imports != null) {
log.trace("Processing imports...");
for (int i=0; i<imports.length; i++) {
assert imports[i] != null;
assert imports[i].getRealm() != null;
assert imports[i].getContent() != null;
String from = valueParser.parse(imports[i].getRealm(), true);
String pkg = valueParser.parse(imports[i].getContent(), true);
if (trace) {
log.trace("Importing " + pkg + " from realm " + from);
}
realm.importFrom(from, pkg);
}
}
}