geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r329128 - in /geronimo/trunk/modules: jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/ web-builder/src/java/org/apache/geronimo/web/deployment/
Date Fri, 28 Oct 2005 06:34:49 GMT
Author: djencks
Date: Thu Oct 27 23:34:18 2005
New Revision: 329128

URL: http://svn.apache.org/viewcvs?rev=329128&view=rev
Log:
GERONIMO-513, different implementation.  Make web apps depend on all managed connection factories
in app and all ejbs in app

Added:
    geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
Modified:
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=329128&r1=329127&r2=329128&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Thu Oct 27 23:34:18 2005
@@ -56,7 +56,6 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.xbeans.ClassFilterType;
 import org.apache.geronimo.deployment.xbeans.DependencyType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
@@ -90,6 +89,7 @@
 import org.apache.geronimo.security.util.URLPattern;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
+import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
@@ -120,7 +120,6 @@
 import org.apache.geronimo.xbeans.j2ee.WebAppType;
 import org.apache.geronimo.xbeans.j2ee.WebResourceCollectionType;
 import org.apache.geronimo.xbeans.j2ee.WelcomeFileListType;
-import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.mortbay.http.BasicAuthenticator;
@@ -132,7 +131,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public class JettyModuleBuilder implements ModuleBuilder {
+public class JettyModuleBuilder extends AbstractWebModuleBuilder {
     private final static Log log = LogFactory.getLog(JettyModuleBuilder.class);
     private final List defaultParentId;
     private final ObjectName jettyContainerObjectName;
@@ -404,14 +403,14 @@
         } catch (URISyntaxException e) {
             throw new DeploymentException("Could not construct URI for location of war entry",
e);
         }
-        
+
         if (jettyWebApp.isSetInverseClassloading()) {
             earContext.setInverseClassloading(jettyWebApp.getInverseClassloading());
         }
-        
+
         ClassFilterType[] filters = jettyWebApp.getHiddenClassesArray();
         ServiceConfigBuilder.addHiddenClasses(earContext, filters);
-        
+
         filters = jettyWebApp.getNonOverridableClassesArray();
         ServiceConfigBuilder.addNonOverridableClasses(earContext, filters);
     }
@@ -472,6 +471,12 @@
                 hosts[i] = hosts[i].trim();
             }
             webModuleData.setAttribute("virtualHosts", hosts);
+
+            //Add dependencies on managed connection factories and ejbs in this app
+            //This is overkill, but allows for people not using java:comp context (even though
we don't support it)
+            //and sidesteps the problem of circular references between ejbs.
+            Set dependencies = findGBeanDependencies(earContext);
+            webModuleData.getDependencies().addAll(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
             webModuleData.setAttribute("userTransaction", userTransaction);

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=329128&r1=329127&r2=329128&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Thu Oct 27 23:34:18 2005
@@ -87,6 +87,7 @@
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
+import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.tomcat.TomcatWebAppType;
@@ -112,7 +113,7 @@
 /**
  * @version $Rev: 161588 $ $Date: 2005-04-16 12:06:59 -0600 (Sat, 16 Apr 2005) $
  */
-public class TomcatModuleBuilder implements ModuleBuilder {
+public class TomcatModuleBuilder extends AbstractWebModuleBuilder {
 
     private static final Log log = LogFactory.getLog(TomcatModuleBuilder.class);
 
@@ -358,10 +359,10 @@
         if (tomcatWebApp.isSetInverseClassloading()) {
             earContext.setInverseClassloading(tomcatWebApp.getInverseClassloading());
         }
-        
+
         ClassFilterType[] filters = tomcatWebApp.getHiddenClassesArray();
         ServiceConfigBuilder.addHiddenClasses(earContext, filters);
-        
+
         filters = tomcatWebApp.getNonOverridableClassesArray();
         ServiceConfigBuilder.addNonOverridableClasses(earContext, filters);
     }
@@ -417,9 +418,15 @@
             Set securityRoles = collectRoleNames(webApp);
             Map rolePermissions = new HashMap();
 
-            URI baseUri = URI.create(webModule.getTargetPath() + "/");       
+            URI baseUri = URI.create(webModule.getTargetPath() + "/");
             webModuleData.setAttribute("webAppRoot", baseUri);
             webModuleData.setAttribute("contextPath", webModule.getContextRoot());
+
+            //Add dependencies on managed connection factories and ejbs in this app
+            //This is overkill, but allows for people not using java:comp context (even though
we don't support it)
+            //and sidesteps the problem of circular references between ejbs.
+            Set dependencies = findGBeanDependencies(earContext);
+            webModuleData.getDependencies().addAll(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
             webModuleData.setAttribute("userTransaction", userTransaction);

Added: geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=329128&view=auto
==============================================================================
--- geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
(added)
+++ geronimo/trunk/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
Thu Oct 27 23:34:18 2005
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.web.deployment;
+
+import java.util.Set;
+import java.util.HashSet;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public abstract class AbstractWebModuleBuilder implements ModuleBuilder {
+    protected static final ObjectName MANAGED_CONNECTION_FACTORY_PATTERN;
+    protected static final ObjectName STATELESS_SESSION_BEAN_PATTERN;
+    protected static final ObjectName STATEFUL_SESSION_BEAN_PATTERN;
+    protected static final ObjectName ENTITY_BEAN_PATTERN;
+
+    static {
+        try {
+            MANAGED_CONNECTION_FACTORY_PATTERN = ObjectName.getInstance("*:j2eeType=" + NameFactory.JCA_MANAGED_CONNECTION_FACTORY
+  ",*");
+            STATELESS_SESSION_BEAN_PATTERN = ObjectName.getInstance("*:j2eeType=" + NameFactory.STATELESS_SESSION_BEAN
+  ",*");
+            STATEFUL_SESSION_BEAN_PATTERN = ObjectName.getInstance("*:j2eeType=" + NameFactory.STATEFUL_SESSION_BEAN
+  ",*");
+            ENTITY_BEAN_PATTERN = ObjectName.getInstance("*:j2eeType=" + NameFactory.ENTITY_BEAN
+  ",*");
+        } catch (MalformedObjectNameException e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    protected Set findGBeanDependencies(EARContext earContext) {
+        Set dependencies = new HashSet();
+        dependencies.addAll(earContext.listGBeans(MANAGED_CONNECTION_FACTORY_PATTERN));
+        dependencies.addAll(earContext.listGBeans(STATELESS_SESSION_BEAN_PATTERN));
+        dependencies.addAll(earContext.listGBeans(STATEFUL_SESSION_BEAN_PATTERN));
+        dependencies.addAll(earContext.listGBeans(ENTITY_BEAN_PATTERN));
+        return dependencies;
+    }
+}



Mime
View raw message