[jboss-cvs] JBossAS SVN: r97283 - in projects/ejb3/trunk/api: .settings and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 2 06:37:58 EST 2009


Author: wolfc
Date: 2009-12-02 06:37:57 -0500 (Wed, 02 Dec 2009)
New Revision: 97283

Added:
   projects/ejb3/trunk/api/src/main/java/javax/ejb/embeddable/
   projects/ejb3/trunk/api/src/main/java/javax/ejb/embeddable/EJBContainer.java
Removed:
   projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java
   projects/ejb3/trunk/api/src/main/java/javax/interceptor/
   projects/ejb3/trunk/api/src/main/java/org/jboss/ejb3/api/spi/
Modified:
   projects/ejb3/trunk/api/.project
   projects/ejb3/trunk/api/.settings/org.eclipse.jdt.core.prefs
   projects/ejb3/trunk/api/.settings/org.maven.ide.eclipse.prefs
   projects/ejb3/trunk/api/src/main/java/javax/ejb/ApplicationException.java
   projects/ejb3/trunk/api/src/main/java/javax/ejb/EJB.java
   projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContext.java
   projects/ejb3/trunk/api/src/main/java/javax/ejb/Timer.java
   projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java
   projects/ejb3/trunk/api/src/main/java/javax/ejb/spi/EJBContainerProvider.java
   projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainer.java
   projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainerProvider.java
   projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/unit/EJBContainerTestCase.java
   projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java
Log:
EJBTHREE-1484: EJB 3.1 FR

Modified: projects/ejb3/trunk/api/.project
===================================================================
--- projects/ejb3/trunk/api/.project	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/.project	2009-12-02 11:37:57 UTC (rev 97283)
@@ -6,9 +6,11 @@
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>
     </buildCommand>
+    <!-- 
     <buildCommand>
       <name>org.maven.ide.eclipse.maven2Builder</name>
     </buildCommand>
+    -->
   </buildSpec>
   <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>

Modified: projects/ejb3/trunk/api/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/api/.settings/org.eclipse.jdt.core.prefs	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/.settings/org.eclipse.jdt.core.prefs	2009-12-02 11:37:57 UTC (rev 97283)
@@ -1,5 +1,5 @@
-#Wed Nov 12 18:45:10 GMT-05:00 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+#Mon Mar 23 15:46:47 CET 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
 eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6

Modified: projects/ejb3/trunk/api/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/ejb3/trunk/api/.settings/org.maven.ide.eclipse.prefs	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/.settings/org.maven.ide.eclipse.prefs	2009-12-02 11:37:57 UTC (rev 97283)
@@ -1,8 +1,8 @@
 #Fri Sep 05 14:26:37 CEST 2008
 activeProfiles=eclipse
 eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
+fullBuildGoals=
 includeModules=false
 resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
+resourceFilterGoals=
 version=1

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/ApplicationException.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/ApplicationException.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/ApplicationException.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -40,6 +40,7 @@
    /**
     * Indicates whether the application exception designation should apply to subclasses of 
     * the annotated exception class.
+    * @since 3.1
     */
    boolean inherited() default true;
    

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/EJB.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/EJB.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/EJB.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -21,9 +21,12 @@
 */
 package javax.ejb;
 
-import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.*;
 import java.lang.annotation.Target;
 
 /**
@@ -42,6 +45,11 @@
    
    String beanName() default "";
    
+   /** 
+    * A portable lookup string containing the JNDI name for the target EJB component.
+    */
+   String lookup() default "";
+   
    String mappedName() default "";
 
    String description() default "";

Deleted: projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -1,196 +0,0 @@
-/*
- * 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 javax.ejb;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.ejb.spi.EJBContainerProvider;
-import javax.naming.Context;
-
-import org.jboss.ejb3.api.spi.EJBContainerWrapper;
-
-/**
- * Used to execute an EJB application in an embeddable container.
- * 
- * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- * @since 3.1
- */
-public abstract class EJBContainer
-{
-   public static final String EMBEDDABLE_APP_NAME_PROPERTY = "javax.ejb.embeddable.appName";
-   public static final String EMBEDDABLE_INITIAL_PROPERTY = "javax.ejb.embeddable.initial";
-   @Deprecated
-   public static final String EMBEDDABLE_INITIAL = EMBEDDABLE_INITIAL_PROPERTY;
-   public static final String EMBEDDABLE_MODULES_PROPERTY = "javax.ejb.embeddable.modules";
-   
-   private static EJBContainerWrapper currentEJBContainer;
-   
-   private static final Pattern nonCommentPattern = Pattern.compile("^([^#]+)");
-
-   private static List<EJBContainerProvider> factories = new ArrayList<EJBContainerProvider>();
-   
-   static
-   {
-      findAllFactories();
-   }
-   
-   /**
-    * Shutdown an embeddable EJBContainer instance.
-    */
-   public abstract void close();
-   
-   /**
-    * Create and initialize an embeddable EJB container. 
-    * JVM classpath is searched for all ejb-jars or exploded ejb-jars in directory format.
-    * 
-    * @return EJBContainer instance
-    * @throws EJBException Thrown if the container or application could not 
-    *   be successfully initialized.
-    */
-   public static EJBContainer createEJBContainer() throws EJBException
-   {
-      return createEJBContainer(null);
-   }
-   
-   /**
-    * Create and initialize an embeddable EJB container with an 
-    * set of configuration properties and names of modules to be initialized. 
-    * 
-    * @param properties One or more spec-defined or vendor-specific properties. 
-    *   The spec reserves the prefix "javax.ejb." for spec-defined properties.
-    * @return EJBContainer instance
-    * @throws EJBException Thrown if the container or application could not 
-    *   be successfully initialized.
-    */
-   public static EJBContainer createEJBContainer(Map<?, ?> properties)
-      throws EJBException
-   {
-      for(EJBContainerProvider factory : factories)
-      {
-         EJBContainer container = factory.createEJBContainer(properties);
-         if(container != null)
-         {
-            currentEJBContainer = new EJBContainerWrapper(container);
-            return currentEJBContainer;
-         }
-      }
-      throw new EJBException("Unable to instantiate container with factories " + factories);
-   }
-   
-   private static List<String> factoryNamesFromReader(BufferedReader reader) throws IOException
-   {
-      List<String> names = new ArrayList<String>();
-      String line;
-      while ((line = reader.readLine()) != null)
-      {
-         line = line.trim();
-         Matcher m = nonCommentPattern.matcher(line);
-         if (m.find())
-         {
-            names.add(m.group().trim());
-         }
-      }
-      return names;
-   }
-   
-   private static void findAllFactories()
-   {
-      try
-      {
-         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-         Enumeration<URL> resources = loader.getResources("META-INF/services/" + EJBContainerProvider.class.getName());
-         Set<String> names = new HashSet<String>();
-         while (resources.hasMoreElements())
-         {
-            URL url = resources.nextElement();
-            InputStream is = url.openStream();
-            try
-            {
-               names.addAll(factoryNamesFromReader(new BufferedReader(new InputStreamReader(is))));
-            }
-            finally
-            {
-               is.close();
-            }
-         }
-         for (String s : names)
-         {
-            Class<?> factoryClass = loader.loadClass(s);
-            factories.add(EJBContainerProvider.class.cast(factoryClass.newInstance()));
-         }
-      }
-      catch (IOException e)
-      {
-         throw new EJBException(e);
-      }
-      catch (InstantiationException e)
-      {
-         throw new EJBException(e);
-      }
-      catch (IllegalAccessException e)
-      {
-         throw new EJBException(e);
-      }
-      catch (ClassNotFoundException e)
-      {
-         throw new EJBException(e);
-      }
-   }
-   
-   /**
-    * Retrieve the last EJBContainer instance to be successfully returned 
-    * from an invocation to a createEJBContainer method. 
-    * @return EJBContainer instance, or null if none exists or if the last EJBContainer 
-    *   instance has been closed.
-    */
-   @Deprecated
-   public static EJBContainer getCurrentEJBContainer()
-   {
-      if(currentEJBContainer != null && currentEJBContainer.isClosed())
-         return null;
-      return currentEJBContainer;
-   }
-   
-   /**
-    * Retrieve a naming context for looking up references to session beans executing in
-    * the embeddable container.
-    * 
-    * @return The naming context.
-    */
-   public Context getContext()
-   {
-      throw new UnsupportedOperationException(this + " does not support a naming context");
-   }
-}

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContext.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContext.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContext.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -21,11 +21,13 @@
 */
 package javax.ejb;
 
-import javax.transaction.UserTransaction;
 import java.security.Identity;
 import java.security.Principal;
+import java.util.Map;
 import java.util.Properties;
 
+import javax.transaction.UserTransaction;
+
 /**
  * <P>The EJBContext interface provides an instance with access to the
  * container-provided runtime context of an enterprise Bean instance.</P>
@@ -83,8 +85,15 @@
     */
    public Principal getCallerPrincipal();
 
-
    /**
+    * Returns the context data associated with this invocation or lifecycle callback. If there
+    * is no context data, an empty Map object will be returned. 
+    * @return Context data or empty map.
+    * @since 3.1
+    */
+   Map<String, Object> getContextData();
+   
+   /**
     * <B>Deprecated.</B> <I>Use boolean isCallerInRole(String roleName) instead.</I>
     *
     * <P>Test if the caller has a given role.</P>

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/Timer.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/Timer.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/Timer.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -31,11 +31,11 @@
 public interface Timer {
    
    /**
-    * Cause the timer and all its associated expiration notifications to be cancelled.
+    * Cause the timer and all its associated expiration notifications to be canceled.
     *
     * @throws IllegalStateException If this method is invoked while the instance is in
     *                               a state that does not allow access to this method.
-    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been canceled.
     * @throws EJBException If this method could not complete due to a system-level failure.
     **/
    public void cancel()
@@ -51,12 +51,14 @@
     *
     * @throws IllegalStateException If this method is invoked while the instance is in
     *                               a state that does not allow access to this method.
-    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled.
+    * @throws NoMoreTimeoutsException Indicates that the timer has no future timeouts.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been canceled.
     * @throws EJBException If this method could not complete due to a system-level failure.
     **/
    public long getTimeRemaining()
       throws
          IllegalStateException,
+         NoMoreTimeoutsException,
          NoSuchObjectLocalException,
          EJBException;
    
@@ -67,12 +69,14 @@
     *
     * @throws IllegalStateException If this method is invoked while the instance is in
     *                               a state that does not allow access to this method.
-    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled.
+    * @throws NoMoreTimeoutsException Indicates that the timer has no future timeouts.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been canceled.
     * @throws EJBException If this method could not complete due to a system-level failure.
     **/
    public Date getNextTimeout()
       throws
          IllegalStateException,
+         NoMoreTimeoutsException,
          NoSuchObjectLocalException,
          EJBException;
    
@@ -84,7 +88,7 @@
     *
     * @throws IllegalStateException If this method is invoked while the instance is in
     *                               a state that does not allow access to this method.
-    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been canceled.
     * @throws EJBException If this method could not complete due to a system-level failure.
     **/
    public Serializable getInfo()
@@ -101,7 +105,7 @@
     *
     * @throws IllegalStateException If this method is invoked while the instance is in
     *                               a state that does not allow access to this method.
-    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been cancelled.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired or has been canceled.
     * @throws EJBException If this method could not complete due to a system-level failure.
     **/
    public TimerHandle getHandle()
@@ -126,6 +130,20 @@
     */
    ScheduleExpression getSchedule() throws IllegalStateException, 
       NoSuchObjectLocalException, EJBException;
+
+   /**
+    * Query whether this timer is a calendar-based timer. 
+    * 
+    * @return true if this timer is a calendar-based timer. 
+    * @throws IllegalStateException If this method is invoked while the instance
+    *   is in a state that does not allow access to this method.
+    * @throws NoSuchObjectLocalException If invoked on a timer that has expired
+    *   or has been cancelled. 
+    * @throws EJBException If this method could not complete due to a system-level failure.
+    * @since 3.1
+    */
+   boolean isCalendarTimer() throws IllegalStateException, NoSuchObjectLocalException, 
+      EJBException;
    
    /**
     * Query whether this timer has persistent semantics.

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -36,6 +36,21 @@
     * Create a calendar-based timer based on the input schedule expression.
     * 
     * @param schedule A schedule expression describing the timeouts for this timer.
+    * @return The newly created Timer.
+    * @throws IllegalArgumentException If Schedule represents an invalid schedule
+    *   expression.
+    * @throws IllegalStateException If this method is invoked while the instance
+    *   is in a state that does not allow access to this method. 
+    * @throws EJBException If this method could not complete due to a system-level failure.
+    * @since 3.1
+    */
+   Timer createCalendarTimer(ScheduleExpression schedule)
+      throws IllegalArgumentException, IllegalStateException, EJBException;
+   
+   /**
+    * Create a calendar-based timer based on the input schedule expression.
+    * 
+    * @param schedule A schedule expression describing the timeouts for this timer.
     * @param info Application information to be delivered along with the timer 
     *   expiration. This can be null.
     * @return The newly created Timer.

Copied: projects/ejb3/trunk/api/src/main/java/javax/ejb/embeddable/EJBContainer.java (from rev 96936, projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java)
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/embeddable/EJBContainer.java	                        (rev 0)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/embeddable/EJBContainer.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -0,0 +1,174 @@
+/*
+ * 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 javax.ejb.embeddable;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.ejb.EJBException;
+import javax.ejb.spi.EJBContainerProvider;
+import javax.naming.Context;
+
+/**
+ * Used to execute an EJB application in an embeddable container.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ * @since 3.1
+ */
+public abstract class EJBContainer
+{
+   public static final String APP_NAME = "javax.ejb.embeddable.appName";
+   public static final String MODULES = "javax.ejb.embeddable.modules";
+   public static final String PROVIDER = "javax.ejb.embeddable.provider";
+   
+   private static final Pattern nonCommentPattern = Pattern.compile("^([^#]+)");
+
+   private static List<EJBContainerProvider> factories = new ArrayList<EJBContainerProvider>();
+   
+   static
+   {
+      findAllFactories();
+   }
+   
+   /**
+    * Shutdown an embeddable EJBContainer instance.
+    */
+   public abstract void close();
+   
+   /**
+    * Create and initialize an embeddable EJB container. 
+    * JVM classpath is searched for all ejb-jars or exploded ejb-jars in directory format.
+    * 
+    * @return EJBContainer instance
+    * @throws EJBException Thrown if the container or application could not 
+    *   be successfully initialized.
+    */
+   public static EJBContainer createEJBContainer() throws EJBException
+   {
+      return createEJBContainer(null);
+   }
+   
+   /**
+    * Create and initialize an embeddable EJB container with an 
+    * set of configuration properties and names of modules to be initialized. 
+    * 
+    * @param properties One or more spec-defined or vendor-specific properties. 
+    *   The spec reserves the prefix "javax.ejb." for spec-defined properties.
+    * @return EJBContainer instance
+    * @throws EJBException Thrown if the container or application could not 
+    *   be successfully initialized.
+    */
+   public static EJBContainer createEJBContainer(Map<?, ?> properties)
+      throws EJBException
+   {
+      for(EJBContainerProvider factory : factories)
+      {
+         EJBContainer container = factory.createEJBContainer(properties);
+         if(container != null)
+            return container;
+      }
+      throw new EJBException("Unable to instantiate container with factories " + factories);
+   }
+   
+   private static List<String> factoryNamesFromReader(BufferedReader reader) throws IOException
+   {
+      List<String> names = new ArrayList<String>();
+      String line;
+      while ((line = reader.readLine()) != null)
+      {
+         line = line.trim();
+         Matcher m = nonCommentPattern.matcher(line);
+         if (m.find())
+         {
+            names.add(m.group().trim());
+         }
+      }
+      return names;
+   }
+   
+   private static void findAllFactories()
+   {
+      try
+      {
+         ClassLoader loader = Thread.currentThread().getContextClassLoader();
+         Enumeration<URL> resources = loader.getResources("META-INF/services/" + EJBContainerProvider.class.getName());
+         Set<String> names = new HashSet<String>();
+         while (resources.hasMoreElements())
+         {
+            URL url = resources.nextElement();
+            InputStream is = url.openStream();
+            try
+            {
+               names.addAll(factoryNamesFromReader(new BufferedReader(new InputStreamReader(is))));
+            }
+            finally
+            {
+               is.close();
+            }
+         }
+         for (String s : names)
+         {
+            Class<?> factoryClass = loader.loadClass(s);
+            factories.add(EJBContainerProvider.class.cast(factoryClass.newInstance()));
+         }
+      }
+      catch (IOException e)
+      {
+         throw new EJBException(e);
+      }
+      catch (InstantiationException e)
+      {
+         throw new EJBException(e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new EJBException(e);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new EJBException(e);
+      }
+   }
+   
+   /**
+    * Retrieve a naming context for looking up references to session beans executing in
+    * the embeddable container.
+    * 
+    * @return The naming context.
+    */
+   public Context getContext()
+   {
+      throw new UnsupportedOperationException(this + " does not support a naming context");
+   }
+}

Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/spi/EJBContainerProvider.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/spi/EJBContainerProvider.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/spi/EJBContainerProvider.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -23,8 +23,8 @@
 
 import java.util.Map;
 
-import javax.ejb.EJBContainer;
 import javax.ejb.EJBException;
+import javax.ejb.embeddable.EJBContainer;
 
 /**
  * The EJBContainerProvider SPI is used by the embeddable container bootstrap class to

Modified: projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainer.java
===================================================================
--- projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainer.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainer.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -23,7 +23,7 @@
 
 import java.util.Map;
 
-import javax.ejb.EJBContainer;
+import javax.ejb.embeddable.EJBContainer;
 
 /**
  * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>

Modified: projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainerProvider.java
===================================================================
--- projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainerProvider.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/JBossEJBContainerProvider.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -23,8 +23,8 @@
 
 import java.util.Map;
 
-import javax.ejb.EJBContainer;
 import javax.ejb.EJBException;
+import javax.ejb.embeddable.EJBContainer;
 import javax.ejb.spi.EJBContainerProvider;
 
 

Modified: projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/unit/EJBContainerTestCase.java
===================================================================
--- projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/unit/EJBContainerTestCase.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/embedded/unit/EJBContainerTestCase.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -21,11 +21,9 @@
  */
 package org.jboss.ejb3.api.test.embedded.unit;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
-import javax.ejb.EJBContainer;
+import javax.ejb.embeddable.EJBContainer;
 
 import org.junit.Test;
 
@@ -36,16 +34,6 @@
 public class EJBContainerTestCase
 {
    @Test
-   public void testCurrentEJBContainer()
-   {
-      EJBContainer container = EJBContainer.createEJBContainer();
-      assertNotNull(container);
-      assertEquals(container, EJBContainer.getCurrentEJBContainer());
-      container.close();
-      assertNull("CurrentEJBContainer should be null after close", EJBContainer.getCurrentEJBContainer());
-   }
-   
-   @Test
    public void testSimpleCreate()
    {
       EJBContainer container = EJBContainer.createEJBContainer();

Modified: projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java	2009-12-02 08:17:01 UTC (rev 97282)
+++ projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java	2009-12-02 11:37:57 UTC (rev 97283)
@@ -24,7 +24,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.lang.reflect.Field;
@@ -33,6 +32,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -106,6 +106,8 @@
    
    private static boolean equalSignature(Method m1, Method m2)
    {
+      // note that we're checking signatures, so the originating class loader is not a criteria
+      
       if(m1 == m2)
          return true;
       if(m1 == null || m2 == null)
@@ -125,18 +127,28 @@
       }
       Class<?> m1e[] = m1.getExceptionTypes();
       Class<?> m2e[] = m2.getExceptionTypes();
-      int j = 0;
+      int matched = 0;
       for(int i = 0; i < m1e.length; i++)
       {
-         if(i >= m2e.length || !m1e[i].getName().equals(m2e[i].getName()))
+         Comparator<Class<?>> c = new Comparator<Class<?>>()
          {
-            if(RuntimeException.class.isAssignableFrom(m1e[i]))
-               continue;
-            return false;
+            @Override
+            public int compare(Class<?> o1, Class<?> o2)
+            {
+               return o1.getName().compareTo(o2.getName());
+            }
+         };
+         int j = indexOf(m2e, m1e[i], c);
+         if(j == -1)
+         {
+            // So we can throw IllegalArgumentException whenever we want :-) (EJBContext.lookup)
+            if(!RuntimeException.class.isAssignableFrom(m1e[i]))
+               return false;
          }
-         j++;
+         else
+            matched++;
       }
-      if(j != m2e.length)
+      if(m2e.length != matched)
          return false;
       return true;
    }
@@ -174,6 +186,16 @@
       return null;
    }
    
+   private static <T> int indexOf(T[] a, T key, Comparator<? super T> c)
+   {
+      for(int i = 0; i < a.length; i++)
+      {
+         if(c.compare(a[i], key) == 0)
+            return i;
+      }
+      return -1;
+   }
+   
    @Test
    public void testSignatures() throws Exception
    {
@@ -214,10 +236,4 @@
          }
       }
    }
-   
-   @Test
-   public void testFail()
-   {
-      fail("test");
-   }
 }




More information about the jboss-cvs-commits mailing list