public void visit(DeploymentUnit unit) throws DeploymentException { try { if (hasJndiBoundBeanManager(unit)) { String path = JndiUtils.getJndiSubcontexPathForBeanManager(moduleInformer, unit); Context subcontext = (Context) rootContext.lookup(path); subcontext.unbind("BeanManager"); rootContext.destroySubcontext(path); } } catch (NamingException e) { throw new DeploymentException(e); } }
public Resource provide(DeploymentUnit deploymentUnit, BeanManagerRefType type) { // TODO Auto-generated method stub if (deploymentUnit.getAttachment(DeployersUtils.WELD_FILES) != null) { return new LinkRefResource(JndiUtils.getGlobalBeanManagerPath(moduleInformer, deploymentUnit)); } else { return new IndependentResource(null); } }
public static String getGlobalBeanManagerPath(JavaEEModuleInformer moduleInformer, DeploymentUnit unit) { DeploymentUnit deploymentUnit = unit.isComponent() ? unit.getParent() : unit; String subcontexPathForBeanManager = getJndiSubcontexPathForBeanManager(moduleInformer, deploymentUnit); return "java:global/" + BEAN_MANAGER_GLOBAL_SUBCONTEXT + "/" + subcontexPathForBeanManager + "/BeanManager"; } }
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); } }