ModularURLScanner scanner = new ModularURLScanner(resourceLoader, "META-INF/beans.xml");
ModuleScanResult scanResult = scanner.scan();
if (!scanResult.getDiscoveredResourceUrls().isEmpty())
{
ContainerServiceExtension serviceExtension = new ContainerServiceExtension(container, addon);
ContainerBeanRegistrant registrantExtension = new ContainerBeanRegistrant();
weld = new ModularWeld(scanResult);
weld.addExtension(serviceExtension);
weld.addExtension(registrantExtension);
WeldContainer container = weld.initialize();
manager = container.getBeanManager();
Assert.notNull(manager, "BeanManager was null");
AddonRepositoryProducer repositoryProducer = BeanManagerUtils.getContextualInstance(manager,
AddonRepositoryProducer.class);
repositoryProducer.setRepository(addon.getRepository());
FurnaceProducer forgeProducer = BeanManagerUtils.getContextualInstance(manager, FurnaceProducer.class);
forgeProducer.setFurnace(furnace);
AddonProducer addonProducer = BeanManagerUtils.getContextualInstance(manager, AddonProducer.class);
addonProducer.setAddon(addon);
AddonRegistryProducer addonRegistryProducer = BeanManagerUtils.getContextualInstance(manager,
AddonRegistryProducer.class);
addonRegistryProducer.setRegistry(addonRegistry);
ServiceRegistryProducer serviceRegistryProducer = BeanManagerUtils.getContextualInstance(manager,
ServiceRegistryProducer.class);
serviceRegistry = new WeldServiceRegistry(furnace.getLockManager(), addon, manager, serviceExtension.getServices());
serviceRegistryProducer.setServiceRegistry(serviceRegistry);
Assert.notNull(BeanManagerUtils.getContextualInstance(manager, ServiceRegistry.class),
"InboundEvent registry was null.");
EventManagerProducer eventManagerProducer = BeanManagerUtils.getContextualInstance(manager,