geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r984117 - /geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java
Date Tue, 10 Aug 2010 16:57:45 GMT
Author: djencks
Date: Tue Aug 10 16:57:44 2010
New Revision: 984117

URL: http://svn.apache.org/viewvc?rev=984117&view=rev
Log:
GERONIMO-5514 EJBContainer.Provider is supposed to be the EJBContainer subclass name, not
the EJBContainerProvider subclass name

Modified:
    geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java

Modified: geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java?rev=984117&r1=984116&r2=984117&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java
(original)
+++ geronimo/specs/trunk/geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/EJBContainer.java
Tue Aug 10 16:57:44 2010
@@ -21,15 +21,11 @@
 //
 package javax.ejb.embeddable;
 
-import javax.ejb.EJBException;
-import javax.ejb.spi.EJBContainerProvider;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
 import java.util.Collections;
-import java.util.Enumeration;
+import java.util.List;
 
+import javax.ejb.EJBException;
+import javax.ejb.spi.EJBContainerProvider;
 import org.apache.geronimo.osgi.locator.ProviderLocator;
 
 public abstract class EJBContainer {
@@ -52,40 +48,19 @@ public abstract class EJBContainer {
             properties = Collections.EMPTY_MAP;
         }
 
-        Object o = properties.get(PROVIDER);
-
-        if (o instanceof String) {
-            String providerName = (String) o;
-
-            Class providerClass;
-
-            try {
-                providerClass = ProviderLocator.loadClass(providerName);
-            } catch (Exception e) {
-                throw new EJBException("Invalid or inaccessible provider class: " + providerName,
e);
-            }
-
-            try {
-                EJBContainerProvider provider = (EJBContainerProvider) providerClass.newInstance();
-                return provider.createEJBContainer(properties);
-            } catch (Exception e) {
-                throw new EJBException("Provider error. Provider: " + providerName, e);
-            }
-        } else {
-            // do the services search processing.
-            try {
-                ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                // go check the loader files.
-                EJBContainerProvider provider = (EJBContainerProvider)ProviderLocator.getService(EJBContainerProvider.class.getName(),
EJBContainer.class, loader);
-                if (provider != null) {
-                    return provider.createEJBContainer(properties);
-                }
-                else {
-                    throw new EJBException("Provider error. No provider definition found");
+        try {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            // go check the loader files.
+            List<Object> providers = ProviderLocator.getServices(EJBContainerProvider.class.getName(),
EJBContainer.class, loader);
+            for (Object o : providers) {
+                EJBContainer container = ((EJBContainerProvider) o).createEJBContainer(properties);
+                if (container != null) {
+                    return container;
                 }
-            } catch (Exception e) {
-                throw new EJBException("Provider error. No provider found", e);
             }
+            throw new EJBException("Provider error. No provider definition found");
+        } catch (Exception e) {
+            throw new EJBException("Provider error. No provider found", e);
         }
     }
 



Mime
View raw message