[jboss-cvs] JBossAS SVN: r105926 - in trunk: build and 116 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 10 09:56:41 EDT 2010


Author: marius.bogoevici
Date: 2010-06-10 09:56:35 -0400 (Thu, 10 Jun 2010)
New Revision: 105926

Added:
   trunk/weld-int/
   trunk/weld-int/assembly/
   trunk/weld-int/assembly/pom.xml
   trunk/weld-int/assembly/src/
   trunk/weld-int/assembly/src/main/
   trunk/weld-int/assembly/src/main/assembly/
   trunk/weld-int/assembly/src/main/assembly/assembly.xml
   trunk/weld-int/assembly/src/main/assembly/resources/
   trunk/weld-int/assembly/src/main/assembly/resources/META-INF/
   trunk/weld-int/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml
   trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
   trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml
   trunk/weld-int/assembly/src/main/assembly/resources/lib-int/
   trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/
   trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/
   trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia
   trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml
   trunk/weld-int/deployer/
   trunk/weld-int/deployer/pom.xml
   trunk/weld-int/deployer/src/
   trunk/weld-int/deployer/src/main/
   trunk/weld-int/deployer/src/main/java/
   trunk/weld-int/deployer/src/main/java/org/
   trunk/weld-int/deployer/src/main/java/org/jboss/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/AbstractJndiBinderDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaCompJndiBinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinderDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEModuleJndiBinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JndiBinderDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/SimpleCompJndiBinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/WebJndiBinderDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/AbstractManifestFinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/JDKManifestFinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestFinder.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestUtils.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/VFSManifestFinder.java
   trunk/weld-int/deployer/src/test/
   trunk/weld-int/deployer/src/test/java/
   trunk/weld-int/deployer/src/test/java/org/
   trunk/weld-int/deployer/src/test/java/org/jboss/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/crm/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/CheckableJndiBinderDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockContext.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJndiBinderDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ext/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jar/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jsf/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ui/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/util/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/web/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java
   trunk/weld-int/deployer/src/test/resources/
   trunk/weld-int/deployer/src/test/resources/org/
   trunk/weld-int/deployer/src/test/resources/org/jboss/
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml
   trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml
   trunk/weld-int/deployer/src/test/resources/weld/
   trunk/weld-int/deployer/src/test/resources/weld/earwithutil/
   trunk/weld-int/deployer/src/test/resources/weld/earwithutil/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/earwithutil/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/jarinear/
   trunk/weld-int/deployer/src/test/resources/weld/jarinear/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/jarinear/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/
   trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/post/
   trunk/weld-int/deployer/src/test/resources/weld/post/ejb/
   trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml
   trunk/weld-int/deployer/src/test/resources/weld/post/web/
   trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/
   trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/jboss-web.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/
   trunk/weld-int/deployer/src/test/resources/weld/simple/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/simple/crm/
   trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/ext/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/jar/
   trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/ui/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF
   trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/web/
   trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/
   trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml
   trunk/weld-int/deployer/src/test/resources/weld/warinear/
   trunk/weld-int/deployer/src/test/resources/weld/warinear/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/warinear/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/META-INF/application.properties
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/WEB-INF/
   trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml
   trunk/weld-int/ejb/
   trunk/weld-int/ejb/pom.xml
   trunk/weld-int/ejb/src/
   trunk/weld-int/ejb/src/main/
   trunk/weld-int/ejb/src/main/java/
   trunk/weld-int/ejb/src/main/java/org/
   trunk/weld-int/ejb/src/main/java/org/jboss/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBean31DescriptorAdaptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/jsf/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/messaging/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/persistence/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/resource/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/security/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/servlet/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/transaction/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/validation/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/vdf/
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ws/
   trunk/weld-int/pom.xml
   trunk/weld-int/webtier/
   trunk/weld-int/webtier/pom.xml
   trunk/weld-int/webtier/src/
   trunk/weld-int/webtier/src/main/
   trunk/weld-int/webtier/src/main/java/
   trunk/weld-int/webtier/src/main/java/org/
   trunk/weld-int/webtier/src/main/java/org/jboss/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/DummyELResolver.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingELResolver.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/util/
   trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java
Modified:
   trunk/build/build.xml
   trunk/component-matrix/pom.xml
   trunk/depchain/pom.xml
   trunk/pom.xml
Log:
JBAS-7938: weld-int moved into JBAS

Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml	2010-06-10 13:08:11 UTC (rev 105925)
+++ trunk/build/build.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -2526,9 +2526,8 @@
       <mapper refid="remove-versions" />
     </copy>
 
-    <unzip dest="${install.server}/all/deployers">
-      <fileset file="${org.jboss.weld.integration:weld-jboss-int-deployer-assembly:zip}"/>
-    </unzip>
+    <unzip dest="${install.server}/all/deployers"
+            src="${project.root}/weld-int/assembly/target/distribution/weld-int-deployer-assembly.zip"/>
 
     <!-- Install Admin Console -->
     <mkdir dir="${install.common.deploy}/admin-console.war"/>

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2010-06-10 13:08:11 UTC (rev 105925)
+++ trunk/component-matrix/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -109,7 +109,8 @@
     <version.org.jboss.ejb3.embedded>1.0.0-alpha-1</version.org.jboss.ejb3.embedded>
     <version.org.jboss.ejb.api>1.0-alpha-1</version.org.jboss.ejb.api>
     <version.org.jboss.embedded>1.0.0-alpha-3</version.org.jboss.embedded>
-    <version.org.jboss.injection>0.1.0-alpha-2</version.org.jboss.injection>
+   <version.org.jboss.injection>0.1.0-alpha-2</version.org.jboss.injection>
+    <version.org.jboss.interceptor>1.0.0-CR11</version.org.jboss.interceptor>
     <version.org.jboss.integration>6.0.0.CR1</version.org.jboss.integration>
     <version.org.jboss.javaee.specs.bom>1.0.0.Beta1</version.org.jboss.javaee.specs.bom>
     <version.org.jboss.jbossxb>2.0.2.Beta7</version.org.jboss.jbossxb>
@@ -153,6 +154,7 @@
     <version.org.jboss.stdio>1.0.0.CR3</version.org.jboss.stdio>
     <version.org.jboss.threads>2.0.0.CR4</version.org.jboss.threads>
     <version.org.jboss.vfs>3.0.0.CR5</version.org.jboss.vfs>
+    <version.org.jboss.weld>1.0.1-Final</version.org.jboss.weld>
     <version.org.jboss.xnio>2.1.0.CR2</version.org.jboss.xnio>
     <version.org.jboss.xnio.metadata>2.1.0.CR5</version.org.jboss.xnio.metadata>
     <version.org.osgi>4.2.0</version.org.osgi>
@@ -167,7 +169,6 @@
     <version.sun-jaxws>2.2</version.sun-jaxws>
     <version.sun-policy>2.0-b01</version.sun-policy>
     <version.weld.api>1.0-SP1</version.weld.api>
-    <version.weld.integration>6.0.0.Beta11</version.weld.integration>
     <version.xdoclet>1.2.3</version.xdoclet>
     <version.xmlschema>1.4.5</version.xmlschema>
   </properties>
@@ -240,14 +241,32 @@
         <version>${version.weld.api}</version>
       </dependency>
 
+       <dependency>
+        <groupId>org.jboss.weld</groupId>
+        <artifactId>weld-spi</artifactId>
+        <version>${version.weld.api}</version>
+      </dependency>
+
       <dependency>
-        <groupId>org.jboss.weld.integration</groupId>
-        <artifactId>weld-jboss-int-deployer-assembly</artifactId>
-        <version>${version.weld.integration}</version>
-        <type>zip</type>
+          <groupId>org.jboss.weld</groupId>
+          <artifactId>weld-core</artifactId>
+          <version>${version.org.jboss.weld}</version>
       </dependency>
 
       <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>weld-int-assembly</artifactId>
+      <type>pom</type>
+      <version>${project.version}</version>
+    </dependency>
+
+      <dependency>
+        <groupId>org.jboss.interceptor</groupId>
+        <artifactId>jboss-interceptor</artifactId>
+        <version>${version.org.jboss.interceptor}</version>
+      </dependency>
+
+      <dependency>
         <groupId>org.jboss.snowdrop</groupId>
         <artifactId>jboss-spring-deployer</artifactId>
         <version>${version.spring.integration}</version>
@@ -974,7 +993,13 @@
               <artifactId>jboss-logmanager</artifactId>
            </exclusion>
         </exclusions>
-      </dependency>  
+      </dependency>
+
+      <!--<dependency>-->
+        <!--<groupId>org.jboss.logging</groupId>-->
+        <!--<artifactId>jboss-logging-spi</artifactId>-->
+        <!--<version>${version.org.jboss.logging-spi}</version>-->
+      <!--</dependency> -->
       
       <dependency>
         <groupId>org.jboss.logging</groupId>
@@ -2581,6 +2606,13 @@
 
         <dependency>
           <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-deployers-vfs</artifactId>
+          <type>test-jar</type>
+          <version>${version.org.jboss.deployers}</version>
+        </dependency>
+
+        <dependency>
+          <groupId>org.jboss.deployers</groupId>
           <artifactId>jboss-deployers-vfs-spi</artifactId>
           <version>${version.org.jboss.deployers}</version>
           <exclusions>

Modified: trunk/depchain/pom.xml
===================================================================
--- trunk/depchain/pom.xml	2010-06-10 13:08:11 UTC (rev 105925)
+++ trunk/depchain/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -972,9 +972,9 @@
       <artifactId>jboss-threads-metadata</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.jboss.weld.integration</groupId>
-      <artifactId>weld-jboss-int-deployer-assembly</artifactId>
-      <type>zip</type>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>weld-int-assembly</artifactId>
+      <type>pom</type>
     </dependency>
     <dependency>
       <groupId>org.jboss.snowdrop</groupId>

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2010-06-10 13:08:11 UTC (rev 105925)
+++ trunk/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -549,6 +549,7 @@
         <module>tomcat</module>
         <module>varia</module>
         <module>webservices</module>
+        <module>weld-int</module>
         <!-- distro modules -->
         <module>client</module>
         <module>build</module>

Copied: trunk/weld-int/assembly/pom.xml (from rev 105217, projects/weld-int/trunk/assembly/pom.xml)
===================================================================
--- trunk/weld-int/assembly/pom.xml	                        (rev 0)
+++ trunk/weld-int/assembly/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,110 @@
+<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.jbossas</groupId>
+      <artifactId>jboss-as-weld-int</artifactId>
+      <version>6.0.0-SNAPSHOT</version>
+   </parent>
+   
+   <groupId>org.jboss.jbossas</groupId>
+   <artifactId>weld-int-assembly</artifactId>
+   <packaging>jar</packaging>
+   <name>JBoss Application Server Weld Integration Assembly</name>
+   <description>Weld deployer assembly for JBoss AS</description>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>assemble</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>attached</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/assembly.xml</descriptor>
+                            </descriptors>
+                            <outputDirectory>
+                                target/distribution
+                            </outputDirectory>
+                            <workDirectory>
+                                target/assembly/work
+                            </workDirectory>
+                            <finalName>
+                                weld-int-deployer-assembly
+                            </finalName>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+   
+   <dependencies>
+   
+   <!-- 
+      This MUST NOT export ANY dependencies- they should be marked optional.
+   -->
+   
+    <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>weld-int-ejb</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>weld-int-webtier</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>weld-int-deployer</artifactId>
+      <optional>true</optional>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-core</artifactId>
+      <optional>true</optional>
+      <exclusions>
+          <exclusion>
+              <groupId>org.jboss.interceptor</groupId>
+              <artifactId>jboss-interceptor-api</artifactId>
+          </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.spec.javax.interceptor</groupId>
+      <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.interceptor</groupId>
+      <artifactId>jboss-interceptor</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>

Copied: trunk/weld-int/assembly/src/main/assembly/assembly.xml (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/assembly.xml)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/assembly.xml	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/assembly.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,46 @@
+<?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>org.slf4j:slf4j-ext:jar</include>
+            <include>ch.qos.cal10n:cal10n-api</include>
+            <include>org.jboss.weld:weld-spi</include>
+            <include>org.jboss.jbossas:weld-int-ejb</include>
+            <include>org.jboss.jbossas:weld-int-deployer</include>
+            <include>org.jboss.interceptor:jboss-interceptor</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>
+            <include>org.jboss.jbossas:weld-int-webtier</include>            
+         </includes>
+      </dependencySet>
+   </dependencySets>
+   
+</assembly>

Copied: trunk/weld-int/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/resources/META-INF/jboss-structure.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,84 @@
+<?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>-->
+
+  <!-- Responsible for binding bean managers -->
+  <!--<bean name="JndiBinderDeployer" class="org.jboss.weld.integration.deployer.jndi.JndiBinderDeployer">-->
+      <!--<depends>NameSpaces</depends>-->
+  <!--</bean>-->
+
+  <bean name="JavaEEComponentJndiBinderDeployer" class="org.jboss.weld.integration.deployer.jndi.JavaEEComponentJndiBinderDeployer">
+      <constructor><parameter><inject bean="NamingJavaEEComponentInformer"/></parameter></constructor>
+      <depends>NameSpaces</depends>
+  </bean>
+
+  <bean name="WebJndiBinderDeployer" class="org.jboss.weld.integration.deployer.jndi.WebJndiBinderDeployer">
+      <constructor><parameter><inject bean="NamingJavaEEModuleInformer"/></parameter></constructor>
+      <depends>NameSpaces</depends>
+  </bean>
+
+  <!-- Adds plugin to BeanMetaDataDeployer that installs WeldKernelControllerContexts -->
+  <!-- bean name="WeldBeanMetaDataDeployerPlugin" class="org.jboss.weld.integration.deployer.mc.WeldBeanMetaDataDeployerPlugin"/ -->
+  
+
+
+</deployment>

Copied: trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-services-jboss-beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/.faces-config.xml.jsfdia	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess"/>

Copied: trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml (from rev 105217, projects/weld-int/trunk/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml)
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	                        (rev 0)
+++ trunk/weld-int/assembly/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/deployer/pom.xml (from rev 105788, projects/weld-int/trunk/deployer/pom.xml)
===================================================================
--- trunk/weld-int/deployer/pom.xml	                        (rev 0)
+++ trunk/weld-int/deployer/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,361 @@
+<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.jbossas</groupId>
+      <artifactId>jboss-as-weld-int</artifactId>
+      <version>6.0.0-SNAPSHOT</version>
+   </parent>
+   
+   <groupId>org.jboss.jbossas</groupId>
+   <artifactId>weld-int-deployer</artifactId>
+   <packaging>jar</packaging>
+   <name>JBoss Application Server Weld Integration MC Deployers</name>
+   <description>Weld deployers for JBoss AS</description>
+   
+   <build>
+     <plugins>
+       <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-jar-plugin</artifactId>
+         <executions>
+           <execution>
+             <goals>
+               <goal>test-jar</goal>
+             </goals>
+             <phase>test</phase>
+           </execution>
+         </executions>
+       </plugin>
+     </plugins>
+   </build>
+   
+   <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-ejb</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-ejb-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-jca-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-jms-api</artifactId>
+          </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.kernel</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.kernel</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <optional>true</optional>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss.kernel</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>
+    
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-mdr</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.kernel</groupId>
+          <artifactId>jboss-kernel</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.cl</groupId>
+          <artifactId>jboss-classloading</artifactId>
+        </exclusion>
+      </exclusions>
+      -->
+    </dependency>
+
+    <dependency>
+        <groupId>org.jboss.reloaded</groupId>
+        <artifactId>jboss-reloaded-naming-deployers</artifactId>
+        <scope>provided</scope>
+    </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>org.jboss.spec.javax.servlet</groupId>
+      <artifactId>jboss-servlet-api_3.0_spec</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.logging</groupId>
+      <artifactId>jboss-logging</artifactId>
+      <scope>provided</scope>
+    </dependency>
+       
+       <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-core</artifactId>
+         <scope>provided</scope>
+         <exclusions>
+           <exclusion>
+              <groupId>org.jboss.microcontainer</groupId>
+              <artifactId>jboss-kernel</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>apache-xerces</groupId>
+             <artifactId>xml-apis</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.microcontainer</groupId>
+             <artifactId>jboss-dependency</artifactId>
+           </exclusion>
+            <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-aop-mc-int</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-jaspi-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-jca-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-jacc-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-transaction-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-jms-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>org.jboss.javaee</groupId>
+             <artifactId>jboss-ejb-api</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>sun-jaxws</groupId>
+             <artifactId>jsr181-api</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>quartz</groupId>
+             <artifactId>quartz</artifactId>
+           </exclusion>
+           <exclusion>
+             <groupId>sun-jaxws</groupId>
+             <artifactId>jaxws-api</artifactId>
+           </exclusion>
+         </exclusions>
+       </dependency>
+      
+   </dependencies>
+
+</project>

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,145 @@
+/*
+ * 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.beans.metadata.spi.BeanMetaData;
+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
+{
+   public static final String JAVAX_VALIDATION_VALIDATOR_FACTORY = "javax.validation.ValidatorFactory";
+
+   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;
+   }
+
+   /**
+    * Get the name of the bootstrap bean deployer attachment
+    * @param unit The deployment unit
+    * @return the deployer attachment name of the bootstrap bean
+    */
+   public static String getBootstrapBeanAttachmentName(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null deployment unit");
+
+      return getBootstrapBeanName(unit) + "_" + BeanMetaData.class.getSimpleName();
+   }
+
+   /**
+    * Get the name of the weld deployment bean
+    * @param unit The deployment unit
+    * @return the weld deployment bean name
+    */
+   public static String getDeploymentBeanName(DeploymentUnit unit)
+   {
+      return unit.getName() + "_JBossDeployment";
+   }
+
+   /**
+    * Get the name of the weld deployment deployers attachment
+    * @param unit The deployment unit
+    * @return the deployer attachment name of the weld deployment
+    */
+   public static String getDeploymentAttachmentName(DeploymentUnit unit)
+   {
+      return getDeploymentBeanName(unit);
+   }
+
+   /**
+    * 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;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldUrlIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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/";
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,32 @@
+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;
+
+/**
+ * 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"});
+   }
+
+   @Override
+   protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+   {
+      return DeployersUtils.checkForWeldFiles(unit);
+   }
+
+   protected String getShortLibName()
+   {
+      return "weld-int-webtier.jar";
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,107 @@
+/*
+ * 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);
+   }
+
+   @Override
+   public final void deploy(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      if (info != null)
+      {
+         deployInternal(unit, info);
+      }
+      else if (info == null && DeployersUtils.checkForWeldFiles(unit))
+      {
+         info = new BootstrapInfo();
+         unit.addAttachment(BootstrapInfo.class, info);
+         deployInternal(unit, info);
+      }
+   }
+
+   @Override
+   public void undeploy(DeploymentUnit unit, BootstrapInfo info)
+   {
+      if (info != null)
+      {
+         undeployInternal(unit, info);
+      }
+   }
+
+   protected void undeployInternal(DeploymentUnit unit, BootstrapInfo info)
+   {
+
+   }
+
+   /**
+    * Do deploy.
+    *
+    * @param unit the deployment unit
+    * @param info non-null bootstrap info
+    * @throws org.jboss.deployers.spi.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);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractDeploymentDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,85 @@
+/*
+ * 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;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * 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;
+
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(DeployersUtils.getDeploymentBeanName(unit), getDeploymentClass().getName());
+      buildDeployment(unit, info, builder);
+      info.setDeployment(builder.createInject(DeployersUtils.getDeploymentBeanName(unit)));
+      unit.addAttachment(DeployersUtils.getDeploymentAttachmentName(unit), 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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/BootstrapInfo.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/DynamicDependencyCreator.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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 = ControllerState.getInstance(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 = ControllerState.getInstance(dependentState);
+
+      DependencyInfo di = targetControllerContext.getDependencyInfo();
+      for (Object dependency : dependencies)
+      {
+         DependencyItem item = new AbstractDependencyItem(targetName, dependency, whenRequired, dependent);
+         di.addIDependOn(item);
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/EjbServicesDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeployment.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/FlatDeploymentDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/JBossBeanDeploymentArchive.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY);
+   }
+
+   @Override
+   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(DeployersUtils.getBootstrapBeanAttachmentName(unit), bootstrap.getBeanMetaData());
+
+      String injectorName = unit.getName() + "_WBInjector";
+      BeanMetaDataBuilder weldInjector = BeanMetaDataBuilder.createBuilder(injectorName, WeldInjector.class.getName());
+      weldInjector.addConstructorParameter(BootstrapBean.class.getName(), bootstrap.createInject(bootstrapName));
+      weldInjector.setDestroy("cleanup");
+      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(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY);
+
+      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(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY, validatorFactory);
+      return builder.createInject(beanName);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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 static 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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldDiscoveryEnvironment.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,79 @@
+/*
+ * 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.Collections;
+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
+    */
+   public void addWeldClass(Class<?> clazz)
+   {
+      classes.add(clazz);
+   }
+
+   /**
+    * Add weld xml url.
+    *
+    * @param url the weld xml url
+    */
+   public void addWeldXmlURL(URL url)
+   {
+      urls.add(url);
+   }
+
+   /**
+    * Get weld classes.
+    *
+    * @return the weld classes
+    */
+   public Collection<Class<?>> getWeldClasses()
+   {
+      return Collections.unmodifiableCollection(classes);
+   }
+
+   /**
+    * Get weld xmls.
+    *
+    * @return the weld xmls
+    */
+   public Collection<URL> getWeldXml()
+   {
+      return Collections.unmodifiableCollection(urls);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldJndiBinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/helpers/BootstrapBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.integration.deployer.env.FlatDeployment;
+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;
+
+/**
+ * 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();
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaData.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/ext/JBossWeldMetaDataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/AbstractJndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/AbstractJndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/AbstractJndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/AbstractJndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,153 @@
+/*
+ * 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.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+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.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Extract binding logic to an abstract binder deployer.
+ *
+ * @param <T> exact bootstrap bean
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractJndiBinderDeployer<T> extends AbstractDeployer
+{
+   public static final String BEAN_MANAGER_JNDI_SUBCONTEXT = "BeanManagers";
+
+   private Class<T> bootstrapClass;
+   private Object thisName;
+   private Hashtable<String, String> jndiEnvironment = new Hashtable<String, String>();
+   private Context beanManagerContext;
+
+   protected AbstractJndiBinderDeployer(Class<T> bootstrapClass)
+   {
+      if (bootstrapClass == null)
+         throw new IllegalArgumentException("Null bootstrap class");
+
+      setTopLevelOnly(true);
+      addInput(BeanMetaData.class);
+      setStage(DeploymentStages.PRE_REAL);
+
+      this.bootstrapClass = bootstrapClass;
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
+      String bbAttachmentName = bootstrapName + "_" + BeanMetaData.class.getSimpleName();
+
+      BeanMetaData bbBMD = unit.getAttachment(bbAttachmentName, BeanMetaData.class);
+      if (bbBMD != null)
+      {
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(bbBMD);
+
+         ParameterMetaDataBuilder pmdb = builder.addInstallWithParameters("bind", thisName.toString(), ControllerState.INSTALLED, ControllerState.INSTALLED);
+         pmdb.addParameterMetaData(bootstrapClass.getName(), builder.createThis());
+         pmdb.addParameterMetaData(String.class.getName(), unit.getSimpleName());
+
+         pmdb = builder.addUninstallWithParameters("unbind", thisName.toString(), ControllerState.INSTALLED, ControllerState.INSTALLED);
+         pmdb.addParameterMetaData(bootstrapClass.getName(), builder.createThis());
+         pmdb.addParameterMetaData(String.class.getName(), unit.getSimpleName());
+      }
+   }
+
+   @Inject(fromContext = FromContext.NAME)
+   public void setThisName(Object thisName)
+   {
+      this.thisName = thisName;
+   }
+
+   protected Context createContext() throws NamingException
+   {
+      return new InitialContext(jndiEnvironment);
+   }
+
+   public void create() throws Exception
+   {
+      if (jndiEnvironment != null)
+         addNonSerializableFactory(jndiEnvironment); // is here OK?
+
+      Context context = createContext();
+      beanManagerContext = context.createSubcontext(BEAN_MANAGER_JNDI_SUBCONTEXT);
+   }
+
+   protected Context getBeanManagerContext()
+   {
+      return beanManagerContext;
+   }
+
+   public void destroy()
+   {
+      try
+      {
+         Context context = createContext();
+         context.destroySubcontext(BEAN_MANAGER_JNDI_SUBCONTEXT);
+      }
+      catch (Exception ignore)
+      {
+      }
+   }
+
+   public void setJndiEnvironment(Hashtable<String, String> jndiEnvironment)
+   {
+      this.jndiEnvironment = jndiEnvironment;
+   }
+
+// --- binding logic ---
+
+   public abstract void bind(T bootstrapBean, String deploymentUnitName) throws NamingException;
+
+   public abstract void unbind(T bootstrapBean, String deploymentUnitName) throws NamingException;
+
+   protected static void addNonSerializableFactory(Hashtable<String, String> environment)
+   {
+      String nonSerializableFactory = NonSerializableFactory.class.getName();
+      String objFactory = environment.get(Context.OBJECT_FACTORIES);
+      if (objFactory != null)
+      {
+         objFactory = nonSerializableFactory + ":" + objFactory;
+      }
+      else
+      {
+         objFactory = nonSerializableFactory;
+      }
+
+      environment.put(Context.OBJECT_FACTORIES, objFactory);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaCompJndiBinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaCompJndiBinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaCompJndiBinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaCompJndiBinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author Marius Bogoevici
+ */
+public abstract class JavaCompJndiBinder
+{
+   protected Logger log = Logger.getLogger(getClass());
+   private String deploymentUnitName;
+
+   public JavaCompJndiBinder(String deploymentUnitName)
+   {
+      this.deploymentUnitName = deploymentUnitName;
+   }
+
+   public void bindToJavaComp()
+   {
+      try
+      {
+         getJavaCompContext().bind("BeanManager",new Reference(BeanManager.class.getName(), "org.jboss.weld.resources.ManagerObjectFactory", null));
+      }
+      catch (NamingException e)
+      {
+         log.error("Could not bound BeanManager on " + getJavaContextDescription());
+      }
+   }
+
+   protected abstract Context getJavaCompContext() throws NamingException;
+
+   protected abstract String getJavaContextDescription();
+
+   public void unbind()
+   {
+      try
+      {
+         getJavaCompContext().unbind("BeanManager");
+      }
+      catch (NamingException e)
+      {
+         log.error("Cound not unbind java:comp/BeanManager for " + deploymentUnitName);
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import javax.naming.Context;
+
+import org.jboss.reloaded.naming.spi.JavaEEComponent;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class JavaEEComponentJndiBinder extends JavaCompJndiBinder
+{
+
+   private JavaEEComponent javaEEComponent;
+
+   public JavaEEComponentJndiBinder(JavaEEComponent javaEEComponent, String deploymentUnitName)
+   {
+      super(deploymentUnitName);
+      this.javaEEComponent = javaEEComponent;
+   }
+
+   @Override
+   protected Context getJavaCompContext()
+   {
+      return javaEEComponent.getContext();
+   }
+
+   @Override
+   protected String getJavaContextDescription()
+   {
+      return javaEEComponent.getName();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEComponentJndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+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.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
+import org.jboss.reloaded.naming.spi.JavaEEComponent;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class JavaEEComponentJndiBinderDeployer extends AbstractSimpleRealDeployer<JBossEnterpriseBeanMetaData>
+{
+
+   private JavaEEComponentInformer informer;
+
+   public JavaEEComponentJndiBinderDeployer(JavaEEComponentInformer javaEEComponentInformer)
+   {
+      super(JBossEnterpriseBeanMetaData.class);
+      informer = javaEEComponentInformer;
+      setComponentsOnly(true);
+      setOutput(BeanMetaData.class);
+   }
+
+   @Override
+   public void deploy(DeploymentUnit deploymentUnit, JBossEnterpriseBeanMetaData jBossEnterpriseBeanMetaData) throws DeploymentException
+   {
+      BeanMetaData bbBMD = getBootstrapBeanAttachment(deploymentUnit.getTopLevel());
+      if (bbBMD == null)
+      {
+         return;
+      }
+
+      if (informer.getModuleType(deploymentUnit).equals(org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer.ModuleType.EJB)
+            && !deploymentUnit.getParent().isAttachmentPresent(JBossWebMetaData.class))
+      {
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(deploymentUnit.getName() + "_CompJndiBinder", JavaEEComponentJndiBinder.class.getName());
+         AbstractInjectionValueMetaData javaComponent = new AbstractInjectionValueMetaData(getComponentBeanName(deploymentUnit));
+         builder.addConstructorParameter(JavaEEComponent.class.getName(), javaComponent);
+         builder.addConstructorParameter(String.class.getName(), deploymentUnit.getName());
+         builder.addInstall("bindToJavaComp");
+         deploymentUnit.getParent().addAttachment(deploymentUnit.getName() + "_JavaCompBinder", builder.getBeanMetaData());
+      }
+   }
+
+   private BeanMetaData getBootstrapBeanAttachment(DeploymentUnit deploymentUnit)
+   {
+      String bootstrapName = DeployersUtils.getBootstrapBeanName(deploymentUnit.getTopLevel());
+      String bbAttachmentName = bootstrapName + "_" + BeanMetaData.class.getSimpleName();
+
+      BeanMetaData bbBMD = deploymentUnit.getTopLevel().getAttachment(bbAttachmentName, BeanMetaData.class);
+      return bbBMD;
+   }
+
+   private String getComponentBeanName(DeploymentUnit deploymentUnit)
+   {
+      String appName = informer.getApplicationName(deploymentUnit);
+      String moduleName = informer.getModulePath(deploymentUnit);
+      String componentName = informer.getComponentName(deploymentUnit);
+      String name = "jboss.naming:";
+      if(appName != null)
+         name += "application=" + appName + ",";
+      name += "module=" + moduleName + ",component=" + componentName;
+      return name;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEModuleJndiBinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEModuleJndiBinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEModuleJndiBinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JavaEEModuleJndiBinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import javax.naming.Context;
+
+import org.jboss.reloaded.naming.spi.JavaEEModule;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class JavaEEModuleJndiBinder extends JavaCompJndiBinder
+{
+
+   private JavaEEModule javaEEModule;
+
+   public JavaEEModuleJndiBinder(JavaEEModule javaEEModule, String deploymentUnitName)
+   {
+      super(deploymentUnitName);
+      this.javaEEModule = javaEEModule;
+   }
+
+   @Override
+   protected Context getJavaCompContext()
+   {
+      return javaEEModule.getContext();
+   }
+
+   @Override
+   protected String getJavaContextDescription()
+   {
+      return javaEEModule.getName();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/JndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,122 @@
+/*
+ * 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.jndi;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.integration.deployer.env.helpers.BootstrapBean;
+import org.jboss.weld.manager.api.WeldManager;
+
+/**
+ * This deployer intercepts BootstrapBean metadata,
+ * and adds JndiBinder invocations to it.
+ *
+ * @author Pete Muir
+ * @author <a href="mailto:stan.silvert at jboss.org">Stan Silvert</a>
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JndiBinderDeployer extends AbstractJndiBinderDeployer<BootstrapBean>
+{
+   public JndiBinderDeployer()
+   {
+      super(BootstrapBean.class);
+   }
+
+// --- binding logic ---
+
+   public void bind(BootstrapBean bootstrapBean, String deploymentUnitName) throws NamingException
+   {
+      Map<String, BeanManager> beanManagers = new DeploymentVisitor(bootstrapBean).visit().getBeanManagers();
+      Context context = getBeanManagerContext().createSubcontext(deploymentUnitName);
+
+      for (Map.Entry<String, BeanManager> entry : beanManagers.entrySet())
+      {
+         NonSerializableFactory.rebind(context, entry.getKey(), entry.getValue());
+      }
+   }
+
+   public void unbind(BootstrapBean bootstrapBean, String deploymentUnitName) throws NamingException
+   {
+      Map<String, BeanManager> beanManagers = new DeploymentVisitor(bootstrapBean).visit().getBeanManagers();
+      Context context = (Context)getBeanManagerContext().lookup(deploymentUnitName); // or how do I get existing sub-context
+
+      for (Map.Entry<String, BeanManager> entry : beanManagers.entrySet())
+      {
+         context.unbind(entry.getKey());
+         NonSerializableFactory.unbind(entry.getKey());
+      }
+
+      getBeanManagerContext().destroySubcontext(deploymentUnitName);
+   }
+
+   protected static class DeploymentVisitor
+   {
+      private final Map<String, BeanManager> beanManagers;
+      private final BootstrapBean bootstrapBean;
+
+      public DeploymentVisitor(BootstrapBean bootstrapBean)
+      {
+         this.beanManagers = new HashMap<String, BeanManager>();
+         this.bootstrapBean = bootstrapBean;
+      }
+
+      public Map<String, BeanManager> getBeanManagers()
+      {
+         return Collections.unmodifiableMap(beanManagers);
+      }
+
+      public DeploymentVisitor visit()
+      {
+         for (BeanDeploymentArchive bda : bootstrapBean.getDeployment().getBeanDeploymentArchives())
+         {
+            visit(bda, new HashSet<BeanDeploymentArchive>());
+         }
+         return this;
+      }
+
+      private void visit(BeanDeploymentArchive bda, Set<BeanDeploymentArchive> seenBdas)
+      {
+         WeldManager beanManager = bootstrapBean.getBootstrap().getManager(bda);
+         // BeanManager id is simply the BDA ID
+         String key = beanManager.getId();
+         beanManagers.put(key, beanManager);
+         for (BeanDeploymentArchive child : bda.getBeanDeploymentArchives())
+         {
+            if (!seenBdas.contains(child))
+            {
+               visit(child, seenBdas);
+            }
+         }
+      }
+
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/SimpleCompJndiBinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/SimpleCompJndiBinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/SimpleCompJndiBinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/SimpleCompJndiBinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class SimpleCompJndiBinder extends JavaCompJndiBinder
+{
+   private DeploymentUnit deploymentUnit;
+
+   public SimpleCompJndiBinder(DeploymentUnit deploymentUnit)
+   {
+      super(deploymentUnit.getName());
+      this.deploymentUnit = deploymentUnit;
+   }
+
+   @Override
+   protected Context getJavaCompContext() throws NamingException
+   {
+      ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(deploymentUnit.getClassLoader());
+         return ((Context) new InitialContext().lookup("java:comp"));
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(originalClassLoader);
+         this.deploymentUnit = null;
+      }
+   }
+
+
+   @Override
+   protected String getJavaContextDescription()
+   {
+     return "JNDI java:comp";
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/WebJndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/WebJndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/WebJndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/jndi/WebJndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jndi;
+
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+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.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
+import org.jboss.reloaded.naming.spi.JavaEEModule;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class WebJndiBinderDeployer extends AbstractSimpleRealDeployer<JBossWebMetaData>
+{
+
+   private JavaEEModuleInformer informer;
+
+   public WebJndiBinderDeployer(JavaEEModuleInformer javaEEModuleInformer)
+   {
+      super(JBossWebMetaData.class);
+      informer = javaEEModuleInformer;
+      setOutput(BeanMetaData.class);
+   }
+
+   @Override
+   public void deploy(DeploymentUnit deploymentUnit, JBossWebMetaData jBossWebMetaData) throws DeploymentException
+   {
+      BeanMetaData bbBMD = getBootstrapBeanAttachment(deploymentUnit.getTopLevel());
+      if (bbBMD != null && deploymentUnit.isAttachmentPresent(JBossWebMetaData.class))
+      {
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(deploymentUnit.getName() + "_WebCompJndiBinder", SimpleCompJndiBinder.class.getName());
+         builder.addConstructorParameter(DeploymentUnit.class.getName(), deploymentUnit);
+         builder.addInstall("bindToJavaComp");
+         // no uninstall method for SimpleCompJndiBinder (context will be destroyed by Tomcat)
+         //builder.addUninstall("unbind");
+         deploymentUnit.getTopLevel().addAttachment(deploymentUnit.getName() + "_WebCompJndiBinder", builder.getBeanMetaData());
+
+         BeanMetaDataBuilder moduleBinderBuilder = BeanMetaDataBuilder.createBuilder(deploymentUnit.getName() + "_JavaModuleJndiBinder", JavaEEModuleJndiBinder.class.getName());
+         AbstractInjectionValueMetaData javaModule = new AbstractInjectionValueMetaData(getModuleBeanName(deploymentUnit));
+         moduleBinderBuilder.addConstructorParameter(JavaEEModule.class.getName(), javaModule);
+         moduleBinderBuilder.addConstructorParameter(String.class.getName(), deploymentUnit.getName());
+         moduleBinderBuilder.addInstall("bindToJavaComp");
+         moduleBinderBuilder.addUninstall("unbind");
+         deploymentUnit.getTopLevel().addAttachment(deploymentUnit.getName() + "_JavaModuleJndiBinder", moduleBinderBuilder.getBeanMetaData());
+      }
+   }
+
+   private BeanMetaData getBootstrapBeanAttachment(DeploymentUnit deploymentUnit)
+   {
+      String bootstrapName = DeployersUtils.getBootstrapBeanName(deploymentUnit.getTopLevel());
+      String bbAttachmentName = bootstrapName + "_" + BeanMetaData.class.getSimpleName();
+
+      BeanMetaData bbBMD = deploymentUnit.getTopLevel().getAttachment(bbAttachmentName, BeanMetaData.class);
+      return bbBMD;
+   }
+
+   private String getModuleBeanName(DeploymentUnit deploymentUnit)
+   {
+      String appName = informer.getApplicationName(deploymentUnit);
+      String moduleName = informer.getModulePath(deploymentUnit);
+      String name = "jboss.naming:";
+      if (appName != null)
+      {
+         name += "application=" + appName + ",";
+      }
+      name += "module=" + moduleName;
+      return name;
+   }
+
+
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostFacesConfigDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossWebMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostWebMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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(0, WBL);
+         listeners.add(1, 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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldAwareMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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 org.jboss.deployers.spi.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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldClassloadingDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldEjbInterceptorMetadataDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,166 @@
+/*
+ * 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.AroundInvokeMetaData;
+import org.jboss.metadata.ejb.spec.AroundInvokesMetaData;
+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.vfs.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 INJECTION_INTERCEPTOR_CLASS_NAME = "org.jboss.weld.integration.ejb.SessionBeanInterceptor";
+   public static final String CONTEXT_INTERCEPTOR_CLASS_NAME = "org.jboss.weld.ejb.SessionBeanInterceptor";
+   public static final String BINDINGS_INTERCEPTOR_CLASS_NAME = "org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor";
+
+   private InterceptorMetaData injectionIMD;
+   private InterceptorMetaData bindingsIMD;
+   private InterceptorMetaData contextIMD;
+   private InterceptorBindingMetaData injectionIBMD;
+   private InterceptorBindingMetaData bindingsIBMD;
+   private InterceptorBindingMetaData contextIBMD;
+
+   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
+      injectionIMD = new InterceptorMetaData();
+      injectionIMD.setInterceptorClass(INJECTION_INTERCEPTOR_CLASS_NAME);
+
+      contextIMD = new InterceptorMetaData();
+      contextIMD.setInterceptorClass(CONTEXT_INTERCEPTOR_CLASS_NAME);
+
+      if (contextIMD.getAroundInvokes() == null)
+      {
+         contextIMD.setAroundInvokes(new AroundInvokesMetaData());
+      }
+      AroundInvokeMetaData aroundInvokeMetaData = new AroundInvokeMetaData();
+      aroundInvokeMetaData.setClassName(CONTEXT_INTERCEPTOR_CLASS_NAME);
+      aroundInvokeMetaData.setMethodName("aroundInvoke");
+      contextIMD.getAroundInvokes().add(aroundInvokeMetaData);
+
+      // create interceptor metadata instance for JSR-299 specific bindings
+      bindingsIMD = new InterceptorMetaData();
+      bindingsIMD.setInterceptorClass(BINDINGS_INTERCEPTOR_CLASS_NAME);
+
+      // create interceptor binding metadata instance
+      injectionIBMD = createInterceptorBindingMetadata(INJECTION_INTERCEPTOR_CLASS_NAME);
+      bindingsIBMD = createInterceptorBindingMetadata(BINDINGS_INTERCEPTOR_CLASS_NAME);
+      contextIBMD = createInterceptorBindingMetadata(CONTEXT_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;
+   }
+
+   @Override
+   protected void internalDeploy(VFSDeploymentUnit unit, JBossMetaData jbmd, VirtualFile wbXml) throws DeploymentException
+   {
+      if (jbmd.getInterceptors() == null)
+      {
+         InterceptorsMetaData imd = new InterceptorsMetaData();
+         EjbJar3xMetaData ejmd = new EjbJar30MetaData();
+         ejmd.setInterceptors(imd);
+         jbmd.merge(null, ejmd);
+      }
+      InterceptorsMetaData interceptors = jbmd.getInterceptors();
+      interceptors.add(injectionIMD); // clone?
+      interceptors.add(bindingsIMD);
+      interceptors.add(contextIMD);
+
+      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(contextIBMD);
+      interceptorBindings.add(0, injectionIBMD);
+
+      // Add JSR-299 binding interceptor as the last (all others have to be
+      // called first)
+      interceptorBindings.add(bindingsIBMD);
+
+      // 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 (!INJECTION_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 " + INJECTION_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

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/WeldFilesDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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.exists())
+            {
+               // 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();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/NonContextualObjectInjectionHelper.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,24 @@
+package org.jboss.weld.integration.injection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * 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);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/injection/WeldInjector.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,46 @@
+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.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
+      BeanDeploymentArchive beanDeploymentArchive = bootstrapBean.getDeployment().getFlatBeanDeploymentArchive();
+      NonContextualObjectInjectionHelper.injectNonContextualInstance(instance, bootstrapBean.getBootstrap().getManager(beanDeploymentArchive));
+   }
+
+   public void cleanup()
+   {
+      bootstrapBean = null;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/AbstractManifestFinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/util/AbstractManifestFinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/AbstractManifestFinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/AbstractManifestFinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.weld.integration.util;
+
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.util.jar.Manifest;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Find manifest info from class - abstract from code source.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+abstract class AbstractManifestFinder implements ManifestFinder
+{
+   protected Logger log = Logger.getLogger(getClass());
+
+   public Manifest findManifest(Class<?> clazz) throws Exception
+   {
+      ProtectionDomain domain = clazz.getProtectionDomain();
+      CodeSource source = domain.getCodeSource();
+      URL location = source.getLocation();
+      return findManifest(location);
+   }
+
+   /**
+    * Find manifest from base url.
+    *
+    * @param url the url
+    * @return manifest or null
+    * @throws Exception for any error
+    */
+   protected abstract Manifest findManifest(URL url) throws Exception;
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/JDKManifestFinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/util/JDKManifestFinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/JDKManifestFinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/JDKManifestFinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,82 @@
+/*
+ * 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.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+/**
+ * Find manifest info from class - plain JDK.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+class JDKManifestFinder extends AbstractManifestFinder
+{
+   protected Manifest findManifest(URL url) throws Exception
+   {
+      URLConnection conn = url.openConnection();
+      if (conn instanceof JarURLConnection)
+      {
+         JarURLConnection jarConn = (JarURLConnection)conn;
+         return jarConn.getManifest();
+      }
+      else
+      {
+         File parent = new File(url.toURI());
+         File child = new File(parent, JarFile.MANIFEST_NAME);
+         if (child.exists())
+         {
+            InputStream fis = new FileInputStream(child);
+            try
+            {
+               return new Manifest(fis);
+            }
+            finally
+            {
+               close(fis);
+            }
+         }
+         else
+         {
+            return null;
+         }
+      }
+   }
+
+   private static void close(InputStream is)
+   {
+      try
+      {
+         is.close();
+      }
+      catch (IOException ignored)
+      {
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestFinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/util/ManifestFinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestFinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestFinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,41 @@
+/*
+ * 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.util;
+
+import java.util.jar.Manifest;
+
+/**
+ * Find manifest info from class.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+interface ManifestFinder
+{
+   /**
+    * Find manifest.
+    *
+    * @param clazz the class
+    * @return manifest if found, else null
+    * @throws Exception for any error
+    */
+   Manifest findManifest(Class<?> clazz) throws Exception;
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestUtils.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/util/ManifestUtils.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestUtils.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/ManifestUtils.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.util.jar.Manifest;
+
+/**
+ * Get manifest info from class.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ManifestUtils
+{
+   /** The manifest finder abstraction */
+   private static ManifestFinder finder;
+
+   static
+   {
+      try
+      {
+         Class<?> vfsFinderClass = Class.forName("org.jboss.weld.integration.util.VFSManifestFinder");
+         finder = (ManifestFinder)vfsFinderClass.newInstance();
+      }
+      catch (Exception e)
+      {
+         finder = new JDKManifestFinder();
+      }
+   }
+
+   /**
+    * Get manifest for class.
+    *
+    * @param clazz the class to check
+    * @return manifest if found, else null
+    * @throws Exception for any error
+    */
+   public static Manifest getManifest(final Class<?> clazz) throws Exception
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm != null)
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Manifest>()
+         {
+            public Manifest run() throws Exception
+            {
+               return finder.findManifest(clazz);
+            }
+         });
+      else
+         return finder.findManifest(clazz);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/VFSManifestFinder.java (from rev 105788, projects/weld-int/trunk/deployer/src/main/java/org/jboss/weld/integration/util/VFSManifestFinder.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/VFSManifestFinder.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/util/VFSManifestFinder.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.weld.integration.util;
+
+import java.net.URL;
+import java.util.jar.Manifest;
+
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * Find manifest info from class - JBoss VFS.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+class VFSManifestFinder extends AbstractManifestFinder
+{
+   VFSManifestFinder()
+   {
+      log.debug(VFS.class.getSimpleName() + "ManifestFinder instantiated.");
+   }
+
+   protected Manifest findManifest(URL url) throws Exception
+   {
+      VirtualFile root = VFS.getChild(url);
+      return VFSUtils.getManifest(root);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,163 @@
+/*
+ * 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 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.test.deployers.test.AbstractWeldTest;
+import org.jboss.vfs.VirtualFile;
+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
+   {
+      VirtualFile 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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+
+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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.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.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;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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();
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.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;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbServices implements EjbServices, EjbInjectionServices
+{
+   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() {}
+
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockEmptyEjbServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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() {}
+
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/MockWeldBootstrap.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/WeldDEWrapper.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/CheckableJndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/CheckableJndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/CheckableJndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/CheckableJndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,62 @@
+/*
+ * 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 javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.weld.integration.deployer.jndi.AbstractJndiBinderDeployer;
+
+/**
+ * Mock checkable jndi binder deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class CheckableJndiBinderDeployer extends AbstractJndiBinderDeployer<Object>
+{
+   public static Context ROOT = new MockContext();
+
+   public CheckableJndiBinderDeployer()
+   {
+      super(Object.class);
+   }
+
+   @Override
+   protected Context createContext() throws NamingException
+   {
+      return ROOT;
+   }
+
+   public void bind(Object bootstrapBean, String deploymentUnitName) throws NamingException
+   {
+      Context context = getBeanManagerContext().createSubcontext(deploymentUnitName);
+      context.bind("bootstrap", bootstrapBean);
+   }
+
+   public void unbind(Object bootstrapBean, String deploymentUnitName) throws NamingException
+   {
+      Context context = (Context)getBeanManagerContext().lookup(deploymentUnitName);
+      context.unbind("bootstrap");
+
+      getBeanManagerContext().destroySubcontext(deploymentUnitName);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.WeldDEWrapper");
+      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.MockWeldBootstrap");
+      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();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockContext.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockContext.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockContext.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockContext.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,227 @@
+/*
+ * 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.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.naming.Binding;
+import javax.naming.CompositeName;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * Pure mock, no logic used when hacking this ;-)
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockContext implements Context
+{
+   private Hashtable<Object, Object> env = new Hashtable<Object, Object>();
+   private Map<Object, Object> map = new HashMap<Object, Object>();
+
+   public Object lookup(Name name) throws NamingException
+   {
+      return map.get(name);
+   }
+
+   public Object lookup(String name) throws NamingException
+   {
+      return map.get(name);
+   }
+
+   public void bind(Name name, Object obj) throws NamingException
+   {
+      map.put(name, obj);
+   }
+
+   public void bind(String name, Object obj) throws NamingException
+   {
+      map.put(name, obj);
+   }
+
+   public void rebind(Name name, Object obj) throws NamingException
+   {
+      map.put(name, obj);
+   }
+
+   public void rebind(String name, Object obj) throws NamingException
+   {
+      map.put(name, obj);
+   }
+
+   public void unbind(Name name) throws NamingException
+   {
+      map.remove(name);
+   }
+
+   public void unbind(String name) throws NamingException
+   {
+      map.remove(name);
+   }
+
+   public void rename(Name oldName, Name newName) throws NamingException
+   {
+      Object previous = map.remove(oldName);
+      map.put(newName, previous);
+   }
+
+   public void rename(String oldName, String newName) throws NamingException
+   {
+      Object previous = map.remove(oldName);
+      map.put(newName, previous);
+   }
+
+   private <T> NamingEnumeration<T> empty()
+   {
+      return new NamingEnumeration<T>()
+      {
+         public T next() throws NamingException
+         {
+            return null;
+         }
+
+         public boolean hasMore() throws NamingException
+         {
+            return false;
+         }
+
+         public void close() throws NamingException
+         {
+         }
+
+         public boolean hasMoreElements()
+         {
+            return false;
+         }
+
+         public T nextElement()
+         {
+            return null;
+         }
+      };
+   }
+
+   public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
+   {
+      return empty();
+   }
+
+   public NamingEnumeration<NameClassPair> list(String name) throws NamingException
+   {
+      return empty();
+   }
+
+   public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
+   {
+      return empty();
+   }
+
+   public NamingEnumeration<Binding> listBindings(String name) throws NamingException
+   {
+      return empty();
+   }
+
+   public void destroySubcontext(Name name) throws NamingException
+   {
+      map.remove(name);
+   }
+
+   public void destroySubcontext(String name) throws NamingException
+   {
+      map.remove(name);
+   }
+
+   public Context createSubcontext(Name name) throws NamingException
+   {
+      Context context = new MockContext();
+      map.put(name, context);
+      return context;
+   }
+
+   public Context createSubcontext(String name) throws NamingException
+   {
+      Context context = new MockContext();
+      map.put(name, context);
+      return context;
+   }
+
+   public Object lookupLink(Name name) throws NamingException
+   {
+      return map.get(name);
+   }
+
+   public Object lookupLink(String name) throws NamingException
+   {
+      return map.get(name);
+   }
+
+   public NameParser getNameParser(Name name) throws NamingException
+   {
+      return NameParser.class.cast(map.get(name));
+   }
+
+   public NameParser getNameParser(String name) throws NamingException
+   {
+      return NameParser.class.cast(map.get(name));
+   }
+
+   public Name composeName(Name name, Name prefix) throws NamingException
+   {
+      return new CompositeName().addAll(prefix).addAll(name);
+   }
+
+   public String composeName(String name, String prefix) throws NamingException
+   {
+      return prefix + "/" + name;
+   }
+
+   public Object addToEnvironment(String propName, Object propVal) throws NamingException
+   {
+      return env.put(propName, propVal);
+   }
+
+   public Object removeFromEnvironment(String propName) throws NamingException
+   {
+      return env.remove(propName);
+   }
+
+   public Hashtable<?, ?> getEnvironment() throws NamingException
+   {
+      return env;
+   }
+
+   public void close() throws NamingException
+   {
+      map.clear();
+   }
+
+   public String getNameInNamespace() throws NamingException
+   {
+      return null;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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());
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJndiBinderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJndiBinderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJndiBinderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJndiBinderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,41 @@
+/*
+ * 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 javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.weld.integration.deployer.jndi.JndiBinderDeployer;
+
+/**
+ * Mock jndi binder deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJndiBinderDeployer extends JndiBinderDeployer
+{
+   @Override
+   protected Context createContext() throws NamingException
+   {
+      return new MockContext();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.vfs.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

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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
+{
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWeldTest.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,180 @@
+/*
+ * 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.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * 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 VirtualFile createBasicEar() throws Exception
+   {
+      return createBasicEar(SomeUtil.class);
+   }
+
+   protected VirtualFile createBasicEar(Class<?> utilClass) throws Exception
+   {
+      VirtualFile ear = createTopLevelWithUtil(utilClass);
+
+      VirtualFile jar = ear.getChild("simple.jar");
+      createAssembledDirectory(jar)
+         .addPackage(PlainJavaBean.class)
+         .addPath("/weld/simple/jar");
+
+      VirtualFile ejbs = ear.getChild("ejbs.jar");
+      createAssembledDirectory(ejbs)
+         .addPackage(MySLSBean.class)
+         .addPath("/weld/simple/ejb");
+
+      VirtualFile war = ear.getChild("simple.war");
+      createAssembledDirectory(war)
+         .addPackage("WEB-INF/classes", ServletWebBean.class)
+         .addPath("/weld/simple/web")
+         .addPackage("WEB-INF/lib/ui.jar", UIWebBean.class)
+         .addPath("WEB-INF/lib/ui.jar", "/weld/simple/ui");
+
+      // war w/o beans.xml
+
+      war = ear.getChild("crm.war");
+      createAssembledDirectory(war)
+         .addPackage("WEB-INF/classes", NotWBJsfBean.class)
+         .addPackage("WEB-INF/lib/crm.jar", CrmWebBean.class)
+         .addPath("WEB-INF/lib/crm.jar", "/weld/simple/crm");
+
+      enableTrace("org.jboss.deployers");
+
+      return ear;
+   }
+
+   protected VirtualFile createTopLevelWithUtil() throws Exception
+   {
+      return createTopLevelWithUtil("/weld/simple");
+   }
+
+   protected VirtualFile createTopLevelWithUtil(Class<?> utilClass) throws Exception
+   {
+      if (utilClass != null)
+      return createTopLevelWithUtil("/weld/simple", utilClass);
+      else
+      return createTopLevelWithUtil();
+   }
+
+   protected VirtualFile createTopLevelWithUtil(String path) throws Exception
+   {
+      return createTopLevelWithUtil(path, SomeUtil.class);
+   }
+
+   protected VirtualFile createTopLevelWithUtil(String path, Class<?> utilClass) throws Exception
+   {
+      VirtualFile earFile = VFS.getChild("top-level.ear");
+      createAssembledDirectory(earFile)
+         .addPath(path)
+         .addPackage("lib/util.jar", utilClass)
+         .addPackage("lib/ext.jar", ExternalWebBean.class)
+         .addPath("lib/ext.jar", "/weld/simple/ext");
+      return earFile;
+   }
+
+   protected VirtualFile createWarInEar() throws Exception
+   {
+      VirtualFile earFile = VFS.getChild("war-in-ear.ear");
+      createAssembledDirectory(earFile)
+         .addPath("/weld/warinear")
+         .addPackage("simple.war/WEB-INF/classes", ServletWebBean.class)
+         .addPath("simple.war", "/weld/simple/web");
+      return earFile;
+   }
+
+   protected VirtualFile createJarInEar() throws Exception
+   {
+      VirtualFile earFile = VFS.getChild("jar-in-ear.ear");
+      createAssembledDirectory(earFile)
+         .addPath("/weld/jarinear")
+         .addPackage("simple.jar", PlainJavaBean.class)
+         .addPath("simple.jar", "/weld/simple/jar");
+      return earFile;
+   }
+
+   protected VirtualFile createWar(String warName, Class<?> reference) throws Exception
+   {
+      VirtualFile warFile = VFS.getChild(warName);
+      createAssembledDirectory(warFile)
+         .addPackage("WEB-INF/classes", reference)
+         .addPath("/weld/simple/web");
+      return warFile;
+   }
+
+   protected VirtualFile createEjbJar(String jarName, Class<?> reference) throws Exception
+   {
+      VirtualFile jarFile = VFS.getChild(jarName);
+      createAssembledDirectory(jarFile)
+         .addPackage(reference)
+         .addPath("/weld/simple/ejb");
+      return jarFile;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,166 @@
+/*
+ * 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.Field;
+import java.util.Map;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.plugins.tracker.AbstractContextRegistry;
+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.kernel.plugins.bootstrap.basic.KernelConstants;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.deployers.support.deployer.CheckableJndiBinderDeployer;
+import org.jboss.vfs.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
+{
+   private KernelController controller;
+
+   public BootDeployerTestCase(String name)
+   {
+      super(name);
+      setAutowireCandidate(true);
+   }
+
+   public static Test suite()
+   {
+      return suite(BootDeployerTestCase.class);
+   }
+
+   @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
+   public void setController(KernelController controller)
+   {
+      this.controller = controller;
+   }
+
+   protected void testBootstrap(VirtualFile ear) throws Exception
+   {
+      // should already be on the deployer
+      Context bmContext = assertInstanceOf(
+            CheckableJndiBinderDeployer.ROOT.lookup(CheckableJndiBinderDeployer.BEAN_MANAGER_JNDI_SUBCONTEXT),
+            Context.class,
+            false
+      );
+
+      Object bootstrap;
+      String duSimpleName = null;
+      Deployment deployment = createVFSDeployment(ear);
+      DeployerClient mainDeployer = getDeployerClient();
+      mainDeployer.addDeployment(deployment);
+      mainDeployer.process();
+      ControllerContext wbContext = null;
+      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"));
+
+            // test jndi binding
+            duSimpleName = earDU.getSimpleName();
+            Context context = assertInstanceOf(bmContext.lookup(duSimpleName), Context.class, false);
+            assertSame(bootstrap, context.lookup("bootstrap"));
+
+            Class<?> wbClass = earDU.getClassLoader().loadClass("org.jboss.test.deployers.support.CheckableBootstrap");
+            wbContext = controller.getContextByClass(wbClass);
+            assertNotNull(wbContext);
+            assertSame(bootstrap, wbContext.getTarget());
+         }
+         finally
+         {
+            undeploy(ejb);
+         }
+      }
+      finally
+      {
+         mainDeployer.removeDeployment(deployment);
+         mainDeployer.process();
+
+         // clear binding
+         assertNull(bmContext.lookup(duSimpleName));
+
+         // clear context 2 class mapping
+         if (wbContext != null)
+            assertNull(wbContext.getTarget());
+
+         Field registryField = AbstractController.class.getDeclaredField("registry");
+         registryField.setAccessible(true);
+         Object registry = registryField.get(controller);
+         Field mapField = AbstractContextRegistry.class.getDeclaredField("contextsByClass");
+         mapField.setAccessible(true);
+         @SuppressWarnings({"unchecked"})
+         Map<Class<?>, ?> map = (Map) mapField.get(registry);
+         for (Class<?> clazz : map.keySet())
+         {
+            String className = clazz.getName();
+            // should be the only one -- no other service/bean should use it -- except if we leak
+            if ("org.jboss.test.deployers.support.CheckableBootstrap".equals(className))
+            {
+
+               Object value = map.get(clazz);
+               fail("" + value);
+            }
+         }
+      }
+      assertTrue(invoke(bootstrap, "Shutdown"));
+   }
+
+   public void testEar() throws Exception
+   {
+      testBootstrap(createBasicEar());
+   }
+
+   public void testWarInEar() throws Exception
+   {
+      testBootstrap(createWarInEar());
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,131 @@
+/*
+ * 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.vfs.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());
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.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.vfs.VFS;
+import org.jboss.vfs.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
+   {
+      VirtualFile ear = VFS.getChild("top-level.ear");
+      createAssembledDirectory(ear)
+         .addPath("/weld/warwowb")
+         .addPath("simple.war", "/weld/warwowb/web")
+         .addPath("ejbs.jar", "/weld/warwowb/ejb");
+
+      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
+   {
+      VirtualFile topLevel = VFS.getChild("ejbs.jar");
+      createAssembledDirectory(topLevel)
+         .addPath("/weld/" + type + "/ejb");
+
+      DeploymentUnit topDU = assertDeploy(topLevel);
+      try
+      {
+         assertClassLoading(testCL, topDU);
+         assertWBInterceptor(topDU);
+      }
+      finally
+      {
+         undeploy(topDU);
+      }
+   }
+
+   protected void testWar(String type, boolean testCL, boolean testListner) throws Exception
+   {
+      VirtualFile topLevel = VFS.getChild("web.war");
+      createAssembledDirectory(topLevel)
+         .addPath("/weld/" + type + "/web");
+
+      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.INJECTION_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());
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,106 @@
+/*
+ * 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.vfs.VFS;
+import org.jboss.vfs.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
+   {
+      VirtualFile ear = VFS.getChild("jar-in-ear.ear");
+      createAssembledDirectory(ear)
+         .addPath("/weld/jarwarinear")
+         .addPackage("simple.jar", PlainJavaBean.class)
+         .addPackage("simple.war/WEB-INF/classes", PlainJavaBean.class)
+         .addPath("simple.war", "/weld/warwowb/web");
+
+      testDeployment(ear);
+   }
+
+   public void testWar() throws Exception
+   {
+      VirtualFile war = VFS.getChild("w1.war");
+      createAssembledDirectory(war)
+         .addPackage("WEB-INF/classes", PlainJavaBean.class)
+         .addPath("/weld/warwowb/web");
+      testDeployment(war);
+   }
+
+   public void testJar() throws Exception
+   {
+      VirtualFile jar = VFS.getChild("j1.jar");
+      createAssembledDirectory(jar)
+         .addPackage(PlainJavaBean.class);
+
+      testDeployment(jar);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java (from rev 105788, projects/weld-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,129 @@
+/*
+ * 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.vfs.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());
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,38 @@
+<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"/>
+
+  <bean name="JndiBinderDeployer" class="org.jboss.test.deployers.support.deployer.CheckableJndiBinderDeployer"/>
+
+  <!-- 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>

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,61 @@
+<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"/>
+
+  <!-- Binds bootstrap to jndi -->
+  <bean name="JndiBinderDeployer" class="org.jboss.test.deployers.support.deployer.MockJndiBinderDeployer"/>
+
+  <!-- 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.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"/>
+
+  <!-- Removed WeldJndiBinder -->
+
+</deployment>

Copied: trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/org/jboss/test/deployers/test/WeldDiscoveryEnvTestCase.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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>

Copied: trunk/weld-int/deployer/src/test/resources/weld/earwithutil/META-INF/application.properties (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/earwithutil/META-INF/application.properties)
===================================================================

Copied: trunk/weld-int/deployer/src/test/resources/weld/jarinear/META-INF/application.properties (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/jarinear/META-INF/application.properties)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/jarinear/META-INF/application.properties	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/jarinear/META-INF/application.properties	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1 @@
+jar-module=simple.jar

Added: trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/jarwarinear/META-INF/application.properties	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+jar-moduel=simple.jar
+web-module=simple.war

Copied: trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Copied: trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>
+</web-beans>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/post/ejb/META-INF/jboss.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<jboss>
+</jboss>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>
+</web-beans>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/post/web/WEB-INF/jboss-web.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/post/web/WEB-INF/jboss-web.xml)
===================================================================

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/META-INF/application.properties
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/META-INF/application.properties	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/META-INF/application.properties	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/crm/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ejb/META-INF/ejb-jar.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<ejb-jar>
+</ejb-jar>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Copied: trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ext/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: hand
+Class-Path: lib/util.jar, lib/ext.jar

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/jar/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/MANIFEST.MF	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Created-By: hand

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/ui/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Added: trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/simple/web/WEB-INF/web.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web>
+</web>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/warinear/META-INF/application.properties (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/warinear/META-INF/application.properties)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/warinear/META-INF/application.properties	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/warinear/META-INF/application.properties	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1 @@
+web-module=simple.war

Copied: trunk/weld-int/deployer/src/test/resources/weld/warwowb/META-INF/application.properties (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/META-INF/application.properties)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/warwowb/META-INF/application.properties	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/warwowb/META-INF/application.properties	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+ejb-module=ejbs.jar
+web-module=simple.war

Copied: trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/beans.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web-beans>  
+</web-beans>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/warwowb/ejb/META-INF/ejb-jar.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<ejb-jar>
+</ejb-jar>
\ No newline at end of file

Copied: trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml (from rev 105788, projects/weld-int/trunk/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml)
===================================================================
--- trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml	                        (rev 0)
+++ trunk/weld-int/deployer/src/test/resources/weld/warwowb/web/WEB-INF/web.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,2 @@
+<web>
+</web>
\ No newline at end of file

Copied: trunk/weld-int/ejb/pom.xml (from rev 105788, projects/weld-int/trunk/ejb/pom.xml)
===================================================================
--- trunk/weld-int/ejb/pom.xml	                        (rev 0)
+++ trunk/weld-int/ejb/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,346 @@
+<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.jbossas</groupId>
+    <artifactId>jboss-as-weld-int</artifactId>
+    <version>6.0.0-SNAPSHOT</version>
+  </parent>
+    
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.jbossas</groupId>
+  <artifactId>weld-int-ejb</artifactId>
+  <packaging>jar</packaging>
+  <name>JBoss Application Server Weld Integration EE services</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>
+      <exclusions>
+        <exclusion>
+          <groupId>apache-xerces</groupId>
+          <artifactId>xml-apis</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-dependency</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jaspi-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jca-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jacc-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-transaction-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jms-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-ejb-api</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>sun-jaxws</groupId>
+          <artifactId>jsr181-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>quartz</groupId>
+          <artifactId>quartz</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>sun-jaxws</groupId>
+          <artifactId>jaxws-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-core</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+           <groupId>org.jboss.microcontainer</groupId>
+           <artifactId>jboss-kernel</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>apache-xerces</groupId>
+          <artifactId>xml-apis</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-dependency</artifactId>
+        </exclusion>
+        <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-aop-mc-int</artifactId>
+           </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jaspi-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jca-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jacc-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-transaction-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-jms-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.javaee</groupId>
+          <artifactId>jboss-ejb-api</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>sun-jaxws</groupId>
+          <artifactId>jsr181-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>quartz</groupId>
+          <artifactId>quartz</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>sun-jaxws</groupId>
+          <artifactId>jaxws-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-endpoint-deployer</artifactId>
+      <exclusions>
+          <exclusion>
+              <groupId>org.jboss.logging</groupId>
+              <artifactId>jboss-logging-spi</artifactId>
+          </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+        <groupId>org.jboss.ejb3</groupId>
+        <artifactId>jboss-ejb3-proxy-impl</artifactId>
+        <exclusions>
+		   	<exclusion>
+	               <groupId>apache-xerces</groupId>
+	               <artifactId>xml-apis</artifactId>
+	           </exclusion>
+	       		<exclusion>
+		               <groupId>jboss.web</groupId>
+		               <artifactId>servlet-api</artifactId>
+		           </exclusion>
+           <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-kernel</artifactId>
+           </exclusion>
+	    	<exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-dependency</artifactId>
+           </exclusion>
+	       <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-aop-mc-int</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-jaspi-api</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-jms-api</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-transaction-api</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-ejb-api</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-jacc-api</artifactId>
+           </exclusion>
+		   <exclusion>
+               <groupId>org.jboss.logging</groupId>
+               <artifactId>jboss-logging-spi</artifactId>
+           </exclusion>
+
+        </exclusions>
+    </dependency>
+    
+    <dependency>
+       <groupId>org.jboss.jpa</groupId>
+       <artifactId>jboss-jpa-deployers</artifactId>
+       <exclusions>
+           <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-transaction-api</artifactId>
+           </exclusion>
+           <exclusion>
+               <groupId>org.jboss.javaee</groupId>
+               <artifactId>jboss-jca-api</artifactId>
+           </exclusion>
+       </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.jbossts</groupId>
+      <artifactId>jbossjts-integration</artifactId>
+       <exclusions>
+          <exclusion>
+              <groupId>ant</groupId>
+              <artifactId>ant</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-ejb-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-jca-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-transaction-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.logging</groupId>
+              <artifactId>jboss-logging-spi</artifactId>
+          </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.faces</groupId>
+      <artifactId>jsf-api</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>org.jboss.spec.javax.interceptor</groupId>
+        <artifactId>jboss-interceptors-api_1.1_spec</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>
+    
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata-ejb</artifactId>
+      <exclusions>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-ejb-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-jca-api</artifactId>
+          </exclusion>
+          <exclusion>
+              <groupId>org.jboss.javaee</groupId>
+              <artifactId>jboss-jms-api</artifactId>
+          </exclusion>
+      </exclusions>
+    </dependency>
+
+  </dependencies>  
+</project>

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossBussinessInterfaceDescriptorAdaptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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();
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEJBDescriptorAdaptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,104 @@
+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)
+   {
+      if (enterpriseBeanMetaData.getEjbClass() != null)
+      {
+         try
+         {
+            this.beanClass = (Class<T>) Reflections.classForName(enterpriseBeanMetaData.getEjbClass(), deploymentUnit.getClassLoader());
+         }
+         catch (ClassCastException e)
+         {
+            throw new IllegalStateException("Error loading EJB Session bean class", e);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new IllegalStateException("Cannot load EJB Session bean class", e);
+         }
+      }
+      else
+      {
+         throw new IllegalStateException("EJB class is null. EJB " + enterpriseBeanMetaData);
+      }
+      this.ejbName = enterpriseBeanMetaData.getEjbName();
+   }
+
+   public 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

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossEjbServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,234 @@
+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.JBossSessionBean31MetaData;
+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<EjbDescriptor, InterceptorBindings> interceptorBindings = new ConcurrentHashMap<EjbDescriptor, 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, 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())
+      {
+         JBossMetaData jBossMetaData = du.getAttachment(JBossMetaData.class);
+         for (JBossEnterpriseBeanMetaData enterpriseBeanMetaData : jBossMetaData.getEnterpriseBeans())
+         {
+            if (enterpriseBeanMetaData.isSession() && enterpriseBeanMetaData instanceof JBossSessionBean31MetaData)
+            {
+               JBossSessionBean31MetaData sessionBeanMetaData = (JBossSessionBean31MetaData) enterpriseBeanMetaData;
+               EjbDescriptor<?> ejbDescriptor = new JBossSessionBean31DescriptorAdaptor<Object>(sessionBeanMetaData, du, resolver);
+               ejbs.add(ejbDescriptor);
+            }
+            else 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);
+   }
+
+   @Override
+   public void cleanup()
+   {
+      ejbContainerNames.clear();
+      ejbs.clear();
+      resolver = null;
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossMessageDrivenBeanDescriptorAdaptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBean31DescriptorAdaptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBean31DescriptorAdaptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBean31DescriptorAdaptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBean31DescriptorAdaptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,69 @@
+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.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.jboss.jndi.resolver.impl.JNDIPolicyBasedJNDINameResolverFactory;
+import org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBean31JNDINameResolver;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.DefaultJNDIBindingPolicyFactory;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+
+public class JBossSessionBean31DescriptorAdaptor<T> extends JBossSessionBeanDescriptorAdaptor<T>
+{
+
+   private final String localJndiName;
+   private final boolean noInterfaceView;
+   private final boolean singleton;
+
+   public JBossSessionBean31DescriptorAdaptor(JBossSessionBean31MetaData sessionBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver)
+   {
+      super(sessionBeanMetaData, deploymentUnit, resolver);
+      if (sessionBeanMetaData.isNoInterfaceBean())
+      {
+         getLocalBusinessInterfaces().add(new JBossBussinessInterfaceDescriptorAdaptor<T>(sessionBeanMetaData.getEjbClass(), sessionBeanMetaData.getEjbName(), deploymentUnit, resolver));
+         this.localJndiName = getJndiName(sessionBeanMetaData);
+         this.noInterfaceView = true;
+      }
+      else
+      {
+         this.localJndiName = null;
+         this.noInterfaceView = true;
+      }
+      singleton = sessionBeanMetaData.isSingleton();
+   }
+
+   @Override
+   public String getLocalJndiName()
+   {
+      if (localJndiName == null)
+      {
+         return super.getLocalJndiName();
+      }
+      else
+      {
+         return localJndiName;
+      }
+   }
+
+   @Override
+   public boolean isNoInterfaceView()
+   {
+      return noInterfaceView;
+   }
+
+   @Override
+   public boolean isSingleton()
+   {
+      return singleton;
+   }
+
+   private static String getJndiName(JBossSessionBean31MetaData sessionBean)
+   {
+      DefaultJndiBindingPolicy jndiBindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
+      // get a jndi name resolver for this session bean, based on a jndi binding
+      // policy
+      SessionBean31JNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(sessionBean, jndiBindingPolicy);
+      // no-interface view jndi name
+      return jndiNameResolver.resolveNoInterfaceJNDIName(sessionBean);
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionBeanDescriptorAdaptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,135 @@
+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)
+   {
+      this(sessionBeanMetaData, deploymentUnit, resolver, sessionBeanMetaData.getLocalJndiName());
+   }
+
+   public JBossSessionBeanDescriptorAdaptor(JBossSessionBeanMetaData sessionBeanMetaData, DeploymentUnit deploymentUnit, EjbReferenceResolver resolver, String jndiName)
+   {
+      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 = jndiName;
+      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;
+   }
+
+   public boolean isNoInterfaceView()
+   {
+      return false;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/SessionBeanInterceptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,160 @@
+/*
+ * 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.EJBContext;
+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 EJBContext ejbContext;
+
+   @Resource(mappedName="java:comp/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 (ejbContext instanceof StatefulSessionContextImpl)
+      {
+         try
+         {
+
+            String guid = (String) statefulGuidField.get(ejbContext);
+            Container container = Ejb3Registry.getContainer(guid);
+            return container.getEjbName();
+         }
+         catch (IllegalArgumentException e)
+         {
+            throw new RuntimeException(e);
+         }
+         catch (IllegalAccessException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      else if (ejbContext instanceof EJBContextImpl<?, ?>)
+      {
+         try
+         {
+            BeanContext<?> beanContext = (BeanContext<?>) beanContextField.get(ejbContext);
+            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 EJBContext " + ejbContext);
+      }
+
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,89 @@
+/*
+ * 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.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.InvocationContext;
+
+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);
+   }
+
+   public Object getTimer()
+   {
+      throw new UnsupportedOperationException("Get timer not supported");
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,165 @@
+/*
+ * 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.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.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.ejb.spi.helpers.ForwardingEjbServices;
+import org.jboss.weld.integration.ejb.JBossEjbServices;
+import org.jboss.weld.integration.ejb.SessionBeanInterceptor;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.serialization.spi.ContextualStore;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextualInstance;
+
+/**
+ * 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
+{
+
+   private static final long serialVersionUID = -1999613731498564948L;
+
+   @Resource(mappedName="java:comp/BeanManager")
+   private WeldManager beanManager;
+
+   private InterceptorBindings interceptorBindings;
+
+   private Map<String, SerializableContextualInstance<Interceptor<Object>, Object>> interceptorInstances;
+
+   @PostConstruct
+   public void doPostConstruct(InvocationContext invocationContext) throws Exception
+   {
+      init(invocationContext);
+      doLifecycleInterception(invocationContext, InterceptionType.POST_CONSTRUCT);
+   }
+
+   private  void init(InvocationContext invocationContext)
+   {
+      // create contextual instances for inteDITrceptors
+      interceptorInstances = new ConcurrentHashMap<String, SerializableContextualInstance<Interceptor<Object>, Object>>();
+      EjbDescriptor<?> ejbDescriptor = (EjbDescriptor<?>) invocationContext.getContextData().get(SessionBeanInterceptor.EJB_DESCRIPTOR);
+      EjbServices ejbServices = beanManager.getServices().get(EjbServices.class);
+      if (ejbServices instanceof ForwardingEjbServices)
+      {
+         ejbServices = ((ForwardingEjbServices)ejbServices).delegate();
+      }
+      if (ejbServices instanceof JBossEjbServices)
+      {
+         interceptorBindings = ((JBossEjbServices)ejbServices).getInterceptorBindings(ejbDescriptor);
+      }
+
+      if (interceptorBindings != null)
+      {
+         for (Interceptor<?> interceptor : interceptorBindings.getAllInterceptors())
+         {
+            addInterceptorInstance((Interceptor<Object>)interceptor, invocationContext);
+         }
+
+      }
+   }
+
+   @SuppressWarnings("unchecked")
+   private void addInterceptorInstance(Interceptor<Object> interceptor, InvocationContext invocationContext)
+   {
+      CreationalContext<Object> creationalContext = (CreationalContext<Object>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
+      Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext);
+      SerializableContextualInstance<Interceptor<Object>,Object> serializableContextualInstance
+            = beanManager.getServices().get(ContextualStore.class).getSerializableContextualInstance(interceptor, instance, creationalContext);
+      interceptorInstances.put(interceptor.getBeanClass().getName(), serializableContextualInstance);
+   }
+
+   @PreDestroy
+   public void doPreDestroy(InvocationContext invocationContext) throws Exception
+   {
+      doLifecycleInterception(invocationContext, InterceptionType.PRE_DESTROY);
+   }
+
+   @AroundInvoke
+   public Object doAroundInvoke(InvocationContext invocationContext) throws Exception
+   {
+      return doMethodInterception(invocationContext, InterceptionType.AROUND_INVOKE);
+   }
+
+   private void doLifecycleInterception(InvocationContext invocationContext, InterceptionType interceptionType)
+         throws Exception
+   {
+      if (interceptorBindings != null)
+      {
+         List<Interceptor<?>> currentInterceptors = interceptorBindings.getLifecycleInterceptors(interceptionType);
+         delegateInterception(invocationContext, interceptionType, currentInterceptors);
+      }
+      else
+      {
+         invocationContext.proceed();
+      }
+   }
+
+   private Object doMethodInterception(InvocationContext invocationContext, InterceptionType interceptionType)
+         throws Exception
+   {
+      if (interceptorBindings != null)
+      {
+         List<Interceptor<?>> currentInterceptors = interceptorBindings.getMethodInterceptors(interceptionType, invocationContext.getMethod());
+         return delegateInterception(invocationContext, interceptionType, currentInterceptors);
+      }
+      else
+      {
+         return invocationContext.proceed();
+      }
+   }
+
+   private Object delegateInterception(InvocationContext invocationContext, InterceptionType interceptionType, List<Interceptor<?>> currentInterceptors)
+         throws Exception
+   {
+      List<Object> currentInterceptorInstances = new ArrayList<Object>();
+      for (Interceptor<?> interceptor: currentInterceptors)
+      {
+         currentInterceptorInstances.add(interceptorInstances.get(interceptor.getBeanClass().getName()).getInstance());
+      }
+      if (currentInterceptorInstances.size() > 0)
+      {
+         return new DelegatingInterceptorInvocationContext(invocationContext, currentInterceptors, currentInterceptorInstances, interceptionType).proceed();
+      }
+      else
+      {
+         return invocationContext.proceed();
+      }
+
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/persistence/JBossJpaServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/resource/JBossResourceServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,74 @@
+package org.jboss.weld.integration.resource;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.injection.spi.helpers.AbstractResourceServices;
+
+public class JBossResourceServices extends AbstractResourceServices implements ResourceInjectionServices
+{
+
+   private static Logger log = Logger.getLogger(JBossResourceServices.class);
+
+   private static final String USER_TRANSACTION_LOCATION = "java:comp/UserTransaction";
+   private static final String USER_TRANSACTION_CLASS_NAME = "javax.transaction.UserTransaction";
+   private static final String HANDLE_DELEGATE_CLASS_NAME = "javax.ejb.spi.HandleDelegate";
+   private static final String TIMER_SERVICE_CLASS_NAME = "javax.ejb.TimerService";
+   private static final String ORB_CLASS_NAME = "org.omg.CORBA.ORB";
+
+
+   protected static String getEJBResourceName(InjectionPoint injectionPoint, String proposedName)
+   {
+      if (injectionPoint.getType() instanceof Class<?>)
+      {
+         Class<?> type = (Class<?>) injectionPoint.getType();
+         if (USER_TRANSACTION_CLASS_NAME.equals(type.getName()))
+         {
+            return USER_TRANSACTION_LOCATION;
+         }
+         else if (HANDLE_DELEGATE_CLASS_NAME.equals(type.getName()))
+         {
+            log.warn("Injection of @Resource HandleDelegate not supported in managed beans. Injection Point: " + injectionPoint);
+            return proposedName;
+         }
+         else if (ORB_CLASS_NAME.equals(type.getName()))
+         {
+            log.warn("Injection of @Resource ORB not supported in managed beans. Injection Point: " + injectionPoint);
+            return proposedName;
+         }
+         else if (TIMER_SERVICE_CLASS_NAME.equals(type.getName()))
+         {
+            log.warn("Injection of @Resource TimerService not supported in managed beans. Injection Point: " + injectionPoint);
+            return proposedName;
+         }
+      }
+      return proposedName;
+   }
+
+   private final Context context;
+
+   public JBossResourceServices() throws NamingException
+   {
+      this.context = new InitialContext();
+   }
+
+   @Override
+   protected Context getContext()
+   {
+      return context;
+   }
+
+   @Override
+   protected String getResourceName(InjectionPoint injectionPoint)
+   {
+      return getEJBResourceName(injectionPoint, super.getResourceName(injectionPoint));
+   }
+
+
+
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/security/JBossSecurityServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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() {}
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/servlet/JBossServletServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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() {}
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/transaction/JBossTransactionServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,84 @@
+/*
+ * 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 com.arjuna.ats.jbossatx.jta.TransactionManagerService;
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+/**
+ * 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() {}
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/AbstractJBossServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/JBossEjb.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+      }
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/util/Reflections.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+      }
+
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/validation/JBossValidationServices.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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() {}
+
+}
\ No newline at end of file

Copied: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java (from rev 105788, projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java)
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java	                        (rev 0)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/vdf/DeploymentUnitAware.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+}
\ No newline at end of file

Added: trunk/weld-int/pom.xml
===================================================================
--- trunk/weld-int/pom.xml	                        (rev 0)
+++ trunk/weld-int/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,53 @@
+<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.jbossas</groupId>
+        <artifactId>jboss-as-parent</artifactId>
+        <version>6.0.0-SNAPSHOT</version>
+    </parent>
+    <name>JBoss Application Server Weld Integration</name>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.jboss.jbossas</groupId>
+    <artifactId>jboss-as-weld-int</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>assembly</module>
+        <module>deployer</module>
+        <module>ejb</module>
+        <module>webtier</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.jboss.jbossas</groupId>
+                <artifactId>weld-int-deployer</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.jbossas</groupId>
+                <artifactId>weld-int-ejb</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.jbossas</groupId>
+                <artifactId>weld-int-webtier</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>
\ No newline at end of file

Copied: trunk/weld-int/webtier/pom.xml (from rev 105788, projects/weld-int/trunk/webtier/pom.xml)
===================================================================
--- trunk/weld-int/webtier/pom.xml	                        (rev 0)
+++ trunk/weld-int/webtier/pom.xml	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,93 @@
+<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.jbossas</groupId>
+        <artifactId>jboss-as-weld-int</artifactId>
+        <version>6.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.jboss.jbossas</groupId>
+    <artifactId>weld-int-webtier</artifactId>
+    <packaging>jar</packaging>
+    <name>JBoss Application Server Weld Integration EE Webtier services</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>org.jboss.spec.javax.servlet</groupId>
+            <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.spec.javax.servlet.jsp</groupId>
+            <artifactId>jboss-jsp-api_2.2_spec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.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>

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/DummyELResolver.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/DummyELResolver.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/DummyELResolver.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/DummyELResolver.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,48 @@
+package org.jboss.weld.integration.webtier.jsf;
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+
+public class DummyELResolver extends ELResolver
+{
+
+   @Override
+   public Class<?> getCommonPropertyType(ELContext context, Object base)
+   {
+      return null;
+   }
+
+   @Override
+   public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)
+   {
+      return null;
+   }
+
+   @Override
+   public Class<?> getType(ELContext context, Object base, Object property)
+   {
+      return null;
+   }
+
+   @Override
+   public Object getValue(ELContext context, Object base, Object property)
+   {
+      return null;
+   }
+
+   @Override
+   public boolean isReadOnly(ELContext context, Object base, Object property)
+   {
+      return false;
+   }
+
+   @Override
+   public void setValue(ELContext context, Object base, Object property, Object value)
+   {
+
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplication.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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();
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingApplicationFactory.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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();
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingELResolver.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingELResolver.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingELResolver.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/ForwardingELResolver.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,84 @@
+/*
+ * 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.beans.FeatureDescriptor;
+import java.util.Iterator;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+public abstract class ForwardingELResolver extends ELResolver
+{
+
+   protected abstract ELResolver delegate();
+
+   @Override
+   public Class<?> getCommonPropertyType(ELContext context, Object base)
+   {
+      return delegate().getCommonPropertyType(context, base);
+   }
+
+   @Override
+   public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)
+   {
+      return delegate().getFeatureDescriptors(context, base);
+   }
+
+   @Override
+   public Class<?> getType(ELContext context, Object base, Object property)
+   {
+      return delegate().getType(context, base, property);
+   }
+
+   @Override
+   public Object getValue(ELContext context, Object base, Object property)
+   {
+      return delegate().getValue(context, base, property);
+   }
+
+   @Override
+   public boolean isReadOnly(ELContext context, Object base, Object property)
+   {
+      return delegate().isReadOnly(context, base, property);
+   }
+
+   @Override
+   public void setValue(ELContext context, Object base, Object property, Object value)
+   {
+      delegate().setValue(context, base, property, value);
+   }
+
+   @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();
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplication.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -0,0 +1,104 @@
+/*
+ * 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.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.integration.webtier.util.Reflections;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldApplication extends ForwardingApplication
+{
+
+   private static class AdjustableELResolver extends ForwardingELResolver
+   {
+
+      private ELResolver delegate;
+
+      public void setDelegate(ELResolver delegate)
+      {
+         this.delegate = delegate;
+      }
+
+      @Override
+      protected ELResolver delegate()
+      {
+         return delegate;
+      }
+   }
+
+
+   private final Application application;
+   private ExpressionFactory expressionFactory;
+   private AdjustableELResolver elResolver;
+   private boolean intialized;
+
+   public WeldApplication(Application application)
+   {
+      this.application = application;
+      application.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.weld.el.WeldELContextListener"));
+      elResolver = new AdjustableELResolver();
+      elResolver.setDelegate(new DummyELResolver());
+      application.addELResolver(elResolver);
+   }
+
+   private void init()
+   {
+      if (!intialized && beanManager() != null)
+      {
+         elResolver.setDelegate(beanManager().getELResolver());
+         this.expressionFactory = beanManager().wrapExpressionFactory(application.getExpressionFactory());
+      }
+   }
+
+   @Override
+   protected Application delegate()
+   {
+      init();
+      return application;
+   }
+
+   @Override
+   public ExpressionFactory getExpressionFactory()
+   {
+      init();
+      return expressionFactory;
+   }
+
+   private static BeanManager beanManager()
+   {
+      if (FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getExternalContext().getContext() instanceof ServletContext)
+      {
+         ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
+         return (BeanManager) servletContext.getAttribute(BeanManager.class.getName());
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsf/WeldApplicationFactory.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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;
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/ForwardingJspApplicationContextImpl.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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();
+   }
+
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/jsp/JspInitializationListener.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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.integration.webtier.util.Reflections;
+import org.jboss.weld.servlet.api.helpers.AbstractServletListener;
+
+/**
+ * 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
+   }
+}
\ No newline at end of file

Copied: trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java (from rev 105788, projects/weld-int/trunk/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java)
===================================================================
--- trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java	                        (rev 0)
+++ trunk/weld-int/webtier/src/main/java/org/jboss/weld/integration/webtier/util/Reflections.java	2010-06-10 13:56:35 UTC (rev 105926)
@@ -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);
+      }
+   }
+
+}
\ No newline at end of file



More information about the jboss-cvs-commits mailing list