public void visit(DeploymentUnit unit) throws DeploymentException { if (unit.isTopLevel()) { Context javaComp = getJavaComp(unit); try { Reference reference = new Reference("javax.enterprise.inject.spi.BeanManager", "org.jboss.weld.integration.deployer.jndi.JBossBeanManagerObjectFactory", null); reference.add(new StringRefAddr("id", IdFactory.getIdFromClassLoader(unit.getClassLoader()))); javaComp.bind("BeanManager", reference); _logger.debug("CDI BeanManager successfully bound into JNDI (java:comp) for SwitchYard deployment '" + unit.getName() + "'."); } catch (NamingException e) { throw new DeploymentException("Error binding BeanManager.", e); } } }
public void visit(DeploymentUnit unit) throws DeploymentException { try { if (hasJndiBoundBeanManager(unit)) { String path = JndiUtils.getJndiSubcontexPathForBeanManager(moduleInformer, unit); Context subcontext = Util.createSubcontext(rootContext, path); Reference reference = new Reference(BeanManager.class.getName(), "org.jboss.weld.integration.deployer.jndi.JBossBeanManagerObjectFactory", null); reference.add(new StringRefAddr(REFADDR_ID, IdFactory.getIdFromClassLoader(unit.getClassLoader()))); subcontext.bind("BeanManager", reference); } } catch (NamingException e) { throw new DeploymentException(e); } }
public BeanDeploymentArchive getBeanDeploymentArchive(BootstrapBean bootstrap, DeploymentUnit deploymentUnit) { for (BeanDeploymentArchive beanDeploymentArchive: bootstrap.getDeployment().getBeanDeploymentArchives()) { String id = IdFactory.getIdFromClassLoader(deploymentUnit.getClassLoader()); if (beanDeploymentArchive.getId().equals(id)) { return beanDeploymentArchive; } } return null; } }
@Override protected void processMetadata(BeanMetaDataBuilder beanMetaDataBuilder, DeploymentUnit unit, JBossEnterpriseBeanMetaData ejb) { beanMetaDataBuilder.setBean(Jsr299BeanInstantiator.class.getName()); beanMetaDataBuilder.addPropertyMetaData("bdaId", IdFactory.getIdFromClassLoader(unit.getClassLoader())); AbstractInjectionValueMetaData bootstrapBean = new AbstractInjectionValueMetaData(DeployersUtils.getBootstrapBeanName(unit)); beanMetaDataBuilder.addPropertyMetaData("bootstrapBean", bootstrapBean); } }
/** * Creates the BeanDeploymentArchive that corresponds to this archive. This method * never returns duplicates. * * @param bootstrap the Weld boostrap * @param services the services * @return the BeanDeploymentArchive representing this archive. If this bda has not * been created, it is created and returned */ public BeanDeploymentArchive createBeanDeploymentArchive(Bootstrap bootstrap, ServiceRegistry services) { if (bda == null) { services.add(ResourceLoader.class, new ClassLoaderResourceLoader(classLoader)); bda = new BeanDeploymentArchiveImpl(IdFactory.getIdFromClassLoader(classLoader), bootstrap, services, this); for (ArchiveLifecycleListener listener: lifecycleListeners) { // notifies the listener that this archive became visible as a BDA listener.archiveVisible(this, bda); } } return bda; }
String bdaId = IdFactory.getIdFromClassLoader(unit.getClassLoader()); try