final List<String> orderedJarNames = new ArrayList();
final boolean didLoad = !awJarUrlsByName.isEmpty();
Set<String> processedJars = new HashSet();
// Register post-loads after the application has completed initialization
AWConcreteApplication application = (AWConcreteApplication)AWConcreteApplication.sharedInstance();
Map<String, Set<String>> jarToLoadedPackageNames = MapUtil.map();
for (Map.Entry<String, URL> e : awJarUrlsByName.entrySet()) {
initJar(resourceManager, rd, e.getValue(), e.getKey(), awJarUrlsByName,
processedJars, orderedJarNames, jarToLoadedPackageNames);
}
long runtime = System.currentTimeMillis() - startMillis;
/// System.out.printf("*** Jar scan time = %f", ((float)runtime)/1000);
// fire the initializers
for (String jarName : orderedJarNames) {
Properties properties = aribawebPropertiesForName(jarName);
String initializer = (String)properties.get("initializer");
if (initializer != null) {
AWBinding.fieldBinding("initializer", initializer, null).value(null);
}
Set<String> loadedPackageNames = jarToLoadedPackageNames.get(jarName);
// set the namespace resolver for these packages
String parentPackage = (String)properties.get("use-namespace-from-package");
if (parentPackage != null) {
AWNamespaceManager ns = AWNamespaceManager.instance();
AWNamespaceManager.Resolver resolver = ns.resolverForPackage(parentPackage);
Assert.that(resolver != null, "Couldn't find resolver for package: %s", parentPackage);
String namespaceId = (String)properties.get("namespace-identifier");
if (namespaceId != null) {
resolver = new AWNamespaceManager.Resolver(resolver);
resolver.addIncludeToNamespace(namespaceId, new AWNamespaceManager.Import(
new ArrayList(loadedPackageNames), Arrays.asList("")));
}
for (String packageName : loadedPackageNames) {
ns.registerResolverForPackage(packageName, resolver);
}
}
}
// register to run post initializers after application done initializing
application.registerDidInitCallback(new AWConcreteApplication.DidInitCallback() {
public void applicationDidInit (AWConcreteApplication application) {
// Run the post-initializers
for (String jarName : orderedJarNames) {
Properties properties = aribawebPropertiesForName(jarName);
String postInitializer = (String)properties.get("post-initializer");