[jboss-cvs] JBossAS SVN: r108001 - in trunk: testsuite/imports/sections and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 6 22:02:03 EDT 2010


Author: flavia.rainone at jboss.com
Date: 2010-09-06 22:02:02 -0400 (Mon, 06 Sep 2010)
New Revision: 108001

Added:
   trunk/testsuite/.externalToolBuilders/
   trunk/testsuite/src/main/org/jboss/test/deployers/weld/test/WeldPlainEjbTranslatorExampleUnitTestCase.java
   trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/
   trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/META-INF/
   trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/META-INF/application.xml
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ServiceRegistryFactory.java
Modified:
   trunk/testsuite/imports/sections/weld.xml
   trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
   trunk/weld-int/deployer/pom.xml
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossDeploymentDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java
Log:
[JBAS-8250] Enable the new weld-int DeploymentImpl and add a test for DeploymentImpl.loadBDA to testsuite

Modified: trunk/testsuite/imports/sections/weld.xml
===================================================================
--- trunk/testsuite/imports/sections/weld.xml	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/testsuite/imports/sections/weld.xml	2010-09-07 02:02:02 UTC (rev 108001)
@@ -36,6 +36,27 @@
          </fileset>
       </jar>
    </target>
+
+   <!-- translator example with a plain, non-weld, ejb jar -->
+   <target name="plainEjbTranslator" depends="compile">
+      <mkdir dir="${build.lib}" />
+      
+      <jar destfile="${build.lib}/weld-translator-without-beans.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/deployers/weld/translator/ejb/**"/>
+         </fileset>
+      </jar>
+      
+      <jar destfile="${build.lib}/weld-plainejbtranslator.ear">
+         <fileset dir="${build.lib}">
+            <include name="weld-translator-without-beans.jar"/>
+            <include name="weld-translator.war"/>
+         </fileset>
+   <fileset dir="${source.resources}/deployers/weld/plainEjbTranslator">
+            <include name="META-INF/application.xml"/>
+         </fileset>
+      </jar>
+   </target>
    
    <target name="numberguess" depends="compile">
       <mkdir dir="${build.lib}" />
@@ -58,7 +79,7 @@
 
    </target>
 
-   <target name="_jars-weld" depends="numberguess, translator">
+   <target name="_jars-weld" depends="numberguess, translator, plainEjbTranslator">
       <mkdir dir="${build.lib}" />
    </target>
   

Added: trunk/testsuite/src/main/org/jboss/test/deployers/weld/test/WeldPlainEjbTranslatorExampleUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/weld/test/WeldPlainEjbTranslatorExampleUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/weld/test/WeldPlainEjbTranslatorExampleUnitTestCase.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.deployers.weld.test;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Test;
+
+/**
+ * Same as WeldTranslatorExampleUnitTestCase, with the difference that this
+ * test deploys an ear whose ejb jar file is a non-weld archive
+ * (i.e, it lacks the META-INF/beans.xml).
+ * This example asserts that Deployment.loadBeanDeploymentArchive works
+ * correctly in such scenario.
+ * 
+ * 
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class WeldPlainEjbTranslatorExampleUnitTestCase extends WeldExampleTest
+{
+   public WeldPlainEjbTranslatorExampleUnitTestCase(String test)
+   {
+      super(test);
+      setTestExpected(true);
+   }
+
+    @Override
+    protected URL getBaseURL() throws Exception {
+        return new URL(getBaseURLString() + getWebContextName() + "/home.jsf");
+    }
+    
+    @Override
+    protected Set<String> getExpectedDeployments(String topLevelDeployment, String exampleName)
+    {
+       final Set<String> expected = new HashSet<String>();
+       expected.add(topLevelDeployment);
+       expected.add(String.format(exampleJar, "translator-without-beans"));
+       expected.add(String.format(exampleWar, "translator"));
+       return expected;
+    }
+
+    public static Test suite() throws Exception
+   {
+      return deploy(WeldPlainEjbTranslatorExampleUnitTestCase.class, false);
+   }
+}
+


Property changes on: trunk/testsuite/src/main/org/jboss/test/deployers/weld/test/WeldPlainEjbTranslatorExampleUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/META-INF/application.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/META-INF/application.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/deployers/weld/plainEjbTranslator/META-INF/application.xml	2010-09-07 02:02:02 UTC (rev 108001)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+
+<application xmlns="http://java.sun.com/xml/ns/javaee" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+             version="5">
+
+  <display-name>weld-plainejbtranslator-ear</display-name>
+  <module>
+    <web>
+      <web-uri>weld-translator.war</web-uri>
+      <context-root>/weld-plainejbtranslator</context-root>
+    </web>
+  </module>
+  <module>
+    <ejb>weld-translator-without-beans.jar</ejb>
+  </module>
+</application>

Modified: trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	2010-09-07 02:02:02 UTC (rev 108001)
@@ -11,13 +11,14 @@
   <bean name="WeldFilesDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
 
   <!-- Responsible for discovering Weld classes -->
-  <bean name="WeldDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.WeldDiscoveryDeployer"/>
+  <bean name="ArchiveInfoDeployer" class="org.jboss.weld.integration.deployer.env.ArchiveInfoDeployer"/>
+  <bean name="ArchiveDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.ArchiveDiscoveryDeployer"/>
 
   <!-- Responsible for discovering Weld classes -->
   <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer"/>
 
   <!-- Responsible for discovering Weld classes -->
-  <bean name="FlatDeploymentDeployer" class="org.jboss.weld.integration.deployer.env.FlatDeploymentDeployer"/>
+   <bean name="DeploymentDeployer" class="org.jboss.weld.integration.deployer.env.JBossDeploymentDeployer"/>
 
   <!-- Responsible for dynamic ejb dependency creation -->
   <bean name="DynamicDependencyCreator" class="org.jboss.weld.integration.deployer.env.DynamicDependencyCreator">
@@ -66,9 +67,7 @@
 
    <!-- For non-flat deployments, comment this definition and uncomment the next one -->
 
-   <bean name="BeanDeploymentArchiveLocator" class="org.jboss.weld.integration.deployer.jndi.FlatBeanDeploymentArchiveLocator"/>
-
-   <!--<bean name="BeanDeploymentArchiveLocator" class="org.jboss.weld.integration.deployer.jndi.JBossBeanDeploymentArchiveLocator"/>-->
+   <bean name="BeanDeploymentArchiveLocator" class="org.jboss.weld.integration.deployer.jndi.JBossBeanDeploymentArchiveLocator"/>
    
 
   <!-- Responsible for binding bean managers -->

Modified: trunk/weld-int/deployer/pom.xml
===================================================================
--- trunk/weld-int/deployer/pom.xml	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/pom.xml	2010-09-07 02:02:02 UTC (rev 108001)
@@ -51,6 +51,11 @@
     </dependency>
 
     <dependency>
+       <groupId>org.jboss.jbossas</groupId>
+       <artifactId>weld-int-ejb</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core</artifactId>
       <scope>provided</scope>
@@ -344,6 +349,11 @@
     </dependency>
     
     <dependency>
+      <groupId>org.jboss.bootstrap</groupId>
+      <artifactId>jboss-bootstrap-api-as</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossDeploymentDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossDeploymentDeployer.java	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossDeploymentDeployer.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -25,6 +25,7 @@
 import java.util.Collection;
 
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.weld.bootstrap.spi.Deployment;
 import org.jboss.weld.integration.deployer.env.bda.ArchiveInfo;
@@ -60,6 +61,7 @@
       builder.addConstructorParameter(String.class.getName(), unit.getName());
       builder.addConstructorParameter(Collection.class.getName(), getArchiveInfos(unit));
       builder.addConstructorParameter(Collection.class.getName(), builder.createInject(info.getEjbServices().getUnderlyingValue(), "ejbs"));
+      builder.addConstructorParameter(BeanFactory.class.getName(), builder.createInject("JBossEjbServices"));
       builder.addUninstall("undeploy");
    }
    

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -29,10 +29,10 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.weld.bootstrap.api.Bootstrap;
-import org.jboss.weld.bootstrap.spi.Deployment;
 import org.jboss.weld.context.api.BeanStore;
 import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
 import org.jboss.weld.integration.deployer.DeployersUtils;
+import org.jboss.weld.integration.deployer.env.bda.DeploymentImpl;
 import org.jboss.weld.integration.deployer.env.helpers.BootstrapBean;
 import org.jboss.weld.integration.injection.WeldInjector;
 
@@ -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(DeploymentImpl.class.getName(), deploymentValue);
       bootstrap.addPropertyMetaData("ejbServices", ejbServicesValue);
       bootstrap.addPropertyMetaData("ejbInjectionServices", ejbInjectionServicesValue);
       bootstrap.addPropertyMetaData("jpaServices", createServiceConnector("JBossJpaServices", "org.jboss.weld.integration.persistence.JBossJpaServices", unit));

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -23,12 +23,11 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 
 import javax.enterprise.inject.spi.Extension;
 
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
 import org.jboss.weld.bootstrap.api.Bootstrap;
 import org.jboss.weld.bootstrap.api.Service;
 import org.jboss.weld.bootstrap.api.ServiceRegistry;
@@ -46,9 +45,6 @@
  */
 public class DeploymentImpl implements Deployment
 {
-   // FIXME bootstrapServices: workaround to keep track of the services needed for new BDAs
-   private Map<Class<? extends Service>, Service> bootstrapServices = new HashMap<Class<? extends Service>, Service>();
-   
    // the name of this deployment
    private String name;
 
@@ -57,13 +53,17 @@
 
    // the services provided by this deployment
    private final ServiceRegistry services;
+
+   // holds the services to be added to all BDAs contained in this deployment
    private final ServiceRegistry bdaServices;
+
    // a collection of all archives that have been loaded by this DeploymentImpl, i.e.
    // created for the purpose of serving loadBeanDeploymentArchive
    private Collection<Archive> loadedArchives;
-   
-   private Collection<EjbDescriptor<?>> ejbs;
-   
+
+   // ServiceRegistryFactory to be used by loaded BDAs
+   private ServiceRegistryFactory loadedBDAServiceRegistry;
+
    private Iterable<Metadata<Extension>> extensions;
 
    /**
@@ -74,17 +74,17 @@
     *                     contained in this deployment
     * @param ejbs         the ejb descriptors
     */
-   public DeploymentImpl(String name, Collection<ArchiveInfo> archiveInfos, Collection<EjbDescriptor<?>> ejbs)
+   public DeploymentImpl(String name, Collection<ArchiveInfo> archiveInfos, Collection<EjbDescriptor<?>> ejbs, BeanFactory ejbServicesFactory)
    {
       this.name = name;
       this.archives = new ArchiveCollection();
       this.services = new SimpleServiceRegistry();
       this.bdaServices = new SimpleServiceRegistry();
-      this.ejbs = ejbs;
       for (ArchiveInfo archiveInfo: archiveInfos)
       {
          archives.add(ArchiveFactory.createArchive(archiveInfo, ejbs));
       }
+      this.loadedBDAServiceRegistry = new ServiceRegistryFactory(ejbServicesFactory);
    }
 
    public void initialize(Bootstrap bootstrap)
@@ -121,7 +121,7 @@
             if (archive == null)
             {
                ArchiveInfo archiveInfo = new ArchiveInfo(beanClassLoader);
-               archive = ArchiveFactory.createArchive(archiveInfo, ejbs);
+               archive = ArchiveFactory.createArchive(archiveInfo, new ArrayList<EjbDescriptor<?>>());
                if (loadedArchives == null)
                {
                   loadedArchives = new ArrayList<Archive>();
@@ -129,37 +129,17 @@
                loadedArchives.add(archive);
             }
          }
-         
       }
       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<Class<? extends Service>, Service> temp = new HashMap<Class<? extends Service>, Service>();
-      for(Entry<Class<? extends Service>, Service> entry: bootstrapServices.entrySet())
+      BeanDeploymentArchive bda = archive.getBeanDeploymentArchive();
+      if (archive.getBeanDeploymentArchive() == null)
       {
-         if (entry.getKey() != EjbServices.class && entry.getKey() != EjbInjectionServices.class
-                 && !entry.getKey().toString().contains("EjbDescriptors"))
-         {
-            temp.put(entry.getKey(), entry.getValue());
-         }
+         ServiceRegistry serviceRegistry = loadedBDAServiceRegistry.create();
+         bda = archive.createBeanDeploymentArchive(serviceRegistry);
       }
-      serviceRegistry.addAll(temp.entrySet());
-      JBossEjbServices ejbServices = null;
-      try
-      {
-         ejbServices = new JBossEjbServices();
-      } catch (NamingException e)
-      {
-         e.printStackTrace();
-      }
-      serviceRegistry.add(EjbInjectionServices.class, ejbServices);
-      serviceRegistry.add(EjbServices.class, ejbServices);*/
-      serviceRegistry.addAll(bdaServices.entrySet());
-      return archive.createBeanDeploymentArchive(serviceRegistry);//bdaServices);
+      return bda;
    }
-   
+
    /**
     * Add bootstrap service to all BDAs in this deployment.
     * 
@@ -173,9 +153,10 @@
       {
          beanDeploymentArchive.getServices().add(type, service);
       }
-      bootstrapServices.put(type, service);
+      bdaServices.add(type, service);
+      loadedBDAServiceRegistry.addService(type, service);
    }
-   
+
    public void undeploy()
    {
       for(Iterator<Archive> iterator = archives.iterator(); iterator.hasNext(); )
@@ -194,15 +175,15 @@
          }
       }
    }
-   
+
    public Iterable<Metadata<Extension>> getExtensions()
    {
       return extensions;
    }
-   
+
    @Override
    public String toString()
    {
       return "Deployment[" + name + "]";
    }
-}
+}
\ No newline at end of file

Added: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ServiceRegistryFactory.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ServiceRegistryFactory.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ServiceRegistryFactory.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.integration.deployer.env.bda;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.ejb.spi.EjbServices;
+
+/**
+ * Creates a ServiceRegistry for newly loaded BDAs 
+ * 
+ * @see DeploymentImpl#loadBeanDeploymentArchive(Class)
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @version $Revision$
+ */
+class ServiceRegistryFactory
+{
+   private BeanFactory ejbServicesFactory;
+   private Map<Class<? extends Service>, Service> services;
+
+   public ServiceRegistryFactory(BeanFactory ejbServicesFactory)
+   {
+      this.ejbServicesFactory = ejbServicesFactory;
+      services = new HashMap<Class<? extends Service>, Service>();
+   }
+
+   public void addService(Class<? extends Service> serviceType, Service service)
+   {
+      services.put(serviceType, service);
+   }
+
+   public ServiceRegistry create()
+   {
+      ServiceRegistry serviceRegistry = new SimpleServiceRegistry();
+      serviceRegistry.addAll(services.entrySet());
+      EjbServices ejbServices = null;
+      try
+      {
+         ejbServices = (EjbServices) ejbServicesFactory.createBean();
+      } catch (Throwable e)
+      {
+         throw new RuntimeException(e);
+      }
+      serviceRegistry.add(EjbServices.class, ejbServices);
+      return serviceRegistry;
+   }
+}


Property changes on: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ServiceRegistryFactory.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -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 DeploymentImpl deployment;
    private BeanStore applicationBeanStore;
 
-   public BootstrapBean(Bootstrap bootstrap, FlatDeployment flatDeployment)
+   public BootstrapBean(Bootstrap bootstrap, DeploymentImpl 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,7 @@
 
    private <S extends Service> void addBeanDeploymentArchiveService(Class<S> type, S service)
    {
-      if (getDeployment().getFlatBeanDeploymentArchive() == null)
-      {
-         throw new IllegalStateException("Must add BeanDeploymentArchive to FlatDeployment first!");
-      }
-      getDeployment().getFlatBeanDeploymentArchive().getServices().add(type, service);
+      deployment.addBootstrapService(type, service);
    }
 
    public void boot()
@@ -131,9 +128,12 @@
 
    public void initialize()
    {
-      deployment.getFlatBeanDeploymentArchive().setBootstrap(bootstrap);
+      deployment.initialize(bootstrap);
       // Create the JBoss Servlet Services
-      addDeploymentService(ServletServices.class, new JBossServletServices(deployment.getFlatBeanDeploymentArchive()));
+      for (BeanDeploymentArchive beanDeploymentArchive: deployment.getBeanDeploymentArchives())
+      {
+         addDeploymentService(ServletServices.class, new JBossServletServices(beanDeploymentArchive));
+      }
       bootstrap.startContainer(Environments.EE_INJECT, deployment, applicationBeanStore);
    }
 

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	2010-09-06 17:42:42 UTC (rev 108000)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	2010-09-07 02:02:02 UTC (rev 108001)
@@ -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()



More information about the jboss-cvs-commits mailing list