[jboss-cvs] JBossAS SVN: r106153 - in projects/ejb3/trunk/core: src/main/java/org/jboss/ejb3 and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 18 08:08:55 EDT 2010


Author: jaikiran
Date: 2010-06-18 08:08:54 -0400 (Fri, 18 Jun 2010)
New Revision: 106153

Modified:
   projects/ejb3/trunk/core/pom.xml
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/TimerServicePropertyInjector.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1358/MockContainer.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
Log:
EJBTHREE-2118 Integrate core containers with BeanManager

Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/pom.xml	2010-06-18 12:08:54 UTC (rev 106153)
@@ -44,7 +44,7 @@
     <version.org.jboss.ejb3.context>0.1.1</version.org.jboss.ejb3.context>
     <version.org.jboss.jboss-as>5.1.0.GA</version.org.jboss.jboss-as>
     <version.org.jboss.security>2.0.3.SP1</version.org.jboss.security>
-    <version.org.jboss.ejb3_timerservice-naming>1.0.0-alpha-1</version.org.jboss.ejb3_timerservice-naming>
+    <version.org.jboss.ejb3_timerservice-naming>1.0.0-SNAPSHOT</version.org.jboss.ejb3_timerservice-naming>
     <version.sun-jaxws>2.1.1</version.sun-jaxws>
   </properties>
 
@@ -400,7 +400,7 @@
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-timerservice-spi</artifactId>
-      <version>1.0.1</version>
+      <version>1.0.2-SNAPSHOT</version>
     </dependency>
     
     <dependency>

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -28,6 +28,7 @@
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
+import org.jboss.ejb3.context.spi.BeanManager;
 import org.jboss.ejb3.pool.Pool;
 import org.jboss.ejb3.statistics.InvocationStatistics;
 
@@ -41,7 +42,7 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public interface Container
+public interface Container extends BeanManager
 {
    String ENC_CTX_NAME = "java:comp";
 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -31,6 +31,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
+import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -45,6 +46,8 @@
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
 import javax.ejb.Local;
 import javax.ejb.Remote;
 import javax.ejb.Timeout;
@@ -58,6 +61,7 @@
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.Domain;
@@ -1870,4 +1874,69 @@
          this.semaphore.release();
       }
    }
+   
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public EJBHome getEJBHome() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public EJBLocalHome getEJBLocalHome() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean getRollbackOnly() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public UserTransaction getUserTransaction() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isCallerInRole(Principal callerPrincipal, String roleName) throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object lookup(String name) throws IllegalArgumentException
+   {
+      try
+      {
+         Object obj = this.getEnc().lookup(name);
+         return obj;
+      }
+      catch (NamingException ne)
+      {
+         throw new RuntimeException(ne);
+      }
+   }
+
+   /**
+    * {@inheritDoc} 
+    */
+   public void setRollbackOnly() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -176,8 +176,7 @@
 
    public BeanManager getManager()
    {
-      // TODO: implement
-      throw new UnsupportedOperationException("Not yet implemented");
+      return this.getContainer();
    }
 
    public Object getTarget()

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -46,6 +46,7 @@
 import org.jboss.ejb3.Ejb3Module;
 import org.jboss.ejb3.TimerServiceContainer;
 import org.jboss.ejb3.annotation.ResourceAdapter;
+import org.jboss.ejb3.context.spi.MessageDrivenBeanManager;
 import org.jboss.ejb3.jms.JMSDestinationFactory;
 import org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
@@ -61,7 +62,7 @@
  * @version <tt>$Revision$</tt>
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
  */
-public abstract class MessagingContainer extends TimerServiceContainer implements MultiTimeoutMethodTimedObjectInvoker
+public abstract class MessagingContainer extends TimerServiceContainer implements MultiTimeoutMethodTimedObjectInvoker, MessageDrivenBeanManager
 {
    private static final Logger log = Logger.getLogger(MessagingContainer.class);
    
@@ -633,53 +634,6 @@
    }
    
    /**
-    * {@inheritDoc}
-    * 
-    * @throws IllegalArgumentException If the passed <code>timeoutMethodName</code> or <code>timer</code> is null
-    */
-   @Override
-   public void callTimeout(Timer timer, String timeoutMethodName, String[] timeoutMethodParams) throws Exception
-   {
-      if (timer == null)
-      {
-         throw new IllegalArgumentException("Timer instance is null on callTimeout");
-      }
-      if (timeoutMethodName == null)
-      {
-         throw new IllegalArgumentException("Timeout method name is null on callTimeout");
-      }
-      // load the method param classes
-      Class<?>[] methodParams = null;
-      if (timeoutMethodParams != null)
-      {
-         methodParams = new Class<?>[timeoutMethodParams.length];
-         int i = 0;
-         for (String param : timeoutMethodParams)
-         {
-            Class<?> methodParam = this.classloader.loadClass(param);
-            methodParams[i++] = methodParam;
-         }
-      }
-      Method autoTimeoutMethod = null;
-      try
-      {
-         // NOTE: We do *not* do any semantic validations on the timeout method. 
-         // Any relevant validations should be done outside the container during metadata
-         // creation stage.
-         autoTimeoutMethod = this.getBeanClass().getMethod(timeoutMethodName, methodParams);
-      }
-      catch (NoSuchMethodException nsme)
-      {
-         log.error("Timeout method not found for bean " + this.getEjbName() + " for timer " + timer);
-         throw nsme;
-      }
-
-      // call the timeout method
-      this.callTimeout(timer, autoTimeoutMethod);
-      
-   }
-   
-   /**
     * Invokes the passed timeout method for the passed {@link Timer}, on a bean instance.
     * 
     * @param timer The {@link Timer} for which the timeout has occurred 
@@ -687,7 +641,8 @@
     * @throws Exception If any exception occurs during invocation of timeout method on the target bean
     * @throws {@link NullPointerException} If the passed <code>tMethod</code> is null
     */
-   private void callTimeout(Timer timer, Method tMethod) throws Exception
+   @Override
+   public void callTimeout(Timer timer, Method tMethod) throws Exception
    {
       Object[] args = {timer};
       if(tMethod.getParameterTypes().length == 0)

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -59,6 +59,8 @@
 import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
 import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.context.spi.SessionBeanManager;
+import org.jboss.ejb3.context.spi.SessionContext;
 import org.jboss.ejb3.core.proxy.spi.CurrentRemoteProxyFactory;
 import org.jboss.ejb3.core.proxy.spi.EJB2RemoteProxyFactory;
 import org.jboss.ejb3.endpoint.Endpoint;
@@ -82,7 +84,7 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public abstract class SessionContainer extends TimerServiceContainer implements InvokableContext, Endpoint
+public abstract class SessionContainer extends TimerServiceContainer implements InvokableContext, Endpoint, SessionBeanManager
 {
    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(SessionContainer.class);
@@ -872,4 +874,28 @@
    {
       return false;
    }
+   
+   /**
+    * {@inheritDoc} 
+    */
+   public <T> T getBusinessObject(SessionContext ctx, Class<T> businessInterface) throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}  
+    */
+   public EJBLocalObject getEJBLocalObject(SessionContext ctx) throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}   
+    */
+   public EJBObject getEJBObject(SessionContext ctx) throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -36,7 +36,6 @@
 import javax.ejb.Handle;
 import javax.ejb.RemoteHome;
 import javax.ejb.Timer;
-import javax.ejb.TimerService;
 import javax.naming.NamingException;
 
 import org.jboss.aop.Advisor;
@@ -45,7 +44,6 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.InvocationResponse;
 import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.ejb.AllowedOperationsAssociation;
 import org.jboss.ejb.AllowedOperationsFlags;
 import org.jboss.ejb3.BeanContext;
@@ -74,7 +72,6 @@
 import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker;
 import org.jboss.ejb3.timerservice.spi.TimedObjectInvoker;
-import org.jboss.ejb3.timerservice.spi.TimerServiceFactory;
 import org.jboss.ejb3.util.CollectionHelper;
 import org.jboss.injection.WebServiceContextProxy;
 import org.jboss.injection.lang.reflect.BeanProperty;
@@ -641,52 +638,6 @@
    }
    
    /**
-    * {@inheritDoc}
-    * 
-    * @throws IllegalArgumentException If the passed <code>timeoutMethodName</code> or <code>timer</code> is null
-    */
-   @Override
-   public void callTimeout(Timer timer, String timeoutMethodName, String[] timeoutMethodParams) throws Exception
-   {
-      if (timer == null)
-      {
-         throw new IllegalArgumentException("Timer instance is null on callTimeout");
-      }
-      if (timeoutMethodName == null)
-      {
-         throw new IllegalArgumentException("Timeout method name is null on callTimeout");
-      }
-      // load the method param classes
-      Class<?>[] methodParams = null;
-      if (timeoutMethodParams != null)
-      {
-         methodParams = new Class<?>[timeoutMethodParams.length];
-         int i = 0;
-         for (String param : timeoutMethodParams)
-         {
-            Class<?> methodParam = this.classloader.loadClass(param);
-            methodParams[i++] = methodParam;
-         }
-      }
-      Method autoTimeoutMethod = null;
-      try
-      {
-         // NOTE: We do *not* do any semantic validations on the timeout method. 
-         // Any relevant validations should be done outside the container during metadata
-         // creation stage.
-         autoTimeoutMethod = this.getBeanClass().getMethod(timeoutMethodName, methodParams);
-      }
-      catch (NoSuchMethodException nsme)
-      {
-         log.error("Timeout method not found for bean " + this.getEjbName() + " for timer " + timer);
-         throw nsme;
-      }
-      // call the timeout method
-      this.callTimeout(timer, autoTimeoutMethod);
-      
-   }
-   
-   /**
     * Invokes the passed timeout method for the passed {@link Timer}, on a bean instance.
     * 
     * @param timer The {@link Timer} for which the timeout has occurred 
@@ -694,7 +645,8 @@
     * @throws Exception If any exception occurs during invocation of timeout method on the target bean
     * @throws {@link NullPointerException} If the passed <code>tMethod</code> is null
     */
-   private void callTimeout(Timer timer, Method tMethod) throws Exception
+   @Override
+   public void callTimeout(Timer timer, Method tMethod) throws Exception
    {
       Object[] args =
       {timer};

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -37,7 +37,6 @@
 import javax.transaction.UserTransaction;
 import javax.xml.ws.WebServiceContext;
 
-import org.jboss.ejb3.Container;
 import org.jboss.injection.lang.reflect.BeanProperty;
 import org.jboss.injection.lang.reflect.FieldBeanProperty;
 import org.jboss.injection.lang.reflect.MethodBeanProperty;
@@ -562,7 +561,7 @@
       }
       else if (type.equals(TimerService.class))
       {
-         injectors.put(accObj, new TimerServicePropertyInjector(property, (Container) container)); // only EJBs
+         injectors.put(accObj, new JndiPropertyInjector(property, "TimerService", container.getEnc()));
       }
       else if(type.equals(URL.class) && ref.mappedName() != null && ref.mappedName().length() > 0)
       {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/TimerServicePropertyInjector.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/TimerServicePropertyInjector.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/TimerServicePropertyInjector.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -31,7 +31,9 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
  * @version $Revision: 1.1 $
+ * @deprecated Use {@link JndiPropertyInjector} instead
  */
+ at Deprecated
 public class TimerServicePropertyInjector implements Injector
 {
    private BeanProperty property;

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1358/MockContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1358/MockContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1358/MockContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -21,12 +21,16 @@
  */
 package org.jboss.ejb3.core.test.ejbthree1358;
 
+import java.security.Principal;
 import java.util.Hashtable;
 
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
 import javax.ejb.TimerService;
 import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
 
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.Container;
@@ -219,4 +223,53 @@
       throw new RuntimeException("NYI");
    }
 
+   @Override
+   public EJBHome getEJBHome() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public EJBLocalHome getEJBLocalHome() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public boolean getRollbackOnly() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public UserTransaction getUserTransaction() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public boolean isCallerInRole(Principal callerPrincipal, String roleName) throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public Object lookup(String name) throws IllegalArgumentException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public void setRollbackOnly() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
 }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2010-06-18 12:05:48 UTC (rev 106152)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2010-06-18 12:08:54 UTC (rev 106153)
@@ -21,12 +21,16 @@
  */
 package org.jboss.ejb3.test.threadlocal;
 
+import java.security.Principal;
 import java.util.Hashtable;
 
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
 import javax.ejb.TimerService;
 import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
 
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.Container;
@@ -301,5 +305,55 @@
       // TODO Auto-generated method stub
       return null;
    }
+   
+   @Override
+   public EJBHome getEJBHome() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
 
+   @Override
+   public EJBLocalHome getEJBLocalHome() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public boolean getRollbackOnly() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public UserTransaction getUserTransaction() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public boolean isCallerInRole(Principal callerPrincipal, String roleName) throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public Object lookup(String name) throws IllegalArgumentException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public void setRollbackOnly() throws IllegalStateException
+   {
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+
 }



More information about the jboss-cvs-commits mailing list