geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r831498 - in /geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment: EjbDeploymentBuilder.java EjbModuleBuilder.java
Date Sat, 31 Oct 2009 00:59:25 GMT
Author: djencks
Date: Sat Oct 31 00:59:24 2009
New Revision: 831498

URL: http://svn.apache.org/viewvc?rev=831498&view=rev
Log:
GERONIMO-4918 Add dependencies from ejb gbeans to resource gbeans in the same ear to make
sure jndi context can be constructed when app starts

Modified:
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?rev=831498&r1=831497&r2=831498&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
Sat Oct 31 00:59:24 2009
@@ -28,6 +28,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
 
 import org.apache.geronimo.common.DeploymentException;
@@ -38,6 +39,7 @@
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -45,9 +47,9 @@
 import org.apache.geronimo.openejb.EntityDeploymentGBean;
 import org.apache.geronimo.openejb.MessageDrivenDeploymentGBean;
 import org.apache.geronimo.openejb.OpenEjbSystem;
+import org.apache.geronimo.openejb.SingletonDeploymentGBean;
 import org.apache.geronimo.openejb.StatefulDeploymentGBean;
 import org.apache.geronimo.openejb.StatelessDeploymentGBean;
-import org.apache.geronimo.openejb.SingletonDeploymentGBean;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
 import org.apache.geronimo.security.deployment.SecurityConfiguration;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
@@ -173,10 +175,22 @@
         }
     }
 
+    private static Set<AbstractName> getResourceDependencies(EARContext earContext)
{
+        AbstractNameQuery cfNameQuery = new AbstractNameQuery(earContext.getConfigID(), Collections.singletonMap(NameFactory.J2EE_TYPE,
NameFactory.JCA_MANAGED_CONNECTION_FACTORY));
+        AbstractNameQuery aoNameQuery = new AbstractNameQuery(earContext.getConfigID(), Collections.singletonMap(NameFactory.J2EE_TYPE,
NameFactory.JCA_ADMIN_OBJECT));
+        AbstractNameQuery raNameQuery = new AbstractNameQuery(earContext.getConfigID(), Collections.singletonMap(NameFactory.J2EE_TYPE,
NameFactory.JCA_RESOURCE_ADAPTER));
+        Set<AbstractName> dependencies = new HashSet<AbstractName>();
+        dependencies.addAll(earContext.findGBeans(cfNameQuery));
+        dependencies.addAll(earContext.findGBeans(aoNameQuery));
+        dependencies.addAll(earContext.findGBeans(raNameQuery));
+        return dependencies;
+    }
 
     public void addEjbModuleDependency(GBeanData ejbModule) {
+        Set<AbstractName> resourceDependencies = getResourceDependencies(earContext);
         for (GBeanData gbean : gbeans.values()) {
             ejbModule.addDependency(gbean.getAbstractName());
+            gbean.addDependencies(resourceDependencies);
         }
     }
 

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=831498&r1=831497&r2=831498&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Sat Oct 31 00:59:24 2009
@@ -866,6 +866,8 @@
 
             // add a dependency from the module to the ra so we can be assured the mdb
             // container exists when this app is started
+            //TODO we are now useing a sledgehammer in EjbDeploymentBuilder and adding any
possibly relevant
+            // dependency to every ejb gbean.
             ejbModuleGBeanData.addDependency(resourceAdapterAbstractName);
         }
         //check that all the mdbs have resource adapters identified.



Mime
View raw message