if (debug)
log.debug("Scanning bundle " + bundleString + " for configurations...");
// initialize context
final DelegatedExecutionOsgiBundleApplicationContext localApplicationContext;
if (debug)
log.debug("Creating an application context for bundle " + bundleString);
try {
localApplicationContext = contextCreator.createApplicationContext(localBundleContext);
}
catch (Exception ex) {
log.error("Cannot create application context for bundle " + bundleString, ex);
return;
}
if (localApplicationContext == null) {
log.debug("No application context created for bundle " + bundleString);
return;
}
// an application context has been created - do type filtering
// filtering could be applied before creating the application context but then user might disable this by accident
// so its best to do this inside the extender itself (this could change in the future)
if (compatibilityChecker.checkCompatibility(bundle)) {
log.debug("Bundle " + bundleString + " is Spring type compatible with Spring-DM");
}
else {
log.debug("Ignoring bundle " + bundleString + " as it's Spring incompatible with Spring-DM...");
return;
}
// create a dedicated hook for this application context
BeanFactoryPostProcessor processingHook = new OsgiBeanFactoryPostProcessorAdapter(localBundleContext,
postProcessors);
// add in the post processors
localApplicationContext.addBeanFactoryPostProcessor(processingHook);
// add the context to the tracker
managedContexts.put(bundleId, localApplicationContext);
localApplicationContext.setDelegatedEventMulticaster(multicaster);
// create refresh runnable
Runnable contextRefresh = new Runnable() {
public void run() {
localApplicationContext.refresh();
}
};
// executor used for creating the appCtx
// chosen based on the sync/async configuration