### Eclipse Workspace Patch 1.0 #P JBossAS-parent Index: weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml =================================================================== --- weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml (revisão 107929) +++ weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml (cópia de trabalho) @@ -11,13 +11,18 @@ - + + + + - + + + @@ -66,9 +71,9 @@ - + - + Index: weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java =================================================================== --- weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java (revisão 107018) +++ weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java (cópia de trabalho) @@ -34,9 +34,10 @@ public void inject(Object instance) { - // assume that the deployment is flat - BeanDeploymentArchive beanDeploymentArchive = bootstrapBean.getDeployment().getFlatBeanDeploymentArchive(); - NonContextualObjectInjectionHelper.injectNonContextualInstance(instance, bootstrapBean.getBootstrap().getManager(beanDeploymentArchive)); + for (BeanDeploymentArchive beanDeploymentArchive: bootstrapBean.getDeployment().getBeanDeploymentArchives()) + { + NonContextualObjectInjectionHelper.injectNonContextualInstance(instance, bootstrapBean.getBootstrap().getManager(beanDeploymentArchive)); + } } public void cleanup() Index: weld-int/deployer/pom.xml =================================================================== --- weld-int/deployer/pom.xml (revisão 107604) +++ weld-int/deployer/pom.xml (cópia de trabalho) @@ -49,6 +49,11 @@ weld-spi provided + + + org.jboss.jbossas + weld-int-ejb + org.jboss @@ -344,6 +349,11 @@ + org.jboss.bootstrap + jboss-bootstrap-api-as + + + junit junit test Index: weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java =================================================================== --- weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java (revisão 107933) +++ weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java (cópia de trabalho) @@ -26,7 +26,10 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; +import javax.naming.NamingException; + import javax.enterprise.inject.spi.Extension; import org.jboss.weld.bootstrap.api.Bootstrap; @@ -37,6 +40,10 @@ import org.jboss.weld.bootstrap.spi.Deployment; import org.jboss.weld.bootstrap.spi.Metadata; import org.jboss.weld.ejb.spi.EjbDescriptor; +import org.jboss.weld.ejb.spi.EjbServices; +import org.jboss.weld.injection.spi.EjbInjectionServices; +import org.jboss.weld.integration.ejb.JBossEjbServices; +import org.jboss.weld.integration.util.JBossEjb; /** * {@link Deployment} implementation for JBoss AS. @@ -86,6 +93,11 @@ archives.add(ArchiveFactory.createArchive(archiveInfo, ejbs)); } } + + public void initialize() + { + System.out.println("HERE"); + } public void initialize(Bootstrap bootstrap) { @@ -121,7 +133,7 @@ if (archive == null) { ArchiveInfo archiveInfo = new ArchiveInfo(beanClassLoader); - archive = ArchiveFactory.createArchive(archiveInfo, ejbs); + archive = ArchiveFactory.createArchive(archiveInfo, new ArrayList>()); if (loadedArchives == null) { loadedArchives = new ArrayList(); @@ -133,19 +145,7 @@ } archive.addClass(beanClass); ServiceRegistry serviceRegistry = new SimpleServiceRegistry(); - - // TODO this was a temporary test to try to make right the ejb service part - // however, it didn't work as explained in the forum - /*Map, Service> temp = new HashMap, Service>(); - for(Entry, Service> entry: bootstrapServices.entrySet()) - { - if (entry.getKey() != EjbServices.class && entry.getKey() != EjbInjectionServices.class - && !entry.getKey().toString().contains("EjbDescriptors")) - { - temp.put(entry.getKey(), entry.getValue()); - } - } - serviceRegistry.addAll(temp.entrySet()); + serviceRegistry.addAll(bootstrapServices.entrySet()); JBossEjbServices ejbServices = null; try { @@ -154,9 +154,10 @@ { e.printStackTrace(); } - serviceRegistry.add(EjbInjectionServices.class, ejbServices); - serviceRegistry.add(EjbServices.class, ejbServices);*/ - serviceRegistry.addAll(bdaServices.entrySet()); + JBossEjb jbossEjb = new JBossEjb(); + ejbServices.setResolver(jbossEjb.getResolver()); + ejbServices.setJbossEjb(jbossEjb); + serviceRegistry.add(EjbServices.class, ejbServices); return archive.createBeanDeploymentArchive(serviceRegistry);//bdaServices); } @@ -174,6 +175,7 @@ beanDeploymentArchive.getServices().add(type, service); } bootstrapServices.put(type, service); + bdaServices.add(type, service); } public void undeploy() Index: weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java =================================================================== --- weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java (revisão 107875) +++ weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java (cópia de trabalho) @@ -71,7 +71,7 @@ BeanMetaDataBuilder bootstrap = BeanMetaDataBuilder.createBuilder(bootstrapName, "org.jboss.weld.integration.deployer.env.helpers.BootstrapBean"); bootstrap.addConstructorParameter(Bootstrap.class.getName(), createBootstrap(unit)); - bootstrap.addConstructorParameter(FlatDeployment.class.getName(), deploymentValue); + bootstrap.addConstructorParameter(Deployment.class.getName(), deploymentValue); bootstrap.addPropertyMetaData("ejbServices", ejbServicesValue); bootstrap.addPropertyMetaData("ejbInjectionServices", ejbInjectionServicesValue); bootstrap.addPropertyMetaData("jpaServices", createServiceConnector("JBossJpaServices", "org.jboss.weld.integration.persistence.JBossJpaServices", unit)); Index: weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java =================================================================== --- weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java (revisão 107933) +++ weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java (cópia de trabalho) @@ -6,12 +6,13 @@ import org.jboss.weld.bootstrap.api.Environments; import org.jboss.weld.bootstrap.api.Service; import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive; +import org.jboss.weld.bootstrap.spi.Deployment; import org.jboss.weld.context.api.BeanStore; import org.jboss.weld.ejb.spi.EjbServices; import org.jboss.weld.injection.spi.EjbInjectionServices; import org.jboss.weld.injection.spi.JpaInjectionServices; import org.jboss.weld.injection.spi.ResourceInjectionServices; -import org.jboss.weld.integration.deployer.env.FlatDeployment; +import org.jboss.weld.integration.deployer.env.bda.DeploymentImpl; import org.jboss.weld.security.spi.SecurityServices; import org.jboss.weld.servlet.api.ServletServices; import org.jboss.weld.transaction.spi.TransactionServices; @@ -48,13 +49,13 @@ } private final Bootstrap bootstrap; - private final FlatDeployment deployment; + private final Deployment deployment; private BeanStore applicationBeanStore; - public BootstrapBean(Bootstrap bootstrap, FlatDeployment flatDeployment) + public BootstrapBean(Bootstrap bootstrap, Deployment deployment) { this.bootstrap = bootstrap; - this.deployment = flatDeployment; + this.deployment = deployment; } public void setEjbServices(EjbServices ejbServices) @@ -77,7 +78,7 @@ addBeanDeploymentArchiveService(ResourceInjectionServices.class, resourceServices); } - public FlatDeployment getDeployment() + public Deployment getDeployment() { return deployment; } @@ -109,11 +110,10 @@ private void addBeanDeploymentArchiveService(Class type, S service) { - if (getDeployment().getFlatBeanDeploymentArchive() == null) - { - throw new IllegalStateException("Must add BeanDeploymentArchive to FlatDeployment first!"); - } - getDeployment().getFlatBeanDeploymentArchive().getServices().add(type, service); + // temporary approach to add a service to all bdas in a Deployment and to + // bdas that will be loaded in the future + // TODO remove this casting when done + ((DeploymentImpl) deployment).addBootstrapService(type, service); } public void boot() @@ -131,9 +131,14 @@ public void initialize() { - deployment.getFlatBeanDeploymentArchive().setBootstrap(bootstrap); + // FIXME: this is part of the update + //deployment.getFlatBeanDeploymentArchive().setBootstrap(bootstrap); // Create the JBoss Servlet Services - addDeploymentService(ServletServices.class, new JBossServletServices(deployment.getFlatBeanDeploymentArchive())); + ((DeploymentImpl) deployment).initialize(bootstrap); + for (BeanDeploymentArchive beanDeploymentArchive: deployment.getBeanDeploymentArchives()) + { + addDeploymentService(ServletServices.class, new JBossServletServices(beanDeploymentArchive)); + } bootstrap.startContainer(Environments.EE_INJECT, deployment, applicationBeanStore); }