geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r948268 - in /geronimo/server/trunk/plugins: j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ j2ee/j2ee-server/src/main/history/ jetty8/jetty8-deployer/src/main/plan/ openejb/geronimo-openejb-builder/src/main/ja...
Date Wed, 26 May 2010 00:19:32 GMT
Author: djencks
Date: Wed May 26 00:19:32 2010
New Revision: 948268

URL: http://svn.apache.org/viewvc?rev=948268&view=rev
Log:
GERONIMO-5177 introduce sub-modules to allow deploying ejbs, rars, etc as parts of wars, ejbs,
clients, etc.  First draft

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ApplicationInfo.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
Wed May 26 00:19:32 2010
@@ -52,7 +52,7 @@ public class AppClientModule extends Mod
                            Collection<ConnectorModule> resourceModules, 
                            AnnotatedApplicationClient annotatedAppClient ) {
         super(standAlone, moduleName, name, clientEnvironment, moduleFile, targetPath, 
-              specDD, vendorDD, originalSpecDD, null, annotatedAppClient );
+              specDD, vendorDD, originalSpecDD, null, annotatedAppClient, null, null );
         this.serverEnvironment = serverEnvironment;
         this.appClientName = appClientName;
         this.mainClassName = mainClassName;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ApplicationInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ApplicationInfo.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ApplicationInfo.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ApplicationInfo.java
Wed May 26 00:19:32 2010
@@ -33,8 +33,6 @@ import org.apache.xmlbeans.XmlObject;
 public class ApplicationInfo extends Module<XmlObject, XmlObject> {
     
     private ConfigurationModuleType type;
-    private LinkedHashSet<Module> modules;
-    private ModuleList moduleLocations;
 
     public ApplicationInfo(ConfigurationModuleType type,
                            Environment environment,
@@ -43,39 +41,21 @@ public class ApplicationInfo extends Mod
                            JarFile earFile,
                            XmlObject specDD,
                            XmlObject vendorDD,
-                           LinkedHashSet<Module> modules,
+                           LinkedHashSet<Module<?,?>> modules,
                            ModuleList moduleLocations,
                            String originalSpecDD,
                            AnnotatedApp annotatedApp) {
-        super(true, baseName, name, environment, earFile, "", specDD, vendorDD, originalSpecDD,
null, annotatedApp);
+        super(true, baseName, name, environment, earFile, "", specDD, vendorDD, originalSpecDD,
null, annotatedApp, moduleLocations, modules);
         assert type != null;
         assert environment != null;
         assert modules != null;
         assert moduleLocations != null;
 
         this.type = type;
-        this.modules = modules;
-        this.moduleLocations = moduleLocations;
     }
 
     public ConfigurationModuleType getType() {
         return type;
     }
 
-    public LinkedHashSet<Module> getModules() {
-        return modules;
-    }
-
-    public void setModules(LinkedHashSet<Module> modules) {
-        this.modules = modules;
-    }
-
-    public ModuleList getModuleLocations() {
-        return moduleLocations;
-    }
-
-    public void setModuleLocations(ModuleList moduleLocations) {
-        this.moduleLocations = moduleLocations;
-    }
-
 }
\ No newline at end of file

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
Wed May 26 00:19:32 2010
@@ -39,7 +39,7 @@ public class ConnectorModule<T, U> exten
                            String originalSpecDD, 
                            AnnotatedApp annotatedApp) {
         super(standAlone, moduleName, name, environment, moduleFile, 
-              targetPath, specDD, vendorDD, originalSpecDD, null, annotatedApp );
+              targetPath, specDD, vendorDD, originalSpecDD, null, annotatedApp, null, null
);
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Wed May 26 00:19:32 2010
@@ -356,7 +356,7 @@ public class EARConfigBuilder implements
                 jarFile,
                 null,
                 null,
-                new LinkedHashSet<Module>(Collections.singleton(module)),
+                new LinkedHashSet<Module<?,?>>(Collections.<Module<?,?>>singleton(module)),
                 new ModuleList(),
                 null,
                 null);
@@ -426,7 +426,7 @@ public class EARConfigBuilder implements
         // todo change module so you can extract the real module path back out.. then we
can eliminate
         // the moduleLocations and have addModules return the modules
         ModuleList moduleLocations = new ModuleList();
-        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
+        LinkedHashSet<Module<?,?>> modules = new LinkedHashSet<Module<?,?>>();
         try {
             addModules(earFile, application, gerApplication, moduleLocations, modules, environment,
earName, idBuilder);
             if (application == null) {
@@ -474,7 +474,7 @@ public class EARConfigBuilder implements
                 annotatedApp);
     }
 
-    private ApplicationType createDefaultSpecPlan(Set<Module> modules) {
+    private ApplicationType createDefaultSpecPlan(Set<Module<?,?>> modules) {
         ApplicationType application = ApplicationType.Factory.newInstance();
         for (Module module : modules) {
             ConfigurationModuleType configurationModuleType = module.getType();
@@ -833,7 +833,7 @@ public class EARConfigBuilder implements
         return filter;
     }
 
-    private void addModules(JarFile earFile, ApplicationType application, GerApplicationType
gerApplication, ModuleList moduleLocations, LinkedHashSet<Module> modules, Environment
environment, AbstractName earName, ModuleIDBuilder idBuilder) throws DeploymentException {
+    private void addModules(JarFile earFile, ApplicationType application, GerApplicationType
gerApplication, ModuleList moduleLocations, LinkedHashSet<Module<?,?>> modules,
Environment environment, AbstractName earName, ModuleIDBuilder idBuilder) throws DeploymentException
{
         Map<String, Object> altVendorDDs = new HashMap<String, Object>();
         try {
             mapVendorPlans(gerApplication, altVendorDDs, earFile);

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
Wed May 26 00:19:32 2010
@@ -41,7 +41,7 @@ public class EJBModule extends Module<Xm
                      String originalSpecDD, 
                      AnnotatedApp annotatedApp) {
         super(standAlone, moduleName, name, environment, moduleFile, 
-              targetPath, specDD, vendorDD, originalSpecDD, null, annotatedApp);
+              targetPath, specDD, vendorDD, originalSpecDD, null, annotatedApp, null, null);
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Wed May 26 00:19:32 2010
@@ -18,12 +18,14 @@ package org.apache.geronimo.j2ee.deploym
 
 import java.net.URI;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.Deployable;
 import org.apache.geronimo.deployment.DeployableJarFile;
+import org.apache.geronimo.deployment.ModuleList;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -56,20 +58,30 @@ public abstract class Module<T, U> {
     private ClassFinder classFinder;
 
     protected final Map sharedContext = new HashMap();
+    protected LinkedHashSet<Module<?,?>> modules = new LinkedHashSet<Module<?,?>>();
+    protected ModuleList moduleLocations = new ModuleList();
 
-    protected Module(boolean standAlone, 
-                     AbstractName moduleName, 
-                     String name, 
-                     Environment environment, 
-                     JarFile moduleFile, 
-                     String targetPath, 
-                     T specDD, 
-                     U vendorDD, 
-                     String originalSpecDD, 
-                     String namespace, 
-                     AnnotatedApp annotatedApp) {
+    protected Module(boolean standAlone,
+                     AbstractName moduleName,
+                     String name,
+                     Environment environment,
+                     JarFile moduleFile,
+                     String targetPath,
+                     T specDD,
+                     U vendorDD,
+                     String originalSpecDD,
+                     String namespace,
+                     AnnotatedApp annotatedApp,
+                     ModuleList moduleLocations,
+                     LinkedHashSet<Module<?,?>> modules) {
         this(standAlone, moduleName, name, environment, new DeployableJarFile(moduleFile),

              targetPath, specDD, vendorDD, originalSpecDD, namespace, annotatedApp);
+        if (moduleLocations != null) {
+            this.moduleLocations = moduleLocations;
+        }
+        if (modules != null) {
+            this.modules = modules;
+        }
     }
 
     protected Module(boolean standAlone, 
@@ -269,4 +281,19 @@ public abstract class Module<T, U> {
         }
     }
 
+    public LinkedHashSet<Module<?,?>> getModules() {
+        return modules;
+    }
+
+    public void setModules(LinkedHashSet<Module<?,?>> modules) {
+        this.modules = modules;
+    }
+
+    public ModuleList getModuleLocations() {
+        return moduleLocations;
+    }
+
+    public void setModuleLocations(ModuleList moduleLocations) {
+        this.moduleLocations = moduleLocations;
+    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml Wed May
26 00:19:32 2010
@@ -27,8 +27,33 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-osgi-registry</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         <type>jar</type>
     </dependency>
+    <dependency>
+        <groupId>org.apache.servicemix.bundles</groupId>
+        <artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-bundleutils</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-finder</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-reflect</artifactId>
+        <type>jar</type>
+    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml Wed May 26
00:19:32 2010
@@ -123,6 +123,9 @@ wsdl=text/xml
             <pattern>
                 <name>OpenWebBeansModuleBuilderExtension</name>
             </pattern>
+            <pattern>
+                <name>EJBBuilder</name>
+            </pattern>
         </references>
         <reference name="ResourceEnvironmentSetter">
             <name>ResourceRefBuilder</name>

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=948268&r1=948267&r2=948268&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
Wed May 26 00:19:32 2010
@@ -55,11 +55,15 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.jndi.JndiKey;
@@ -133,11 +137,15 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Master builder for processing EJB JAR deployments and creating the
- * correspinding runtime objects (GBeans, etc.).
+ * corresponding runtime objects (GBeans, etc.).
+ *
+ * Acts as either a ModuleBuilder (for standalone ejb jars or ejb jars in an ear) or as a
ModuleBuilderExtension
+ * for ejbs embedded in a web app.
  *
  * @version $Revision: 479481 $ $Date: 2006-11-26 16:52:20 -0800 (Sun, 26 Nov 2006) $
  */
-public class EjbModuleBuilder implements ModuleBuilder, GBeanLifecycle {
+@GBean(j2eeType = NameFactory.MODULE_BUILDER)
+public class EjbModuleBuilder implements ModuleBuilder, GBeanLifecycle, ModuleBuilderExtension
{
     private static final Logger log = LoggerFactory.getLogger(EjbModuleBuilder.class);
 
     private static final String OPENEJBJAR_NAMESPACE = XmlUtil.OPENEJBJAR_QNAME.getNamespaceURI();
@@ -159,13 +167,13 @@ public class EjbModuleBuilder implements
     private final ResourceEnvironmentSetter resourceEnvironmentSetter;
     private final Collection<ModuleBuilderExtension> moduleBuilderExtensions;
 
-    public EjbModuleBuilder(Environment defaultEnvironment,
-                            String defaultCmpJTADataSource,
-                            String defaultCmpNonJTADataSource,
-                            Collection<ModuleBuilderExtension> moduleBuilderExtensions,
-                            Collection<NamespaceDrivenBuilder> serviceBuilders,
-                            NamingBuilder namingBuilders,
-                            ResourceEnvironmentSetter resourceEnvironmentSetter) {
+    public EjbModuleBuilder(@ParamAttribute(name = "defaultEnvironment")Environment defaultEnvironment,
+                            @ParamAttribute(name = "defaultCmpJTADataSource")String defaultCmpJTADataSource,
+                            @ParamAttribute(name = "defaultCmpNonJTADataSource")String defaultCmpNonJTADataSource,
+                            @ParamReference(name = "ModuleBuilderExtensions", namingType
= NameFactory.MODULE_BUILDER)Collection<ModuleBuilderExtension> moduleBuilderExtensions,
+                            @ParamReference(name = "ServiceBuilders", namingType = NameFactory.MODULE_BUILDER)Collection<NamespaceDrivenBuilder>
serviceBuilders,
+                            @ParamReference(name = "NamingBuilders", namingType = NameFactory.MODULE_BUILDER)NamingBuilder
namingBuilders,
+                            @ParamReference(name = "ResourceEnvironmentSetter", namingType
= NameFactory.MODULE_BUILDER)ResourceEnvironmentSetter resourceEnvironmentSetter) {
         this.defaultEnvironment = defaultEnvironment;
         this.defaultCmpJTADataSource = defaultCmpJTADataSource;
         this.defaultCmpNonJTADataSource = defaultCmpNonJTADataSource;
@@ -192,14 +200,17 @@ public class EjbModuleBuilder implements
         System.setProperty("openejb.naming", "xbean");
     }
 
+    @Override
     public void doStart() throws Exception {
         XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
     }
 
+    @Override
     public void doStop() {
         XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
     }
 
+    @Override
     public void doFail() {
         doStop();
     }
@@ -217,18 +228,51 @@ public class EjbModuleBuilder implements
         return EjbModuleBuilder.OPENEJBJAR_NAMESPACE;
     }
 
+    @Override
     public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws
DeploymentException {
         return null;
     }
     
+    @Override
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, "ejb.jar", null, null, null, naming, idBuilder);
     }
 
+    @Override
     public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName,
naming, idBuilder);
     }
 
+    //ModuleBuilderExtension entry points
+    @Override
+    public void createModule(Module module, Bundle bundle, Naming naming, ModuleIDBuilder
moduleIDBuilder) throws DeploymentException {
+        //May be implemented for EBA support ?
+    }
+
+    @Override
+    public void createModule(Module module,
+                             Object plan,
+                             JarFile moduleFile,
+                             String targetPath,
+                             URL specDDUrl,
+                             Environment environment,
+                             Object moduleContextInfo,
+                             AbstractName earName,
+                             Naming naming,
+                             ModuleIDBuilder idBuilder) throws DeploymentException {
+        //check for web module
+        if (module instanceof WebModule) {
+            //check for WEB-INF/ejb-jar.xml
+            Module ejbModule = createModule(null, moduleFile, targetPath, null, environment,
earName, naming, idBuilder);
+            if (ejbModule != null) {
+                module.getModules().add(ejbModule);
+                //???
+                module.getModuleLocations().add(targetPath);
+            }
+        }
+
+    }
+
     private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder)
throws DeploymentException {
         if (moduleFile == null) throw new NullPointerException("moduleFile is null");
         if (targetPath == null) throw new NullPointerException("targetPath is null");
@@ -427,9 +471,16 @@ public class EjbModuleBuilder implements
     }
 
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws
DeploymentException {
-        installModule(module, earContext);
-        EARContext moduleContext;
+    @Override
+    public void installModule(JarFile earFile,
+                              EARContext earContext,
+                              Module module,
+                              Collection configurationStores,
+                              ConfigurationStore targetConfigurationStore,
+                              Collection repository) throws DeploymentException {
+        if (module instanceof EjbModule) {
+            installModule(module, earContext);
+            EARContext moduleContext;
 //        if (module.isStandAlone()) {
             moduleContext = earContext;
 //        } else {
@@ -454,17 +505,25 @@ public class EjbModuleBuilder implements
 //                throw e;
 //            }
 //        }
-        module.setEarContext(moduleContext);
-        module.setRootEarContext(earContext);
-        if (((EjbModule) module).getEjbJar().getAssemblyDescriptor() != null) {
-            namingBuilder.buildEnvironment(null, null, module.getEnvironment());
-        }
-        for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
-            try {
-                builder.installModule(earFile, earContext, module, configurationStores, targetConfigurationStore,
repository);
-            } catch (Throwable t) {
-                String builderName = builder.getClass().getSimpleName();
-                log.error(builderName + ".installModule() failed: " + t.getMessage(), t);
+            module.setEarContext(moduleContext);
+            module.setRootEarContext(earContext);
+            if (((EjbModule) module).getEjbJar().getAssemblyDescriptor() != null) {
+                namingBuilder.buildEnvironment(null, null, module.getEnvironment());
+            }
+            for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
+                try {
+                    builder.installModule(earFile, earContext, module, configurationStores,
targetConfigurationStore, repository);
+                } catch (Throwable t) {
+                    String builderName = builder.getClass().getSimpleName();
+                    log.error(builderName + ".installModule() failed: " + t.getMessage(),
t);
+                }
+            }
+        } else {
+            LinkedHashSet<Module<?,?>> modules = module.getModules();
+            for (Module<?,?> subModule: modules) {
+                if (subModule instanceof EjbModule)  {
+                    installModule(earFile, earContext, subModule, configurationStores, targetConfigurationStore,
repository);
+                }
             }
         }
     }
@@ -503,61 +562,71 @@ public class EjbModuleBuilder implements
         return true;
     }
 
+    @Override
     public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException
{
-        EjbModule ejbModule = (EjbModule) module;
+        if (module instanceof EjbModule) {
+            EjbModule ejbModule = (EjbModule) module;
 
-        EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, bundle);
+            EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, bundle);
 
-        ejbModule.setEjbJarInfo(ejbJarInfo);
+            ejbModule.setEjbJarInfo(ejbJarInfo);
 
-        // update the original spec dd with the metadata complete dd
-        EjbJar ejbJar = ejbModule.getEjbJar();
-        ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
+            // update the original spec dd with the metadata complete dd
+            EjbJar ejbJar = ejbModule.getEjbJar();
+            ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
 
-        // Get the geronimo-openejb plan
-        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
+            // Get the geronimo-openejb plan
+            GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
 
-        // We must set all mapped name references back to null or Geronimo will blow up
+            // We must set all mapped name references back to null or Geronimo will blow
up
 //        unmapReferences(ejbJar, geronimoEjbJarType);
 
-        // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled
based on xmlbeans objects
-        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
-        ejbModule.setSpecDD(ejbJarType);
-
-        // convert the plan to xmlbeans since geronimo naming is coupled on xmlbeans objects
-        OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.convertToXmlbeans(geronimoEjbJarType);
-        ejbModule.setVendorDD(geronimoOpenejb);
-
-        // todo move namingBuilders.buildEnvironment() here when geronimo naming supports
it
-
-        // initialize the naming builders
-        if (ejbJarType.getAssemblyDescriptor() != null) {
-            namingBuilder.initContext(ejbJarType.getAssemblyDescriptor(),
-                    geronimoOpenejb,
-                    ejbModule);
-        }
-
-        EjbDeploymentBuilder ejbDeploymentBuilder = new EjbDeploymentBuilder(earContext,
ejbModule, namingBuilder, resourceEnvironmentSetter);
-        ejbModule.setEjbBuilder(ejbDeploymentBuilder);
-        ejbDeploymentBuilder.initContext();
-
-        // Add extra gbean declared in the geronimo-openejb.xml file
-        serviceBuilders.build(geronimoOpenejb, earContext, ejbModule.getEarContext());
-
-        ClassPathList manifestcp = new ClassPathList();
-        manifestcp.add(module.getTargetPath());
-        EARContext moduleContext = module.getEarContext();
-        ModuleList moduleLocations = EARContext.MODULE_LIST_KEY.get(module.getRootEarContext().getGeneralData());
-        URI baseUri = URI.create(module.getTargetPath());
-        moduleContext.getCompleteManifestClassPath(module.getDeployable(), baseUri, URI.create("."),
manifestcp, moduleLocations);
-        moduleContext.getGeneralData().put(EARContext.CLASS_PATH_LIST_KEY, manifestcp);
+            // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is
coupled based on xmlbeans objects
+            EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
+            ejbModule.setSpecDD(ejbJarType);
+
+            // convert the plan to xmlbeans since geronimo naming is coupled on xmlbeans
objects
+            OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.convertToXmlbeans(geronimoEjbJarType);
+            ejbModule.setVendorDD(geronimoOpenejb);
+
+            // todo move namingBuilders.buildEnvironment() here when geronimo naming supports
it
+
+            // initialize the naming builders
+            if (ejbJarType.getAssemblyDescriptor() != null) {
+                namingBuilder.initContext(ejbJarType.getAssemblyDescriptor(),
+                        geronimoOpenejb,
+                        ejbModule);
+            }
+
+            EjbDeploymentBuilder ejbDeploymentBuilder = new EjbDeploymentBuilder(earContext,
ejbModule, namingBuilder, resourceEnvironmentSetter);
+            ejbModule.setEjbBuilder(ejbDeploymentBuilder);
+            ejbDeploymentBuilder.initContext();
+
+            // Add extra gbean declared in the geronimo-openejb.xml file
+            serviceBuilders.build(geronimoOpenejb, earContext, ejbModule.getEarContext());
+
+            ClassPathList manifestcp = new ClassPathList();
+            manifestcp.add(module.getTargetPath());
+            EARContext moduleContext = module.getEarContext();
+            ModuleList moduleLocations = EARContext.MODULE_LIST_KEY.get(module.getRootEarContext().getGeneralData());
+            URI baseUri = URI.create(module.getTargetPath());
+            moduleContext.getCompleteManifestClassPath(module.getDeployable(), baseUri, URI.create("."),
manifestcp, moduleLocations);
+            moduleContext.getGeneralData().put(EARContext.CLASS_PATH_LIST_KEY, manifestcp);
 
-        for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
-            try {
-                builder.initContext(earContext, module, bundle);
-            } catch (Throwable t) {
-                String builderName = builder.getClass().getSimpleName();
-                log.error(builderName + ".initContext() failed: " + t.getMessage(), t);
+            for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
+                try {
+                    builder.initContext(earContext, module, bundle);
+                } catch (Throwable t) {
+                    String builderName = builder.getClass().getSimpleName();
+                    log.error(builderName + ".initContext() failed: " + t.getMessage(), t);
+                }
+            }
+        } else {
+            LinkedHashSet<Module<?,?>> modules = module.getModules();
+            for (Module<?,?> subModule: modules) {
+                if (subModule instanceof EjbModule)  {
+                    initContext(earContext, subModule, bundle);
+                }
             }
         }
     }
@@ -769,7 +838,21 @@ public class EjbModuleBuilder implements
      * Does the meaty work of processing the deployment information and
      * creating GBeans for all the EJBs in the JAR, etc.
      */
+    @Override
     public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection
repositories) throws DeploymentException {
+        if (module instanceof EjbModule) {
+            doAddGBeans(earContext, module, bundle, repositories);
+        } else {
+            LinkedHashSet<Module<?,?>> modules = module.getModules();
+            for (Module<?,?> subModule: modules) {
+                if (subModule instanceof EjbModule)  {
+                    doAddGBeans(earContext, subModule, bundle, repositories);
+                }
+            }
+        }
+    }
+    
+    public void doAddGBeans(EARContext earContext, Module module, Bundle bundle, Collection
repositories) throws DeploymentException {
         EjbModule ejbModule = (EjbModule) module;
         EjbDeploymentBuilder ejbDeploymentBuilder = ejbModule.getEjbBuilder();
 
@@ -992,31 +1075,4 @@ public class EjbModuleBuilder implements
     }
 
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbModuleBuilder.class,
NameFactory.MODULE_BUILDER);
-        infoBuilder.addAttribute("defaultEnvironment", Environment.class, true);
-        infoBuilder.addAttribute("defaultCmpJTADataSource", String.class, true);
-        infoBuilder.addAttribute("defaultCmpNonJTADataSource", String.class, true);
-        infoBuilder.addReference("ModuleBuilderExtensions", ModuleBuilderExtension.class,
NameFactory.MODULE_BUILDER);
-        infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
-        infoBuilder.addReference("NamingBuilders", NamingBuilder.class, NameFactory.MODULE_BUILDER);
-        infoBuilder.addReference("ResourceEnvironmentSetter", ResourceEnvironmentSetter.class,
NameFactory.MODULE_BUILDER);
-
-        infoBuilder.setConstructor(new String[]{
-                "defaultEnvironment",
-                "defaultCmpJTADataSource",
-                "defaultCmpNonJTADataSource",
-                "ModuleBuilderExtensions",
-                "ServiceBuilders",
-                "NamingBuilders",
-                "ResourceEnvironmentSetter"});
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml?rev=948268&r1=948267&r2=948268&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml Wed May 26
00:19:32 2010
@@ -66,6 +66,9 @@
             <pattern>
                 <name>OpenWebBeansModuleBuilderExtension</name>
             </pattern>
+            <pattern>
+                <name>EJBBuilder</name>
+            </pattern>
         </references>
         <reference name="ResourceEnvironmentSetter">
             <name>ResourceRefBuilder</name>



Mime
View raw message