geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r699102 - in /geronimo/server/trunk/plugins/openejb: geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java
Date Thu, 25 Sep 2008 21:35:19 GMT
Author: dblevins
Date: Thu Sep 25 14:35:18 2008
New Revision: 699102

URL: http://svn.apache.org/viewvc?rev=699102&view=rev
Log:
Tweaked the EjbModuleBuilder so that it can create something similar to the actual container
info that will be used with a running configuration despite not having all the data.

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=699102&r1=699101&r2=699102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Thu Sep 25 14:35:18 2008
@@ -99,6 +99,11 @@
 import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
 import org.apache.openejb.assembler.classic.StatefulBeanInfo;
 import org.apache.openejb.assembler.classic.PersistenceContextReferenceInfo;
+import org.apache.openejb.assembler.classic.StatelessSessionContainerInfo;
+import org.apache.openejb.assembler.classic.StatefulSessionContainerInfo;
+import org.apache.openejb.assembler.classic.SingletonSessionContainerInfo;
+import org.apache.openejb.assembler.classic.BmpEntityContainerInfo;
+import org.apache.openejb.assembler.classic.CmpEntityContainerInfo;
 import org.apache.openejb.util.UniqueDefaultLinkResolver;
 import org.apache.openejb.config.AppModule;
 import org.apache.openejb.config.ConfigurationFactory;
@@ -651,15 +656,16 @@
     private void addContainerInfos(Configuration configuration, ContainerSystemInfo containerSystem,
ConfigurationFactory configurationFactory) throws OpenEJBException {
         LinkedHashSet<GBeanData> containerDatas = configuration.findGBeanDatas(Collections.singleton(new
AbstractNameQuery(EjbContainer.class.getName())));
         for (GBeanData containerData : containerDatas) {
-            Class<? extends ContainerInfo> infoClass = (Class<? extends ContainerInfo>)
containerData.getAttribute("infoType");
-            if (infoClass == null) {
-                String type = (String) containerData.getAttribute("type");
-                infoClass = EjbContainer.getInfoType(type);
-            }
-            String serviceId = (String) containerData.getAttribute("id");
-            Properties declaredProperties = (Properties) containerData.getAttribute("properties");
-            String providerId = (String) containerData.getAttribute("provider");
-            ContainerInfo containerInfo = configurationFactory.configureService(infoClass,
serviceId, declaredProperties, providerId, "Container");
+
+            String id = EjbContainer.getId(containerData.getAbstractName());
+
+            Class<? extends ContainerInfo> infoClass = EjbContainer.getInfoType(containerData.getGBeanInfo().getClassName());
+
+            Properties declaredProperties = new Properties();
+
+            String providerId = null;
+
+            ContainerInfo containerInfo = configurationFactory.configureService(infoClass,
id, declaredProperties, providerId, "Container");
             containerSystem.containers.add(containerInfo);
         }
     }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java?rev=699102&r1=699101&r2=699102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbContainer.java
Thu Sep 25 14:35:18 2008
@@ -24,6 +24,7 @@
 import org.apache.openejb.assembler.classic.BmpEntityContainerInfo;
 import org.apache.openejb.assembler.classic.CmpEntityContainerInfo;
 import org.apache.openejb.assembler.classic.MdbContainerInfo;
+import org.apache.openejb.assembler.classic.SingletonSessionContainerInfo;
 
 import java.util.Properties;
 
@@ -39,7 +40,7 @@
     private final Class<? extends ContainerInfo> infoType;
 
     public EjbContainer(AbstractName abstractName, Class<? extends ContainerInfo> infoType,
OpenEjbSystem openEjbSystem, String provider, String type, Properties properties) {
-        this.id = (String) abstractName.getName().get("name");
+        this.id = getId(abstractName);
         this.infoType = infoType;
         this.openEjbSystem = openEjbSystem;
         this.provider = provider;
@@ -49,6 +50,10 @@
         }
     }
 
+    public static String getId(AbstractName abstractName) {
+        return (String) abstractName.getName().get("name");
+    }
+
     protected Object set(String key, String value) {
         return properties.setProperty(key, value);
     }
@@ -94,7 +99,15 @@
         if ("CMP_ENTITY".equalsIgnoreCase(type)) return CmpEntityContainerInfo.class;
         if ("CMP2_ENTITY".equalsIgnoreCase(type)) return CmpEntityContainerInfo.class;
         if ("MESSAGE".equalsIgnoreCase(type)) return MdbContainerInfo.class;
+
+        String className = type; // EjbModuleBuilder will pass in the className of the gbean
+        if (className.endsWith("StatelessContainerGBean")) return StatelessSessionContainerInfo.class;
+        if (className.endsWith("StatefulContainerGBean")) return StatefulSessionContainerInfo.class;
+        if (className.endsWith("SingletonContainerGBean")) return SingletonSessionContainerInfo.class;
+        if (className.endsWith("BmpContainerGBean")) return BmpEntityContainerInfo.class;
+        if (className.endsWith("CmpContainerGBean")) return CmpEntityContainerInfo.class;
+
         else return ContainerInfo.class;
     }
-    
+
 }



Mime
View raw message