[jboss-cvs] JBossAS SVN: r94573 - in projects/weld-int/trunk: assembly and 120 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 9 06:32:12 EDT 2009


Author: shane.bryzak at jboss.com
Date: 2009-10-09 06:32:09 -0400 (Fri, 09 Oct 2009)
New Revision: 94573

Added:
   projects/weld-int/trunk/assembly/
   projects/weld-int/trunk/assembly/.classpath
   projects/weld-int/trunk/assembly/.project
   projects/weld-int/trunk/assembly/.settings/
   projects/weld-int/trunk/assembly/.settings/org.eclipse.jdt.core.prefs
   projects/weld-int/trunk/assembly/.settings/org.maven.ide.eclipse.prefs
   projects/weld-int/trunk/assembly/pom.xml
   projects/weld-int/trunk/assembly/src/
   projects/weld-int/trunk/assembly/src/main/
   projects/weld-int/trunk/assembly/src/main/assembly/
   projects/weld-int/trunk/assembly/src/main/assembly/assembly.xml
   projects/weld-int/trunk/assembly/src/main/assembly/resources/
   projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/
   projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml
   projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
   projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml
   projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/
   projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/
   projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/
   projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia
   projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml
   projects/weld-int/trunk/assembly/src/main/java/
   projects/weld-int/trunk/assembly/src/test/
   projects/weld-int/trunk/assembly/src/test/java/
   projects/weld-int/trunk/assembly/src/test/resources/
   projects/weld-int/trunk/deployer/
   projects/weld-int/trunk/deployer/.classpath
   projects/weld-int/trunk/deployer/.project
   projects/weld-int/trunk/deployer/.settings/
   projects/weld-int/trunk/deployer/.settings/org.eclipse.jdt.core.prefs
   projects/weld-int/trunk/deployer/.settings/org.maven.ide.eclipse.prefs
   projects/weld-int/trunk/deployer/pom.xml
   projects/weld-int/trunk/deployer/src/
   projects/weld-int/trunk/deployer/src/main/
   projects/weld-int/trunk/deployer/src/main/java/
   projects/weld-int/trunk/deployer/src/main/java/org/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java
   projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java
   projects/weld-int/trunk/deployer/src/test/
   projects/weld-int/trunk/deployer/src/test/java/
   projects/weld-int/trunk/deployer/src/test/java/org/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java
   projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java
   projects/weld-int/trunk/deployer/src/test/resources/
   projects/weld-int/trunk/deployer/src/test/resources/org/
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/
   projects/weld-int/trunk/deployer/src/test/resources/weld/earwithutil/
   projects/weld-int/trunk/deployer/src/test/resources/weld/earwithutil/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/earwithutil/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/jboss-web.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/application.properties
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/
   projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml
   projects/weld-int/trunk/ejb/
   projects/weld-int/trunk/ejb/.classpath
   projects/weld-int/trunk/ejb/.project
   projects/weld-int/trunk/ejb/.settings/
   projects/weld-int/trunk/ejb/.settings/org.eclipse.jdt.core.prefs
   projects/weld-int/trunk/ejb/.settings/org.maven.ide.eclipse.prefs
   projects/weld-int/trunk/ejb/pom.xml
   projects/weld-int/trunk/ejb/src/
   projects/weld-int/trunk/ejb/src/main/
   projects/weld-int/trunk/ejb/src/main/java/
   projects/weld-int/trunk/ejb/src/main/java/org/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/jsf/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/messaging/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ws/
   projects/weld-int/trunk/ejb/src/main/resources/
   projects/weld-int/trunk/ejb/src/main/resources/META-INF/
   projects/weld-int/trunk/ejb/src/test/
   projects/weld-int/trunk/ejb/src/test/java/
   projects/weld-int/trunk/ejb/src/test/java/org/
   projects/weld-int/trunk/ejb/src/test/java/org/jboss/
   projects/weld-int/trunk/ejb/src/test/java/org/jboss/test/
   projects/weld-int/trunk/pom.xml
   projects/weld-int/trunk/webtier/
   projects/weld-int/trunk/webtier/.classpath
   projects/weld-int/trunk/webtier/.project
   projects/weld-int/trunk/webtier/.settings/
   projects/weld-int/trunk/webtier/.settings/org.eclipse.jdt.core.prefs
   projects/weld-int/trunk/webtier/.settings/org.maven.ide.eclipse.prefs
   projects/weld-int/trunk/webtier/pom.xml
   projects/weld-int/trunk/webtier/src/
   projects/weld-int/trunk/webtier/src/main/
   projects/weld-int/trunk/webtier/src/main/java/
   projects/weld-int/trunk/webtier/src/main/java/org/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/BeanManagers.java
   projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java
   projects/weld-int/trunk/webtier/src/test/
Log:
refactor weld-int naming


Added: projects/weld-int/trunk/assembly/.classpath
===================================================================
--- projects/weld-int/trunk/assembly/.classpath	                        (rev 0)
+++ projects/weld-int/trunk/assembly/.classpath	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/weld-int/trunk/assembly/.project
===================================================================
--- projects/weld-int/trunk/assembly/.project	                        (rev 0)
+++ projects/weld-int/trunk/assembly/.project	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>weld-jboss-int-deployer-assembly</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/weld-int/trunk/assembly/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/weld-int/trunk/assembly/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/weld-int/trunk/assembly/.settings/org.eclipse.jdt.core.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,5 @@
+#Fri Oct 09 11:41:59 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

Added: projects/weld-int/trunk/assembly/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/weld-int/trunk/assembly/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/weld-int/trunk/assembly/.settings/org.maven.ide.eclipse.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+#Fri Oct 09 11:41:44 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/weld-int/trunk/assembly/pom.xml
===================================================================
--- projects/weld-int/trunk/assembly/pom.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/pom.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,95 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.jboss.weld.integration</groupId>
+      <artifactId>weld-jboss-int</artifactId>
+      <version>5.2.0-SNAPSHOT</version>
+   </parent>
+   
+   <groupId>org.jboss.weld.integration</groupId>
+   <artifactId>weld-jboss-int-deployer-assembly</artifactId>
+   <version>5.2.0-SNAPSHOT</version>
+   <packaging>jar</packaging>
+   <name>Weld JBoss AS Deployer Assembly</name>
+   <description>Weld deployer assembly for JBoss AS</description>
+   
+   <repositories>
+   	<repository>
+   		<id>snapshots.jboss.org</id>
+   		<name>JBoss Snapshot's Repository</name>
+   		<url>http://snapshots.jboss.org/maven2</url>
+   		<releases>
+   			<enabled>false</enabled>
+   		</releases>
+   		<snapshots>
+            <enabled>true</enabled>
+            <updatePolicy>always</updatePolicy>
+   		</snapshots>
+   	</repository>
+   </repositories>
+   
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <configuration>
+               <descriptors>
+                  <descriptor>src/main/assembly/assembly.xml</descriptor>
+               </descriptors>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+   
+   <dependencies>
+   
+   <!-- 
+      This MUST NOT export ANY dependencies- they should be marked optional.
+   -->
+   
+    <dependency>
+      <groupId>org.jboss.weld.integration</groupId>
+      <artifactId>weld-jboss-int-jboss-ejb</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.weld.integration</groupId>
+      <artifactId>weld-jboss-int-webtier</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.weld.integration</groupId>
+      <artifactId>weld-jboss-int-deployer</artifactId>
+      <optional>true</optional>
+    </dependency>
+   
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-core</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.interceptors</groupId>
+      <artifactId>interceptors</artifactId>
+      <optional>true</optional>
+    </dependency>
+      
+    <dependency>
+      <groupId>javax.enterprise</groupId>
+      <artifactId>cdi-api</artifactId>
+      <optional>true</optional>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-spi</artifactId>
+      <optional>true</optional>
+    </dependency>
+      
+   </dependencies>
+
+</project>

Added: projects/weld-int/trunk/assembly/src/main/assembly/assembly.xml
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/assembly.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/assembly.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<assembly xmlns="http://maven.apache.org/POM/4.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="
+              http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd
+          ">   
+   
+   <baseDirectory>weld.deployer</baseDirectory>
+   
+   <formats>
+      <format>zip</format>
+   </formats>
+   
+   <fileSets>
+      <fileSet>
+         <directory>src/main/assembly/resources</directory>
+         <outputDirectory></outputDirectory>
+      </fileSet>
+   </fileSets>
+   
+   <dependencySets>
+      <dependencySet>
+         <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+         <includes>
+            <include>com.google.collections:google-collections</include>
+            <include>javax.inject:javax.inject</include>
+            <include>javax.enterprise:cdi-api</include>
+            <include>org.jboss.weld:weld-api</include>
+            <include>org.jboss.weld:weld-spi</include>
+            <include>org.jboss.weld:weld-logging</include>
+            <include>org.jboss.weld.integration:weld-jboss-int-jboss-ejb</include>
+            <include>org.jboss.weld.integration:weld-jboss-int-deployer</include>
+            <include>org.jboss.weld.integration:weld-jboss-int-webtier</include>
+            <include>org.jboss.interceptors:interceptors</include>
+         </includes>
+      </dependencySet>
+      <dependencySet>
+         <useProjectArtifact>false</useProjectArtifact>
+         <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+         <outputDirectory>lib-int</outputDirectory>
+         <includes>
+            <include>org.jboss.weld:weld-core</include>
+         </includes>
+      </dependencySet>
+   </dependencySets>
+   
+</assembly>

Added: projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<structure>
+    <context>
+        <path name=""/>
+        <metaDataPath>
+            <path name="META-INF"/>
+        </metaDataPath>
+        <classpath>
+            <path name="" suffixes=".jar" />
+        </classpath>
+    </context>
+</structure>

Added: projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Weld + JBossAS integration
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- Weld deployers -->
+  
+  <!-- Responsible for discovering Weld files -->
+  <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"/>
+
+  <!-- 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"/>
+
+  <!-- Responsible for dynamic ejb dependency creation -->
+  <bean name="DynamicDependencyCreator" class="org.jboss.weld.integration.deployer.env.DynamicDependencyCreator">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Responsible for booting Weld -->
+  <bean name="WeldBootstrapDeployer" class="org.jboss.weld.integration.deployer.env.WeldBootstrapDeployer"/>
+  
+  <!-- Responsible for pushing the JSF faces-config.xml onto the application classpath -->
+  <bean name="WeldFacesIntegrationDeployer" class="org.jboss.weld.integration.deployer.cl.WeldFacesIntegrationDeployer"/>
+  
+  <!-- Responsible for pushing the webtier integration jar onto the application classpath -->
+<!--  <bean name="WeldWenTierIntegrationDeployer" class="org.jboss.weld.integration.deployer.cl.WeldWebTierIntegrationDeployer"/>-->
+  
+  <!-- Responsible for pushing Weld onto the application classpath -->
+  <bean name="WeldCoreIntegrationDeployer" class="org.jboss.weld.integration.deployer.cl.WeldCoreIntegrationDeployer"/>
+
+  <!-- Responsible for inserting the Weld EJB interceptor -->
+  <bean name="PostEjbJarMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldEjbInterceptorMetadataDeployer"/>
+  
+  <!-- Responsible for enabling classloader isolation for Weld jars -->
+  <bean name="PostJBossMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+  
+  <!-- Responsible for enabling classloader isolation for Weld wars -->
+  <bean name="PostJBossWebMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+  
+  <!-- Responsible for adding the Weld listener to the Servlet -->
+  <bean name="PostWebMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostWebMetadataDeployer"/>
+
+  <!-- Responsible for adding the Weld Manager object factory to JNDI -->
+  <bean name="WeldJndiBinder" class="org.jboss.weld.integration.deployer.env.WeldJndiBinder">
+  	<start method="startService">
+  		<parameter>java:app/BeanManager</parameter>
+  		<parameter>org.jboss.weld.resources.ManagerObjectFactory</parameter>
+  	</start>
+  	<stop method="stopService"/>
+  </bean>
+
+</deployment>

Added: projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Welds' Services Implementations for JBoss AS
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!-- EJB Services Utility class -->
+   <bean name="WeldJBossEjb" class="org.jboss.weld.integration.util.JBossEjb"/>
+
+   <!-- EJB Services: @EJB-style injection lookup -->
+   <beanfactory name="JBossEjbServices" class="org.jboss.weld.integration.ejb.JBossEjbServices">
+      <property name="resolver"><inject bean="WeldJBossEjb" property="resolver"/></property>
+      <property name="jbossEjb"><inject bean="WeldJBossEjb" /></property>
+   </beanfactory>
+  
+   <!-- JPA Services: @PersistenceContext-style and @PersistenceUnit-style lookup -->
+   <beanfactory name="JBossJpaServices" class="org.jboss.weld.integration.persistence.JBossJpaServices">
+      <property name="persistenceUnitDependencyResolver"><inject bean="PersistenceUnitDependencyResolver" /></property>
+      <property name="jbossEjb"><inject bean="WeldJBossEjb" /></property>
+   </beanfactory>
+  
+   <!-- @Resource-style lookup -->
+   <bean name="JBossResourceServices" class="org.jboss.weld.integration.resource.JBossResourceServices" />
+  
+   <!-- Access to the JTA UserTransaction, and synchronization registration -->
+   <bean name="JBossTransactionServices" class="org.jboss.weld.integration.transaction.JBossTransactionServices">
+      <constructor>
+         <parameter><inject bean="TransactionManager"/></parameter>
+      </constructor>     
+   </bean>
+   
+   <!-- Access to the caller context Principal -->
+   <bean name="JBossSecurityServices" class="org.jboss.weld.integration.security.JBossSecurityServices" />
+  
+</deployment>

Added: projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess"/>

Added: projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml
===================================================================
--- projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	                        (rev 0)
+++ projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<faces-config id="weld" version="1.2" 
+              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/web-facesconfig_1_2.xsd">
+
+   <factory>
+      <application-factory>org.jboss.weld.integration.webtier.jsf.WeldApplicationFactory</application-factory>
+   </factory>
+
+   <application>
+      <view-handler>org.jboss.weld.jsf.ConversationAwareViewHandler</view-handler>
+   </application>
+   
+	<lifecycle>
+		<phase-listener>org.jboss.weld.jsf.WeldPhaseListener</phase-listener>
+	</lifecycle>
+	  
+</faces-config>

Added: projects/weld-int/trunk/deployer/.classpath
===================================================================
--- projects/weld-int/trunk/deployer/.classpath	                        (rev 0)
+++ projects/weld-int/trunk/deployer/.classpath	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/weld-int/trunk/deployer/.project
===================================================================
--- projects/weld-int/trunk/deployer/.project	                        (rev 0)
+++ projects/weld-int/trunk/deployer/.project	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>weld-jboss-int-deployer</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/weld-int/trunk/deployer/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/weld-int/trunk/deployer/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/weld-int/trunk/deployer/.settings/org.eclipse.jdt.core.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,5 @@
+#Fri Oct 09 11:41:59 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

Added: projects/weld-int/trunk/deployer/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/weld-int/trunk/deployer/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/weld-int/trunk/deployer/.settings/org.maven.ide.eclipse.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+#Fri Oct 09 11:41:44 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/weld-int/trunk/deployer/pom.xml
===================================================================
--- projects/weld-int/trunk/deployer/pom.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/pom.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,249 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.jboss.weld.integration</groupId>
+      <artifactId>weld-jboss-int</artifactId>
+      <version>5.2.0-SNAPSHOT</version>
+   </parent>
+   
+   <groupId>org.jboss.weld.integration</groupId>
+   <artifactId>weld-jboss-int-deployer</artifactId>
+   <version>5.2.0-SNAPSHOT</version>
+   <packaging>jar</packaging>
+   <name>Weld JBoss AS Deployers</name>
+   <description>Weld deployers for JBoss AS</description>
+   
+   <repositories>
+   	<repository>
+   		<id>snapshots.jboss.org</id>
+   		<name>JBoss Snapshot's Repository</name>
+   		<url>http://snapshots.jboss.org/maven2</url>
+   		<releases>
+   			<enabled>false</enabled>
+   		</releases>
+   		<snapshots>
+            <enabled>true</enabled>
+            <updatePolicy>always</updatePolicy>
+   		</snapshots>
+   	</repository>
+   </repositories>
+   
+   <dependencies>
+      
+    <dependency>
+      <groupId>javax.enterprise</groupId>
+      <artifactId>cdi-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.cl</groupId>
+      <artifactId>jboss-classloader</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-dependency</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <optional>true</optional>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-dependency</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jbossxb</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jbossxb</artifactId>
+      <optional>true</optional>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-reflect</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.man</groupId>
+      <artifactId>jboss-managed</artifactId>
+      <optional>true</optional>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-reflect</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <!-- Test dependencies -->
+
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+      <!--
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-deployers-impl</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-deployers-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-kernel</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.cl</groupId>
+          <artifactId>jboss-classloading</artifactId>
+        </exclusion>
+      </exclusions>
+      -->
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jboss.profiler.jvmti</groupId>
+          <artifactId>jboss-profiler-jvmti</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant-junit</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.faces</groupId>
+      <artifactId>jsf-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+    	<groupId>org.jboss.ejb3</groupId>
+        <artifactId>jboss-ejb3-core</artifactId>
+    </dependency>
+      
+   </dependencies>
+
+</project>

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Weld deployers utils.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public final class DeployersUtils
+{
+   private DeployersUtils()
+   {
+   }
+
+   public static final String WELD_FILES = "WELD_FILES";
+   public static final String WELD_CLASSPATH = "WELD_CLASSPATH";
+   public static final String WELD_DEPLOYMENT_FLAG = "WELD_DEPLOYMENT_FLAG";
+
+   public static final String WELD_BOOTSTRAP_BEAN = "_WeldBootstrapBean";
+
+   /**
+    * Get bootstrap bean name.
+    *
+    * @param unit the deployment unit
+    * @return weld bootstrap bean name
+    */
+   public static String getBootstrapBeanName(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null deployment unit");
+
+      DeploymentUnit top = unit.getTopLevel();
+      return top.getName() + WELD_BOOTSTRAP_BEAN;
+   }
+
+   /**
+    * Check deployment hierarchy for beans.xml files.
+    * It checks the 'cached' flag.
+    *
+    * @param unit the deployment unit
+    * @return true if beans.xml files exist, false otherwise
+    */
+   public static boolean checkForWeldFiles(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null deployment unit");
+
+      DeploymentUnit top = unit.getTopLevel();
+
+      Boolean flag = top.getAttachment(WELD_DEPLOYMENT_FLAG, Boolean.class);
+      if (flag != null)
+         return flag;
+
+      flag = searchForBeans(top);
+      top.addAttachment(WELD_DEPLOYMENT_FLAG, flag, Boolean.class);
+
+      return flag;
+   }
+
+   /**
+    * Search deployment hierarchy for beans.xml files.
+    *
+    * @param unit the deployment unit
+    * @return true if beans.xml files exist, false otherwise
+    */
+   private static boolean searchForBeans(DeploymentUnit unit)
+   {
+      Collection files = unit.getAttachment(WELD_FILES, Collection.class);
+      if (files != null && files.isEmpty() == false)
+         return true;
+
+      List<DeploymentUnit> children = unit.getChildren();
+      if (children != null && children.isEmpty() == false)
+      {
+         for (DeploymentUnit child : children)
+         {
+            boolean result = searchForBeans(child);
+            if (result)
+               return true;
+         }
+      }
+      return false;
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,34 @@
+package org.jboss.weld.integration.deployer.cl;
+
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+import org.jboss.weld.integration.deployer.ext.JBossWeldMetaData;
+
+/**
+ * Web Beans RI core integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WeldCoreIntegrationDeployer extends WeldUrlIntegrationDeployer<JBossWeldMetaData>
+{
+   public WeldCoreIntegrationDeployer()
+   {
+      super(JBossWeldMetaData.class);
+      setTopLevelOnly(true); // only top level, as that's where Bootstrap bean is gonna be
+      setInputs(DeployersUtils.WELD_FILES);
+      setIntegrationURLs(getURLs());
+   }
+
+   @Override // we override this, as we want any beans.xml
+   protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+   {
+      return DeployersUtils.checkForWeldFiles(unit);
+   }
+
+   @Override
+   protected String getShortLibName()
+   {
+      return "weld-core.jar";
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,37 @@
+package org.jboss.weld.integration.deployer.cl;
+
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Weld integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author Pete Muir
+ */
+public class WeldFacesIntegrationDeployer extends WeldUrlIntegrationDeployer<JBossWebMetaData>
+{
+   public WeldFacesIntegrationDeployer()
+   {
+      super(JBossWebMetaData.class);
+      // We do this at top level to ensure that any deployment (ear or war) 
+      // that supports WB gets this integration (even if that particular war doesn't have beans.xml)
+      setTopLevelOnly(true); 
+      setInputs(DeployersUtils.WELD_FILES);
+      setIntegrationURLs(getURLs());
+   }
+
+   @Override // we override this, as we want any beans.xml
+   protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+   {
+      return DeployersUtils.checkForWeldFiles(unit);
+   }
+
+   @Override
+   protected String getShortLibName()
+   {
+      return "faces";
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,70 @@
+package org.jboss.weld.integration.deployer.cl;
+
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
+import org.jboss.util.StringPropertyReplacer;
+
+/**
+ * Web Beans RI integration deployer.
+ *
+ * @param <T> exact input type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class WeldUrlIntegrationDeployer<T> extends PathUrlIntegrationDeployer<T>
+{
+   protected WeldUrlIntegrationDeployer(Class<T> input)
+   {
+      super(input);
+      setIntegrationURLs(getURLs());
+   }
+
+   /**
+    * Get the short name.
+    * @return
+    */
+   protected abstract String getShortLibName();
+
+   /**
+    * Get the Weld core integration urls.
+    *
+    * @return the weld jbossas integration urls
+    */
+   protected Set<URL> getURLs()
+   {
+      try
+      {
+         String libOpt = getServerHome() + getOptionalLib();
+         libOpt = StringPropertyReplacer.replaceProperties(libOpt);
+         return Collections.singleton(new URL(libOpt + getShortLibName()));
+      }
+      catch (MalformedURLException e)
+      {
+         throw new IllegalArgumentException("Unexpected error: " + e);
+      }
+   }
+
+   /**
+    * Get server home.
+    *
+    * @return the jboss server home location
+    */
+   protected String getServerHome()
+   {
+      return "${jboss.server.home.url}";
+   }
+
+   /**
+    * Get the optinal lib path.
+    *
+    * @return the integration path
+    */
+   protected String getOptionalLib()
+   {
+      return "deployers/weld.deployer/lib-int/";
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,24 @@
+package org.jboss.weld.integration.deployer.cl;
+
+
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Web Beans RI integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WeldWebTierIntegrationDeployer extends WeldUrlIntegrationDeployer<JBossWebMetaData>
+{
+   public WeldWebTierIntegrationDeployer()
+   {
+      super(JBossWebMetaData.class); // we only look at wars
+      setDisableOptional(true); // it needs to be web deployment, or why would you use JSF?
+      setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
+   }
+
+   protected String getShortLibName()
+   {
+      return "weld-jboss-int-webtier.jar";
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,96 @@
+/*
+ * 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;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractOptionalRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Abstract bootstrap info deployer.
+ * Adding and getting info for Bootstrap bean.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractBootstrapInfoDeployer extends AbstractOptionalRealDeployer<BootstrapInfo>
+{
+   protected AbstractBootstrapInfoDeployer(boolean isPassThroughBootstrapInfo)
+   {
+      super(BootstrapInfo.class);
+      setTopLevelOnly(true);
+      setStage(DeploymentStages.PRE_REAL);
+      addInput(DeployersUtils.WELD_FILES);
+      if (isPassThroughBootstrapInfo)
+         addOutput(BootstrapInfo.class);
+   }
+
+   public final void deploy(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      boolean doDeploy = (info != null);
+      if (doDeploy == false)
+      {
+         doDeploy = DeployersUtils.checkForWeldFiles(unit);
+         if (doDeploy)
+         {
+            // info is null, create one
+            info = new BootstrapInfo();
+            unit.addAttachment(BootstrapInfo.class, info);
+         }
+      }
+      
+      if (doDeploy)
+         deployInternal(unit, info);
+   }
+
+   /**
+    * Do deploy.
+    *
+    * @param unit the deployment unit
+    * @param info non-null bootstrap info
+    * @throws DeploymentException for any error
+    */
+   protected abstract void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException;
+
+   /**
+    * Create service connector.
+    *
+    * @param name the connector name
+    * @param bean the bean to create
+    * @param unit the deployment unit
+    * @return new inject metadata
+    */
+   protected static ValueMetaData createServiceConnector(String name, String bean, DeploymentUnit unit)
+   {
+      String beanName = unit.getName() + "_" + name;
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, bean);
+      builder.setFactory(name);
+      builder.setFactoryMethod("createBean");
+      builder.addPropertyMetaData("deploymentUnit", unit);
+      unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData());
+      return builder.createInject(beanName);
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+/**
+ * Abstract Deployment Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDeploymentDeployer extends AbstractBootstrapInfoDeployer
+{
+   public AbstractDeploymentDeployer()
+   {
+      super(true);
+      addInput(BootstrapInfo.EJB_SERVICES);
+      addOutput(BootstrapInfo.DEPLOYMENT);
+      addOutput(BeanMetaData.class);
+   }
+
+   public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      if (info.getEjbServices() == null)
+         throw new DeploymentException("Missing ejb services value: " + unit);
+
+      if (isRelevant(unit) == false)
+         return;
+
+      String unitName = unit.getName();
+      String deploymentName = unitName + "_JBossDeployment";
+
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(deploymentName, getDeploymentClass().getName());
+      buildDeployment(unit, info, builder);
+      info.setDeployment(builder.createInject(deploymentName));
+      unit.addAttachment(deploymentName, builder.getBeanMetaData(), BeanMetaData.class);
+   }
+
+   /**
+    * Is this deployer relevant.
+    *
+    * @param unit the deployment unit
+    * @return true if relevant, false otherwise
+    */
+   protected boolean isRelevant(DeploymentUnit unit)
+   {
+      return true;
+   }
+
+   /**
+    * Get deployment impl class.
+    *
+    * @return the deployment class
+    */
+   protected abstract Class<? extends Deployment> getDeploymentClass();
+
+   /**
+    * Build deployment
+    *
+    * @param unit the deployment unit
+    * @param info the bootstrap info
+    * @param builder the bean metadata builder
+    */
+   protected abstract void buildDeployment(DeploymentUnit unit, BootstrapInfo info, BeanMetaDataBuilder builder);}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * Simple bootstrap info class, used as attachment key.
+ * Holds inject values for deployment and various services.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BootstrapInfo
+{
+   private ValueMetaData ejbServices;
+   public static final String EJB_SERVICES = BootstrapInfo.class.getSimpleName() + "EJB_SERVICES";
+
+   private ValueMetaData deployment;
+   public static final String DEPLOYMENT = BootstrapInfo.class.getSimpleName() + "DEPLOYMENT";
+   
+   private ValueMetaData servletServices;
+   public static final String SERVLET_SERVICES = BootstrapInfo.class.getSimpleName() + "SERVLET_SERVICES";
+
+   public ValueMetaData getDeployment()
+   {
+      return deployment;
+   }
+
+   public void setDeployment(ValueMetaData deployment)
+   {
+      this.deployment = deployment;
+   }
+
+   public ValueMetaData getEjbServices()
+   {
+      return ejbServices;
+   }
+
+   public void setEjbServices(ValueMetaData ejbServices)
+   {
+      this.ejbServices = ejbServices;
+   }
+   
+   public ValueMetaData getServletServices()
+   {
+      return servletServices;
+   }
+   
+   public void setServletServices(ValueMetaData servletServices)
+   {
+      this.servletServices = servletServices;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
+
+/**
+ * Bean which knows how to create dynamic dependencies to target bean.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class DynamicDependencyCreator
+{
+   /** The controller */
+   private Controller controller;
+
+   public DynamicDependencyCreator(Controller controller)
+   {
+      this.controller = controller;
+   }
+
+   /**
+    * Create dependencies to target bean.
+    *
+    * @param targetName the target bean name
+    * @param dependencies dependencies names
+    * @param whenRequiredState when required state
+    * @param dependentState dependencies dependent state
+    */
+   public void createDepenencies(Object targetName, Iterable<String> dependencies, String whenRequiredState, String dependentState)
+   {
+      if (targetName == null)
+         throw new IllegalArgumentException("Null target name");
+      if (dependencies == null)
+         throw new IllegalArgumentException("Null dependecies");
+
+      ControllerContext targetControllerContext = controller.getContext(targetName, null);
+      if (targetControllerContext == null)
+         throw new IllegalArgumentException("No such target bean installed: " + targetName);
+
+      Throwable error = targetControllerContext.getError();
+      if (error != null)
+         throw new IllegalArgumentException("Target bean " + targetName + " is in Error state: " + error);
+
+      ControllerState whenRequired;
+      if (whenRequiredState == null)
+         whenRequired = ControllerState.INSTALLED;
+      else
+         whenRequired = new ControllerState(whenRequiredState);
+
+      ControllerState currentTargetState = targetControllerContext.getState();
+      if (controller.getStates().isBeforeState(currentTargetState, whenRequired) == false)
+         throw new IllegalArgumentException("Target bean " + targetName + " is already past " + whenRequiredState + " state: " + targetControllerContext);
+
+      ControllerState dependent = null;
+      if (dependentState != null)
+         dependent = new ControllerState(dependentState);
+      
+      DependencyInfo di = targetControllerContext.getDependencyInfo();
+      for (Object dependency : dependencies)
+      {
+         DependencyItem item = new AbstractDependencyItem(targetName, dependency, whenRequired, dependent);
+         di.addIDependOn(item);
+      }
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * EjbServices Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class EjbServicesDeployer extends AbstractBootstrapInfoDeployer
+{
+   /** The ejb services class name */
+   private String ejbServicesClassName = "org.jboss.weld.integration.ejb.JBossEjbServices";
+
+   public EjbServicesDeployer()
+   {
+      super(true);
+      addOutput(BootstrapInfo.EJB_SERVICES);
+   }
+
+   public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      ValueMetaData ejbServicesValue = createServiceConnector("JBossEjbServices", ejbServicesClassName, unit);
+      info.setEjbServices(ejbServicesValue);
+   }
+
+   /**
+    * Set ejb services class name.
+    *
+    * @param ejbServicesClassName the ejb services classname
+    */
+   public void setEjbServicesClassName(String ejbServicesClassName)
+   {
+      this.ejbServicesClassName = ejbServicesClassName;
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.deployer.env;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+/**
+ * Initial (naive) implementation of Deployment for JBoss AS.
+ *
+ * This version simply flattens the entire deployment into a single
+ * BeanDeploymentArchive
+ *
+ * @author pmuir
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeployment implements Deployment
+{
+   private final BeanDeploymentArchive beanDeploymentArchive;
+   private final List<BeanDeploymentArchive> beanDeploymentArchives;
+   private final ServiceRegistry services;
+
+   public FlatDeployment(WeldDiscoveryEnvironment environment, Collection<EjbDescriptor<?>> ejbDescriptors)
+   {
+      this.beanDeploymentArchive = new JBossBeanDeploymentArchive("flat" ,environment, ejbDescriptors);
+      this.beanDeploymentArchives = Collections.singletonList(beanDeploymentArchive);
+      this.services = new SimpleServiceRegistry();
+   }
+
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return beanDeploymentArchives;
+   }
+
+   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+   {
+      return beanDeploymentArchive;
+   }
+   
+   public BeanDeploymentArchive getFlatBeanDeploymentArchive()
+   {
+      return beanDeploymentArchive;
+   }
+   
+   public ServiceRegistry getServices()
+   {
+      return services;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,60 @@
+/*
+ * 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;
+
+import java.util.Collection;
+
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+/**
+ * Flat Deployment Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeploymentDeployer extends AbstractDeploymentDeployer
+{
+   public FlatDeploymentDeployer()
+   {
+      super();
+      addInput(WeldDiscoveryEnvironment.class);
+   }
+
+   @Override
+   protected boolean isRelevant(DeploymentUnit unit)
+   {
+      return unit.isAttachmentPresent(WeldDiscoveryEnvironment.class);
+   }
+
+   protected Class<? extends Deployment> getDeploymentClass()
+   {
+      return FlatDeployment.class;
+   }
+
+   protected void buildDeployment(DeploymentUnit unit, BootstrapInfo info, BeanMetaDataBuilder builder)
+   {
+      WeldDiscoveryEnvironment env = unit.getAttachment(WeldDiscoveryEnvironment.class);
+      builder.addConstructorParameter(WeldDiscoveryEnvironment.class.getName(), env);
+      builder.addConstructorParameter(Collection.class.getName(), builder.createInject(info.getEjbServices().getUnderlyingValue(), "ejbs"));
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,59 @@
+package org.jboss.weld.integration.deployer.env;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+public class JBossBeanDeploymentArchive implements BeanDeploymentArchive
+{
+   
+   private final WeldDiscoveryEnvironment environment;
+   private final Collection<EjbDescriptor<?>> ejbDescriptors;
+   private final ServiceRegistry services;
+   private final String id;
+
+   public JBossBeanDeploymentArchive(String id, WeldDiscoveryEnvironment environment, Collection<EjbDescriptor<?>> ejbDescriptors)
+   {
+      this.environment = environment;
+      this.ejbDescriptors = ejbDescriptors;
+      this.services = new SimpleServiceRegistry();
+      this.id = id;
+   }
+   
+   public Collection<Class<?>> getBeanClasses()
+   {
+      return environment.getWeldClasses();
+   }
+   
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return Collections.emptyList();
+   }
+   
+   public Collection<URL> getBeansXml()
+   {
+      return environment.getWeldXml();
+   }
+   
+   public Collection<EjbDescriptor<?>> getEjbs()
+   {
+      return ejbDescriptors;
+   }
+
+   public ServiceRegistry getServices()
+   {
+      return services;
+   }
+   
+   public String getId()
+   {
+      return id;
+   }
+   
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,137 @@
+/*
+ * 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;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+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.helpers.BootstrapBean;
+import org.jboss.weld.integration.injection.WeldInjector;
+
+/**
+ * Deploy Weld boostrap service.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldBootstrapDeployer extends AbstractBootstrapInfoDeployer
+{
+   public WeldBootstrapDeployer()
+   {
+      super(false);
+      setDisableOptional(true);
+      addOutput(BeanMetaData.class);
+      addInput("javax.validation.ValidatorFactory");
+   }
+
+   protected void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      ValueMetaData ejbServicesValue = info.getEjbServices();
+      if (ejbServicesValue == null)
+         throw new DeploymentException("Missing ejb services: " + unit);
+
+      ValueMetaData deploymentValue = info.getDeployment();
+      if (deploymentValue == null)
+         throw new DeploymentException("Missing deployment: " + unit);
+      
+
+
+      String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
+      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.addPropertyMetaData("ejbServices", ejbServicesValue);
+      bootstrap.addPropertyMetaData("ejbInjectionServices", ejbServicesValue);
+      bootstrap.addPropertyMetaData("jpaServices", createServiceConnector("JBossJpaServices", "org.jboss.weld.integration.persistence.JBossJpaServices", unit));
+      bootstrap.addPropertyMetaData("resourceServices", bootstrap.createInject("JBossResourceServices"));
+      bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
+      bootstrap.addPropertyMetaData("applicationContext", createBeanStore());
+      bootstrap.addPropertyMetaData("securityServices", bootstrap.createInject("JBossSecurityServices"));
+      bootstrap.addPropertyMetaData("validationServices", createValidationServices(unit));
+      bootstrap.setCreate("initialize");
+      bootstrap.setStart("boot");
+      bootstrap.setDestroy("shutdown");
+      bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
+      
+      // call dynamic dependency creator for EJBs
+      ParameterMetaDataBuilder install = bootstrap.addInstallWithParameters("createDepenencies", "DynamicDependencyCreator", null, ControllerState.CONFIGURED);
+      install.addParameterMetaData(Object.class.getName(), bootstrapName);
+      install.addParameterMetaData(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbContainerNames"));
+      install.addParameterMetaData(String.class.getName(), "Start");
+      install.addParameterMetaData(String.class.getName(), "Start");
+      
+      unit.addAttachment(bootstrapName + "_" + BeanMetaData.class.getSimpleName(), bootstrap.getBeanMetaData());
+
+      String injectorName = unit.getName() + "_WBInjector";
+      BeanMetaDataBuilder weldInjector = BeanMetaDataBuilder.createBuilder(injectorName, WeldInjector.class.getName());
+      weldInjector.addConstructorParameter(BootstrapBean.class.getName(), bootstrap.createInject(bootstrapName));
+      unit.addAttachment(injectorName + "_" + BeanMetaData.class.getSimpleName(), weldInjector.getBeanMetaData());
+   }
+
+   /**
+    * Create new bean store.
+    *
+    * @return the bean store instance
+    */
+   protected BeanStore createBeanStore()
+   {
+      return new ConcurrentHashMapBeanStore();
+   }
+
+   /**
+    * Create bootstrap bean.
+    *
+    * @param unit the deployment unit
+    * @return new injected bootstrap metadata
+    */
+   protected ValueMetaData createBootstrap(DeploymentUnit unit)
+   {
+      String beanName = unit.getName() + "_WeldBootstrap";
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, "org.jboss.weld.bootstrap.WeldBootstrap");
+      unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData());
+      return builder.createInject(beanName);
+   }
+   
+   protected ValueMetaData createValidationServices(DeploymentUnit unit) throws DeploymentException
+   {
+      Object validatorFactory = unit.getAttachment("javax.validation.ValidatorFactory");
+      
+      if (validatorFactory == null)
+      {
+         throw new DeploymentException("Missing ValidatorFactory attachment in deployment: " + unit);
+      }
+      
+      String beanName = unit.getName() + "_JBossValidationServices";
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, "org.jboss.weld.integration.validation.JBossValidationServices");
+      unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData());
+      builder.addConstructorParameter("javax.validation.ValidatorFactory", validatorFactory);
+      return builder.createInject(beanName);
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,137 @@
+/*
+ * 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;
+
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.visitor.ClassFilter;
+import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.classloading.spi.visitor.ResourceVisitor;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+import org.jboss.weld.integration.deployer.ext.JBossWeldMetaData;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldDiscoveryDeployer extends AbstractOptionalVFSRealDeployer<JBossWeldMetaData>
+{
+   public WeldDiscoveryDeployer()
+   {
+      super(JBossWeldMetaData.class);
+      addInput(DeployersUtils.WELD_FILES);
+      addInput(DeployersUtils.WELD_CLASSPATH);
+      addOutput(WeldDiscoveryEnvironment.class);
+      setStage(DeploymentStages.PRE_REAL);
+   }
+
+   public void deploy(VFSDeploymentUnit unit, JBossWeldMetaData deployment) throws DeploymentException
+   {
+      @SuppressWarnings("unchecked")
+      Collection<VirtualFile> wbFiles = unit.getAttachment(DeployersUtils.WELD_FILES, Collection.class);
+      boolean hasWB = (wbFiles != null && wbFiles.isEmpty() == false);
+
+      @SuppressWarnings("unchecked")
+      Collection<VirtualFile> cpFiles = unit.getAttachment(DeployersUtils.WELD_CLASSPATH, Collection.class);
+      boolean hasCp = (cpFiles != null && cpFiles.isEmpty() == false);
+
+      WeldDiscoveryEnvironment environment = null;
+      if (hasWB || hasCp)
+      {
+         VFSDeploymentUnit topUnit = unit.getTopLevel();
+         environment = topUnit.getAttachment(WeldDiscoveryEnvironment.class);
+         if (environment == null)
+         {
+            environment = new WeldDiscoveryEnvironment();
+            topUnit.addAttachment(WeldDiscoveryEnvironment.class, environment);
+         }
+      }
+
+      try
+      {
+         if (hasWB)
+         {
+            for (VirtualFile file : wbFiles)
+               environment.addWeldXmlURL(file.toURL());
+         }
+
+         if (hasCp)
+         {
+            Module module = unit.getAttachment(Module.class);
+            if (module == null)
+            {
+               VFSDeploymentUnit parent = unit.getParent();
+               while (parent != null && module == null)
+               {
+                  module = parent.getAttachment(Module.class);
+                  parent = parent.getParent();
+               }
+               if (module == null)
+                  throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
+            }
+
+            URL[] urls = new URL[cpFiles.size()];
+            int i = 0;
+            for (VirtualFile file : cpFiles)
+            {
+               urls[i++] = file.toURL();
+            }
+
+            WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(environment);
+            module.visit(visitor, ClassFilter.INSTANCE, null, urls);
+         }
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot build WB env.", e);
+      }
+   }
+
+   private class WBDiscoveryVisitor implements ResourceVisitor
+   {
+      private WeldDiscoveryEnvironment wbdi;
+
+      private WBDiscoveryVisitor(WeldDiscoveryEnvironment wbdi)
+      {
+         this.wbdi = wbdi;
+      }
+
+      public ResourceFilter getFilter()
+      {
+         return ClassFilter.INSTANCE;
+      }
+
+      public void visit(ResourceContext resource)
+      {
+         wbdi.addWeldClass(resource.loadClass());
+      }
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * WBD env impl.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldDiscoveryEnvironment
+{
+   private Set<Class<?>> classes = new HashSet<Class<?>>();
+   private Set<URL> urls = new HashSet<URL>();
+
+   /**
+    * Add weld class.
+    *
+    * @param clazz the weld class
+    */
+   void addWeldClass(Class<?> clazz)
+   {
+      classes.add(clazz);
+   }
+
+   /**
+    * Add weld xml url.
+    *
+    * @param url the weld xml url
+    */
+   void addWeldXmlURL(URL url)
+   {
+      urls.add(url);      
+   }
+
+   /**
+    * Get weld classes.
+    *
+    * @return the weld classes
+    */
+   public Collection<Class<?>> getWeldClasses()
+   {
+      return classes;
+   }
+
+   /**
+    * Get weld xmls.
+    *
+    * @return the weld xmls
+    */
+   public Collection<URL> getWeldXml()
+   {
+      return urls;
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.integration.deployer.env;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+/**
+ * This singleton bean for the deployer is responsible for binding an object
+ * factory to the required name(s) in JNDI. Once bound, all deployed
+ * applications can obtain the Web Beans manager from JNDI.
+ * 
+ * @author David Allen
+ * 
+ */
+public class WeldJndiBinder
+{
+   private String jndiName = null;
+
+   /**
+    * Start the service.
+    * 
+    * @param jndiContextPath the jndi context path
+    * @param managerObjectFactoryClass the manager object factory
+    * @throws Exception for any error
+    */
+   public void startService(String jndiContextPath, String managerObjectFactoryClass) throws Exception
+   {
+      jndiName = jndiContextPath;
+      Reference managerReference = new Reference(BeanManager.class.getName(), managerObjectFactoryClass, null);
+      bind(jndiContextPath, managerReference);
+   }
+
+   /**
+    * Stop the service.
+    * 
+    * @throws Exception for any error
+    */
+   public void stopService() throws Exception
+   {
+      Context initialContext = new InitialContext();
+      initialContext.unbind(jndiName);
+   }
+
+   /**
+    * Bind object to jndi.
+    * 
+    * @param key the key
+    * @param binding the object to bind
+    * @throws Exception for any error
+    */
+   protected void bind(String key, Object binding) throws Exception
+   {
+      Context initialContext = new InitialContext();
+      try
+      {
+         String[] parts = key.split("/");
+         int length = parts.length;
+         Context context = initialContext;
+         Context nextContext;
+         for (int i = 0; i < length - 1; i++)
+         {
+            try
+            {
+               nextContext = (Context) context.lookup(parts[i]);
+            }
+            catch (NamingException e)
+            {
+               nextContext = context.createSubcontext(parts[i]);
+            }
+            context = nextContext;
+         }
+         context.bind(parts[length - 1], binding);
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException("Cannot bind " + binding + " to " + key, e);
+      }
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,144 @@
+package org.jboss.weld.integration.deployer.env.helpers;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.bootstrap.api.Bootstrap;
+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.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.security.spi.SecurityServices;
+import org.jboss.weld.servlet.api.ServletServices;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.validation.spi.ValidationServices;
+import org.jboss.weld.integration.deployer.env.FlatDeployment;
+
+/**
+ * A bean version of bootstrap that delegates to the underlying bootstrap impl
+ * 
+ * @author Pete Muir
+ *
+ */
+public class BootstrapBean
+{
+   
+   static class JBossServletServices implements ServletServices
+   {
+      
+      // For now, JBoss is using a totally flat deployment structure
+      private final BeanDeploymentArchive beanDeploymentArchive;
+      
+      public JBossServletServices(BeanDeploymentArchive beanDeploymentArchive)
+      {
+         this.beanDeploymentArchive = beanDeploymentArchive;
+      }
+      
+      
+      public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx)
+      {
+         return beanDeploymentArchive;
+      }
+      
+      public void cleanup() {}
+
+   }
+   
+   private final Bootstrap bootstrap;
+   private final FlatDeployment deployment;
+   private BeanStore applicationBeanStore;
+
+   public BootstrapBean(Bootstrap bootstrap, FlatDeployment flatDeployment)
+   {
+      this.bootstrap = bootstrap;
+      this.deployment = flatDeployment;
+   }
+   
+   public void setEjbServices(EjbServices ejbServices)
+   {
+      addDeploymentService(EjbServices.class, ejbServices);
+   }
+   
+   public void setEjbInjectionServices(EjbInjectionServices service)
+   {
+      addBeanDeploymentArchiveService(EjbInjectionServices.class, service);
+   }
+   
+   public void setJpaServices(JpaInjectionServices jpaServices)
+   {
+      addBeanDeploymentArchiveService(JpaInjectionServices.class, jpaServices);
+   }
+   
+   public void setResourceServices(ResourceInjectionServices resourceServices)
+   {
+      addBeanDeploymentArchiveService(ResourceInjectionServices.class, resourceServices);
+   }
+   
+   public FlatDeployment getDeployment()
+   {
+      return deployment;
+   }
+   
+   public void setTransactionServices(TransactionServices transactionServices)
+   {
+      addDeploymentService(TransactionServices.class, transactionServices);
+   }
+   
+   public void setApplicationContext(BeanStore applicationContext)
+   {
+      this.applicationBeanStore = applicationContext;
+   }
+   
+   public void setValidationServices(ValidationServices validationServices) 
+   {
+      addDeploymentService(ValidationServices.class, validationServices);
+   }
+   
+   public void setSecurityServices(SecurityServices securityServices)
+   {
+      addDeploymentService(SecurityServices.class, securityServices);
+   }
+   
+   private <S extends Service> void addDeploymentService(Class<S> type, S service)
+   {
+      getDeployment().getServices().add(type, service);
+   }
+   
+   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);
+   }
+   
+   public void boot()
+   {
+      bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
+   }
+   
+   /**
+    * @return the bootstrap
+    */
+   public Bootstrap getBootstrap()
+   {
+      return bootstrap;
+   }
+   
+   public void initialize()
+   {
+      // Create the JBoss Servlet Services
+      addDeploymentService(ServletServices.class, new JBossServletServices(deployment.getFlatBeanDeploymentArchive()));
+      bootstrap.startContainer(Environments.EE_INJECT, deployment, applicationBeanStore);
+   }
+   
+   public void shutdown()
+   {
+      bootstrap.shutdown();
+   }
+   
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,51 @@
+/*
+ * 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.ext;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss Weld custom meta data
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWeldMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   private VirtualFile file;
+
+   public JBossWeldMetaData(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      this.file = file;
+   }
+
+   public URL getURL() throws Exception
+   {
+      return file.toURL();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,45 @@
+/*
+ * 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.ext;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWeldMetaDataDeployer extends AbstractVFSParsingDeployer<JBossWeldMetaData>
+{
+   public JBossWeldMetaDataDeployer()
+   {
+      super(JBossWeldMetaData.class);
+      setName("jboss-web-beans.xml");
+   }
+
+   protected JBossWeldMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWeldMetaData root) throws Exception
+   {
+      return new JBossWeldMetaData(file);
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,52 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Post faces-config.xml deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostFacesConfigDeployer extends AbstractSimpleVFSRealDeployer<JBossWebMetaData>
+{
+   public PostFacesConfigDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setStage(DeploymentStages.POST_PARSE);
+   }
+
+   public void deploy(VFSDeploymentUnit unit, JBossWebMetaData deployment) throws DeploymentException
+   {
+      VirtualFile facesConfigXml = unit.getMetaDataFile("faces-config.xml");
+      if (facesConfigXml != null)
+      {
+         // TODO - Pete or Stan   
+      }
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,65 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Post jboss-app.xml weld deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostJBossAppMetadataDeployer extends WeldClassloadingDeployer<JBossAppMetaData>
+{
+   public static final String BASE_EAR_DEPLOYMENT_NAME = "jboss.j2ee:service=EARDeployment";
+
+   public PostJBossAppMetadataDeployer()
+   {
+      super(JBossAppMetaData.class);
+      addInput(DeployersUtils.WELD_FILES);
+      setOptionalWeldXml(true);
+   }
+
+   protected boolean isClassLoadingMetadataPresent(JBossAppMetaData deployment)
+   {
+      return deployment.getLoaderRepository() != null;
+   }
+
+   @Override
+   protected boolean isIsolated(VFSDeploymentUnit unit, VirtualFile wbXml)
+   {
+      return (super.isIsolated(unit, wbXml) && (wbXml != null || DeployersUtils.checkForWeldFiles(unit)));
+   }
+
+   protected String getJMXName(JBossAppMetaData metaData, DeploymentUnit unit)
+   {
+      String name = metaData.getJmxName();
+      if( name == null )
+         name = BASE_EAR_DEPLOYMENT_NAME + ",url='" + unit.getSimpleName() + "'";
+
+      return name;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,55 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * Post jboss.xml weld deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostJBossMetadataDeployer extends WeldClassloadingDeployer<JBossMetaData>
+{
+   public static final String BASE_EJB_DEPLOYMENT_NAME = "jboss.j2ee:service=EJBDeployment";
+
+   public PostJBossMetadataDeployer()
+   {
+      super(JBossMetaData.class);
+      setTopLevelOnly(true); // only check for top .jar files
+   }
+
+   protected boolean isClassLoadingMetadataPresent(JBossMetaData deployment)
+   {
+      return deployment.getLoaderRepository() != null;
+   }
+
+   protected String getJMXName(JBossMetaData metaData, DeploymentUnit unit)
+   {
+      String name = metaData.getJmxName();
+      if (name == null)
+         name = BASE_EJB_DEPLOYMENT_NAME + ",url='" + unit.getSimpleName() + "'";
+
+      return name;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,51 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Post jboss-web.xml weld deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostJBossWebMetadataDeployer extends WeldClassloadingDeployer<JBossWebMetaData>
+{
+   public static final String BASE_WAR_DEPLOYMENT_NAME = "jboss.j2ee:service=WARDeployment";
+
+   public PostJBossWebMetadataDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setTopLevelOnly(true); // only check for top .war files
+   }
+
+   protected boolean isClassLoadingMetadataPresent(JBossWebMetaData deployment)
+   {
+      return deployment.getClassLoading() != null;
+   }
+
+   protected String getJMXName(JBossWebMetaData metaData, DeploymentUnit unit)
+   {
+      return BASE_WAR_DEPLOYMENT_NAME + ",url='" + unit.getSimpleName() + "'";
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,102 @@
+/*
+ * 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.metadata;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.FilterMappingMetaData;
+import org.jboss.metadata.web.spec.FilterMetaData;
+import org.jboss.metadata.web.spec.FiltersMetaData;
+import org.jboss.metadata.web.spec.ListenerMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Post web.xml weld deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostWebMetadataDeployer extends WeldAwareMetadataDeployer<JBossWebMetaData>
+{
+   private final ListenerMetaData WBL;
+   private final ListenerMetaData JIL;
+   private final FilterMetaData CPF;
+   private final FilterMappingMetaData CPFM;
+
+   public PostWebMetadataDeployer()
+   {
+      super(JBossWebMetaData.class, true);
+      addInput(DeployersUtils.WELD_FILES);
+      addInput("merged." + JBossWebMetaData.class.getName());
+      setStage(DeploymentStages.POST_CLASSLOADER);
+      setOptionalWeldXml(true);
+      // create wbl listener
+      WBL = new ListenerMetaData();
+      WBL.setListenerClass("org.jboss.weld.servlet.WeldListener");
+      JIL = new ListenerMetaData();
+      JIL.setListenerClass("org.jboss.weld.integration.webtier.jsp.JspInitializationListener");
+      CPF = new FilterMetaData();
+      CPF.setFilterName("Weld Conversation Propagation Filter");
+      CPF.setFilterClass("org.jboss.weld.servlet.ConversationPropagationFilter");
+      CPFM = new FilterMappingMetaData();
+      CPFM.setFilterName("Weld Conversation Propagation Filter");
+      CPFM.setUrlPatterns(Arrays.asList("/*"));
+   }
+
+   protected void internalDeploy(VFSDeploymentUnit unit, JBossWebMetaData deployment, VirtualFile wbXml) throws DeploymentException
+   {
+      if (wbXml != null || DeployersUtils.checkForWeldFiles(unit))
+      {
+         List<ListenerMetaData> listeners = deployment.getListeners();
+         if (listeners == null)
+         {
+            listeners = new ArrayList<ListenerMetaData>();
+            deployment.setListeners(listeners);
+         }
+         listeners.add(WBL);
+         listeners.add(JIL);
+         
+         FiltersMetaData filters = deployment.getFilters();
+         if (filters == null)
+         {
+            filters = new FiltersMetaData();
+            deployment.setFilters(filters);
+         }
+         filters.add(CPF);
+         
+         List<FilterMappingMetaData> filterMappings = deployment.getFilterMappings();
+         if (filterMappings == null)
+         {
+            filterMappings = new ArrayList<FilterMappingMetaData>();
+            deployment.setFilterMappings(filterMappings);
+         }
+         filterMappings.add(CPFM);
+         
+      }
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,76 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Weld aware metadata deployer.
+ * It looks for weld.xml in metadata.
+ *
+ * @param <T> exact metadata type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class WeldAwareMetadataDeployer<T> extends AbstractSimpleVFSRealDeployer<T>
+{
+   /** Do we allow null weld xml file */
+   private boolean optionalWeldXml;
+
+   protected WeldAwareMetadataDeployer(Class<T> input, boolean isInputModified)
+   {
+      super(input);
+      setStage(DeploymentStages.POST_PARSE);
+      if (isInputModified)
+         addOutput(input); // we also modify input
+   }
+
+   public void deploy(VFSDeploymentUnit unit, T deployment) throws DeploymentException
+   {
+      VirtualFile wbXml = unit.getMetaDataFile("beans.xml");
+      if (wbXml != null || optionalWeldXml)
+         internalDeploy(unit, deployment, wbXml);
+   }
+
+   /**
+    * Deploy.
+    *
+    * @param unit the deployment unit
+    * @param deployment the deployment metadata
+    * @param wbXml web beans xml
+    * @throws DeploymentException for any deployment error
+    */
+   protected abstract void internalDeploy(VFSDeploymentUnit unit, T deployment, VirtualFile wbXml) throws DeploymentException;
+
+   /**
+    * Set optional wb xml file.
+    *
+    * @param optionalWeldXml the optional wb xml file flag
+    */
+   public void setOptionalWeldXml(boolean optionalWeldXml)
+   {
+      this.optionalWeldXml = optionalWeldXml;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,118 @@
+/*
+ * 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.metadata;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Handle classloading metadata creation.
+ *
+ * @param <T> exact metadata type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class WeldClassloadingDeployer<T> extends WeldAwareMetadataDeployer<T>
+{
+   /** Whether to isolated deployments */
+   private boolean isolated = true;
+
+   protected WeldClassloadingDeployer(Class<T> input)
+   {
+      super(input, false);
+      addInput(ClassLoadingMetaData.class);
+      addOutput(ClassLoadingMetaData.class);
+   }
+
+   protected void internalDeploy(VFSDeploymentUnit unit, T deployment, VirtualFile wbXml) throws DeploymentException
+   {
+      ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+      if (classLoadingMetaData != null)
+         return;
+
+      if (isClassLoadingMetadataPresent(deployment))
+         return;
+
+      if (isIsolated(unit, wbXml) == false)
+         return;
+
+      String domain = getJMXName(deployment, unit) + ",extension=LoaderRepository";
+      classLoadingMetaData = new ClassLoadingMetaData();
+      classLoadingMetaData.setName(unit.getName());
+      classLoadingMetaData.setDomain(domain);
+      classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
+      classLoadingMetaData.setImportAll(true);
+      classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
+      classLoadingMetaData.setJ2seClassLoadingCompliance(false);
+
+      unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+   }
+
+   /**
+    * Is cl metadata already present.
+    *
+    * @param deployment the metadata deployment
+    * @return true if cl metadata already exists
+    */
+   protected abstract boolean isClassLoadingMetadataPresent(T deployment);
+
+   /**
+    * Should we isolate deployment.
+    *
+    * @param unit the deployment unit
+    * @param wbXml weld xml
+    * @return true is deployment shouold be isolated, false otherwise
+    */
+   protected boolean isIsolated(VFSDeploymentUnit unit, VirtualFile wbXml)
+   {
+      return isIsolated();
+   }
+
+   /**
+    * Get jmx name.
+    *
+    * @param metaData the metadata
+    * @param unit the deployment unit
+    * @return deployment's jmx name
+    */
+   protected abstract String getJMXName(T metaData, DeploymentUnit unit);
+
+   /**
+    * @return whether ear deployments should be isolated
+    */
+   public boolean isIsolated()
+   {
+      return isolated;
+   }
+
+   /**
+    * @param isolated whether ear deployments should be isolated
+    */
+   public void setIsolated(boolean isolated)
+   {
+      this.isolated = isolated;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,149 @@
+/*
+ * 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.metadata;
+
+import java.util.Iterator;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorBindingMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorBindingsMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorClassesMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Adds wb custom interceptor to ejb deployments.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at SuppressWarnings("deprecation")
+public class WeldEjbInterceptorMetadataDeployer extends WeldAwareMetadataDeployer<JBossMetaData>
+{
+   public static final String CONTEXT_INTERCEPTOR_CLASS_NAME = "org.jboss.weld.integration.ejb.SessionBeanInterceptor";
+   public static final String BINDINGS_INTERCEPTOR_CLASS_NAME = "org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor";
+
+   private InterceptorMetaData SBI;
+   private InterceptorMetaData BIND;
+   private InterceptorBindingMetaData CONTEXT_IBMD;
+   private InterceptorBindingMetaData BINDINGS_IMDB;
+
+
+   public WeldEjbInterceptorMetadataDeployer()
+   {
+      super(JBossMetaData.class, true);
+      
+      addInput(DeployersUtils.WELD_FILES);
+      addInput("merged." + JBossMetaData.class.getName());
+      setStage(DeploymentStages.POST_CLASSLOADER);
+
+      // create interceptor metadata instance for session beans
+      SBI = new InterceptorMetaData();
+      SBI.setInterceptorClass(CONTEXT_INTERCEPTOR_CLASS_NAME);
+
+      // create interceptor metadata instance for JSR-299 specific bindings
+      BIND = new InterceptorMetaData();
+      BIND.setInterceptorClass(BINDINGS_INTERCEPTOR_CLASS_NAME);
+
+      // create interceptor binding metadata instance
+      CONTEXT_IBMD = createInterceptorBindingMetadata(CONTEXT_INTERCEPTOR_CLASS_NAME);
+      BINDINGS_IMDB = createInterceptorBindingMetadata(BINDINGS_INTERCEPTOR_CLASS_NAME);
+
+   }
+
+   private InterceptorBindingMetaData createInterceptorBindingMetadata(String interceptorClassName)
+   {
+      InterceptorBindingMetaData ibmd = new InterceptorBindingMetaData();
+      InterceptorClassesMetaData interceptorClasses = new InterceptorClassesMetaData();
+      interceptorClasses.add(interceptorClassName);
+      ibmd.setInterceptorClasses(interceptorClasses);
+      ibmd.setEjbName("*");
+      return ibmd;
+   }
+
+   protected void internalDeploy(VFSDeploymentUnit unit, JBossMetaData jbmd, VirtualFile wbXml) throws DeploymentException
+   {
+      InterceptorsMetaData interceptors = jbmd.getInterceptors();
+      if (interceptors == null)
+      {
+         InterceptorsMetaData imd = new InterceptorsMetaData();
+         imd.add(SBI);
+         imd.add(BIND);
+         EjbJar3xMetaData ejmd = new EjbJar30MetaData();
+         ejmd.setInterceptors(imd);
+
+         jbmd.merge(null, ejmd);
+      }
+      else
+      {
+         interceptors.add(SBI); // clone?
+         interceptors.add(BIND);
+      }
+
+      JBossAssemblyDescriptorMetaData assemblyDescriptor = jbmd.getAssemblyDescriptor();
+      if (assemblyDescriptor == null)
+      {
+         assemblyDescriptor = new JBossAssemblyDescriptorMetaData();
+         jbmd.setAssemblyDescriptor(assemblyDescriptor);
+      }
+      InterceptorBindingsMetaData interceptorBindings = assemblyDescriptor.getInterceptorBindings();
+      if (interceptorBindings == null)
+      {
+         interceptorBindings = new InterceptorBindingsMetaData();
+         assemblyDescriptor.setInterceptorBindings(interceptorBindings);
+      }
+      // Add this as the first binding in the list so that it is called first...
+      interceptorBindings.add(0, CONTEXT_IBMD); // clone?
+
+      //Add JSR-299 binding interceptor as the last (all others have to be called first)
+      interceptorBindings.add(BINDINGS_IMDB);
+
+      // Check to see there is a defined order; if we aren't first, warn
+      for (InterceptorBindingMetaData interceptorBinding : interceptorBindings)
+      {
+         if (interceptorBinding.getInterceptorOrder() != null && ! interceptorBinding.getInterceptorOrder().isEmpty())
+         {
+            if (!CONTEXT_INTERCEPTOR_CLASS_NAME.equals(interceptorBinding.getInterceptorOrder().iterator().next()))
+            {
+               log.warn("The Web Beans SessionnBeanInterceptor is not the inner most EJB interceptor in this deployment. JSR299 injection may not work correctly. Specify " + CONTEXT_INTERCEPTOR_CLASS_NAME + " as the first interceptor in the interceptor ordering for " + interceptorBinding.getEjbName());
+            }
+            // TODO automagically make ours the first?
+            Object lastInterceptorClassName;
+            Iterator<String> iterator = interceptorBinding.getInterceptorOrder().iterator();
+            do {
+               lastInterceptorClassName = iterator.next();
+            } while (iterator.hasNext());
+            if (!BINDINGS_INTERCEPTOR_CLASS_NAME.equals(lastInterceptorClassName))
+            {
+               log.warn("The Web Beans Jsr299BindingsInterceptor is not the outer most EJB interceptor in this deployment. JSR299 requires that @InterceptorBinding-bound interceptors should execute after @Interceptors-registered interceptors. Specify " + BINDINGS_INTERCEPTOR_CLASS_NAME + " as the last interceptor in the interceptor ordering for " + interceptorBinding.getEjbName());
+            }
+         }
+      }
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,127 @@
+/*
+ * 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.metadata;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+import org.jboss.weld.integration.deployer.ext.JBossWeldMetaData;
+
+/**
+ * A deployer that collects all beans.xml files in deployment unit
+ * and keeps them under WEB_BEANS_FILES constant.
+ * It also collects wb's matching classpaths, under WEB_BEANS_CLASSPATH const.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldFilesDeployer extends AbstractOptionalVFSRealDeployer<JBossWeldMetaData>
+{
+   public WeldFilesDeployer()
+   {
+      super(JBossWeldMetaData.class);
+      addOutput(DeployersUtils.WELD_FILES);
+      addOutput(DeployersUtils.WELD_CLASSPATH);
+      setStage(DeploymentStages.POST_PARSE);
+   }
+
+   public void deploy(VFSDeploymentUnit unit, JBossWeldMetaData deployment) throws DeploymentException
+   {
+      List<VirtualFile> wbFiles = new ArrayList<VirtualFile>();
+      List<VirtualFile> cpFiles = new ArrayList<VirtualFile>();
+      try
+      {
+         if (deployment != null)
+         {
+            // do some custom stuff
+         }
+
+         Iterable<VirtualFile> classpaths = getClassPaths(unit);
+         for (VirtualFile cp : classpaths)
+         {
+            VirtualFile wbXml = cp.getChild("META-INF/beans.xml");
+            if (wbXml != null)
+            {
+               // add url
+               wbFiles.add(wbXml);
+               // add classes
+               cpFiles.add(cp);
+            }
+         }
+
+         // handle war slightly different
+         VirtualFile warWbXml = unit.getFile("WEB-INF/beans.xml");
+         if (warWbXml != null)
+         {
+            wbFiles.add(warWbXml);
+
+            VirtualFile classes = unit.getFile("WEB-INF/classes");
+            if (classes != null)
+               cpFiles.add(classes);
+         }
+
+         if (wbFiles.isEmpty() == false)
+            unit.addAttachment(DeployersUtils.WELD_FILES, wbFiles, Collection.class);
+         if (cpFiles.isEmpty() == false)
+            unit.addAttachment(DeployersUtils.WELD_CLASSPATH, cpFiles, Collection.class);
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot WBD files/classpath.", e);
+      }
+   }
+
+   /**
+    * Get the matching class paths that belong to this deployment unit.
+    *
+    * @param unit the deployment unit
+    * @return matching class paths
+    * @throws Exception for any error
+    */
+   protected Iterable<VirtualFile> getClassPaths(VFSDeploymentUnit unit) throws Exception
+   {
+      List<VirtualFile> classpath = unit.getClassPath();
+      if (classpath != null && classpath.isEmpty() == false)
+      {
+         List<VirtualFile> matching = new ArrayList<VirtualFile>();
+         VirtualFile root = unit.getRoot();
+         for (VirtualFile cp : classpath)
+         {
+            VirtualFile check = cp;
+            while (check != null && check.equals(root) == false)
+               check = check.getParent();
+
+            if (check != null)
+               matching.add(cp);
+         }
+         return matching;
+      }
+      return Collections.emptySet();
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,24 @@
+package org.jboss.weld.integration.injection;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.context.spi.CreationalContext;
+
+/**
+ * Helper class for injecting Web Beans into non-contextual objects
+ *
+ * @author Marius Bogoevici
+ */
+public class NonContextualObjectInjectionHelper
+{
+   @SuppressWarnings("unchecked")
+   public static void injectNonContextualInstance(Object instance, BeanManager beanManager)
+   {
+      if (beanManager == null)
+         throw new IllegalArgumentException("Null bean manager.");
+
+      CreationalContext<Object> creationalContext =  beanManager.createCreationalContext(null);
+      InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) beanManager.createInjectionTarget(beanManager.createAnnotatedType(instance.getClass()));
+      injectionTarget.inject(instance, creationalContext);
+   }
+}

Added: projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java
===================================================================
--- projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,44 @@
+package org.jboss.weld.integration.injection;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.injection.Injector;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
+import org.jboss.weld.integration.deployer.env.helpers.BootstrapBean;
+
+/**
+ * Injector for injecting Web Beans into Servlets and other Web Artifacts
+ *
+ * @author Marius Bogoevici
+ */
+public class WeldInjector implements Injector
+{
+   private BootstrapBean bootstrapBean;
+
+   public WeldInjector(BootstrapBean bootstrapBean)
+   {
+      if (bootstrapBean == null)
+         throw new IllegalArgumentException("Null bootstrap bean");
+
+      this.bootstrapBean = bootstrapBean;
+   }
+
+   public Class getInjectionClass()
+   {
+      return null;
+   }
+
+   public void inject(BeanContext ctx)
+   {
+      //no-op
+   }
+
+   public void inject(Object instance)
+   {
+      // assume that the deployment is flat. If this changes, the servlet context
+      // needs to be passed along
+      ServletServices services = bootstrapBean.getDeployment().getServices().get(ServletServices.class);
+      BeanDeploymentArchive beanDeploymentArchive = services.getBeanDeploymentArchive(null);
+      NonContextualObjectInjectionHelper.injectNonContextualInstance(instance, bootstrapBean.getBootstrap().getManager(beanDeploymentArchive));
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,67 @@
+/*
+ * 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.test.deployers;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.test.BootDeployerTestCase;
+import org.jboss.test.deployers.test.CLIsolationTestCase;
+import org.jboss.test.deployers.test.FlatDeploymentTestCase;
+import org.jboss.test.deployers.test.PostDeployersTestCase;
+import org.jboss.test.deployers.test.SmokeTestCase;
+import org.jboss.test.deployers.test.WeldDiscoveryEnvTestCase;
+
+/**
+ * VFS deployers tests.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class VFSTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Deployers Weld Tests");
+
+      // Smoke
+      suite.addTest(SmokeTestCase.suite());
+
+      // Post metadata modification
+      suite.addTest(PostDeployersTestCase.suite());
+      suite.addTest(CLIsolationTestCase.suite());
+
+      // Bootstrap creation
+      suite.addTest(WeldDiscoveryEnvTestCase.suite());
+      suite.addTest(FlatDeploymentTestCase.suite());
+
+      // Bootstrap bean
+      suite.addTest(BootDeployerTestCase.suite());
+
+      return suite;
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.deployers.support;
+
+import org.jboss.weld.bootstrap.api.Bootstrap;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface CheckableBootstrap extends Bootstrap
+{
+   boolean isCreate();
+
+   boolean isBoot();
+
+   boolean isShutdown();
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,89 @@
+/*
+ * 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.test.deployers.support;
+
+import java.util.Collections;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbServices implements EjbServices
+{
+   public void setDeploymentUnit(DeploymentUnit unit)
+   {
+   }
+
+   public Object resolveEjb(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public Object resolvePersistenceContext(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public Object resolveResource(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+
+   public void removeEjb(Object instance)
+   {
+   }
+
+   public SessionObjectReference resolveEjb(EjbDescriptor<?> descriptor)
+   {
+      return null;
+   }
+
+   public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings)
+   {
+      // do nothing
+   }
+
+   public Iterable<EjbDescriptor<?>> getEjbs()
+   {
+      return Collections.emptySet();
+   }
+
+   public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+   {
+      return null;
+   }
+
+   public Iterable<String> getEjbContainerNames()
+   {
+	   return Collections.singleton("EjbContainer#1");
+   }
+   
+   public void cleanup() {}
+   
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.deployers.support;
+
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEmptyEjbServices extends MockEjbServices
+{
+   public Iterable<String> getEjbContainerNames()
+   {
+	   return Collections.emptySet();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.deployers.support;
+
+import javax.transaction.Synchronization;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockTransactionServices implements TransactionServices
+{
+   public boolean isTransactionActive()
+   {
+      return false;
+   }
+
+   public void registerSynchronization(Synchronization synchronizedObserver)
+   {
+   }
+   
+   public UserTransaction getUserTransaction()
+   {
+      return null;
+   }
+   
+   public void cleanup() {}
+   
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,113 @@
+/*
+ * 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.test.deployers.support;
+
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environment;
+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.manager.api.WeldManager;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWeldBootstrap implements CheckableBootstrap
+{
+   private boolean create;
+   private boolean startInit;
+   private boolean shutdown;
+   private boolean validateBeans;
+   private boolean endInit;
+   private boolean deployBeans;
+
+   public MockWeldBootstrap()
+   {
+      System.out.println(">>>>>>>>>>>>>>>>>> " + getClass());
+      System.out.println(">>>>>>>>>>>>>>>>>> " + getClass().getClassLoader());
+   }
+   
+   public void initialize()
+   {
+      startContainer(null, null, null);
+   }
+   
+   public void boot()
+   {
+      startInitialization().deployBeans().validateBeans().endInitialization();
+   }
+
+   public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore)
+   {
+      create = true;
+      return this;
+   }
+
+   public WeldManager getManager(BeanDeploymentArchive beanDeploymentArchive)
+   {
+      return null;
+   }
+
+   public void shutdown()
+   {
+      shutdown = true;
+   }
+
+   public boolean isCreate()
+   {
+      return create;
+   }
+
+   public boolean isBoot()
+   {
+      return startInit && deployBeans && validateBeans && endInit;
+   }
+
+   public boolean isShutdown()
+   {
+      return shutdown;
+   }
+
+   public Bootstrap deployBeans()
+   {
+      this.deployBeans = true;
+      return this;
+   }
+
+   public Bootstrap endInitialization()
+   {
+      this.endInit = true;
+      return this;
+   }
+
+   public Bootstrap startInitialization()
+   {
+      this.startInit = true;
+      return this;
+   }
+
+   public Bootstrap validateBeans()
+   {
+      this.validateBeans = true;
+      return this;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,67 @@
+/*
+ * 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.test.deployers.support;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldDEWrapper
+{
+   protected final Deployment deployment;
+
+   public WeldDEWrapper(Deployment deployment)
+   {
+      this.deployment = deployment;
+   }
+
+   public Iterable<Class<?>> discoverWebBeanClasses()
+   {
+      Set<Class<?>> result = new HashSet<Class<?>>();
+      Collection<BeanDeploymentArchive> bdas = deployment.getBeanDeploymentArchives();
+      for (BeanDeploymentArchive bda : bdas)
+      {
+         for (Class<?> clazz : bda.getBeanClasses())
+            result.add(clazz);
+      }
+      return result;
+   }
+
+   public Iterable<URL> discoverWeldXml()
+   {
+      Set<URL> result = new HashSet<URL>();
+      Collection<BeanDeploymentArchive> bdas = deployment.getBeanDeploymentArchives();
+      for (BeanDeploymentArchive bda : bdas)
+      {
+         for (URL url : bda.getBeansXml())
+            result.add(url);
+      }
+      return result;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.crm;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class CrmWebBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,93 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+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.AbstractBootstrapInfoDeployer;
+import org.jboss.weld.integration.deployer.env.BootstrapInfo;
+
+/**
+ * Mock wb boot deployer.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockBootDeployer extends AbstractBootstrapInfoDeployer
+{
+   public MockBootDeployer()
+   {
+      super(false);
+      setDisableOptional(true);
+      addOutput(BeanMetaData.class);
+   }
+
+   public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      ValueMetaData ejbServicesValue = info.getEjbServices();
+      if (ejbServicesValue == null)
+         throw new DeploymentException("Missing ejb services: " + unit);
+
+      ValueMetaData deploymentValue = info.getDeployment();
+      if (deploymentValue == null)
+         throw new DeploymentException("Missing deployment: " + unit);
+
+      String unitName = unit.getName();
+      String envName = unitName + "_JBossWebBeanDiscovery";
+      BeanMetaDataBuilder envWrapper = BeanMetaDataBuilder.createBuilder(envName, "org.jboss.test.deployers.support.WBDEWrapper");
+      envWrapper.addConstructorParameter(Deployment.class.getName(), deploymentValue);
+      unit.addAttachment(envName + "_" + BeanMetaData.class.getSimpleName(), envWrapper.getBeanMetaData());
+
+      String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
+      BeanMetaDataBuilder bootstrap = BeanMetaDataBuilder.createBuilder(bootstrapName, "org.jboss.test.deployers.support.MockWBBootstrap");
+      bootstrap.setCreate("initialize");
+      bootstrap.setStart("boot");
+      bootstrap.setDestroy("shutdown");
+      bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
+      // call dynamic dependency creator for EJBs
+      ParameterMetaDataBuilder install = bootstrap.addInstallWithParameters("createDepenencies", "DynamicDependencyCreator", null, ControllerState.CONFIGURED);
+      install.addParameterMetaData(Object.class.getName(), bootstrapName);
+      install.addParameterMetaData(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbContainerNames"));
+      install.addParameterMetaData(String.class.getName(), "Start");
+      install.addParameterMetaData(String.class.getName(), "Start");
+      
+      unit.addAttachment(bootstrapName + "_" + BeanMetaData.class.getSimpleName(), bootstrap.getBeanMetaData());
+   }
+
+   /**
+    * Create new bean store.
+    *
+    * @return the bean store instance
+    */
+   protected BeanStore createBeanStore()
+   {
+      return new ConcurrentHashMapBeanStore();
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,51 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+
+/**
+ * Copy ejb-jar md to jboss md.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockCopyJBossDeployer extends AbstractSimpleRealDeployer<EjbJarMetaData>
+{
+   public MockCopyJBossDeployer()
+   {
+      super(EjbJarMetaData.class);
+      addOutput(JBossMetaData.class);
+      setStage(DeploymentStages.POST_PARSE);
+   }
+
+   public void deploy(DeploymentUnit unit, EjbJarMetaData deployment) throws DeploymentException
+   {
+      JBossMetaData jbmd = new JBossMetaData();
+      jbmd.merge(null, deployment);
+      unit.addAttachment(JBossMetaData.class, jbmd);
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,61 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Mock adding weld-core.jar to classpath.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockCoreIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
+{
+   public MockCoreIntegrationDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setTopLevelOnly(true);
+      setIntegrationURLs(getURLs());
+   }
+
+   @Override
+   protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+   {
+      return DeployersUtils.checkForWeldFiles(unit);
+   }
+
+   protected Set<URL> getURLs()
+   {
+      ProtectionDomain pd = getClass().getProtectionDomain();
+      CodeSource cs = pd.getCodeSource();
+      return Collections.singleton(cs.getLocation());
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock ejb-jar.xml parser.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbJarDeployer extends AbstractVFSParsingDeployer<EjbJarMetaData>
+{
+   public MockEjbJarDeployer()
+   {
+      super(EjbJarMetaData.class);
+      setName("ejb-jar.xml");
+   }
+
+   protected EjbJarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EjbJarMetaData root) throws Exception
+   {
+      return new EjbJar30MetaData();
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,53 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Mock adding weld-core.jar to classpath.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockFacesIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
+{
+   public MockFacesIntegrationDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
+      setIntegrationURLs(getURLs());
+   }
+
+   protected Set<URL> getURLs()
+   {
+      ProtectionDomain pd = getClass().getProtectionDomain();
+      CodeSource cs = pd.getCodeSource();
+      return Collections.singleton(cs.getLocation());
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,48 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBoss50AppMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock application.properties parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossAppDeployer extends AbstractVFSParsingDeployer<JBossAppMetaData>
+{
+   public MockJBossAppDeployer()
+   {
+      super(JBossAppMetaData.class);
+      setTopLevelOnly(true);
+      setName("application.properties");
+   }
+
+   protected JBossAppMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossAppMetaData root) throws Exception
+   {
+      return new JBoss50AppMetaData();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock jboss.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossDeployer extends AbstractVFSParsingDeployer<JBossMetaData>
+{
+   public MockJBossDeployer()
+   {
+      super(JBossMetaData.class);
+      setName("jboss.xml");
+   }
+
+   protected JBossMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossMetaData root) throws Exception
+   {
+      return new JBossMetaData();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock jboss-web.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossWebDeployer extends AbstractVFSParsingDeployer<JBossWebMetaData>
+{
+   public MockJBossWebDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setName("jboss-web.xml");
+   }
+
+   protected JBossWebMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebMetaData root) throws Exception
+   {
+      return new JBossWebMetaData();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,51 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+
+/**
+ * Mock merge ejbjar md --> jboss md deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockMergeJBossDeployer extends AbstractSimpleRealDeployer<EjbJarMetaData>
+{
+   public MockMergeJBossDeployer()
+   {
+      super(EjbJarMetaData.class);
+      addOutput(JBossMetaData.class);
+      setStage(DeploymentStages.POST_CLASSLOADER);
+   }
+
+   public void deploy(DeploymentUnit unit, EjbJarMetaData deployment) throws DeploymentException
+   {
+      JBossMetaData jbmd = new JBossMetaData();
+      jbmd.merge(null, deployment);
+      unit.addAttachment(JBossMetaData.class, jbmd);
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,61 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.weld.integration.deployer.cl.WeldUrlIntegrationDeployer;
+import org.jboss.weld.integration.deployer.ext.JBossWeldMetaData;
+
+/**
+ * Mock war classloader deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockUrlIntegrationDeployer extends WeldUrlIntegrationDeployer<JBossWeldMetaData>
+{
+   public MockUrlIntegrationDeployer()
+   {
+      super(JBossWeldMetaData.class);
+   }
+
+   protected String getShortLibName()
+   {
+      return "<ignore>";
+   }
+
+   @Override
+   protected Set<URL> getURLs()
+   {
+      try
+      {
+         URL url = getClass().getProtectionDomain().getCodeSource().getLocation();
+         return Collections.singleton(url);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,171 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import java.io.ByteArrayInputStream;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.common.jboss.LoaderRepositoryConfigMetaData;
+import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Mock war classloader deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWarClassLoaderDeployer extends AbstractSimpleVFSRealDeployer<JBossWebMetaData>
+{
+   /** The parent class loader first model flag */
+   private boolean java2ClassLoadingCompliance = false;
+
+   /** Package names that should be ignored for class loading */
+   private String filteredPackages;
+
+   /**
+    * Create a new WarClassLoaderDeployer.
+    */
+   public MockWarClassLoaderDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setStage(DeploymentStages.POST_PARSE);
+      addInput(ClassLoadingMetaData.class);
+      setOutput(ClassLoadingMetaData.class);
+   }
+
+   public boolean isJava2ClassLoadingCompliance()
+   {
+      return java2ClassLoadingCompliance;
+   }
+
+   public void setJava2ClassLoadingCompliance(boolean flag)
+   {
+      this.java2ClassLoadingCompliance = flag;
+   }
+
+   public String getFilteredPackages()
+   {
+      return filteredPackages;
+   }
+   public void setFilteredPackages(String pkgs)
+   {
+      this.filteredPackages = pkgs;
+   }
+
+   @Override
+   public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData) throws DeploymentException
+   {
+      // Ignore if it already has classloading
+      if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
+         return;
+
+      // The default domain name is the unit name
+      String domainName = unit.getName();
+
+      // The default classloading compliance is on the deployer
+      boolean j2seClassLoadingCompliance = java2ClassLoadingCompliance;
+
+      // Do we have a legacy classloading element?
+      org.jboss.metadata.web.jboss.ClassLoadingMetaData webCLMD = metaData.getClassLoading();
+      if (webCLMD != null)
+      {
+         // Was the complince set?
+         if (webCLMD.wasJava2ClassLoadingComplianceSet())
+            j2seClassLoadingCompliance = webCLMD.isJava2ClassLoadingCompliance();
+
+         // Does it have a loader repository
+         LoaderRepositoryMetaData lrmd = webCLMD.getLoaderRepository();
+         if (lrmd != null)
+         {
+            // Use the trimmed repository name as the domain
+            String repositoryName = lrmd.getName();
+            if (repositoryName != null)
+            {
+               repositoryName = repositoryName.trim();
+               if (repositoryName != null)
+               {
+                  domainName = repositoryName;
+
+                  // If there was no compliance set see if the loader repository has one
+                  if (webCLMD.wasJava2ClassLoadingComplianceSet() == false)
+                  {
+                     Set<LoaderRepositoryConfigMetaData> configs = lrmd.getLoaderRepositoryConfig();
+                     if (configs != null && configs.isEmpty() == false)
+                     {
+                        LoaderRepositoryConfigMetaData lrcmd = configs.iterator().next();
+
+                        Properties props = new Properties();
+                        String config = lrcmd.getConfig();
+                        try
+                        {
+                           if (config != null)
+                           {
+                              ByteArrayInputStream bais = new ByteArrayInputStream(config.getBytes());
+                              props.load(bais);
+                           }
+                        }
+                        catch (Exception e)
+                        {
+                           throw DeploymentException.rethrowAsDeploymentException("Error parsing repository config " + config, e);
+                        }
+                        String java2ParentDelegation = props.getProperty("java2ParentDelegation");
+                        if( java2ParentDelegation == null )
+                        {
+                           // Check for previous mis-spelled property name
+                           java2ParentDelegation = props.getProperty("java2ParentDelegaton", "false");
+                        }
+                        j2seClassLoadingCompliance = Boolean.valueOf(java2ParentDelegation);
+                     }
+                  }
+               }
+            }
+         }
+      }
+
+      // Create a classloading metadata
+      // NOTE: Don't explicitly set the parentDomain otherwise it will create a top level classloader
+      //       for subdeployments rather than a classloader hanging off the main deployment's classloader
+      ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+      classLoadingMetaData.setName(unit.getName());
+      classLoadingMetaData.setDomain(domainName);
+      classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
+      classLoadingMetaData.setImportAll(true);
+      classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
+      classLoadingMetaData.setJ2seClassLoadingCompliance(j2seClassLoadingCompliance);
+      if (filteredPackages != null)
+      {
+         ClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString(filteredPackages);
+         classLoadingMetaData.setExcluded(filter);
+      }
+      unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.deployers.support.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock web.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWebDeployer extends AbstractVFSParsingDeployer<JBossWebMetaData>
+{
+   public MockWebDeployer()
+   {
+      super(JBossWebMetaData.class);
+      setName("web.xml");
+   }
+
+   protected JBossWebMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebMetaData root) throws Exception
+   {
+      return new JBossWebMetaData();
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,30 @@
+/*
+ * 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.test.deployers.support.ejb;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface BusinessInterface
+{
+   int add(int x, int y);
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,33 @@
+/*
+ * 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.test.deployers.support.ejb;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MySLSBean implements BusinessInterface
+{
+   public int add(int x, int y)
+   {
+      return x + y;
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.ext;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ExternalWebBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.jar;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PlainJavaBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.jsf;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class NotWBJsfBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.ui;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class UIWebBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.util;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SomeUtil
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,29 @@
+/*
+ * 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.test.deployers.support.web;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ServletWebBean
+{
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,162 @@
+/*
+ * 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.test.deployers.test;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.support.MockEmptyEjbServices;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.BusinessInterface;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Abstract Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDeploymentTest extends AbstractWeldTest
+{
+   protected AbstractDeploymentTest(String name)
+   {
+      super(name);
+   }
+
+   protected void getArchives(List<BeanDeploymentArchive> result, Collection<BeanDeploymentArchive> archives)
+   {
+      for (BeanDeploymentArchive bda : archives)
+      {
+         result.add(bda);
+         getArchives(result, bda.getBeanDeploymentArchives());
+      }
+   }
+
+   protected abstract int getExpectedArchives();
+
+   public void testSimpleUsage() throws Exception
+   {
+      AssembledDirectory ear = createBasicEar(MockEmptyEjbServices.class);
+      VFSDeploymentUnit topUnit = assertDeploy(ear);
+      try
+      {
+         assertBean(DeployersUtils.getBootstrapBeanName(topUnit), null, Object.class);
+
+         Object bean = getBean(Deployment.class);
+         Deployment deployment = assertInstanceOf(bean, Deployment.class, false);
+
+         List<BeanDeploymentArchive> archives = new ArrayList<BeanDeploymentArchive>();
+         getArchives(archives, deployment.getBeanDeploymentArchives());
+         assertEquals(getExpectedArchives(), archives.size());
+
+         List<URL> urls = new ArrayList<URL>();
+         List<Class<?>> classes = new ArrayList<Class<?>>();
+         for (BeanDeploymentArchive bad : archives)
+         {
+            for (URL url : bad.getBeansXml())
+               urls.add(url);
+            for (Class<?> clazz : bad.getBeanClasses())
+               classes.add(clazz);
+         }
+
+         Set<String> expected = new HashSet<String>();
+         addExpectedResource(expected, "ejbs.jar");
+         addExpectedResource(expected, "ext.jar");
+         addExpectedResource(expected, "simple.jar");
+         addExpectedResource(expected, "ui.jar");
+         addExpectedResource(expected, "crm.jar");
+         addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
+
+         assertEquals("Illegal size or urls.", urls.size(), expected.size());
+
+         for (URL url : urls)
+         {
+            boolean found = false;
+            Iterator<String> iter = expected.iterator();
+            while (iter.hasNext())
+            {
+               String expectedURL = iter.next();
+               if (url.toExternalForm().contains(expectedURL))
+               {
+                  iter.remove();
+                  found = true;
+                  break;
+               }
+            }
+            assertTrue("Unexpected wb url: " + url, found);
+         }
+
+         addExpectedClass(expected, BusinessInterface.class);
+         addExpectedClass(expected, MySLSBean.class);
+         addExpectedClass(expected, ExternalWebBean.class);
+         addExpectedClass(expected, PlainJavaBean.class);
+         addExpectedClass(expected, UIWebBean.class);
+         addExpectedClass(expected, ServletWebBean.class);
+         addExpectedClass(expected, CrmWebBean.class);
+
+         assertEquals("Illegal size or classes.", classes.size(), expected.size());
+
+         for (Class<?> clazz : classes)
+            assertTrue(expected.remove(clazz.getName()));
+
+         assertEmpty("Should be emtpy, missing " + expected, expected);
+
+         Class<?> newBeanClass = topUnit.getClassLoader().loadClass("org.jboss.test.deployers.support.MockTransactionServices");
+         BeanDeploymentArchive newBDA = deployment.loadBeanDeploymentArchive(newBeanClass);
+         assertNewBeanDeploymentArchive(archives, newBDA);
+      }
+      finally
+      {
+         undeploy(topUnit);
+      }
+   }
+
+   protected abstract void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA);
+
+   private static void addExpectedResource(Set<String> expected, String unit)
+   {
+      addExpectedResource(expected, unit, "/META-INF/beans.xml");
+   }
+
+   private static void addExpectedResource(Set<String> expected, String unit, String suffix)
+   {
+      expected.add(unit + suffix);
+   }
+
+   private static void addExpectedClass(Set<String> expected, Class<?> clazz)
+   {
+      expected.add(clazz.getName());
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,196 @@
+/*
+ * 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.test.deployers.test;
+
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.jsf.NotWBJsfBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.util.SomeUtil;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.AssembledDirectory;
+
+/**
+ * AbstractWeldTest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractWeldTest extends BootstrapDeployersTest
+{
+   protected AbstractWeldTest(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      // excluding class that knows hot to load from system classloader
+      Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
+      excluded.add(BeanMetaDataFactoryVisitor.class);
+
+      super.setUp();
+   }
+
+   protected void assertInstanceOf(Object target, String className, ClassLoader cl) throws Exception
+   {
+      Class<?> clazz = cl.loadClass(className);
+      assertTrue(clazz.isInstance(target));
+   }
+
+   protected boolean invoke(Object target, String name) throws Exception
+   {
+      Method m = target.getClass().getMethod("is" + name);
+      return (Boolean)m.invoke(target);
+   }
+
+   protected AssembledDirectory createBasicEar() throws Exception
+   {
+      return createBasicEar(SomeUtil.class);
+   }
+
+   protected AssembledDirectory createBasicEar(Class<?> utilClass) throws Exception
+   {
+      AssembledDirectory ear = createTopLevelWithUtil(utilClass);
+
+      AssembledDirectory jar = ear.mkdir("simple.jar");
+      addPackage(jar, PlainJavaBean.class);
+      addPath(jar, "/weld/simple/jar", "META-INF");
+
+      AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
+      addPackage(ejbs, MySLSBean.class);
+      addPath(ejbs, "/weld/simple/ejb", "META-INF");
+
+      AssembledDirectory war = ear.mkdir("simple.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, ServletWebBean.class);
+      addPath(war, "/weld/simple/web", "WEB-INF");
+
+      AssembledDirectory lib = webinf.mkdir("lib");
+
+      AssembledDirectory uijar = lib.mkdir("ui.jar");
+      addPackage(uijar, UIWebBean.class);
+      addPath(uijar, "/weld/simple/ui", "META-INF");
+
+      // war w/o beans.xml
+
+      war = ear.mkdir("crm.war");
+      webinf = war.mkdir("WEB-INF");
+      classes = webinf.mkdir("classes");
+      addPackage(classes, NotWBJsfBean.class);
+
+      lib = webinf.mkdir("lib");
+
+      uijar = lib.mkdir("crm.jar");
+      addPackage(uijar, CrmWebBean.class);
+      addPath(uijar, "/weld/simple/crm", "META-INF");
+
+      enableTrace("org.jboss.deployers");
+
+      return ear;
+   }
+
+   protected AssembledDirectory createTopLevelWithUtil() throws Exception
+   {
+      return createTopLevelWithUtil("/weld/simple");
+   }
+
+   protected AssembledDirectory createTopLevelWithUtil(Class<?> utilClass) throws Exception
+   {
+      return createTopLevelWithUtil("/weld/simple", utilClass);
+   }
+
+   protected AssembledDirectory createTopLevelWithUtil(String path) throws Exception
+   {
+      return createTopLevelWithUtil(path, SomeUtil.class);
+   }
+
+   protected AssembledDirectory createTopLevelWithUtil(String path, Class<?> utilClass) throws Exception
+   {
+      AssembledDirectory topLevel = createAssembledDirectory("top-level.ear", "top-level.ear");
+      addPath(topLevel, path, "META-INF");
+
+      AssembledDirectory earLib = topLevel.mkdir("lib");
+
+      AssembledDirectory util = earLib.mkdir("util.jar");
+      addPackage(util, utilClass);
+
+      AssembledDirectory ext = earLib.mkdir("ext.jar");
+      addPackage(ext, ExternalWebBean.class);
+      addPath(ext, "/weld/simple/ext", "META-INF");
+
+      return topLevel;
+   }
+
+   protected AssembledDirectory createWarInEar() throws Exception
+   {
+      AssembledDirectory ear = createAssembledDirectory("war-in-ear.ear", "war-in-ear.ear");
+      addPath(ear, "/weld/warinear", "META-INF");
+
+      AssembledDirectory war = ear.mkdir("simple.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, ServletWebBean.class);
+      addPath(war, "/weld/simple/web", "WEB-INF");
+
+      return ear;
+   }
+
+   protected AssembledDirectory createJarInEar() throws Exception
+   {
+      AssembledDirectory ear = createAssembledDirectory("jar-in-ear.ear", "jar-in-ear.ear");
+      addPath(ear, "/weld/jarinear", "META-INF");
+
+      AssembledDirectory jar = ear.mkdir("simple.jar");
+      addPackage(jar, PlainJavaBean.class);
+      addPath(jar, "/weld/simple/jar", "META-INF");
+
+      return ear;
+   }
+
+   protected AssembledDirectory createWar(String warName, Class<?> reference) throws Exception
+   {
+      AssembledDirectory war = createAssembledDirectory(warName, warName);
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, reference);
+      addPath(war, "/weld/simple/web", "WEB-INF");
+      return war;
+   }
+
+   protected AssembledDirectory createEjbJar(String jarName, Class<?> reference) throws Exception
+   {
+      AssembledDirectory jar = createAssembledDirectory(jarName, jarName);
+      addPackage(jar, reference);
+      addPath(jar, "/weld/simple/ejb", "META-INF");
+      return jar;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,101 @@
+/*
+ * 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.test.deployers.test;
+
+import junit.framework.Test;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Test boot deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BootDeployerTestCase extends AbstractWeldTest
+{
+   public BootDeployerTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(BootDeployerTestCase.class);
+   }
+
+   protected void testBootstrap(VirtualFile ear) throws Exception
+   {
+      Object bootstrap;
+      Deployment deployment = createVFSDeployment(ear);
+      DeployerClient mainDeployer = getDeployerClient();
+      mainDeployer.addDeployment(deployment);
+      mainDeployer.process();
+      try
+      {
+         DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
+         String bootName = DeployersUtils.getBootstrapBeanName(earDU);
+         bootstrap = getBean(bootName, null);
+         assertInstanceOf(bootstrap, "org.jboss.test.deployers.support.CheckableBootstrap", earDU.getClassLoader());
+         // waiting on ejb
+         assertTrue(invoke(bootstrap, "Create"));
+         assertFalse(invoke(bootstrap, "Boot")); // not yet booted
+         assertFalse(invoke(bootstrap, "Shutdown"));
+         // install ejb
+         KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
+         try
+         {
+            assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
+            /// check boot
+            assertTrue(invoke(bootstrap, "Create"));
+            assertTrue(invoke(bootstrap, "Boot"));
+            assertFalse(invoke(bootstrap, "Shutdown"));
+         }
+         finally
+         {
+            undeploy(ejb);
+         }
+      }
+      finally
+      {
+         mainDeployer.removeDeployment(deployment);
+         mainDeployer.process();
+      }
+      assertTrue(invoke(bootstrap, "Shutdown"));
+   }
+
+   public void testEar() throws Exception
+   {
+      testBootstrap(createBasicEar());
+   }
+
+   public void testWarInEar() throws Exception
+   {
+      testBootstrap(createWarInEar());
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,132 @@
+/*
+ * 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.test.deployers.test;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.jsf.NotWBJsfBean;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * CL isolation tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class CLIsolationTestCase extends AbstractWeldTest
+{
+   public CLIsolationTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(CLIsolationTestCase.class);
+   }
+
+   protected void assertClassNotFound(String className, DeploymentUnit unit) throws Exception
+   {
+      ClassLoader cl = unit.getClassLoader();
+      try
+      {
+         Class<?> clazz = cl.loadClass(className);
+         fail("Should not be here: " + clazz.getClassLoader());
+      }
+      catch (ClassNotFoundException ignore)
+      {
+      }
+   }
+
+   protected void testIsolation(VirtualFile fst, String inFst, VirtualFile snd, String inSnd) throws Exception
+   {
+      Deployment deployment1 = createVFSDeployment(fst);
+      Deployment deployment2 = createVFSDeployment(snd);
+
+      DeployerClient mainDeployer = getDeployerClient();
+      mainDeployer.addDeployment(deployment1);
+      mainDeployer.addDeployment(deployment2);
+      mainDeployer.process();
+      try
+      {
+         DeploymentUnit du1 = getMainDeployerStructure().getDeploymentUnit(deployment1.getName());
+         assertLoadClass(inFst, du1.getClassLoader());
+         assertClassNotFound(inSnd, du1);
+
+         DeploymentUnit du2 = getMainDeployerStructure().getDeploymentUnit(deployment2.getName());
+         assertLoadClass(inSnd, du2.getClassLoader());
+         assertClassNotFound(inFst, du2);
+      }
+      finally
+      {
+         mainDeployer.removeDeployment(deployment2);
+         mainDeployer.removeDeployment(deployment1);
+         mainDeployer.process();
+      }
+   }
+
+   public void testTwoEars() throws Exception
+   {
+      VirtualFile ear1 = createTopLevelWithUtil("/weld/earwithutil");
+      VirtualFile ear2 = createJarInEar();
+      testIsolation(ear1, "org.jboss.test.deployers.support.util.SomeUtil", ear2, "org.jboss.test.deployers.support.jar.PlainJavaBean");
+   }
+
+   public void testTwoWars() throws Exception
+   {
+      VirtualFile war1 = createWar("w1.war", ServletWebBean.class);
+      VirtualFile war2 = createWar("w2.war", NotWBJsfBean.class);
+      testIsolation(war1, ServletWebBean.class.getName(), war2, NotWBJsfBean.class.getName());
+   }
+
+   public void testTwoJars() throws Exception
+   {
+      VirtualFile jar1 = createEjbJar("j1.jar", ServletWebBean.class);
+      VirtualFile jar2 = createEjbJar("j2.jar", NotWBJsfBean.class);
+      testIsolation(jar1, ServletWebBean.class.getName(), jar2, NotWBJsfBean.class.getName());
+   }
+
+   public void testWarEar() throws Exception
+   {
+      VirtualFile ear = createJarInEar();
+      VirtualFile war = createWar("w1.war", ServletWebBean.class);
+      testIsolation(ear, "org.jboss.test.deployers.support.jar.PlainJavaBean", war, ServletWebBean.class.getName());
+   }
+
+   public void testJarEar() throws Exception
+   {
+      VirtualFile ear = createJarInEar();
+      VirtualFile jar = createEjbJar("j1.jar", ServletWebBean.class);
+      testIsolation(ear, "org.jboss.test.deployers.support.jar.PlainJavaBean", jar, ServletWebBean.class.getName());
+   }
+
+   public void testJarWar() throws Exception
+   {
+      VirtualFile jar = createEjbJar("j1.jar", PlainJavaBean.class);
+      VirtualFile war = createWar("w1.war", ServletWebBean.class);
+      testIsolation(jar, PlainJavaBean.class.getName(), war, ServletWebBean.class.getName());
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,56 @@
+/*
+ * 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.test.deployers.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * Flat Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeploymentTestCase extends AbstractDeploymentTest
+{
+   public FlatDeploymentTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(FlatDeploymentTestCase.class);
+   }
+
+   protected int getExpectedArchives()
+   {
+      return 1; // flat only
+   }
+
+   protected void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA)
+   {
+      assertSame(newBDA, archives.iterator().next());
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,198 @@
+/*
+ * 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.test.deployers.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.common.ejb.IEjbJarMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ListenerMetaData;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.metadata.WeldEjbInterceptorMetadataDeployer;
+
+/**
+ * Test post deployers.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostDeployersTestCase extends AbstractWeldTest
+{
+   public PostDeployersTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(PostDeployersTestCase.class);
+   }
+
+   public void testSimpleJar() throws Exception
+   {
+      testJar("simple", false);
+   }
+
+   public void testPostJar() throws Exception
+   {
+      testJar("post", true);
+   }
+
+   public void testSimpleWar() throws Exception
+   {
+      testWar("simple", false, true);
+   }
+
+   public void testPostWar() throws Exception
+   {
+      testWar("post", true, false);
+   }
+
+   public void testEar() throws Exception
+   {
+      VirtualFile ear = createBasicEar();
+      DeploymentUnit earDU = assertDeploy(ear);
+      try
+      {
+         assertClassLoading(true, earDU);
+
+         DeploymentUnit jarDU = assertChild(earDU, "ejbs.jar");
+         assertWBInterceptor(jarDU);
+
+         DeploymentUnit webDU = assertChild(earDU, "simple.war");
+         assertWBListener(webDU);
+      }
+      finally
+      {
+         undeploy(earDU);
+      }
+   }
+
+   public void testWarWithNoWBFile() throws Exception
+   {
+      AssembledDirectory ear = createAssembledDirectory("top-level.ear", "top-level.ear");
+      addPath(ear, "/weld/warwowb", "META-INF");
+
+      AssembledDirectory war = ear.mkdir("simple.war");
+      addPath(war, "/weld/warwowb/web", "WEB-INF");
+
+      AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
+      addPath(ejbs, "/weld/warwowb/ejb", "META-INF");
+
+      DeploymentUnit topDU = assertDeploy(ear);
+      try
+      {
+         DeploymentUnit ejbDU = assertChild(topDU, "ejbs.jar");
+         assertWBInterceptor(ejbDU);
+
+         DeploymentUnit webDU = assertChild(topDU, "simple.war");
+         assertWBListener(webDU);
+      }
+      finally
+      {
+         undeploy(topDU);
+      }
+   }
+
+   protected void testJar(String type, boolean testCL) throws Exception
+   {
+      AssembledDirectory topLevel = createAssembledDirectory("ejbs.jar", "ejbs.jar");
+      addPath(topLevel, "/weld/" + type + "/ejb", "META-INF");
+
+      DeploymentUnit topDU = assertDeploy(topLevel);
+      try
+      {
+         assertClassLoading(testCL, topDU);
+         assertWBInterceptor(topDU);
+      }
+      finally
+      {
+         undeploy(topDU);
+      }
+   }
+
+   protected void testWar(String type, boolean testCL, boolean testListner) throws Exception
+   {
+      AssembledDirectory topLevel = createAssembledDirectory("web.war", "web.war");
+      addPath(topLevel, "/weld/" + type + "/web", "WEB-INF");
+
+      DeploymentUnit topDU = assertDeploy(topLevel);
+      try
+      {
+         if (testCL)
+            assertClassLoading(testCL, topDU);
+         if (testListner)
+            assertWBListener(topDU);
+      }
+      finally
+      {
+         undeploy(topDU);
+      }
+   }
+
+   protected void assertClassLoading(boolean equals, DeploymentUnit unit)
+   {
+      ClassLoadingMetaData clmd = unit.getAttachment(ClassLoadingMetaData.class);
+      assertNotNull(clmd);
+
+      ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+      classLoadingMetaData.setName(unit.getName());
+      classLoadingMetaData.setDomain(clmd.getDomain()); // hack, get domain from clmd
+      classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
+      classLoadingMetaData.setImportAll(true);
+      classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
+      classLoadingMetaData.setJ2seClassLoadingCompliance(false);
+
+      assertEquals(equals, clmd.equals(classLoadingMetaData));
+   }
+
+   protected void assertWBInterceptor(DeploymentUnit unit)
+   {
+      IEjbJarMetaData ejbmd = unit.getAttachment(JBossMetaData.class);
+      assertNotNull(ejbmd);
+      InterceptorsMetaData interceptors = ejbmd.getInterceptors();
+      assertNotNull(interceptors);
+      InterceptorMetaData imd = interceptors.get(WeldEjbInterceptorMetadataDeployer.CONTEXT_INTERCEPTOR_CLASS_NAME);
+      assertNotNull(imd);
+   }
+
+   protected void assertWBListener(DeploymentUnit unit)
+   {
+      JBossWebMetaData jbwmd = unit.getAttachment(JBossWebMetaData.class);
+      assertNotNull(jbwmd);
+      List<ListenerMetaData> listeners = jbwmd.getListeners();
+      assertNotNull(listeners);
+      assertEquals(2, listeners.size());
+      ListenerMetaData lmd = listeners.get(0);
+      assertNotNull(lmd);
+      assertEquals("org.jboss.weld.servlet.WeldListener", lmd.getListenerClass());
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,113 @@
+/*
+ * 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.test.deployers.test;
+
+import junit.framework.Test;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Smoke tests.
+ * Test non WB deployments work OK.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SmokeTestCase extends AbstractWeldTest
+{
+   public SmokeTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(SmokeTestCase.class);
+   }
+
+   protected void testDeployment(VirtualFile app) throws Exception
+   {
+      Deployment deployment = createVFSDeployment(app);
+
+      DeployerClient mainDeployer = getDeployerClient();
+      mainDeployer.addDeployment(deployment);
+      mainDeployer.process();
+      try
+      {
+         DeploymentUnit du = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
+         ControllerContext context = du.getAttachment(ControllerContext.class);
+         assertNotNull(context);
+         assertEquals(ControllerState.INSTALLED, context.getState());
+
+         // There should be no WB bootstrap bean
+         assertNoBean(DeployersUtils.getBootstrapBeanName(du), null);
+      }
+      finally
+      {
+         mainDeployer.removeDeployment(deployment);
+         mainDeployer.process();
+      }
+   }
+
+   public void testEar() throws Exception
+   {
+      AssembledDirectory ear = createAssembledDirectory("jar-in-ear.ear", "jar-in-ear.ear");
+      addPath(ear, "/weld/jarwarinear", "META-INF");
+
+      AssembledDirectory jar = ear.mkdir("simple.jar");
+      addPackage(jar, PlainJavaBean.class);
+
+      AssembledDirectory war = ear.mkdir("simple.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, PlainJavaBean.class);
+      addPath(war, "/weld/warwowb/web", "WEB-INF");
+
+      testDeployment(ear);
+   }
+
+   public void testWar() throws Exception
+   {
+      AssembledDirectory war = createAssembledDirectory("w1.war", "w1.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, PlainJavaBean.class);
+      addPath(war, "/weld/warwowb/web", "WEB-INF");
+
+      testDeployment(war);
+   }
+
+   public void testJar() throws Exception
+   {
+      AssembledDirectory jar = createAssembledDirectory("j1.jar", "j1.jar");
+      addPackage(jar, PlainJavaBean.class);
+
+      testDeployment(jar);
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java
===================================================================
--- projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,130 @@
+/*
+ * 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.test.deployers.test;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.BusinessInterface;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.weld.integration.deployer.env.WeldDiscoveryEnvironment;
+
+/**
+ * WeldDiscovery env test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WeldDiscoveryEnvTestCase extends AbstractWeldTest
+{
+   public WeldDiscoveryEnvTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(WeldDiscoveryEnvTestCase.class);
+   }
+
+   public void testSimpleUsage() throws Exception
+   {
+      VirtualFile ear = createBasicEar();
+      VFSDeploymentUnit topUnit = assertDeploy(ear);
+      try
+      {
+         WeldDiscoveryEnvironment wbDiscovery = topUnit.getAttachment(WeldDiscoveryEnvironment.class);
+         assertNotNull("Null WBDiscoveryEnv.", wbDiscovery);
+
+         Set<String> expected = new HashSet<String>();
+         addExpectedResource(expected, "ejbs.jar");
+         addExpectedResource(expected, "ext.jar");
+         addExpectedResource(expected, "simple.jar");
+         addExpectedResource(expected, "ui.jar");
+         addExpectedResource(expected, "crm.jar");
+         addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
+
+         assertNotNull(wbDiscovery);
+         
+         for (URL url : wbDiscovery.getWeldXml())
+         {
+            boolean found = false;
+            Iterator<String> iter = expected.iterator();
+            while (iter.hasNext())
+            {
+               String expectedURL = iter.next();
+               if (url.toExternalForm().contains(expectedURL))
+               {
+                  iter.remove();
+                  found = true;
+                  break;
+               }
+            }
+            assertTrue("Unexpected wb url: " + url, found);
+         }
+
+         assertEmpty("Should be emtpy, missing " + expected, expected);
+
+         addExpectedClass(expected, BusinessInterface.class);
+         addExpectedClass(expected, MySLSBean.class);
+         addExpectedClass(expected, ExternalWebBean.class);
+         addExpectedClass(expected, PlainJavaBean.class);
+         addExpectedClass(expected, UIWebBean.class);
+         addExpectedClass(expected, ServletWebBean.class);
+         addExpectedClass(expected, CrmWebBean.class);
+
+         for (Class<?> clazz : wbDiscovery.getWeldClasses())
+            assertTrue(expected.remove(clazz.getName()));
+
+         assertEmpty("Should be emtpy, missing " + expected, expected);
+      }
+      finally
+      {
+         undeploy(topUnit);
+      }
+   }
+
+   private static void addExpectedResource(Set<String> expected, String unit)
+   {
+      addExpectedResource(expected, unit, "/META-INF/beans.xml");
+   }
+
+   private static void addExpectedResource(Set<String> expected, String unit, String suffix)
+   {
+      expected.add(unit + suffix);
+   }
+
+   private static void addExpectedClass(Set<String> expected, Class<?> clazz)
+   {
+      expected.add(clazz.getName());
+   }
+}

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,36 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <bean name="JWBMDDeployer" class="org.jboss.weld.integration.deployer.ext.JBossWeldMetaDataDeployer"/>
+  <bean name="WBFilesDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
+  <bean name="WBDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.WeldDiscoveryDeployer"/>
+
+  <bean name="DynamicDependencyCreator" class="org.jboss.weld.integration.deployer.env.DynamicDependencyCreator">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+  <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+  <bean name="MockUrlIntDeployer" class="org.jboss.test.deployers.support.deployer.MockCoreIntegrationDeployer"/>
+
+  <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer">
+    <property name="ejbServicesClassName">org.jboss.test.deployers.support.MockEjbServices</property>
+  </bean>
+
+  <bean name="DeploymentDeployer" class="org.jboss.weld.integration.deployer.env.FlatDeploymentDeployer"/>
+
+  <bean name="BootDeployer" class="org.jboss.test.deployers.support.deployer.MockBootDeployer"/>
+
+  <!-- Mock EJB utils -->
+
+  <beanfactory name="JBossEjbServices" class="org.jboss.test.deployers.support.MockEjbServices"/>
+
+  <bean name="JBossTransactionServices" class="org.jboss.test.deployers.support.MockTransactionServices"/>
+
+  <bean name="RealTransactionManager" class="java.lang.Object"/>
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,19 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <bean name="JWBMDDeployer" class="org.jboss.weld.integration.deployer.ext.JBossWeldMetaDataDeployer"/>
+  <bean name="WeldFilesDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
+
+  <bean name="EarCLIsolationDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossAppMetadataDeployer"/>
+  <bean name="JarCLIsolationDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+  <bean name="WarCLIsolationDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+
+  <bean name="JBAppMDDeployer" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+  <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+  <bean name="EjbJarDeployer" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+  <bean name="EjbMergeDeployer" class="org.jboss.test.deployers.support.deployer.MockCopyJBossDeployer"/>
+  <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,30 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <bean name="JWBMDDeployer" class="org.jboss.weld.integration.deployer.ext.JBossWeldMetaDataDeployer"/>
+  <bean name="WeldFilesDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
+  <bean name="WeldDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.WeldDiscoveryDeployer"/>
+
+  <beanfactory name="JBossEjbServices" class="org.jboss.test.deployers.support.MockEmptyEjbServices"/>
+
+  <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer">
+    <property name="ejbServicesClassName">org.jboss.test.deployers.support.MockEmptyEjbServices</property>
+  </bean>
+
+  <bean name="DeploymentDeployer" class="org.jboss.weld.integration.deployer.env.FlatDeploymentDeployer"/>
+
+  <bean name="BootDeployer" class="org.jboss.test.deployers.support.deployer.MockBootDeployer"/>
+
+  <bean name="DynamicDependencyCreator" class="org.jboss.weld.integration.deployer.env.DynamicDependencyCreator">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossTransactionServices" class="org.jboss.test.deployers.support.MockTransactionServices"/>
+
+  <bean name="RealTransactionManager" class="java.lang.Object"/>
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,21 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <bean name="MockEjbJar" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+  <bean name="MockJBossApp" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+  <bean name="MockJBoss" class="org.jboss.test.deployers.support.deployer.MockJBossDeployer"/>
+  <bean name="MockJBossWeb" class="org.jboss.test.deployers.support.deployer.MockJBossWebDeployer"/>
+  <bean name="MockWeb" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+  <bean name="MockMergeJBoss" class="org.jboss.test.deployers.support.deployer.MockMergeJBossDeployer"/>
+
+  <bean name="WeldFiles" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
+
+  <bean name="PostEjbJar" class="org.jboss.weld.integration.deployer.metadata.WeldEjbInterceptorMetadataDeployer"/>
+  <bean name="PostJBossApp" class="org.jboss.weld.integration.deployer.metadata.PostJBossAppMetadataDeployer"/>
+  <bean name="PostJBoss" class="org.jboss.weld.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+  <bean name="PostJBossWeb" class="org.jboss.weld.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+  <bean name="PostWeb" class="org.jboss.weld.integration.deployer.metadata.PostWebMetadataDeployer"/>
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,58 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- Structure mocks -->
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <!-- Mock metadata deployer -->
+
+  <bean name="JBAppMDDeployer" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+  <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+  <bean name="EjbJarDeployer" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+  <bean name="EjbMergeDeployer" class="org.jboss.test.deployers.support.deployer.MockCopyJBossDeployer"/>
+  <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+
+  <!-- Weld deployers -->
+
+  <!-- Responsible for discovering Weld files -->
+  <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"/>
+
+  <!-- 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"/>
+
+  <!-- Responsible for dynamic ejb dependency creation -->
+  <bean name="DynamicDependencyCreator" class="org.jboss.weld.integration.deployer.env.DynamicDependencyCreator">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Responsible for booting Weld -->
+  <bean name="WeldBootstrapDeployer" class="org.jboss.weld.integration.deployer.env.WeldBootstrapDeployer"/>
+
+  <!-- Missing real URL integration tests-->
+
+  <bean name="MockUrlIntegrationDeployer" class="org.jboss.test.deployers.support.deployer.MockUrlIntegrationDeployer"/>
+
+  <!-- Responsible for inserting the Weld EJB interceptor -->
+  <bean name="PostEjbJarMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.WBEjbInterceptorMetadataDeployer"/>
+
+  <!-- Responsible for enabling classloader isolation for Weld jars -->
+  <bean name="PostJBossMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+
+  <!-- Responsible for enabling classloader isolation for Weld wars -->
+  <bean name="PostJBossWebMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+
+  <!-- Responsible for adding the Weld listener to the Servlet -->
+  <bean name="PostWebMetadataDeployer" class="org.jboss.weld.integration.deployer.metadata.PostWebMetadataDeployer"/>
+
+  <!-- Removed WeldJndiBinder -->
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,10 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+  <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+  <bean name="JWBMDDeployer" class="org.jboss.weld.integration.deployer.ext.JBossWeldMetaDataDeployer"/>
+  <bean name="WBFilesDeployer" class="org.jboss.weld.integration.deployer.metadata.WeldFilesDeployer"/>
+  <bean name="WBDiscoveryDeployer" class="org.jboss.weld.integration.deployer.env.WeldDiscoveryDeployer"/>
+
+</deployment>

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/earwithutil/META-INF/application.properties
===================================================================

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/application.properties
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/application.properties	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/application.properties	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1 @@
+jar-module=simple.jar

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+jar-moduel=simple.jar
+web-module=simple.war

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<jboss>
+</jboss>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/jboss-web.xml
===================================================================

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/META-INF/application.properties
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/META-INF/application.properties	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/META-INF/application.properties	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,4 @@
+jar-module=simple.jar
+ejb-module=ejbs.jar
+web-module=simple.war
+crm-module=crm.war
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<ejb-jar>
+</ejb-jar>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: hand
+Class-Path: lib/util.jar, lib/ext.jar

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web>
+</web>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/application.properties
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/application.properties	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/application.properties	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1 @@
+web-module=simple.war

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/application.properties
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/application.properties	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/application.properties	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+ejb-module=ejbs.jar
+web-module=simple.war

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<ejb-jar>
+</ejb-jar>
\ No newline at end of file

Added: projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml
===================================================================
--- projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml	                        (rev 0)
+++ projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,2 @@
+<web>
+</web>
\ No newline at end of file

Added: projects/weld-int/trunk/ejb/.classpath
===================================================================
--- projects/weld-int/trunk/ejb/.classpath	                        (rev 0)
+++ projects/weld-int/trunk/ejb/.classpath	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/weld-int/trunk/ejb/.project
===================================================================
--- projects/weld-int/trunk/ejb/.project	                        (rev 0)
+++ projects/weld-int/trunk/ejb/.project	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>weld-jboss-int-jboss-ejb</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/weld-int/trunk/ejb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/weld-int/trunk/ejb/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/weld-int/trunk/ejb/.settings/org.eclipse.jdt.core.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,5 @@
+#Fri Oct 09 11:41:56 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

Added: projects/weld-int/trunk/ejb/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/weld-int/trunk/ejb/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/weld-int/trunk/ejb/.settings/org.maven.ide.eclipse.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+#Fri Oct 09 11:41:44 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/weld-int/trunk/ejb/pom.xml
===================================================================
--- projects/weld-int/trunk/ejb/pom.xml	                        (rev 0)
+++ projects/weld-int/trunk/ejb/pom.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,111 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.weld.integration</groupId>
+    <artifactId>weld-jboss-int</artifactId>
+    <version>5.2.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>weld-jboss-int-jboss-ejb</artifactId>
+  <version>5.2.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Weld Container Services: JBoss AS</name>
+  
+  <!-- Do not add version information here, use ../pom.xml instead -->
+  <dependencies>
+  
+    <!-- Global dependencies -->
+        
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-endpoint-deployer</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+       <groupId>org.jboss.jpa</groupId>
+       <artifactId>jboss-jpa-deployers</artifactId>
+       <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>jboss.jbossts</groupId>
+      <artifactId>jbossjts-integration</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.faces</groupId>
+      <artifactId>jsf-api</artifactId>
+    </dependency>
+    
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jboss.profiler.jvmti</groupId>
+          <artifactId>jboss-profiler-jvmti</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant-junit</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>  
+</project>

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,38 @@
+package org.jboss.weld.integration.ejb;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.integration.util.Reflections;
+
+public class JBossBussinessInterfaceDescriptorAdaptor<T> implements BusinessInterfaceDescriptor<T>
+{
+   private Class<T> type;
+
+   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 Class<T> getInterface()
+   {
+      return type;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return "Business interface: " + getInterface();
+   }   
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,98 @@
+package org.jboss.weld.integration.ejb;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.integration.util.Reflections;
+
+public abstract class JBossEJBDescriptorAdaptor<T> implements EjbDescriptor<T>
+{
+   private final Class<T> beanClass;
+   private final String ejbName;
+   private InterceptorBindings interceptorBindings;
+
+   public JBossEJBDescriptorAdaptor(JBossEnterpriseBeanMetaData enterpriseBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver)
+   {
+      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);
+      }
+      
+      this.ejbName = enterpriseBeanMetaData.getEjbName();
+   }
+
+   public Class<T> getBeanClass()
+   {
+      return beanClass;
+   }
+
+   public String getEjbName()
+   {
+      return ejbName;
+   }
+   
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getEjbName());
+      if (isStateful())
+      {
+         builder.append(" (SFSB)");
+      }
+      if (isStateless())
+      {
+         builder.append(" (SLSB)");
+      }
+      if (isSingleton())
+      {
+         builder.append(" (Singleton)");
+      }
+      if (isMessageDriven())
+      {
+         builder.append(" (MDB)");
+      }
+      builder.append("; BeanClass: " + getBeanClass() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+      return builder.toString(); 
+   }
+   
+   @Override
+   public boolean equals(Object other)
+   {
+      if (other instanceof EjbDescriptor<?>)
+      {
+         EjbDescriptor<?> that = (EjbDescriptor<?>) other;
+         return this.getEjbName().equals(that.getEjbName());
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return getEjbName().hashCode();
+   }
+
+   public void setInterceptorBindings(InterceptorBindings interceptorBindings)
+   {
+      this.interceptorBindings = interceptorBindings;
+   }
+
+   public InterceptorBindings getInterceptorBindings()
+   {
+      return interceptorBindings;
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,229 @@
+package org.jboss.weld.integration.ejb;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.ejb.EJB;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.ejb3.common.resolvers.spi.EjbReference;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+import org.jboss.weld.integration.vdf.DeploymentUnitAware;
+
+/**
+ * An implementation of EjbServices for JBoss EJB3
+ *
+ * @author Pete Muir
+ * @author ales.justin at jboss.org
+ * @author Marius Bogoevici
+ */
+public class JBossEjbServices extends AbstractJBossServices implements EjbServices, EjbInjectionServices, DeploymentUnitAware
+{
+   
+   protected EjbReferenceResolver resolver;
+   private final List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
+   private final List<String> ejbContainerNames = new ArrayList<String>();
+   private Map<String, InterceptorBindings> interceptorBindings = new ConcurrentHashMap<String, InterceptorBindings>();
+
+   public JBossEjbServices() throws NamingException
+   {
+      super();
+   }
+
+   public void setResolver(EjbReferenceResolver resolver)
+   {
+      this.resolver = resolver;
+   }
+   
+   @Override
+   public void setDeploymentUnit(DeploymentUnit du)
+   {
+      super.setDeploymentUnit(du);
+      discoverEjbs(du.getTopLevel());
+   }
+
+   public Object resolveEjb(InjectionPoint injectionPoint)
+   {
+      if (!injectionPoint.getAnnotated().isAnnotationPresent(EJB.class))
+      {
+         throw new IllegalArgumentException("No @EJB annotation found on injection point " + injectionPoint);
+      }
+      if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1)
+      {
+         throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
+      }
+      EJB annotation = injectionPoint.getAnnotated().getAnnotation(EJB.class);
+      // Get properties from the annotation
+      String beanName = annotation.beanName();
+      String beanInterface = annotation.beanInterface().getName();
+   
+      // Supply beanInterface from reflection if not explicitly-defined
+      if (beanInterface == null || beanInterface.equals(Object.class.getName()))
+      {
+         if (injectionPoint.getMember() instanceof Field && injectionPoint.getType() instanceof Class)
+         {
+            beanInterface = ((Class<?>) injectionPoint.getType()).getName();
+         }
+         else if (injectionPoint.getMember() instanceof Method)
+         {
+            Method method = (Method) injectionPoint.getMember();
+            beanInterface = method.getParameterTypes()[0].getName();
+         }
+      }
+   
+      String jndiName = resolver.resolveEjb(topLevelDeploymentUnit, new EjbReference(beanName, beanInterface, null));
+      if (jndiName == null)
+      {
+         throw new IllegalStateException("No EJBs available which can be injected into " + injectionPoint);
+      }
+      try
+      {
+         return context.lookup(jndiName);
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException("Error retreiving EJB from JNDI for injection point " + injectionPoint, e);
+      }
+   }
+   
+   public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
+   {
+      try
+      {
+         return new JBossSessionObjectReference(ejbDescriptor, context);
+      }
+      catch (NamingException e)
+      {
+         throw new RuntimeException("Error retreiving EJB from JNDI " + ejbDescriptor, e);
+      }
+   }
+
+   public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings)
+   {
+      //this.interceptorBindings.put(ejbDescriptor.getEjbName(), interceptorBindings);
+      if (ejbDescriptor instanceof JBossEJBDescriptorAdaptor)
+      {
+         ((JBossEJBDescriptorAdaptor)ejbDescriptor).setInterceptorBindings(interceptorBindings);
+      }
+   }
+
+   public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+   {
+      if (mappedName != null)
+      {
+         try
+         {
+            return context.lookup(mappedName);
+         }
+         catch (NamingException e)
+         {
+            throw new RuntimeException("Error retreiving EJB from JNDI with mappedName " + mappedName, e);
+         }
+      }
+      else if (jndiName != null)
+      {
+         try
+         {
+            return context.lookup(jndiName);
+         }
+         catch (NamingException e)
+         {
+            throw new RuntimeException("Error retreiving EJB from JNDI with mappedName " + jndiName, e);
+         }
+      }
+      else
+      {
+         throw new IllegalArgumentException("jndiName, mappedName and ejbLink are null");
+      }
+   }
+
+   /**
+    * Discover ejbs.
+    *
+    * @param du the deployment unit
+    */
+   protected void discoverEjbs(DeploymentUnit du)
+   {
+      // Ensure it's an EJB3 DU (by looking for the processed metadata)
+      if (du.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && du.getAttachment(JBossMetaData.class).isEJB3x())
+      {
+         for (JBossEnterpriseBeanMetaData enterpriseBeanMetaData : du.getAttachment(JBossMetaData.class).getEnterpriseBeans())
+         {
+            if (enterpriseBeanMetaData.isSession())
+            {
+               JBossSessionBeanMetaData sessionBeanMetaData = (JBossSessionBeanMetaData) enterpriseBeanMetaData;
+               EjbDescriptor<?> ejbDescriptor = new JBossSessionBeanDescriptorAdaptor<Object>(sessionBeanMetaData, du, resolver);
+               ejbs.add(ejbDescriptor);
+            }
+            else if (enterpriseBeanMetaData.isMessageDriven())
+            {
+               JBossMessageDrivenBeanMetaData messageDrivenBeanMetaData = (JBossMessageDrivenBeanMetaData) enterpriseBeanMetaData;
+               EjbDescriptor<?> ejbDescriptor = new JBossMessageDrivenBeanDescriptorAdaptor<Object>(messageDrivenBeanMetaData, du, resolver);
+               ejbs.add(ejbDescriptor);
+            }
+            if (enterpriseBeanMetaData.getContainerName() != null)
+            {
+               ejbContainerNames.add(enterpriseBeanMetaData.getContainerName());
+            }
+            else
+            {
+               ejbContainerNames.add(enterpriseBeanMetaData.getGeneratedContainerName());
+            }
+         }
+      }
+   
+      List<DeploymentUnit> children = du.getChildren();
+      if (children != null && children.isEmpty() == false)
+      {
+         for (DeploymentUnit childDu : children)
+         {
+            discoverEjbs(childDu);
+         }
+      }
+   }
+   
+   public Iterable<EjbDescriptor<?>> getEjbs()
+   {
+      return ejbs;
+   }
+
+   /**
+    * Get the names of all ejb container.
+    *
+    * @return all ejb container names
+    */
+   public Iterable<String> getEjbContainerNames()
+   {
+	   return Collections.unmodifiableCollection(ejbContainerNames);
+   }
+
+   public InterceptorBindings getInterceptorBindings(EjbDescriptor<?> ejbDescriptor)
+   {
+      return interceptorBindings.get(ejbDescriptor.getEjbName());
+   }
+
+   public void cleanup()
+   {
+      ejbContainerNames.clear();
+      ejbs.clear();
+      resolver = null;
+   }
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,50 @@
+package org.jboss.weld.integration.ejb;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+
+public class JBossMessageDrivenBeanDescriptorAdaptor<T> extends JBossEJBDescriptorAdaptor<T>
+{
+   public JBossMessageDrivenBeanDescriptorAdaptor(JBossMessageDrivenBeanMetaData messageDrivenBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver)
+   {
+      super(messageDrivenBeanMetaData, deploymentUnit, resolver);
+   }
+
+   public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+   {
+      // Not relevant for MDBs
+      return null;
+   }
+   
+   public Collection<Method> getRemoveMethods()
+   {
+      // Not relevant for MDBs
+      return null;
+   }
+   
+   public boolean isSingleton()
+   {
+      return false;
+   }
+   
+   public boolean isStateful()
+   {
+      return false;
+   }
+   
+   public boolean isStateless()
+   {
+      return false;
+   }
+   
+   public boolean isMessageDriven()
+   {
+      return true;
+   }
+
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,125 @@
+package org.jboss.weld.integration.ejb;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.RemoveMethodMetaData;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.integration.util.Reflections;
+
+public class JBossSessionBeanDescriptorAdaptor<T> extends JBossEJBDescriptorAdaptor<T> implements EjbDescriptor<T>
+{
+   
+   private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
+   
+   private final List<BusinessInterfaceDescriptor<?>> localBusinessInterfaces;
+   private final List<Method> removeMethods;
+   private final boolean stateful;
+   private final boolean stateless;
+   private final boolean singleton;
+   private final String localJndiName;
+   private final DeploymentUnit deploymentUnit;
+   
+   public JBossSessionBeanDescriptorAdaptor(JBossSessionBeanMetaData sessionBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver)
+   {
+      super(sessionBeanMetaData, deploymentUnit, resolver);
+      this.localBusinessInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+      if (sessionBeanMetaData.getBusinessLocals() != null)
+      {
+         for (String interfaceName : sessionBeanMetaData.getBusinessLocals())
+         {
+            this.localBusinessInterfaces.add(new JBossBussinessInterfaceDescriptorAdaptor<Object>(interfaceName, getEjbName(), deploymentUnit, resolver));
+         }
+      }
+      
+      this.removeMethods = new ArrayList<Method>();
+
+      if (sessionBeanMetaData.getRemoveMethods() != null)
+      {
+         for (RemoveMethodMetaData removeMethodMetaData : sessionBeanMetaData.getRemoveMethods())
+         {
+            Method removeMethod;
+            try
+            {
+               List<String> methodParameters = removeMethodMetaData.getBeanMethod().getMethodParams();
+               List<Class<?>> parameterTypes = new ArrayList<Class<?>>();
+               for (String methodParameter : methodParameters)
+               {
+                  try
+                  {
+                     parameterTypes.add(Reflections.classForName(methodParameter, deploymentUnit.getClassLoader()));
+                  }
+                  catch (ClassNotFoundException e)
+                  {
+                     throw new IllegalStateException("Cannot load EJB remove method parameter class interface for " + removeMethodMetaData.toString(), e);
+                  }
+               }
+               removeMethod = getBeanClass().getMethod(removeMethodMetaData.getBeanMethod().getMethodName(), parameterTypes.toArray(EMPTY_CLASS_ARRAY));
+               removeMethods.add(removeMethod);
+            }
+            catch (SecurityException e)
+            {
+               throw new RuntimeException("Unable to access EJB remove method", e);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException("Unable to access EJB remove method", e);
+            }
+
+         }
+      }
+      
+      this.stateful = sessionBeanMetaData.isStateful();
+      this.stateless = sessionBeanMetaData.isStateless();
+      this.singleton = false;
+      this.localJndiName = sessionBeanMetaData.getLocalJndiName();
+      this.deploymentUnit = deploymentUnit;
+   }
+   
+   public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+   {
+      return localBusinessInterfaces;
+   }
+
+   public Collection<Method> getRemoveMethods()
+   {
+      return removeMethods;
+   }
+
+   public boolean isSingleton()
+   {
+      return singleton;
+   }
+
+   public boolean isStateful()
+   {
+      return stateful;
+   }
+
+   public boolean isStateless()
+   {
+      return stateless;
+   }
+   
+   public boolean isMessageDriven()
+   {
+      return false;
+   }
+   
+   public String getLocalJndiName()
+   {
+      return localJndiName;
+   }
+   
+   public DeploymentUnit getDeploymentUnit()
+   {
+      return deploymentUnit;
+   }
+
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,94 @@
+package org.jboss.weld.integration.ejb;
+import java.io.Serializable;
+import java.lang.reflect.Proxy;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.endpoint.Endpoint;
+import org.jboss.ejb3.endpoint.deployers.EndpointResolver;
+import org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandler;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+
+public class JBossSessionObjectReference implements SessionObjectReference
+{
+   
+   private static final String MC_BIND_NAME_ENDPOINT_RESOLVER = "EJB3EndpointResolver";
+
+   private static final long serialVersionUID = 8227728506645839338L;
+   
+   private final Object reference;
+   private final Serializable id; 
+   private final DeploymentUnit deploymentUnit;
+   private final String ejbClassName;
+   private final String jndiName;
+   private final boolean stateful;
+   
+   boolean removed = false;
+    
+   public JBossSessionObjectReference(EjbDescriptor<?> descriptor, Context context) throws NamingException
+   {
+      if (!(descriptor instanceof JBossSessionBeanDescriptorAdaptor<?>))
+      {
+         throw new IllegalArgumentException("Can only operate on JBoss EJB3");
+      }
+      else
+      {
+         this.jndiName = ((JBossSessionBeanDescriptorAdaptor<?>) descriptor).getLocalJndiName();
+         reference = context.lookup(jndiName);
+         final SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler) Proxy.getInvocationHandler(reference);
+         id = (Serializable) handler.getTarget();
+      }
+      this.deploymentUnit = ((JBossSessionBeanDescriptorAdaptor<?>) descriptor).getDeploymentUnit();
+      this.ejbClassName = descriptor.getBeanClass().getSimpleName();
+      this.stateful = descriptor.isStateful();
+   }
+   
+   @SuppressWarnings("unchecked")
+   public <S> S getBusinessObject(Class<S> businessInterfaceType)
+   {
+      return (S) reference;
+   }
+   
+   public void remove()
+   {
+      if (stateful)
+      {
+         getEndpoint().getSessionFactory().destroySession(id);
+         removed = true;
+      }
+      else
+      {
+         throw new UnsupportedOperationException("Can only remove stateful beans " + this );
+      }
+   }
+   
+   private Endpoint getEndpoint()
+   {
+      @Deprecated
+      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
+
+      // Get the resolver
+      EndpointResolver resolver = registrar.lookup(MC_BIND_NAME_ENDPOINT_RESOLVER, EndpointResolver.class);
+      String endpointMcBindName = resolver.resolve(deploymentUnit, ejbClassName);
+      return registrar.lookup(endpointMcBindName, Endpoint.class);
+   }
+   
+   public boolean isRemoved()
+   {
+      // TODO Doesn't account for the case the EJB container removes the EJB without WB!
+      return removed;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return "Session bean reference: " + jndiName + " with id: " + id; 
+   }
+   
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.ejb;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.ejb.SessionContext;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.EJBContextImpl;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.stateful.StatefulSessionContextImpl;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.manager.api.WeldManager;
+
+/**
+ * Interceptor for handling EJB post-construct tasks
+ * 
+ * @author Pete Muir
+ * @author Marius Bogoevici
+ */
+public class SessionBeanInterceptor implements Serializable
+{
+   private static final long serialVersionUID = 7327757031821596782L;
+   
+   private static final Field statefulGuidField;
+   private static final Field beanContextField;
+   
+   static
+   {
+      try
+      {
+         statefulGuidField = StatefulSessionContextImpl.class.getDeclaredField("containerGuid");
+         statefulGuidField.setAccessible(true);
+         beanContextField = EJBContextImpl.class.getDeclaredField("beanContext");
+         beanContextField.setAccessible(true);
+      }
+      catch (SecurityException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (NoSuchFieldException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   @Resource
+   private SessionContext sessionContext;
+   
+   @Resource(mappedName="java:app/BeanManager")
+   private WeldManager beanManager;
+   
+   private CreationalContext<Object> creationalContext;
+   private InjectionTarget<Object> injectionTarget;
+
+   public static final String CREATIONAL_CONTEXT = "org.jboss.weld.integration.ejb.SessionBeanInterceptor.creationalContext";
+   public static final String EJB_DESCRIPTOR = "org.jboss.weld.integration.ejb.SessionBeanInterceptor.ejbName";
+
+   /**
+    * Gets the underlying target and calls the post-construct method
+    * 
+    * @param invocationContext The invocation context
+    * @throws Exception 
+    */
+   @PostConstruct
+   public void postConstruct(InvocationContext invocationContext) throws Exception
+   {
+      String ejbName = getEjbName();
+      EjbDescriptor<Object> descriptor = beanManager.getEjbDescriptor(ejbName);
+      injectionTarget = beanManager.createInjectionTarget(descriptor);
+      Bean<Object> bean = beanManager.getBean(descriptor);
+      creationalContext = beanManager.createCreationalContext(bean);
+      injectionTarget.inject(invocationContext.getTarget(), creationalContext);
+      invocationContext.getContextData().put(CREATIONAL_CONTEXT, creationalContext);
+      invocationContext.getContextData().put(EJB_DESCRIPTOR, descriptor);
+      invocationContext.proceed();
+   }
+
+   /**
+    * Gets the underlying target and calls the pre-destroy method
+    * 
+    * @param invocationContext The invocation context
+    * @throws Exception 
+    */
+   @PreDestroy
+   public void preDestroy(InvocationContext invocationContext) throws Exception
+   {
+      creationalContext.release();
+      invocationContext.proceed();
+   }
+   
+   private String getEjbName()
+   {
+      if (sessionContext instanceof StatefulSessionContextImpl)
+      {
+         try
+         {
+            
+            String guid = (String) statefulGuidField.get(sessionContext);
+            Container container = Ejb3Registry.getContainer(guid);
+            return container.getEjbName();
+         }
+         catch (IllegalArgumentException e)
+         {
+            throw new RuntimeException(e);
+         }
+         catch (IllegalAccessException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      else if (sessionContext instanceof EJBContextImpl<?, ?>)
+      {
+         try
+         {
+            BeanContext<?> beanContext = (BeanContext<?>) beanContextField.get(sessionContext);
+            return beanContext.getContainer().getEjbName();
+         }
+         catch (IllegalArgumentException e)
+         {
+            throw new RuntimeException(e);
+         }
+         catch (IllegalAccessException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      else
+      {
+         throw new IllegalStateException("Unable to extract ejb name from SessionContext " + sessionContext);
+      }
+
+   }
+
+}
+
+   
\ No newline at end of file

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.integration.ejb.interceptor;
+
+import java.lang.reflect.Method;
+import java.util.Queue;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import javax.interceptor.InvocationContext;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.InterceptionType;
+
+public class DelegatingInterceptorInvocationContext implements InvocationContext
+{
+
+   private InvocationContext delegateInvocationContext;
+
+   private Queue<Interceptor> invocationQueue;
+   private Queue<Object> interceptorInstances;
+
+   private InterceptionType interceptionType;
+
+   public DelegatingInterceptorInvocationContext(InvocationContext delegateInvocationContext, List<Interceptor<?>> interceptors, List<Object> instances, InterceptionType interceptionType)
+   {
+      this.delegateInvocationContext = delegateInvocationContext;
+      this.interceptionType = interceptionType;
+      this.invocationQueue = new ConcurrentLinkedQueue<Interceptor>(interceptors);
+      this.interceptorInstances = new ConcurrentLinkedQueue<Object>(instances);
+   }
+
+   public Map<String, Object> getContextData()
+   {
+      return delegateInvocationContext.getContextData();
+   }
+
+   public Method getMethod()
+   {
+      return delegateInvocationContext.getMethod();
+   }
+
+   public Object[] getParameters()
+   {
+      return delegateInvocationContext.getParameters();
+   }
+
+   public Object getTarget()
+   {
+      return delegateInvocationContext.getTarget();
+   }
+
+   public Object proceed() throws Exception
+   {
+      if (!invocationQueue.isEmpty())
+      {
+         return invocationQueue.remove().intercept(interceptionType, interceptorInstances.remove(), this);
+      }
+      else
+      {
+         return delegateInvocationContext.proceed();
+      }
+   }
+
+   public void setParameters(Object[] params)
+   {
+      delegateInvocationContext.setParameters(params);
+   }
+}
\ No newline at end of file

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.integration.ejb.interceptor;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.ejb.SessionContext;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.integration.ejb.SessionBeanInterceptor;
+import org.jboss.weld.manager.api.WeldManager;
+
+/**
+ * Interceptor for applying the JSR-299 specific interceptor bindings.
+ *
+ * It is a separate interceptor, as it needs to be applied after all
+ * the other existing interceptors.
+ * 
+ * @author Marius Bogoevici
+ */
+public class Jsr299BindingsInterceptor implements Serializable
+{
+
+   @Resource(mappedName="java:app/BeanManager")
+   private WeldManager beanManager;
+
+   @Resource
+   private SessionContext sessionContext;
+
+   private InterceptorBindings interceptorBindings;
+
+   private Map<String, Object> interceptorInstances;
+
+   @PostConstruct
+   public void doPostConstruct(InvocationContext invocationContext) throws Exception
+   {
+      // create contextual instances for interceptors
+      interceptorInstances = new ConcurrentHashMap<String, Object>();
+      EjbDescriptor<?> ejbDescriptor = (EjbDescriptor<?>) invocationContext.getContextData().get(SessionBeanInterceptor.EJB_DESCRIPTOR);
+      //interceptorBindings = ejbServices.getInterceptorBindings(ejbDescriptor);
+      // TODO get the bindings associated with the EjbDescriptor or the EjbServices instance
+
+      if (interceptorBindings != null)
+      {
+         for (Interceptor interceptor : interceptorBindings.getAllInterceptors())
+         {
+            CreationalContext creationalContext = (CreationalContext) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
+            interceptorInstances.put(interceptor.getName(), beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext));
+         }
+
+         doLifecycleInterception(invocationContext, InterceptionType.POST_CONSTRUCT);
+      }
+   }
+
+   @PreDestroy
+   public void doPreDestroy(InvocationContext invocationContext) throws Exception
+   {
+      doLifecycleInterception(invocationContext, InterceptionType.PRE_DESTROY);
+   }
+
+   @AroundInvoke
+   public void doAroundInvoke(InvocationContext invocationContext) throws Exception
+   {
+      doMethodInterception(invocationContext, InterceptionType.AROUND_INVOKE);
+   }
+
+   private void doLifecycleInterception(InvocationContext invocationContext, InterceptionType interceptionType)
+         throws Exception
+   {
+      if (interceptorBindings != null)
+      {
+         List<Interceptor<?>> currentInterceptors = interceptorBindings.getLifecycleInterceptors(interceptionType);
+         doInterception(invocationContext, interceptionType, currentInterceptors);
+      }
+   }
+
+   private void doMethodInterception(InvocationContext invocationContext, InterceptionType interceptionType)
+         throws Exception
+   {
+      if (interceptorBindings != null)
+      {
+         List<Interceptor<?>> currentInterceptors = interceptorBindings.getMethodInterceptors(interceptionType, invocationContext.getMethod());
+         doInterception(invocationContext, interceptionType, currentInterceptors);
+      }
+   }
+
+   private void doInterception(InvocationContext invocationContext, InterceptionType interceptionType, List<Interceptor<?>> currentInterceptors)
+         throws Exception
+   {
+      List<Object> currentInterceptorInstances = new ArrayList<Object>();
+      for (Interceptor<?> interceptor: currentInterceptors)
+      {
+         currentInterceptorInstances.add(interceptorInstances.get(interceptor.getName()));
+      }
+      new DelegatingInterceptorInvocationContext(invocationContext, currentInterceptors, currentInterceptorInstances, interceptionType).proceed();
+   }
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,125 @@
+package org.jboss.weld.integration.persistence;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.NamingException;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.jpa.deployment.ManagedEntityManagerFactory;
+import org.jboss.jpa.deployment.PersistenceUnitDeployment;
+import org.jboss.jpa.injection.InjectedEntityManagerFactory;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.integration.util.AbstractJBossServices;
+
+public class JBossJpaServices extends AbstractJBossServices implements JpaInjectionServices
+{
+   
+   public JBossJpaServices() throws NamingException
+   {
+      super();
+   }
+
+   protected PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+   
+   public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver persistenceUnitDependencyResolver)
+   {
+      this.persistenceUnitDependencyResolver = persistenceUnitDependencyResolver;
+   }
+   
+   public Collection<Class<?>> discoverEntities()
+   {
+      return Collections.emptyList();
+   }
+
+   public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
+   {
+      if (!injectionPoint.getAnnotated().isAnnotationPresent(PersistenceContext.class))
+      {
+         throw new IllegalArgumentException("No @PersistenceContext annotation found on injection point " + injectionPoint);
+      }
+      if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1)
+      {
+         throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
+      }
+      try
+      {
+         return resolvePersistenceUnit((injectionPoint.getAnnotated().getAnnotation(PersistenceContext.class).unitName())).createEntityManager();
+      }
+      catch (IllegalStateException e)
+      {
+         throw new IllegalStateException("Unable to resolve persistence context for " + injectionPoint);
+      }
+   }
+   
+   public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint)
+   {
+      if (!injectionPoint.getAnnotated().isAnnotationPresent(PersistenceUnit.class))
+      {
+         throw new IllegalArgumentException("No @PersistenceUnit annotation found on injection point " + injectionPoint);
+      }
+      if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1)
+      {
+         throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
+      }
+      try
+      {
+         return resolvePersistenceUnit((injectionPoint.getAnnotated().getAnnotation(PersistenceUnit.class).unitName()));
+      }
+      catch (IllegalStateException e)
+      {
+         throw new IllegalStateException("Unable to resolve persistence context for " + injectionPoint);
+      }
+   }
+   
+   private EntityManagerFactory resolvePersistenceUnit(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);
+      }
+      PersistenceUnitDeployment deployment = jbossEjb.lookupPersistenceUnitDeployment(beanName);
+      ManagedEntityManagerFactory managedFactory = deployment.getManagedFactory();
+      return new InjectedEntityManagerFactory(managedFactory);
+   }
+   
+   private static String getPersistenceUnitSupplier(DeploymentUnit deploymentUnit, PersistenceUnitDependencyResolver persistenceUnitDependencyResolver, String persistenceUnitName)
+   {
+      if ((deploymentUnit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && deploymentUnit.getAttachment(JBossMetaData.class).isEJB3x()) || (deploymentUnit.getAttachment(JBossWebMetaData.class) != null))
+      {
+         try
+         {
+            return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName);
+         }
+         catch (IllegalArgumentException e)
+         {
+            // No-op, means we can't find the PU in this DU
+         }
+      }
+      for (DeploymentUnit child : deploymentUnit.getChildren())
+      {
+         String beanName = getPersistenceUnitSupplier(child, persistenceUnitDependencyResolver, persistenceUnitName);
+         if (beanName != null)
+         {
+            return beanName;
+         }
+      }
+      return null;
+   }
+   
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,26 @@
+package org.jboss.weld.integration.resource;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.injection.spi.helpers.AbstractResourceServices;
+
+public class JBossResourceServices extends AbstractResourceServices implements ResourceInjectionServices
+{
+   
+   private final Context context;
+   
+   public JBossResourceServices() throws NamingException
+   {
+      this.context = new InitialContext();
+   }
+   
+   @Override
+   protected Context getContext()
+   {
+      return context;
+   }
+   
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.security;
+
+import java.security.Principal;
+
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.weld.security.spi.SecurityServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class JBossSecurityServices implements SecurityServices
+{
+   
+   public Principal getPrincipal()
+   {
+      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+      return sc.getUtil().getUserPrincipal();
+   }
+   
+   public void cleanup() {}
+
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.servlet;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class JBossServletServices implements ServletServices
+{
+   
+   // For now, JBoss is using a totally flat deployment structure
+   private BeanDeploymentArchive beanDeploymentArchive;
+   
+   public JBossServletServices(BeanDeploymentArchive beanDeploymentArchive)
+   {
+      this.beanDeploymentArchive = beanDeploymentArchive;
+   }
+   
+   
+   public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx)
+   {
+      return beanDeploymentArchive;
+   }
+   
+   public void cleanup() {}
+
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.integration.transaction;
+
+import static javax.transaction.Status.STATUS_ACTIVE;
+
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+import com.arjuna.ats.jbossatx.jta.TransactionManagerService;
+
+/**
+ * JBoss AS implementation of TransactionServices. The transaction manager for
+ * the application server is injected directly into this bean and used to
+ * provide the services.
+ * 
+ * @author David Allen
+ * @author ales.justin at jboss.org
+ * 
+ */
+public class JBossTransactionServices implements TransactionServices
+{
+   
+   /** The TM */
+   private final TransactionManagerService transactionManager;
+   
+   public JBossTransactionServices(TransactionManagerService transactionManager)
+   {
+      this.transactionManager = transactionManager;
+   }
+
+   public boolean isTransactionActive()
+   {
+      try
+      {
+         return getUserTransaction().getStatus() == STATUS_ACTIVE;
+      }
+      catch (SystemException e)
+      {
+         throw new RuntimeException("Failed to determine transaction status", e);
+      }
+   }
+   
+   public TransactionManagerService getTransactionManager()
+   {
+      return transactionManager;
+   }
+
+   public void registerSynchronization(Synchronization synchronizedObserver)
+   {
+      try
+      {
+         getTransactionManager().getTransactionManager().getTransaction().registerSynchronization(synchronizedObserver);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Failed to register synchronization " + synchronizedObserver + " for current transaction", e);
+      }
+   }
+   
+   public UserTransaction getUserTransaction()
+   {
+      return transactionManager.getUserTransaction();
+   }
+   
+   public void cleanup() {}
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,42 @@
+package org.jboss.weld.integration.util;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.weld.bootstrap.api.Service;
+
+public class AbstractJBossServices implements Service
+{
+   
+   protected DeploymentUnit topLevelDeploymentUnit;
+   protected JBossEjb jbossEjb;
+   protected final Context context;
+   
+   public AbstractJBossServices() throws NamingException
+   {
+      context = new InitialContext();
+   }
+
+   public void setDeploymentUnit(DeploymentUnit du)
+   {
+      if (du == null)
+      {
+         throw new IllegalArgumentException("Null deployment unit.");
+      }
+   
+      topLevelDeploymentUnit = du.getTopLevel();
+   }
+
+   public void setJbossEjb(JBossEjb jbossEjb)
+   {
+      this.jbossEjb = jbossEjb;
+   }
+   
+   public void cleanup()
+   {
+      
+   }
+   
+}
\ No newline at end of file

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,113 @@
+package org.jboss.weld.integration.util;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
+import org.jboss.jpa.deployment.PersistenceUnitDeployment;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+import org.jboss.kernel.spi.dependency.KernelController;
+
+/**
+ * Utitlies for use with JBoss EJB implementation
+ * 
+ * @author Pete Muir
+ * @author ales.justin at jboss.org
+ *
+ */
+public class JBossEjb
+{
+   private KernelController controller;
+   private EjbReferenceResolver resolver;
+
+   @Inject
+   public void setResolver(EjbReferenceResolver resolver)
+   {
+      this.resolver = resolver;
+   }
+
+   public EjbReferenceResolver getResolver()
+   {
+      return resolver;
+   }
+
+   @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
+   public void setController(KernelController controller)
+   {
+      this.controller = controller;
+   }
+
+   /**
+    * 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");
+      }
+   }
+
+   /**
+    * Get the bean from the MC controller.
+    *
+    * @param name the bean name
+    * @param shouldExist must the bean be present
+    * @return the bean
+    */
+   public Object lookup(final Object name, boolean shouldExist)
+   {
+      // Get Controller Context
+      ControllerContext context = controller.getInstalledContext(name);
+      if (context == null)
+      {
+         if (shouldExist)
+         {
+            // less restrictive state look
+            ControllerContext cc = controller.getContext(name, null);
+            throw new NoSuchInstantiatedBeanException("No such instantiated bean: " + name + " [" + cc + "]");
+         }
+         else
+         {
+            return null;
+         }
+      }  
+      
+      // If there's an error with the context, throw it
+      Throwable error = context.getError();
+      if (error != null)
+         throw new RuntimeException("Could not lookup object at name \"" + name + "\" due to an error with the underlying MC context.", error);
+
+      // Return
+      return context.getTarget();
+   }
+
+   private static class NoSuchInstantiatedBeanException extends IllegalArgumentException
+   {
+      public NoSuchInstantiatedBeanException()
+      {
+         super();
+      }
+
+      public NoSuchInstantiatedBeanException(String arg0, Throwable arg1)
+      {
+         super(arg0, arg1);
+      }
+
+      public NoSuchInstantiatedBeanException(String arg0)
+      {
+         super(arg0);
+      }
+
+      public NoSuchInstantiatedBeanException(Throwable arg0)
+      {
+         super(arg0);
+      }
+   }
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,46 @@
+package org.jboss.weld.integration.util;
+
+import java.beans.Introspector;
+import java.lang.reflect.Method;
+
+public class Reflections
+{
+   
+   /**
+    * Creates an instance from a class name
+    * 
+    * @param name The class name
+    * @return The instance
+    * @throws ClassNotFoundException If the class if not found
+    */
+   public static Class<?> classForName(String name, ClassLoader classLoader) throws ClassNotFoundException
+   {
+      try
+      {
+         return classLoader.loadClass(name);
+      }
+      catch (Exception e)
+      {
+         return Class.forName(name);
+      }
+   }
+   
+   public static String getPropertyName(Method method)
+   {
+      String methodName = method.getName();
+      if (methodName.matches("^(get).*") && method.getParameterTypes().length == 0)
+      {
+         return Introspector.decapitalize(methodName.substring(3));
+      }
+      else if (methodName.matches("^(is).*") && method.getParameterTypes().length == 0)
+      {
+         return Introspector.decapitalize(methodName.substring(2));
+      }
+      else
+      {
+         return null;
+      }
+
+   }
+   
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.validation;
+
+import javax.validation.ValidatorFactory;
+
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class JBossValidationServices implements ValidationServices
+{
+
+   private final ValidatorFactory validatorFactory;
+   
+   public JBossValidationServices(ValidatorFactory validatorFactory)
+   {
+      this.validatorFactory = validatorFactory;
+   }
+
+   public ValidatorFactory getDefaultValidatorFactory()
+   {
+      return validatorFactory;
+   }
+   
+   public void cleanup() {}
+
+}

Added: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java	                        (rev 0)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,39 @@
+/*
+ * 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.vdf;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Deployment unit aware marker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface DeploymentUnitAware
+{
+   /**
+    * Set the deployment unit.
+    *
+    * @param unit the deployment unit
+    */
+   void setDeploymentUnit(DeploymentUnit unit);
+}

Added: projects/weld-int/trunk/pom.xml
===================================================================
--- projects/weld-int/trunk/pom.xml	                        (rev 0)
+++ projects/weld-int/trunk/pom.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,516 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>4</version>
+  </parent>
+  <groupId>org.jboss.weld.integration</groupId>
+  <artifactId>weld-jboss-int</artifactId>
+  <version>5.2.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>Weld JBoss AS Integration Aggregator</name>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/weld-int/trunk/</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/weld-int/trunk/</developerConnection>
+    <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/weld-int/trunk/</url>
+  </scm>
+
+  <modules>
+    <module>ejb</module>
+    <module>webtier</module>
+    <module>deployer</module>
+    <module>assembly</module>
+  </modules>
+  
+  <properties>
+    <version.weld>1.0.0-SNAPSHOT</version.weld>
+    <version.jboss.interceptors>1.0.0-SNAPSHOT</version.jboss.interceptors>
+    <version.jboss.vfs>2.1.2.GA</version.jboss.vfs>
+    <version.jboss.man>2.1.0.GA</version.jboss.man>
+    <version.jboss.microcontainer>2.0.8.GA</version.jboss.microcontainer>
+    <version.jboss.cl>2.0.6.GA</version.jboss.cl>
+    <version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
+    <version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
+    <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
+    <version.jboss.classloading.spi>5.0.3.GA</version.jboss.classloading.spi>
+    <version.jboss.transaction.spi>5.1.0.SP1</version.jboss.transaction.spi>
+    <version.jboss.metadata>1.0.0.GA</version.jboss.metadata>
+    <version.jbossxb>2.0.1.GA</version.jbossxb>
+    <version.jboss.ejb3>1.0.0</version.jboss.ejb3>
+    <version.jboss.ejb3.core>1.1.5</version.jboss.ejb3.core>
+    <version.jboss.ejb3.endpoint>0.1.3</version.jboss.ejb3.endpoint>
+    <version.jboss.jpa>1.0.0-CR1</version.jboss.jpa>
+    <version.jboss.web>2.1.4.GA</version.jboss.web>
+    <version.servlet.api>2.5</version.servlet.api>
+    <version.jsp.api>2.1</version.jsp.api>
+    <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
+    <version.junit>4.4</version.junit>
+    <version.validation>1.0.CR3</version.validation>
+    <version.jbossts>4.6.1.GA</version.jbossts>
+    <version.faces>2.0.0-RC</version.faces>
+  </properties>
+
+  <build>
+    <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
+    <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
+    <finalName>${artifactId}</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+          <showDeprecation>true</showDeprecation>
+          <showWarnings>true</showWarnings>
+          <optimize>true</optimize>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-release-plugin</artifactId>
+        <version>2.0-beta-9</version>
+        <configuration>
+          <tagBase>https://svn.jboss.org/repos/jbossas/projects/weld-int/tags</tagBase>
+          <autoVersionSubmodules>true</autoVersionSubmodules>
+          <allowTimestampedSnapshots>false</allowTimestampedSnapshots>
+        </configuration>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-assembly-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>make-assembly</id>
+              <phase>package</phase>
+              <goals>
+                <goal>attached</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <artifactId>maven-idea-plugin</artifactId>
+          <configuration>
+            <downloadSources>true</downloadSources>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-eclipse-plugin</artifactId>
+          <configuration>
+            <classpathContainers>
+              <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+            </classpathContainers>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>2.2</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.4.3</version>
+          <configuration>
+            <redirectTestOutputToFile>true</redirectTestOutputToFile>
+            <includes>
+              <include>org/jboss/test/**/*TestCase.java</include>
+            </includes>
+          </configuration>
+        </plugin>
+        <plugin>
+          <!-- Configure javadoc plugin with APIviz -->
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <configuration>
+            <doclet>net.gleamynode.apiviz.APIviz</doclet>
+            <docletArtifact>
+              <groupId>net.gleamynode.apiviz</groupId>
+              <artifactId>apiviz</artifactId>
+              <version>1.1.0</version>
+            </docletArtifact>
+            <encoding>UTF-8</encoding>
+          </configuration>
+        </plugin>        
+      </plugins>
+    </pluginManagement>
+  </build>
+  
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Repository</name>
+      <layout>default</layout>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshots Repository</name>
+      <layout>default</layout>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>true</enabled>
+        <updatePolicy>always</updatePolicy>
+      </snapshots>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+    </repository>
+    <!-- APIviz repository -->
+    <repository>
+      <id>apiviz.release</id>
+      <name>APIviz releases</name>
+      <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
+      <releases>
+        
+        <enabled>true</enabled>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>dependencies</report>
+              <report>issue-tracking</report>
+              <report>license</report>
+              <report>scm</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <version>1.0.0</version>
+      </plugin>
+    </plugins>
+  </reporting>
+  
+  <dependencyManagement>
+    <!-- The parent pom manages the inter-dependencies of the modules. -->
+    <dependencies>
+    
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-client</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-client-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-core-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-impl</artifactId>
+        <version>${version.jboss.deployers}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.jboss</groupId>
+            <artifactId>javassist</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-structure-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-vfs</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-vfs-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloader</artifactId>
+        <version>${version.jboss.cl}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloading</artifactId>
+        <version>${version.jboss.cl}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloading-vfs</artifactId>
+        <version>${version.jboss.cl}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.man</groupId>
+        <artifactId>jboss-managed</artifactId>
+        <version>${version.jboss.man}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.microcontainer</groupId>
+        <artifactId>jboss-dependency</artifactId>
+        <version>${version.jboss.microcontainer}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.microcontainer</groupId>
+        <artifactId>jboss-kernel</artifactId>
+        <version>${version.jboss.microcontainer}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jboss-common-core</artifactId>
+        <version>${version.jboss.common.core}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>${version.jboss.logging.spi}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.integration</groupId>
+        <artifactId>jboss-classloading-spi</artifactId>
+        <version>${version.jboss.classloading.spi}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.integration</groupId>
+        <artifactId>jboss-transaction-spi</artifactId>
+        <version>${version.jboss.transaction.spi}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jbossxb</artifactId>
+        <version>${version.jbossxb}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>jboss.web</groupId>
+        <artifactId>jbossweb</artifactId>
+        <version>${version.jboss.web}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jboss-vfs</artifactId>
+        <version>${version.jboss.vfs}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.metadata</groupId>
+        <artifactId>jboss-metadata</artifactId>
+        <version>${version.jboss.metadata}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>jboss.jbossts</groupId>
+        <artifactId>jbossjts-integration</artifactId>
+        <version>${version.jbossts}</version>
+      </dependency>
+    
+      <dependency>
+        <groupId>javax.validation</groupId>
+        <artifactId>validation-api</artifactId>
+        <version>${version.validation}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>javax.faces</groupId>
+        <artifactId>jsf-api</artifactId>
+        <version>${version.faces}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.weld</groupId>
+        <artifactId>weld-spi</artifactId>
+        <version>${version.weld}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.interceptors</groupId>
+        <artifactId>interceptors</artifactId>
+        <version>${version.jboss.interceptors}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.weld.integration</groupId>
+        <artifactId>weld-jboss-int-jboss-ejb</artifactId>
+        <version>${project.version}</version>
+    	</dependency>
+      
+      <dependency>
+        <groupId>org.jboss.weld.integration</groupId>
+        <artifactId>weld-jboss-int-webtier</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.weld.integration</groupId>
+        <artifactId>weld-jboss-int-deployer</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>javax.servlet</groupId>
+        <artifactId>servlet-api</artifactId>
+        <version>${version.servlet.api}</version>
+      </dependency>
+      
+      <dependency>
+         <groupId>javax.servlet.jsp</groupId>
+         <artifactId>jsp-api</artifactId>
+         <version>${version.jsp.api}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-common</artifactId>
+         <version>${version.jboss.ejb3}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-core</artifactId>
+         <version>${version.jboss.ejb3.core}</version>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-proxy</artifactId>
+         <classifier>client</classifier>
+         <version>${version.jboss.ejb3}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-endpoint-deployer</artifactId>
+         <version>${version.jboss.ejb3.endpoint}</version>
+      </dependency>
+      
+      <dependency>
+         <groupId>org.jboss.jpa</groupId>
+         <artifactId>jboss-jpa-deployers</artifactId>
+         <version>${version.jboss.jpa}</version>
+      </dependency>
+
+      <!-- test dependencies -->
+
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-vfs</artifactId>
+        <version>${version.jboss.deployers}</version>
+        <type>test-jar</type>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.test</groupId>
+        <artifactId>jboss-test</artifactId>
+        <version>${version.org.jboss.test}</version>
+        <scope>test</scope>
+      </dependency>
+      
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>${version.junit}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+      	<groupId>org.jboss.weld</groupId>
+      	<artifactId>weld-core</artifactId>
+      	<version>${version.weld}</version>
+      </dependency>
+      <dependency>
+      	<groupId>javax.enterprise</groupId>
+      	<artifactId>cdi-api</artifactId>
+      	<version>${version.weld}</version>
+      </dependency>
+      <dependency>
+      	<groupId>org.jboss.weld</groupId>
+      	<artifactId>weld-spi </artifactId>
+      	<version>${version.weld}</version>
+      </dependency>
+
+    </dependencies>
+  </dependencyManagement>
+
+  <profiles>
+    <profile>
+      <id>default</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
+        <microcontainer.testOutputDirectory>target/test-classes</microcontainer.testOutputDirectory>
+      </properties>
+    </profile>
+    <profile>
+      <id>eclipse</id>
+      <build>
+        <defaultGoal>process-test-resources</defaultGoal>
+        <plugins>
+          <plugin>
+            <artifactId>maven-eclipse-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>eclipse</id>
+                <phase>process-test-resources</phase>
+                <goals>
+                  <goal>eclipse</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <downloadSources>true</downloadSources>
+              <buildOutputDirectory>${microcontainer.outputDirectory}</buildOutputDirectory>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+      <properties>
+        <microcontainer.outputDirectory>eclipse-target/classes</microcontainer.outputDirectory>
+        <microcontainer.testOutputDirectory>eclipse-target/test-classes</microcontainer.testOutputDirectory>
+      </properties>
+    </profile>
+  </profiles>
+
+</project>

Added: projects/weld-int/trunk/webtier/.classpath
===================================================================
--- projects/weld-int/trunk/webtier/.classpath	                        (rev 0)
+++ projects/weld-int/trunk/webtier/.classpath	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/weld-int/trunk/webtier/.project
===================================================================
--- projects/weld-int/trunk/webtier/.project	                        (rev 0)
+++ projects/weld-int/trunk/webtier/.project	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>weld-jboss-int-webtier</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/weld-int/trunk/webtier/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/weld-int/trunk/webtier/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/weld-int/trunk/webtier/.settings/org.eclipse.jdt.core.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,5 @@
+#Fri Oct 09 11:41:56 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

Added: projects/weld-int/trunk/webtier/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/weld-int/trunk/webtier/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/weld-int/trunk/webtier/.settings/org.maven.ide.eclipse.prefs	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,9 @@
+#Fri Oct 09 11:41:44 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/weld-int/trunk/webtier/pom.xml
===================================================================
--- projects/weld-int/trunk/webtier/pom.xml	                        (rev 0)
+++ projects/weld-int/trunk/webtier/pom.xml	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,92 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.weld.integration</groupId>
+    <artifactId>weld-jboss-int</artifactId>
+    <version>5.2.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>weld-jboss-int-webtier</artifactId>
+  <version>5.2.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Weld Container Services: JBoss AS Webtier</name>
+  
+  <!-- Do not add version information here, use ../pom.xml instead -->
+  <dependencies>
+  
+    <!-- Global dependencies -->
+        
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.faces</groupId>
+      <artifactId>jsf-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.servlet.jsp</groupId>
+      <artifactId>jsp-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>jboss.web</groupId>
+      <artifactId>jbossweb</artifactId>
+    </dependency>
+    
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jboss.profiler.jvmti</groupId>
+          <artifactId>jboss-profiler-jvmti</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant-junit</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>  
+</project>

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,457 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.NavigationHandler;
+import javax.faces.application.ProjectStage;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.ActionListener;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+import javax.faces.validator.Validator;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingApplication extends Application
+{
+   
+   protected abstract Application delegate();
+   
+   public void addBehavior(String behaviorId, String behaviorClass)
+   {
+      delegate().addBehavior(behaviorId, behaviorClass);
+   }
+
+   public void addComponent(String componentType, String componentClass)
+   {
+      delegate().addComponent(componentType, componentClass);
+   }
+
+   public void addConverter(String converterId, String converterClass)
+   {
+      delegate().addConverter(converterId, converterClass);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public void addConverter(Class targetClass, String converterClass)
+   {
+      delegate().addConverter(targetClass, converterClass);
+   }
+   
+   @Override
+   public void addDefaultValidatorId(String validatorId)
+   {
+      delegate().addDefaultValidatorId(validatorId);
+   }
+   
+   @Override
+   public void addELContextListener(ELContextListener listener)
+   {
+      delegate().addELContextListener(listener);
+   }
+   
+   @Override
+   public void addELResolver(ELResolver resolver)
+   {
+      delegate().addELResolver(resolver);
+   }
+
+   @Override
+   public void addValidator(String validatorId, String validatorClass)
+   {
+      delegate().addValidator(validatorId, validatorClass);
+   }
+   
+   @Override
+   public Behavior createBehavior(String behaviorId) throws FacesException
+   {
+      return delegate().createBehavior(behaviorId);
+   }
+   
+   @Override
+   public UIComponent createComponent(FacesContext context, Resource componentResource)
+   {
+      return delegate().createComponent(context, componentResource);
+   }
+   
+   @Override
+   public UIComponent createComponent(FacesContext context, String componentType, String rendererType)
+   {
+      return delegate().createComponent(context, componentType, rendererType);
+   }
+
+   @Override
+   public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType) throws FacesException
+   {
+      return delegate().createComponent(componentExpression, context, componentType);
+   }
+   
+   @Override
+   public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType, String rendererType)
+   {
+      return delegate().createComponent(componentExpression, context, componentType, rendererType);
+   }
+   
+   @Override
+   public UIComponent createComponent(String componentType) throws FacesException
+   {
+      return delegate().createComponent(componentType);
+   }
+
+   @Override
+   @Deprecated
+   public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) throws FacesException
+   {
+      return delegate().createComponent(componentBinding, context, componentType);
+   }
+
+   @Override
+   public Converter createConverter(String converterId)
+   {
+      return delegate().createConverter(converterId);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public Converter createConverter(Class targetClass)
+   {
+      return delegate().createConverter(targetClass);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Deprecated
+   @Override
+   public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException
+   {
+      return delegate().createMethodBinding(ref, params);
+   }
+
+   @Override
+   public Validator createValidator(String validatorId) throws FacesException
+   {
+      return delegate().createValidator(validatorId);
+   }
+
+   @Override
+   @Deprecated
+   public ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException
+   {
+      return delegate().createValueBinding(ref);
+   }
+   
+   @Override
+   public <T> T evaluateExpressionGet(FacesContext context, String expression, Class<? extends T> expectedType) throws ELException
+   {
+      return delegate().evaluateExpressionGet(context, expression, expectedType);
+   }
+
+   @Override
+   public ActionListener getActionListener()
+   {
+      return delegate().getActionListener();
+   }
+   
+   @Override
+   public Iterator<String> getBehaviorIds()
+   {
+      return delegate().getBehaviorIds();
+   }
+   
+   
+
+   @Override
+   public Iterator<String> getComponentTypes()
+   {
+      return delegate().getComponentTypes();
+   }
+
+   @Override
+   public Iterator<String> getConverterIds()
+   {
+      return delegate().getConverterIds();
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public Iterator<Class<?>> getConverterTypes()
+   {
+      return delegate().getConverterTypes();
+   }
+
+   @Override
+   public Locale getDefaultLocale()
+   {
+      return delegate().getDefaultLocale();
+   }
+   
+   @Override
+   public String getDefaultRenderKitId()
+   {
+      return delegate().getDefaultRenderKitId();
+   }
+   
+   @Override
+   public Map<String, String> getDefaultValidatorInfo()
+   {
+      return delegate().getDefaultValidatorInfo();
+   }
+   
+   @Override
+   public ELContextListener[] getELContextListeners()
+   {
+      return delegate().getELContextListeners();
+   }
+   
+   @Override
+   public ELResolver getELResolver()
+   {
+      return delegate().getELResolver();
+   }
+   
+   @Override
+   public ExpressionFactory getExpressionFactory()
+   {
+      return delegate().getExpressionFactory();
+   }
+
+   @Override
+   public String getMessageBundle()
+   {
+      return delegate().getMessageBundle();
+   }
+
+   @Override
+   public NavigationHandler getNavigationHandler()
+   {
+      return delegate().getNavigationHandler();
+   }
+
+   @Override
+   @Deprecated
+   public PropertyResolver getPropertyResolver()
+   {
+      return delegate().getPropertyResolver();
+   }
+   
+   @Override
+   public ProjectStage getProjectStage()
+   {
+      return delegate().getProjectStage();
+   }
+   
+   @Override
+   public ResourceBundle getResourceBundle(FacesContext ctx, String name)
+   {
+      return delegate().getResourceBundle(ctx, name);
+   }
+   
+   @Override
+   public ResourceHandler getResourceHandler()
+   {
+      return delegate().getResourceHandler();
+   }
+
+   @Override
+   public StateManager getStateManager()
+   {
+      return delegate().getStateManager();
+   }
+
+   @Override
+   public Iterator<Locale> getSupportedLocales()
+   {
+      return delegate().getSupportedLocales();
+   }
+
+   @Override
+   public Iterator<String> getValidatorIds()
+   {
+      return delegate().getValidatorIds();
+   }
+
+   @Override
+   @Deprecated
+   public VariableResolver getVariableResolver()
+   {
+      return delegate().getVariableResolver();
+   }
+
+   @Override
+   public ViewHandler getViewHandler()
+   {
+      return delegate().getViewHandler();
+   }
+   
+   @Override
+   public void publishEvent(FacesContext context, Class<? extends SystemEvent> systemEventClass, Class<?> sourceBaseType, Object source)
+   {
+      delegate().publishEvent(context, systemEventClass, sourceBaseType, source);
+   }
+   
+   @Override
+   public void publishEvent(FacesContext context, Class<? extends SystemEvent> systemEventClass, Object source)
+   {
+      delegate().publishEvent(context, systemEventClass, source);
+   }
+   
+   @Override
+   public void removeELContextListener(ELContextListener listener)
+   {
+      delegate().removeELContextListener(listener);
+   }
+
+   @Override
+   public void setActionListener(ActionListener listener)
+   {
+      delegate().setActionListener(listener);
+   }
+
+   @Override
+   public void setDefaultLocale(Locale locale)
+   {
+      delegate().setDefaultLocale(locale);
+   }
+
+   @Override
+   public void setDefaultRenderKitId(String renderKitId)
+   {
+      delegate().setDefaultRenderKitId(renderKitId);
+   }
+
+   @Override
+   public void setMessageBundle(String bundle)
+   {
+      delegate().setMessageBundle(bundle);
+   }
+
+   @Override
+   public void setNavigationHandler(NavigationHandler handler)
+   {
+      delegate().setNavigationHandler(handler);
+   }
+
+
+   @Override
+   @Deprecated
+   public void setPropertyResolver(PropertyResolver resolver)
+   {
+      delegate().setPropertyResolver(resolver);
+   }
+   
+   @Override
+   public void setResourceHandler(ResourceHandler resourceHandler)
+   {
+      delegate().setResourceHandler(resourceHandler);
+   }
+
+   @Override
+   public void setStateManager(StateManager manager)
+   {
+      delegate().setStateManager(manager);
+   }
+
+   @Override
+   public void setSupportedLocales(Collection<Locale> locales)
+   {
+      delegate().setSupportedLocales(locales);
+
+   }
+
+   @Override
+   @Deprecated
+   public void setVariableResolver(VariableResolver resolver)
+   {
+      delegate().setVariableResolver(resolver);
+   }
+
+   @Override
+   public void setViewHandler(ViewHandler handler)
+   {
+      delegate().setViewHandler(handler);
+   }
+   
+   @Override
+   public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass, Class<?> sourceClass, SystemEventListener listener)
+   {
+      delegate().subscribeToEvent(systemEventClass, sourceClass, listener);
+   }
+   
+   @Override
+   public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
+   {
+      delegate().subscribeToEvent(systemEventClass, listener);
+   }
+   
+   @Override
+   public void unsubscribeFromEvent(Class<? extends SystemEvent> systemEventClass, Class<?> sourceClass, SystemEventListener listener)
+   {
+      delegate().unsubscribeFromEvent(systemEventClass, sourceClass, listener);
+   }
+   
+   @Override
+   public void unsubscribeFromEvent(Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
+   {
+      delegate().unsubscribeFromEvent(systemEventClass, listener);
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      return delegate().equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsf;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingApplicationFactory extends ApplicationFactory
+{
+
+   protected abstract ApplicationFactory delegate();
+   
+   @Override
+   public Application getApplication()
+   {
+      return delegate().getApplication();
+   }
+
+   @Override
+   public void setApplication(Application application)
+   {
+      delegate().setApplication(application);
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      return delegate().equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsf;
+
+import javax.el.ELContextListener;
+import javax.el.ExpressionFactory;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.application.Application;
+
+import org.jboss.weld.integration.webtier.util.BeanManagers;
+import org.jboss.weld.integration.webtier.util.Reflections;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldApplication extends ForwardingApplication
+{
+   
+   private static final ELContextListener[] EMPTY_LISTENERS = {};
+   
+   private final Application application;
+   private ExpressionFactory expressionFactory;
+   
+   public WeldApplication(Application application)
+   {
+      this.application = application;
+      BeanManager beanManager = BeanManagers.getBeanManager();
+      if (beanManager != null)
+      {
+         application.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.weld.el.WeldELContextListener"));
+         application.addELResolver(beanManager.getELResolver());
+      }
+   }
+
+   @Override
+   protected Application delegate()
+   {
+      return application;
+   }
+   
+   @Override
+   public ExpressionFactory getExpressionFactory()
+   {
+      // Application is multi-threaded, but no need to guard against races (re-
+      // creating the cached expression factory doesn't matter) or liveness
+      // (the value read by all threads will be the same)
+      // We have to do this lazily as Mojarra hasn't set the ExpressionFactory
+      // when the object is created
+      if (this.expressionFactory == null)
+      {
+         BeanManager beanManager = BeanManagers.getBeanManager();
+         if (beanManager != null)
+         {
+            this.expressionFactory = beanManager.wrapExpressionFactory(delegate().getExpressionFactory());
+         }
+         else
+         {
+            // WB failed to initialize properly
+            this.expressionFactory = delegate().getExpressionFactory(); 
+         }
+      }
+      return expressionFactory;
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsf;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldApplicationFactory extends ForwardingApplicationFactory
+{
+
+   private final ApplicationFactory applicationFactory;
+   
+   private Application application;
+   
+   public WeldApplicationFactory(ApplicationFactory applicationFactory)
+   {
+      this.applicationFactory = applicationFactory;
+   }
+   
+   @Override
+   protected ApplicationFactory delegate()
+   {
+      return applicationFactory;
+   }
+   
+   @Override
+   public Application getApplication()
+   {
+      if (application == null)
+      {
+         application = new WeldApplication(delegate().getApplication());
+      }
+      return application;
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsp;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.servlet.jsp.JspContext;
+
+import org.apache.jasper.el.ELContextImpl;
+import org.apache.jasper.runtime.JspApplicationContextImpl;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingJspApplicationContextImpl extends JspApplicationContextImpl
+{
+   
+   protected abstract JspApplicationContextImpl delegate();
+   
+   @Override
+   public void addELContextListener(ELContextListener listener)
+   {
+      delegate().addELContextListener(listener);
+   }
+   
+   @Override
+   public void addELResolver(ELResolver resolver) throws IllegalStateException
+   {
+      delegate().addELResolver(resolver);
+   }
+   
+   @Override
+   public ELContextImpl createELContext(JspContext arg0)
+   {
+      return delegate().createELContext(arg0);
+   }
+   
+   @Override
+   public ExpressionFactory getExpressionFactory()
+   {
+      return delegate().getExpressionFactory();
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      return this == obj || delegate().equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,96 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.jsp;
+
+import javax.el.ELContextListener;
+import javax.el.ExpressionFactory;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
+
+import org.apache.jasper.runtime.JspApplicationContextImpl;
+import org.jboss.weld.servlet.api.helpers.AbstractServletListener;
+import org.jboss.weld.integration.webtier.util.Reflections;
+
+/**
+ * The Web Beans JSP initialization listener
+ * 
+ * 
+ * @author Pete Muir
+ *
+ */
+public class JspInitializationListener extends AbstractServletListener
+{
+   
+   private static class WeldJspApplicationContextImpl extends ForwardingJspApplicationContextImpl
+   {
+      private final JspApplicationContextImpl delegate;
+      private final ExpressionFactory expressionFactory;
+      
+      public WeldJspApplicationContextImpl(JspApplicationContextImpl delegate, ExpressionFactory expressionFactory)
+      {
+         this.delegate = delegate;
+         this.expressionFactory = expressionFactory;
+      }
+
+      @Override
+      protected JspApplicationContextImpl delegate()
+      {
+         return delegate;
+      }
+      
+      @Override
+      public ExpressionFactory getExpressionFactory()
+      {
+         return expressionFactory;
+      }
+      
+   }
+   
+   @Inject 
+   private BeanManager beanManager;
+   
+   @Override
+   public void contextInitialized(ServletContextEvent sce)
+   {
+      
+      if (beanManager != null)
+      {
+
+         // get JspApplicationContext.
+         JspApplicationContext jspAppContext = JspFactory.getDefaultFactory().getJspApplicationContext(sce.getServletContext());
+         
+         // register compositeELResolver with JSP
+         jspAppContext.addELResolver(beanManager.getELResolver());
+   
+         jspAppContext.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.weld.el.WeldELContextListener"));
+         
+         // Hack into JBoss Web/Catalina to replace the ExpressionFactory
+         JspApplicationContextImpl wrappedJspApplicationContextImpl = new WeldJspApplicationContextImpl(JspApplicationContextImpl.getInstance(sce.getServletContext()), beanManager.wrapExpressionFactory(jspAppContext.getExpressionFactory()));
+         sce.getServletContext().setAttribute(JspApplicationContextImpl.class.getName(), wrappedJspApplicationContextImpl);
+      }
+      // otherwise something went wrong starting WB, so don't register with JSP
+   }
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/BeanManagers.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/BeanManagers.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/BeanManagers.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.util;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeanManagers
+{
+   
+   public static BeanManager getBeanManager()
+   {
+      try
+      {
+         InitialContext context = new InitialContext();
+         return (BeanManager) context.lookup("java:app/BeanManager");
+      }
+      catch (NamingException e)
+      {
+         return null;
+      }
+      
+   }
+
+}

Added: projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java
===================================================================
--- projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java	                        (rev 0)
+++ projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java	2009-10-09 10:32:09 UTC (rev 94573)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.integration.webtier.util;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class Reflections
+{
+   
+   
+   public static <T> T newInstance(String className)
+   {
+      try
+      {
+         return Reflections.<T>classForName(className).newInstance();
+      }
+      catch (InstantiationException e)
+      {
+         throw new IllegalArgumentException("Cannot instantiate instance of " + className + " with no-argument constructor", e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new IllegalArgumentException("Cannot instantiate instance of " + className + " with no-argument constructor", e);
+      }
+   }
+   
+   
+   public static <T> Class<T> classForName(String name)
+   {
+      
+      try
+      {
+         if (Thread.currentThread().getContextClassLoader() != null)
+         {
+            Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(name);
+            
+            @SuppressWarnings("unchecked")
+            Class<T> clazz = (Class<T>)  c;
+            
+            return clazz;
+         }
+         else
+         {
+            Class<?> c = Class.forName(name);
+            
+            @SuppressWarnings("unchecked")
+            Class<T> clazz = (Class<T>)  c;
+            
+            return clazz;
+         }
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new IllegalArgumentException("Cannot load class for " + name, e);
+      }
+      catch (NoClassDefFoundError e)
+      {
+         throw new IllegalArgumentException("Cannot load class for " + name, e);
+      }
+   }
+
+}




More information about the jboss-cvs-commits mailing list