[jboss-cvs] JBossAS SVN: r109431 - in trunk: ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 23 09:00:05 EST 2010


Author: jaikiran
Date: 2010-11-23 09:00:03 -0500 (Tue, 23 Nov 2010)
New Revision: 109431

Added:
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResource.java
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceEnvRefResourceProvider.java
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceProvider.java
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResource.java
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceEnvRefResourceProvider.java
   trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceProvider.java
   trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3DeploymentDeployer.java
   trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionResourceEnvRefResourceProvider.java
Modified:
   trunk/component-matrix/pom.xml
   trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java
   trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
   trunk/ejb3/src/resources/META-INF/ejb3-as-deployers-jboss-beans.xml
   trunk/server/src/etc/deployers/switchboard-clustered-jboss-beans.xml
   trunk/server/src/etc/deployers/switchboard-jboss-beans.xml
   trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java
   trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionRefResourceProvider.java
   trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
Log:
JBAS-8548 (1) Integrate EJB3 containers with switchboard and jboss-injection (2) Upgrade the relevant dependencies (3) Implemented additional resource providers

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/component-matrix/pom.xml	2010-11-23 14:00:03 UTC (rev 109431)
@@ -49,7 +49,7 @@
     <version.javax.faces>2.0.3-b05</version.javax.faces>
     <version.javax.validation>1.0.0.GA</version.javax.validation>
     <version.jaxws-httpserver-httpspi>1.0.0.GA</version.jaxws-httpserver-httpspi>
-    <version.jboss.injection>1.0.0-alpha-3</version.jboss.injection>
+    <version.jboss.injection>1.0.0-alpha-5</version.jboss.injection>
     <version.jboss.jaxr>2.0.1</version.jboss.jaxr>
     <version.jboss.jbossts>4.13.1.Final</version.jboss.jbossts>
     <version.jboss.jbossws-native>3.4.0.CR3</version.jboss.jbossws-native>
@@ -85,7 +85,7 @@
     <version.org.jboss.cluster.cache.ispn>1.0.0.CR8</version.org.jboss.cluster.cache.ispn>
     <version.org.jboss.common.core>2.2.17.GA</version.org.jboss.common.core>
     <version.org.jboss.deployers>2.2.0.Alpha8</version.org.jboss.deployers>
-    <version.org.jboss.ejb3.depchain>1.0.0-alpha-20</version.org.jboss.ejb3.depchain>
+    <version.org.jboss.ejb3.depchain>1.0.0-alpha-22</version.org.jboss.ejb3.depchain>
     <!-- This to move into the EJB3 BOM -->
     <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>
@@ -106,14 +106,14 @@
     <version.org.jboss.logging-service-metadata>1.0.0.CR9</version.org.jboss.logging-service-metadata>
     <version.org.jboss.logmanager>1.2.0.CR8</version.org.jboss.logmanager>
     <version.org.jboss.man>2.1.1.SP2</version.org.jboss.man>
-    <version.managed.beans.depchain>1.0.0-alpha-1</version.managed.beans.depchain>
+    <version.managed.beans.depchain>1.0.0-alpha-3</version.managed.beans.depchain>
     <version.org.jboss.marshalling>1.3.0.CR3</version.org.jboss.marshalling>
     <version.org.jboss.mc-int>2.2.0.Alpha3</version.org.jboss.mc-int>
     <version.org.jboss.mdr>2.2.0.Alpha3</version.org.jboss.mdr>
     <version.org.jboss.metadata.client>2.0.0.Alpha2</version.org.jboss.metadata.client>
-    <version.org.jboss.metadata.common>2.0.0.Alpha21</version.org.jboss.metadata.common>
+    <version.org.jboss.metadata.common>2.0.0.Alpha22</version.org.jboss.metadata.common>
     <version.org.jboss.metadata.ear>2.0.0.Alpha4</version.org.jboss.metadata.ear>
-    <version.org.jboss.metadata.ejb>2.0.0-alpha-22</version.org.jboss.metadata.ejb>
+    <version.org.jboss.metadata.ejb>2.0.0-alpha-24</version.org.jboss.metadata.ejb>
     <version.org.jboss.metadata.rar>2.0.0.Alpha</version.org.jboss.metadata.rar>
     <version.org.jboss.metadata.war>2.0.0.Alpha15</version.org.jboss.metadata.war>
     <version.org.jboss.mod_cluster>1.1.0.Final</version.org.jboss.mod_cluster>
@@ -121,7 +121,7 @@
     <version.org.jboss.naming>5.0.5.Final</version.org.jboss.naming>
     <version.org.jboss.profileservice>0.1.0.Alpha1</version.org.jboss.profileservice>
     <version.org.jboss.reflect>2.2.0.Alpha9</version.org.jboss.reflect>
-    <version.org.jboss.reloaded.naming>0.2.0</version.org.jboss.reloaded.naming>
+    <version.org.jboss.reloaded.naming>0.3.0</version.org.jboss.reloaded.naming>
     <version.org.jboss.resteasy>2.1-beta-1</version.org.jboss.resteasy>
     <version.org.jboss.remoting>2.5.3</version.org.jboss.remoting>
     <version.org.jboss.remoting3>3.1.0.Beta2</version.org.jboss.remoting3>
@@ -133,7 +133,7 @@
     <version.org.jboss.shrinkwrap>1.0.0-alpha-11</version.org.jboss.shrinkwrap>
     <version.org.jboss.slf4j>1.0.2.GA</version.org.jboss.slf4j>
     <version.org.jboss.stdio>1.0.0.CR3</version.org.jboss.stdio>
-    <version.org.jboss.switchboard.depchain>1.0.0-alpha-9</version.org.jboss.switchboard.depchain>
+    <version.org.jboss.switchboard.depchain>1.0.0-alpha-11</version.org.jboss.switchboard.depchain>
     <version.org.jboss.threads>2.0.0.CR7</version.org.jboss.threads>
     <version.org.jboss.threads-metadata>2.0.0.CR4</version.org.jboss.threads-metadata>
     <version.org.jboss.vfs>3.0.0.CR5</version.org.jboss.vfs>

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResource.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResource.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResource.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import javax.ejb.EJBContext;
+import javax.naming.LinkRef;
+
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link Resource} for {@link EJBContext} reference
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJBContextResource implements Resource
+{
+
+   /**
+    * The name of MC bean responsible for binding the internal (java:internal/EJBContext)
+    * jndi name
+    */
+   private String mcBeanName;
+
+   public EJBContextResource(String mcBeanDependencyName)
+   {
+      this.mcBeanName = mcBeanDependencyName;
+
+   }
+
+   @Override
+   public Object getDependency()
+   {
+      return this.mcBeanName;
+   }
+
+   @Override
+   public Object getTarget()
+   {
+      return new LinkRef("java:internal/EJBContext");
+   }
+}

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceEnvRefResourceProvider.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceEnvRefResourceProvider.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceEnvRefResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.switchboard.javaee.jboss.environment.JBossResourceEnvRefType;
+import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link MCBasedResourceProvider} for resource-env-ref which references EJBContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJBContextResourceEnvRefResourceProvider implements MCBasedResourceProvider<JBossResourceEnvRefType>
+{
+   /**
+    * The name of MC bean which is responsible for setting up java:internal/EJBContext 
+    */
+   private String ejbContextBinderMCBeanName;
+
+   /**
+    * 
+    * @param ejbContextBinderMCBeanName The name of MC bean which is responsible for setting up java:internal/EJBContext 
+    */
+   public EJBContextResourceEnvRefResourceProvider(String ejbContextBinderMCBeanName)
+   {
+      if (ejbContextBinderMCBeanName == null || ejbContextBinderMCBeanName.trim().isEmpty())
+      {
+         throw new IllegalArgumentException("EJBContext binder MC bean name cannot be null or empty");
+      }
+      this.ejbContextBinderMCBeanName = ejbContextBinderMCBeanName;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Class<JBossResourceEnvRefType> getEnvironmentEntryType()
+   {
+      return JBossResourceEnvRefType.class;
+   }
+
+   @Override
+   public Resource provide(DeploymentUnit unit, JBossResourceEnvRefType resEnvRef)
+   {
+      return new EJBContextResource(this.ejbContextBinderMCBeanName);
+   }
+
+}

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceProvider.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceProvider.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/EJBContextResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.switchboard.javaee.environment.EJBContextRefType;
+import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
+import org.jboss.switchboard.spi.Resource;
+import org.jboss.switchboard.spi.ResourceProvider;
+
+/**
+ * {@link ResourceProvider} for java:comp/EJBContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJBContextResourceProvider implements MCBasedResourceProvider<EJBContextRefType>
+{
+
+   /**
+    * The name of MC bean which is responsible for setting up java:internal/EJBContext 
+    */
+   private String ejbContextBinderMCBeanName;
+
+   /**
+    * 
+    * @param ejbContextBinderMCBeanName The name of MC bean which is responsible for setting up java:internal/EJBContext
+    */
+   public EJBContextResourceProvider(String ejbContextBinderMCBeanName)
+   {
+      if (ejbContextBinderMCBeanName == null || ejbContextBinderMCBeanName.trim().isEmpty())
+      {
+         throw new IllegalArgumentException("EJBContext binder MC bean name cannot be null or empty");
+      }
+      this.ejbContextBinderMCBeanName = ejbContextBinderMCBeanName;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Class<EJBContextRefType> getEnvironmentEntryType()
+   {
+      return EJBContextRefType.class;
+   }
+
+   /**
+    * Returns a {@link EJBContextResource} for a java:comp/EJBContext reference
+    */
+   @Override
+   public Resource provide(DeploymentUnit unit, EJBContextRefType ejbContextRef)
+   {
+      return new EJBContextResource(this.ejbContextBinderMCBeanName);
+   }
+
+}

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResource.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResource.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResource.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import javax.ejb.TimerService;
+import javax.naming.LinkRef;
+
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link Resource} for {@link TimerService} reference
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class TimerServiceResource implements Resource
+{
+
+   /**
+    * The name of MC bean responsible for binding the internal (java:internal/TimerService)
+    * jndi name
+    */
+   private String mcBeanName;
+   
+   public TimerServiceResource(String mcBeanDependencyName)
+   {
+      this.mcBeanName = mcBeanDependencyName;
+   }
+   
+   @Override
+   public Object getDependency()
+   {
+      return this.mcBeanName;
+   }
+
+   @Override
+   public Object getTarget()
+   {
+      return new LinkRef("java:internal/TimerService");
+   }
+
+}

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceEnvRefResourceProvider.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceEnvRefResourceProvider.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceEnvRefResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.switchboard.javaee.jboss.environment.JBossResourceEnvRefType;
+import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link MCBasedResourceProvider} for resource-env-ref which references TimerService
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class TimerServiceResourceEnvRefResourceProvider implements MCBasedResourceProvider<JBossResourceEnvRefType>
+{
+
+   /**
+    * The name of MC bean which is responsible for setting up java:internal/TimerService 
+    */
+   private String timerServiceBinderMCBeanName;
+   
+   /**
+    * 
+    * @param timerServiceBinderMCBeanName The name of MC bean which is responsible for setting up java:internal/TimerService 
+    */
+   public TimerServiceResourceEnvRefResourceProvider(String timerServiceBinderMCBeanName)
+   {
+      if (timerServiceBinderMCBeanName == null || timerServiceBinderMCBeanName.trim().isEmpty())
+      {
+         throw new IllegalArgumentException("TimerService binder MC bean name cannot be null or empty");
+      }
+      this.timerServiceBinderMCBeanName = timerServiceBinderMCBeanName;
+   }
+
+   @Override
+   public Class<JBossResourceEnvRefType> getEnvironmentEntryType()
+   {
+      return JBossResourceEnvRefType.class;
+   }
+
+   @Override
+   public Resource provide(DeploymentUnit unit, JBossResourceEnvRefType resEnvRef)
+   {
+      return new TimerServiceResource(this.timerServiceBinderMCBeanName);
+   }
+
+}

Added: trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceProvider.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceProvider.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/as/ejb3/switchboard/resource/provider/TimerServiceResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.ejb3.switchboard.resource.provider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.switchboard.javaee.environment.TimerServiceRefType;
+import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link MCBasedResourceProvider} for java:comp/TimerService
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class TimerServiceResourceProvider implements MCBasedResourceProvider<TimerServiceRefType>
+{
+
+   /**
+    * The name of MC bean which is responsible for setting up java:internal/TimerService 
+    */
+   private String timerServiceBinderMCBeanName;
+   
+   /**
+    * 
+    * @param timerServiceBinderMCBeanName The name of MC bean which is responsible for setting up java:internal/TimerService 
+    */
+   public TimerServiceResourceProvider(String timerServiceBinderMCBeanName)
+   {
+      if (timerServiceBinderMCBeanName == null || timerServiceBinderMCBeanName.trim().isEmpty())
+      {
+         throw new IllegalArgumentException("TimerService binder MC bean name cannot be null or empty");
+      }
+      this.timerServiceBinderMCBeanName = timerServiceBinderMCBeanName;
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Class<TimerServiceRefType> getEnvironmentEntryType()
+   {
+      return TimerServiceRefType.class;
+   }
+
+   @Override
+   public Resource provide(DeploymentUnit unit, TimerServiceRefType timerServiceRef)
+   {
+      return new TimerServiceResource(this.timerServiceBinderMCBeanName);
+   }
+
+}

Modified: trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3Deployer.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -91,7 +91,7 @@
 	   // Using addInput ensures ordering http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156725
       addInput(AttachmentNames.PROCESSED_METADATA);
       addInput(BeanInstantiator.class);
-      // TODO: should we really output this
+
       setOutput(Ejb3Deployment.class);
       // JBossASKernel install output
       setOutput(KernelDeployment.class);
@@ -181,7 +181,10 @@
             deployment.destroy();
             return;
          }
-         deployment.start();
+         // We'll delay the start and let org.jboss.ejb3.deployers.Ejb3DeploymentDeployer start the deployment
+         // deployment.start();
+         
+         // add the Ejb3Deployment as attachment
          unit.addAttachment(Ejb3Deployment.class, deployment);
          // TODO: temporarily disable the security deployment
          unit.addAttachment(JaccPolicyUtil.IGNORE_ME_NAME, true, Boolean.class);

Added: trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3DeploymentDeployer.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3DeploymentDeployer.java	                        (rev 0)
+++ trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3DeploymentDeployer.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.injection.manager.spi.InjectionManager;
+import org.jboss.switchboard.spi.Barrier;
+
+/**
+ * Deployer responsible for "starting" a {@link Ejb3Deployment}.
+ * 
+ * <p>
+ *  The {@link Ejb3Deployer} creates and attaches a {@link Ejb3Deployment} into
+ *  the deployment unit. The attached {@link Ejb3Deployment} will have it {@link Ejb3Deployment#create()}
+ *  invocation completed by the {@link Ejb3Deployer}. This {@link Ejb3DeploymentDeployer} is just responsible
+ *  for invoking {@link Ejb3Deployer#start()} *after* the deployment unit has been processed by the deployers
+ *  which are responsible for attaching {@link Barrier SwitchBoard barrier} and {@link InjectionManager InjectionManager}
+ *  to the unit. 
+ * </p>
+ *
+ * <p>
+ *  Note: This deployer ideally shouldn't have been required and the other {@link Ejb3Deployer} should have been 
+ *  sufficient for starting the {@link Ejb3Deployment}. But as soon as the {@link Barrier} is added a an input to the
+ *  {@link Ejb3Deployer}, things start falling apart due to the weird circular dependencies that get introduced between the deployers,
+ *  due to the various JBoss WS deployers. 
+ * </p>
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class Ejb3DeploymentDeployer extends AbstractRealDeployer
+{
+
+   public Ejb3DeploymentDeployer()
+   {
+      this.setInput(Ejb3Deployment.class);
+
+      // SwitchBoard
+      addInput(Barrier.class);
+      // InjectionManager
+      addInput(InjectionManager.class);
+
+   }
+
+   @Override
+   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
+   {
+      Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+      
+      try
+      {
+         // start the deployment
+         ejb3Deployment.start();
+      }
+      catch (Exception e)
+      {
+         throw new DeploymentException("Error starting Ejb3Deployment: " + ejb3Deployment.getName(), e);
+      }
+   }
+
+}

Modified: trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -21,13 +21,19 @@
 */
 package org.jboss.ejb3.deployers;
 
+import java.util.Collection;
 import java.util.Map;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.security.jacc.PolicyConfiguration;
 
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
 import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
 import org.jboss.deployment.MappedReferenceMetaDataResolverDeployer;
 import org.jboss.deployment.dependency.ContainerDependencyMetaData;
 import org.jboss.ejb3.Container;
@@ -39,12 +45,23 @@
 import org.jboss.ejb3.javaee.JavaEEApplication;
 import org.jboss.ejb3.javaee.JavaEEComponent;
 import org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin;
+import org.jboss.injection.injector.metadata.EnvironmentEntryType;
+import org.jboss.injection.injector.metadata.InjectionTargetType;
+import org.jboss.injection.injector.metadata.JndiEnvironmentRefsGroup;
+import org.jboss.injection.manager.spi.InjectionManager;
+import org.jboss.injection.manager.spi.Injector;
+import org.jboss.injection.mc.injector.LazyEEInjector;
+import org.jboss.injection.mc.metadata.JndiEnvironmentImpl;
 import org.jboss.kernel.Kernel;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.switchboard.spi.Barrier;
 
 /**
  * JBoss 5.0 Microkernel specific implementation
@@ -132,6 +149,32 @@
       // EJBTHREE-1335: container name in meta data
       generateContainerName(container, beanMD);
       
+      // setup switchboard
+      Barrier switchBoard = this.getSwitchBoardBarrier(container);
+      // the container cannot function without an SwitchBoard Barrier
+      if (switchBoard == null)
+      {
+         throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: "
+               + this.jbossUnit + " (or its component deployment unit)");
+      }
+      // Add dependency on switchboard
+      dependsPolicy.addDependency(switchBoard.getId());
+      log.debug("Added dependency on Switchboard " + switchBoard.getId() + " for EJB container " + ejbContainer.getName());
+      
+      
+      // create and setup Injector(s) for InjectionManager  
+      InjectionManager injectionManager = this.getInjectionManager(container);
+      // the container cannot function without an InjectionManager
+      if (injectionManager == null)
+      {
+         throw new RuntimeException("No InjectionManager found for bean: " + container.getEjbName() + " in unit: "
+               + this.jbossUnit + " (or its component deployment unit)");
+      }
+      // setup the injectors for the bean and any of its interceptors
+      this.setupInjectors(ejbContainer, injectionManager, switchBoard);
+      // set the InjectionManager on the EJBContainer
+      ejbContainer.setInjectionManager(injectionManager);
+      
       super.registerEJBContainer(container);
    }
 
@@ -165,4 +208,192 @@
       summary.setService(beanMD.isService());
       return summary;
    }   
+   
+   protected Barrier getSwitchBoardBarrier(Container container)
+   {
+      if (this.isSharedENC(this.jbossUnit))
+      {
+         return this.jbossUnit.getAttachment(Barrier.class);
+      }
+      
+      // This is a bit brittle since we are relying on the internal knowledge of
+      // what org.jboss.ejb3.deployers.EJBsDeployer uses as a name to attach the EJB metadata
+      // component to the deployment unit. However, we don't have an alternate way to get hold
+      // of the name. So for now, let's just use this
+      String ejbComponentName = JBossEnterpriseBeanMetaData.class.getName() + "." + container.getEjbName();
+      // get the component DU for the EJB of this container from the parent (non-component) DU
+      org.jboss.deployers.structure.spi.DeploymentUnit componentDU = this.jbossUnit.getComponent(ejbComponentName);
+      if (componentDU == null)
+      {
+         // without the component DU, there's no way we can get hold of the switchboard Barrier.
+         // That effectively makes the container unusable. Hence throw this exception
+         throw new RuntimeException("Component Deployment Unit for bean: " + container.getEjbName()
+               + " not found in unit: " + this.jbossUnit);
+      }
+      return componentDU.getAttachment(Barrier.class);
+   }
+   
+   protected InjectionManager getInjectionManager(Container container)
+   {
+      // This is a bit brittle since we are relying on the internal knowledge of
+      // what org.jboss.ejb3.deployers.EJBsDeployer uses as a name to attach the EJB metadata
+      // component to the deployment unit. However, we don't have an alternate way to get hold
+      // of the name. So for now, let's just use this
+      String ejbComponentName = JBossEnterpriseBeanMetaData.class.getName() + "." + container.getEjbName();
+      // get the component DU for the EJB of this container from the parent (non-component) DU
+      org.jboss.deployers.structure.spi.DeploymentUnit componentDU = this.jbossUnit.getComponent(ejbComponentName);
+      if (componentDU == null)
+      {
+         // without the component DU, there's no way we can get hold of the correct InjectionManager.
+         // That effectively makes the container unusable. Hence throw this exception
+         throw new RuntimeException("Component Deployment Unit for bean: " + container.getEjbName()
+               + " not found in unit: " + this.jbossUnit);
+      }
+      // get the InjectionManager
+      return componentDU.getAttachment(InjectionManager.class);
+   }
+   
+   protected void setupInjectors(EJBContainer ejbContainer, InjectionManager injectionManager, Barrier switchBoard)
+   {
+      // Let's first create EEInjector (which pulls from ENC and pushes to EJB instance) for EJB
+      // and then create a EEInjector for each of the interceptors for the bean
+
+      JBossEnterpriseBeanMetaData beanMetaData = ejbContainer.getXml();
+      // convert JBMETA metadata to jboss-injection specific metadata
+      JndiEnvironmentRefsGroup jndiEnvironment = new JndiEnvironmentImpl(beanMetaData, ejbContainer.getClassloader());
+      // For optimization, we'll create an Injector only if there's atleast one InjectionTarget
+      if (this.hasInjectionTargets(jndiEnvironment))
+      {
+         // create the injector
+         LazyEEInjector lazyEEInjector = new LazyEEInjector(jndiEnvironment);
+         // add the injector the injection manager
+         injectionManager.addInjector(lazyEEInjector);
+         // Deploy the Injector as a MC bean (so that the fully populated naming context (obtained via the SwitchBoard
+         // Barrier) gets injected.
+         String injectorMCBeanName = this.getInjectorMCBeanNamePrefix() + ",bean=" + ejbContainer.getEjbName();
+         BeanMetaData injectorBMD = this.createInjectorBMD(injectorMCBeanName, lazyEEInjector, switchBoard);
+         unit.addAttachment(BeanMetaData.class + ":" + injectorMCBeanName, injectorBMD);
+         
+         // Add the Injector dependency on the deployment (so that the DU doesn't
+         // get started till the Injector is available)
+         DependencyPolicy dependsPolicy = ejbContainer.getDependencyPolicy();
+         dependsPolicy.addDependency(injectorMCBeanName);
+         log.debug("Added Injector dependency: " + injectorMCBeanName + " for EJB: " + ejbContainer.getEjbName() + " in unit " + this.jbossUnit);
+      }
+      
+      // Now setup injectors for the interceptors of the bean
+      InterceptorsMetaData interceptors = JBossMetaData.getInterceptors(beanMetaData.getEjbName(), beanMetaData.getJBossMetaData());
+      if (interceptors == null || interceptors.isEmpty())
+      {
+         return;
+      }
+      for (InterceptorMetaData interceptor : interceptors)
+      {
+         if (interceptor == null)
+         {
+            continue;
+         }
+         JndiEnvironmentRefsGroup jndiEnvironmentForInterceptor = new JndiEnvironmentImpl(interceptor, ejbContainer.getClassloader());
+         // For optimization, we'll create an Injector only if there's atleast one InjectionTarget
+         if (this.hasInjectionTargets(jndiEnvironmentForInterceptor))
+         {
+            // create the injector
+            LazyEEInjector lazyEEInjector = new LazyEEInjector(jndiEnvironmentForInterceptor);
+            // add the injector the injection manager
+            injectionManager.addInjector(lazyEEInjector);
+            // Deploy the Injector as a MC bean (so that the fully populated naming context (obtained via the SwitchBoard
+            // Barrier) gets injected.
+            String interceptorInjectorMCBeanName = this.getInjectorMCBeanNamePrefix() + ",bean=" + ejbContainer.getEjbName() + ",interceptor=" + interceptor.getName();
+            BeanMetaData injectorBMD = this.createInjectorBMD(interceptorInjectorMCBeanName, lazyEEInjector, switchBoard);
+            unit.addAttachment(BeanMetaData.class + ":" + interceptorInjectorMCBeanName, injectorBMD);
+            
+            // Add the Injector dependency on the deployment (so that the DU doesn't
+            // get started till the Injector is available)
+            DependencyPolicy dependsPolicy = ejbContainer.getDependencyPolicy();
+            dependsPolicy.addDependency(interceptorInjectorMCBeanName);
+            log.debug("Added Injector dependency: " + interceptorInjectorMCBeanName + " for interceptor "
+                  + interceptor.getName() + " of EJB: " + ejbContainer.getEjbName() + " in unit " + this.jbossUnit);
+         }
+         
+      }
+
+   }
+
+   /**
+    * Returns true if the passed {@link JndiEnvironmentRefsGroup} has atleast one {@link EnvironmentEntryType environment entry}
+    * with an {@link InjectionTargetType injection target}. Else, returns false
+    *  
+    * @param jndiEnv
+    * @return
+    */
+   private boolean hasInjectionTargets(JndiEnvironmentRefsGroup jndiEnv)
+   {
+      Collection<EnvironmentEntryType> envEntries = jndiEnv.getEntries();
+      if (envEntries == null || envEntries.isEmpty())
+      {
+         return false;
+      }
+      for (EnvironmentEntryType envEntry : envEntries)
+      {
+         Collection<InjectionTargetType> injectionTargets = envEntry.getInjectionTargets();
+         if (injectionTargets != null && !injectionTargets.isEmpty())
+         {
+            return true;
+         }
+      }
+      return false;   
+   }
+   
+   /**
+    * Creates and returns {@link BeanMetaData} for the passed {@link LazyEEInjector injector} and sets up
+    * dependency on the passed {@link Barrier SwitchBoard barrier}.
+    * 
+    * @param injectorMCBeanName
+    * @param injector
+    * @param barrier
+    * @return
+    */
+   protected BeanMetaData createInjectorBMD(String injectorMCBeanName, LazyEEInjector injector, Barrier barrier)
+   {
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(injectorMCBeanName, injector.getClass().getName());
+      builder.setConstructorValue(injector);
+
+      // add injection dependency on INSTALLED state of SwitchBoard Barrier
+      AbstractInjectionValueMetaData barrierInjection = new AbstractInjectionValueMetaData(barrier.getId());
+      barrierInjection.setDependentState(ControllerState.INSTALLED);
+      builder.addPropertyMetaData("barrier", barrierInjection);
+
+      // return the Injector BMD
+      return builder.getBeanMetaData();
+   }
+   
+
+   /**
+    * Returns the prefix for the MC bean name, for a {@link Injector injector}
+    * 
+    * @return
+    */
+   protected String getInjectorMCBeanNamePrefix()
+   {
+      StringBuilder sb = new StringBuilder("jboss-injector:");
+      org.jboss.deployers.structure.spi.DeploymentUnit topLevelUnit = this.jbossUnit.isTopLevel() ? this.jbossUnit : this.jbossUnit.getTopLevel();
+      sb.append("topLevelUnit=");
+      sb.append(topLevelUnit.getSimpleName());
+      sb.append(",");
+      sb.append("unit=");
+      sb.append(this.jbossUnit.getSimpleName());
+
+      return sb.toString();
+   }
+
+   private boolean isSharedENC(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit)
+   {
+      JBossMetaData jbossMetaData = deploymentUnit.getAttachment(JBossMetaData.class);
+      JBossWebMetaData jbosswebMetaData = deploymentUnit.getAttachment(JBossWebMetaData.class);
+      if (jbossMetaData != null && jbosswebMetaData != null)
+      {
+         return true;
+      }
+      return false;
+   }
 }

Modified: trunk/ejb3/src/resources/META-INF/ejb3-as-deployers-jboss-beans.xml
===================================================================
--- trunk/ejb3/src/resources/META-INF/ejb3-as-deployers-jboss-beans.xml	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/ejb3/src/resources/META-INF/ejb3-as-deployers-jboss-beans.xml	2010-11-23 14:00:03 UTC (rev 109431)
@@ -149,6 +149,8 @@
       </uninstall>
 
    </bean>
+
+   <bean name="Ejb3DeploymentDeployer" class="org.jboss.ejb3.deployers.Ejb3DeploymentDeployer"/>
    
    <bean name="AppClientParsingDeployer" class="org.jboss.ejb3.deployers.AppClientParsingDeployer">
       <!-- TODO: check depends -->

Modified: trunk/server/src/etc/deployers/switchboard-clustered-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/switchboard-clustered-jboss-beans.xml	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/server/src/etc/deployers/switchboard-clustered-jboss-beans.xml	2010-11-23 14:00:03 UTC (rev 109431)
@@ -5,17 +5,22 @@
     <bean  name="org.jboss.switchboard.WebEnvironmentSwitchBoardDeployer" class="org.jboss.switchboard.mc.deployer.WebEnvironmentSwitchBoardDeployer">
         <constructor><parameter class="org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer"><inject/></parameter></constructor>
     </bean>
-    <!--  Disabled till we have EJB3 containers integrated with switchboard    
     <bean  name="org.jboss.switchboard.EJBEnvironmentSwitchBoardDeployer" class="org.jboss.switchboard.mc.deployer.EJBEnvironmentSwitchBoardDeployer">
         <constructor><parameter class="org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer"><inject/></parameter></constructor>
     </bean>
-    -->
     
     <!--  Resource providers -->
 
     <!--  processes env-entry resources (EE.5.4 of Java EE6 spec) -->
     <bean name="org.jboss.switchboard.EnvEntryResourceProvider" class="org.jboss.switchboard.mc.resource.provider.EnvEntryResourceProvider"/>
 
+    <!-- Resource provider for resource-env-ref of type javax.ejb.EJBContext, javax.ejb.SessionContext -->
+    <bean name="org.jboss.switchboard.EJBContextResEnvRefProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.EJBContextResourceEnvRefResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>EJBContextBinder</value></parameter>
+        </constructor>
+    </bean>    
+
     <!--  processes resource-env-ref resources (EE.5.8 of Java EE6 spec) -->
     <bean name="org.jboss.switchboard.ResourceEnvRefResourceProvider" class="org.jboss.switchboard.mc.resource.provider.ResourceEnvRefProvider">
         <property name="typedResourceEnvRefResourceProviders">
@@ -24,6 +29,30 @@
                     <key>javax.xml.ws.WebServiceContext</key>
                     <value><inject bean="org.jboss.switchboard.WebServiceContextResourceProvider"/></value>
                 </entry>
+                <entry>
+                    <key>javax.ejb.EJBContext</key>
+                    <value><inject bean="org.jboss.switchboard.EJBContextResEnvRefProvider"/></value>
+                </entry>
+                <entry>
+                    <key>javax.ejb.SessionContext</key>
+                    <value><inject bean="org.jboss.switchboard.EJBContextResEnvRefProvider"/></value>
+                </entry>
+                <entry>
+                    <key>javax.ejb.TimerService</key>
+                    <value>
+                        <bean name="org.jboss.switchboard.TimerServiceResEnvRefProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.TimerServiceResourceEnvRefResourceProvider">
+                            <constructor>
+                                <parameter class="java.lang.String"><value>TimerServiceBinder</value></parameter>
+                            </constructor>                    
+                        </bean>
+                    </value>
+                </entry>
+                <entry>
+                    <key>javax.transaction.UserTransaction</key>
+                    <value>
+                        <bean name="org.jboss.switchboard.UserTransactionResEnvRefResourceProvider" class="org.jboss.as.switchboard.resource.provider.UserTransactionResourceEnvRefResourceProvider"/>
+                    </value>
+                </entry>
             </map>           
         </property>
     </bean>
@@ -38,6 +67,11 @@
                 </entry>
             </map>           
         </property>
+        <property name="fallbackResourceRefResourceProviders">
+            <list>
+                <inject bean="org.jboss.switchboard.ManagedBeanResourceRefResourceProvider"/>
+            </list>
+        </property>
     </bean>
 
     <!--  ResourceProvider for java:comp/ORB (EE.5.12 of Java EE6 spec) -->
@@ -49,6 +83,19 @@
     <!--  ResourceProvider for java:comp/TransactionSynchronizationRegistry (EE.5.11 of Java EE 6 spec) -->
     <bean name="org.jboss.switchboard.TransactionSyncRegistryRefResourceProvider" class="org.jboss.as.switchboard.resource.provider.TransactionSynchronizationRefResourceProvider"/>
 
+    <!-- ResourceProvider for java:comp/EJBContext -->
+    <bean name="org.jboss.switchboard.EJBContextResourceProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.EJBContextResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>EJBContextBinder</value></parameter>
+        </constructor>
+    </bean>
+
+    <!-- ResourceProvider for java:comp/TimerService -->
+    <bean name="org.jboss.switchboard.TimerServiceResourceProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.TimerServiceResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>TimerServiceBinder</value></parameter>
+        </constructor>                    
+    </bean>
     
     <!-- Resource provider registry -->
     <bean name="org.jboss.switchboard.ResourceProviderRegistry" class="org.jboss.switchboard.mc.resource.provider.ResourceProviderRegistry">
@@ -65,10 +112,10 @@
                 <inject bean="org.jboss.switchboard.AnnotatedEJBRefResourceProvider"/>
                 -->
                 <inject bean="org.jboss.switchboard.BeanManagerResourceProvider"/>
-                <!-- Disabled till container themselves stop binding into java:comp 
-                    <inject bean="org.jboss.switchboard.ORBRefResourceProvider"/>
-                    <inject bean="org.jboss.switchboard.UserTransactionRefResourceProvider"/>
-                -->
+                <inject bean="org.jboss.switchboard.ORBRefResourceProvider"/>
+                <inject bean="org.jboss.switchboard.UserTransactionRefResourceProvider"/>
+                <inject bean="org.jboss.switchboard.EJBContextResourceProvider"/>
+                <inject bean="org.jboss.switchboard.TimerServiceResourceProvider"/>
                 <!-- Disabled till https://jira.jboss.org/browse/JBAS-8465 is fixed 
                 <inject bean="org.jboss.switchboard.TransactionSyncRegistryRefResourceProvider"/>
                 -->

Modified: trunk/server/src/etc/deployers/switchboard-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/switchboard-jboss-beans.xml	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/server/src/etc/deployers/switchboard-jboss-beans.xml	2010-11-23 14:00:03 UTC (rev 109431)
@@ -5,17 +5,22 @@
     <bean  name="org.jboss.switchboard.WebEnvironmentSwitchBoardDeployer" class="org.jboss.switchboard.mc.deployer.WebEnvironmentSwitchBoardDeployer">
         <constructor><parameter class="org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer"><inject/></parameter></constructor>
     </bean>
-    <!--  Disabled till we have EJB3 containers integrated with switchboard    
     <bean  name="org.jboss.switchboard.EJBEnvironmentSwitchBoardDeployer" class="org.jboss.switchboard.mc.deployer.EJBEnvironmentSwitchBoardDeployer">
         <constructor><parameter class="org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer"><inject/></parameter></constructor>
     </bean>
-    -->
     
     <!--  Resource providers -->
 
     <!--  processes env-entry resources (EE.5.4 of Java EE6 spec) -->
     <bean name="org.jboss.switchboard.EnvEntryResourceProvider" class="org.jboss.switchboard.mc.resource.provider.EnvEntryResourceProvider"/>
 
+    <!-- Resource provider for resource-env-ref of type javax.ejb.EJBContext, javax.ejb.SessionContext -->
+    <bean name="org.jboss.switchboard.EJBContextResEnvRefProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.EJBContextResourceEnvRefResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>EJBContextBinder</value></parameter>
+        </constructor>
+    </bean>    
+
     <!--  processes resource-env-ref resources (EE.5.8 of Java EE6 spec) -->
     <bean name="org.jboss.switchboard.ResourceEnvRefResourceProvider" class="org.jboss.switchboard.mc.resource.provider.ResourceEnvRefProvider">
         <property name="typedResourceEnvRefResourceProviders">
@@ -24,6 +29,30 @@
                     <key>javax.xml.ws.WebServiceContext</key>
                     <value><inject bean="org.jboss.switchboard.WebServiceContextResourceProvider"/></value>
                 </entry>
+                <entry>
+                    <key>javax.ejb.EJBContext</key>
+                    <value><inject bean="org.jboss.switchboard.EJBContextResEnvRefProvider"/></value>
+                </entry>
+                <entry>
+                    <key>javax.ejb.SessionContext</key>
+                    <value><inject bean="org.jboss.switchboard.EJBContextResEnvRefProvider"/></value>
+                </entry>
+                <entry>
+                    <key>javax.ejb.TimerService</key>
+                    <value>
+                        <bean name="org.jboss.switchboard.TimerServiceResEnvRefProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.TimerServiceResourceEnvRefResourceProvider">
+                            <constructor>
+                                <parameter class="java.lang.String"><value>TimerServiceBinder</value></parameter>
+                            </constructor>                    
+                        </bean>
+                    </value>
+                </entry>
+                <entry>
+                    <key>javax.transaction.UserTransaction</key>
+                    <value>
+                        <bean name="org.jboss.switchboard.UserTransactionResEnvRefResourceProvider" class="org.jboss.as.switchboard.resource.provider.UserTransactionResourceEnvRefResourceProvider"/>
+                    </value>
+                </entry>
             </map>           
         </property>
     </bean>
@@ -38,6 +67,11 @@
                 </entry>
             </map>           
         </property>
+        <property name="fallbackResourceRefResourceProviders">
+            <list>
+                <inject bean="org.jboss.switchboard.ManagedBeanResourceRefResourceProvider"/>
+            </list>
+        </property>
     </bean>
 
     <!--  ResourceProvider for java:comp/UserTransaction (EE.5.10 of Java EE 6 spec) -->
@@ -46,6 +80,20 @@
     <!--  ResourceProvider for java:comp/TransactionSynchronizationRegistry (EE.5.11 of Java EE 6 spec) -->
     <bean name="org.jboss.switchboard.TransactionSyncRegistryRefResourceProvider" class="org.jboss.as.switchboard.resource.provider.TransactionSynchronizationRefResourceProvider"/>
 
+    <!-- ResourceProvider for java:comp/EJBContext -->
+    <bean name="org.jboss.switchboard.EJBContextResourceProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.EJBContextResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>EJBContextBinder</value></parameter>
+        </constructor>
+    </bean>
+
+    <!-- ResourceProvider for java:comp/TimerService -->
+    <bean name="org.jboss.switchboard.TimerServiceResourceProvider" class="org.jboss.as.ejb3.switchboard.resource.provider.TimerServiceResourceProvider">
+        <constructor>
+            <parameter class="java.lang.String"><value>TimerServiceBinder</value></parameter>
+        </constructor>                    
+    </bean>
+    
     <!-- Resource provider registry -->
     <bean name="org.jboss.switchboard.ResourceProviderRegistry" class="org.jboss.switchboard.mc.resource.provider.ResourceProviderRegistry">
         <property name="resourceProviders">
@@ -61,12 +109,13 @@
                 <inject bean="org.jboss.switchboard.AnnotatedEJBRefResourceProvider"/>
                 -->
                 <inject bean="org.jboss.switchboard.BeanManagerResourceProvider"/>
-                <!-- Disabled till container themselves stop binding into java:comp
-                    <inject bean="org.jboss.switchboard.UserTransactionRefResourceProvider"/>
-                -->
+                <inject bean="org.jboss.switchboard.UserTransactionRefResourceProvider"/>
+                <inject bean="org.jboss.switchboard.EJBContextResourceProvider"/>
+                <inject bean="org.jboss.switchboard.TimerServiceResourceProvider"/>
                 <!-- Disabled till https://jira.jboss.org/browse/JBAS-8465 is fixed
                 <inject bean="org.jboss.switchboard.TransactionSyncRegistryRefResourceProvider"/>
                 -->
+                <!-- java:comp/ -->
             </list>
         </property>
 

Modified: trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/server/src/main/java/org/jboss/as/naming/javaee/NamingJavaEEComponentInformer.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -24,6 +24,7 @@
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
 
 /**
@@ -56,4 +57,10 @@
    {
       return unit.isAttachmentPresent(JBossEnterpriseBeanMetaData.class) || unit.isAttachmentPresent(JBossServletMetaData.class);
    }
+   
+   @Override
+   public boolean belongsToWebModule(DeploymentUnit deploymentUnit)
+   {
+      return deploymentUnit.isAttachmentPresent(JBossWebMetaData.class);
+   }
 }

Modified: trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionRefResourceProvider.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionRefResourceProvider.java	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionRefResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -10,7 +10,7 @@
 import org.jboss.switchboard.spi.Resource;
 
 /**
- * UserTransactionRefResourceProvider
+ * {@link MCBasedResourceProvider} for java:comp/UserTransaction
  *
  * @author Jaikiran Pai
  * @version $Revision: $
@@ -23,7 +23,7 @@
       return UserTransactionRefType.class;
    }
 
-   public Resource provide(DeploymentUnit context, UserTransactionRefType type)
+   public Resource provide(DeploymentUnit context, UserTransactionRefType userTransactionRef)
    {
       return new LinkRefResource("UserTransaction");
    }

Added: trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionResourceEnvRefResourceProvider.java
===================================================================
--- trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionResourceEnvRefResourceProvider.java	                        (rev 0)
+++ trunk/server/src/main/java/org/jboss/as/switchboard/resource/provider/UserTransactionResourceEnvRefResourceProvider.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.as.switchboard.resource.provider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.switchboard.impl.resource.LinkRefResource;
+import org.jboss.switchboard.javaee.jboss.environment.JBossResourceEnvRefType;
+import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
+import org.jboss.switchboard.spi.Resource;
+
+/**
+ * {@link MCBasedResourceProvider} for resource-env-ref which references UserTransaction
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class UserTransactionResourceEnvRefResourceProvider implements MCBasedResourceProvider<JBossResourceEnvRefType>
+{
+
+   @Override
+   public Class<JBossResourceEnvRefType> getEnvironmentEntryType()
+   {
+      return JBossResourceEnvRefType.class;
+   }
+
+   @Override
+   public Resource provide(DeploymentUnit unit, JBossResourceEnvRefType resEnvRef)
+   {
+      return new LinkRefResource("UserTransaction");
+   }
+
+}

Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2010-11-23 12:33:59 UTC (rev 109430)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2010-11-23 14:00:03 UTC (rev 109431)
@@ -21,6 +21,23 @@
  */
 package org.jboss.web.tomcat.service.deployers;
 
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.security.CodeSource;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.naming.Context;
+
 import org.apache.catalina.Container;
 import org.apache.catalina.Engine;
 import org.apache.catalina.LifecycleEvent;
@@ -37,7 +54,6 @@
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.metadata.web.spec.TldMetaData;
 import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.naming.NonSerializableFactory;
 import org.jboss.reloaded.naming.CurrentComponent;
 import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
 import org.jboss.reloaded.naming.spi.JavaEEComponent;
@@ -57,23 +73,6 @@
 import org.jboss.web.tomcat.service.WebCtxLoader;
 import org.omg.CORBA.ORB;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * A tomcat web application deployment.
  * 
@@ -397,28 +396,28 @@
                metaData.setENCLoader(webLoader.getClassLoader());
                Context javaCompCtx = component.getContext();
 //               // Add ORB/UserTransaction
-               ORB orb = null;
-               try
-               {
-                  ObjectName ORB_NAME = new ObjectName("jboss:service=CorbaORB");
-                  orb = (ORB)server.getAttribute(ORB_NAME, "ORB");
-                  // Bind the orb
-                  if (orb != null)
-                  {
-                     NonSerializableFactory.rebind(javaCompCtx, "ORB", orb);
-                     log.debug("Bound java:comp/ORB");
-                  }
-               }
-               catch (Throwable t)
-               {
-                  log.debug("Unable to retrieve orb: " + t.toString());
-               }
-
-               // JTA links
-               javaCompCtx.bind("TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
-               log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
-               javaCompCtx.bind("UserTransaction", new LinkRef("UserTransaction"));
-               log.debug("Linked java:comp/UserTransaction to JNDI name: UserTransaction");
+//               ORB orb = null;
+//               try
+//               {
+//                  ObjectName ORB_NAME = new ObjectName("jboss:service=CorbaORB");
+//                  orb = (ORB)server.getAttribute(ORB_NAME, "ORB");
+//                  // Bind the orb
+//                  if (orb != null)
+//                  {
+//                     NonSerializableFactory.rebind(javaCompCtx, "ORB", orb);
+//                     log.debug("Bound java:comp/ORB");
+//                  }
+//               }
+//               catch (Throwable t)
+//               {
+//                  log.debug("Unable to retrieve orb: " + t.toString());
+//               }
+//
+//               // JTA links
+//               javaCompCtx.bind("TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
+//               log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
+//               javaCompCtx.bind("UserTransaction", new LinkRef("UserTransaction"));
+//               log.debug("Linked java:comp/UserTransaction to JNDI name: UserTransaction");
                //envCtx = envCtx.createSubcontext("env");
                injectionContainer.populateEnc(webLoader.getClassLoader());
 



More information about the jboss-cvs-commits mailing list