public Manifest run() throws Exception { return finder.findManifest(clazz); } });
protected Collection<String> delegate() { if (ejbs == null) { synchronized (this) { if (ejbs == null) ejbs = EjbDiscoveryUtils.getVisibleEJbNames(unit); } } return ejbs; } });
/** * Get the EjbReferenceResolver from the MC controller. * * @param name the bean name * @return the EjbReferenceResolver */ public PersistenceUnitDeployment lookupPersistenceUnitDeployment(String name) { try { return (PersistenceUnitDeployment) lookup(name, false); } catch (NoSuchInstantiatedBeanException e) { throw new IllegalStateException("PersistenceUnitDeployment " + name + " cannot be found"); } }
public JBossBussinessInterfaceDescriptorAdaptor(String interfaceName, String ejbName, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver) { try { type = (Class<T>) Reflections.classForName(interfaceName, deploymentUnit.getClassLoader()); } catch (ClassCastException e) { throw new IllegalStateException("Error loading EJB Session bean interface", e); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load EJB Session bean interface", 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); } }
@Override public void setDeploymentUnit(DeploymentUnit du) { super.setDeploymentUnit(du); discoverEjbs(du.getTopLevel()); }
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; } }
private PersistenceUnitDeployment lookupPersistenceUnitDeployment(String unitName) { if (unitName == null) { throw new IllegalArgumentException("unitName is null"); } String beanName = getPersistenceUnitSupplier(topLevelDeploymentUnit, persistenceUnitDependencyResolver, unitName); if (beanName == null) { throw new IllegalStateException("No persistence unit available for " + unitName); } return jbossEjb.lookupPersistenceUnitDeployment(beanName); }
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 Manifest findManifest(Class<?> clazz) throws Exception { ProtectionDomain domain = clazz.getProtectionDomain(); CodeSource source = domain.getCodeSource(); URL location = source.getLocation(); return findManifest(location); }
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 JBossBussinessInterfaceDescriptorAdaptor(String interfaceName, String ejbName, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver) { try { type = (Class<T>) Reflections.classForName(interfaceName, deploymentUnit.getClassLoader()); } catch (ClassCastException e) { throw new IllegalStateException("Error loading EJB Session bean interface", e); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load EJB Session bean interface", e); } }
public void deploy(VFSDeploymentUnit unit, JBossWeldMetaData deployment) throws DeploymentException { ClassLoader classLoader = unit.getClassLoader(); if (!unit.isTopLevel() && unit.getParent().getClassLoader() == classLoader) { return; } if (classLoader instanceof RealClassLoader) { unit.addAttachment(ArchiveInfo.class, new ArchiveInfo(classLoader, EjbDiscoveryUtils.getVisibleEJbNames(unit))); } else // FIXME throw new NotImplementedException(); } }
@Override public void setDeploymentUnit(DeploymentUnit du) { super.setDeploymentUnit(du); discoverEjbs(du.getTopLevel()); }
/** * Get the PersistenceUnitDeployment from the MC controller. * * @param name the bean name * @return the PersistenceUnitDeployment */ public PersistenceUnitDeployment lookupPersistenceUnitDeployment(String name) { try { return (PersistenceUnitDeployment) lookup(name, false); } catch (NoSuchInstantiatedBeanException e) { throw new IllegalStateException("PersistenceUnitDeployment " + name + " cannot be found"); } }
@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); } }
/** * Get manifest for class. * * @param clazz the class to check * @return manifest if found, else null * @throws Exception for any error */ public static Manifest getManifest(final Class<?> clazz) throws Exception { SecurityManager sm = System.getSecurityManager(); if (sm != null) return AccessController.doPrivileged(new PrivilegedExceptionAction<Manifest>() { public Manifest run() throws Exception { return finder.findManifest(clazz); } }); else return finder.findManifest(clazz); } }
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 JBossEJBDescriptorAdaptor(JBossEnterpriseBeanMetaData enterpriseBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver) { if (enterpriseBeanMetaData.getEjbClass() != null) { try { this.beanClass = (Class<T>) Reflections.classForName(enterpriseBeanMetaData.getEjbClass(), deploymentUnit.getClassLoader()); } catch (ClassCastException e) { throw new IllegalStateException("Error loading EJB Session bean class", e); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load EJB Session bean class", e); } } else { throw new IllegalStateException("EJB class is null. EJB " + enterpriseBeanMetaData); } this.ejbName = enterpriseBeanMetaData.getEjbName(); }
public JBossEJBDescriptorAdaptor(JBossEnterpriseBeanMetaData enterpriseBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver) { if (enterpriseBeanMetaData.getEjbClass() != null) { try { this.beanClass = (Class<T>) Reflections.classForName(enterpriseBeanMetaData.getEjbClass(), deploymentUnit.getClassLoader()); } catch (ClassCastException e) { throw new IllegalStateException("Error loading EJB Session bean class", e); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load EJB Session bean class", e); } } else { throw new IllegalStateException("EJB class is null. EJB " + enterpriseBeanMetaData); } this.ejbName = enterpriseBeanMetaData.getEjbName(); }