geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1166214 - in /geronimo/server/trunk: framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ plugins/j2ee/geronimo-web-2.5-bu...
Date Wed, 07 Sep 2011 15:10:17 GMT
Author: xuhaihong
Date: Wed Sep  7 15:10:16 2011
New Revision: 1166214

URL: http://svn.apache.org/viewvc?rev=1166214&view=rev
Log:
GERONIMO-6143 Create a fragment context for each sub modules in the EAR package

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Wed Sep  7 15:10:16 2011
@@ -31,7 +31,6 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -495,6 +494,14 @@ public class DeploymentContext {
         return configuration.getBundle();
     }
 
+    public ConfigurationModuleType getModuleType() {
+        return moduleType;
+    }
+
+    public Environment getEnvironment() {
+        return environment;
+    }
+
     protected BundleContext getBundleContext() {
         return bundleContext;
     }

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=1166214&r1=1166213&r2=1166214&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 Sep  7 15:10:16 2011
@@ -301,7 +301,7 @@ public abstract class Module<T, U> {
     }
 
     public void addAsChildConfiguration() throws DeploymentException {
-        if (rootEarContext != null && rootEarContext != earContext) {
+        if (rootEarContext != null && rootEarContext != earContext && !(earContext instanceof FragmentContext)) {
             ConfigurationData moduleConfigurationData = earContext.getConfigurationData();
             rootEarContext.addChildConfiguration(getTargetPath(), moduleConfigurationData);
         }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Wed Sep  7 15:10:16 2011
@@ -56,6 +56,7 @@ import org.apache.geronimo.components.ja
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -63,6 +64,7 @@ import org.apache.geronimo.gbean.GBeanDa
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.FragmentContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
@@ -77,12 +79,9 @@ import org.apache.geronimo.j2ee.jndi.Web
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.ImportType;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
@@ -92,9 +91,9 @@ import org.apache.geronimo.security.jasp
 import org.apache.geronimo.security.jaspi.ServerAuthModuleGBean;
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.geronimo.web.security.SpecSecurityBuilder;
-import org.apache.geronimo.web25.deployment.utils.WebAppXmlAttributeBuilder;
 import org.apache.geronimo.web25.deployment.merge.MergeHelper;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
+import org.apache.geronimo.web25.deployment.utils.WebAppXmlAttributeBuilder;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
 import org.apache.openejb.jee.Filter;
 import org.apache.openejb.jee.JaxbJavaee;
@@ -122,7 +121,7 @@ import org.xml.sax.SAXException;
  */
 public abstract class AbstractWebModuleBuilder implements ModuleBuilder {
     private static final Logger log = LoggerFactory.getLogger(AbstractWebModuleBuilder.class);
-    
+
     static {
         PropertyEditorManager.registerEditor(WebAppInfo.class, WebAppXmlAttributeBuilder.class);
     }
@@ -250,7 +249,7 @@ public abstract class AbstractWebModuleB
     }
 
     protected void addGBeanDependencies(EARContext earContext, GBeanData webModuleData) {
-        log.debug("Adding dependencies to web module: " + webModuleData.getAbstractName());
+        //log.debug("Adding dependencies to web module: " + webModuleData.getAbstractName());
 //        Configuration earConfiguration = earContext.getConfiguration();
 //        addDependencies(earContext.findGBeanDatas(earConfiguration, MANAGED_CONNECTION_FACTORY_PATTERN), webModuleData);
 //        addDependencies(earContext.findGBeanDatas(earConfiguration, ADMIN_OBJECT_PATTERN), webModuleData);
@@ -343,10 +342,10 @@ public abstract class AbstractWebModuleB
             throws DeploymentException {
         EARContext moduleContext;
         //TODO GERONIMO-4972 find a way to create working nested bundles.
-        if (true || module.isStandAlone()) {
+        if (module.isStandAlone()) {
             moduleContext = earContext;
         } else {
-            Environment environment = module.getEnvironment();
+            /*Environment environment = module.getEnvironment();
             Artifact earConfigId = earContext.getConfigID();
             Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
             environment.setConfigId(configId);
@@ -363,7 +362,10 @@ public abstract class AbstractWebModuleB
             } catch (DeploymentException e) {
                 cleanupConfigurationDir(configurationDir);
                 throw e;
-            }
+            }*/
+            //Merge the environment configurations to the parent EAR package, as now the same bundle is shared for all the modules.
+            EnvironmentBuilder.mergeEnvironments(earContext.getEnvironment(), module.getEnvironment());
+            moduleContext = new FragmentContext(earContext, ConfigurationModuleType.WAR);
         }
         module.setEarContext(moduleContext);
         module.setRootEarContext(earContext);
@@ -402,11 +404,11 @@ public abstract class AbstractWebModuleB
             // and the url class loader will not pick up a manifest from an unpacked dir
             //GERONIMO-4972 this can't be correct for one-bundle deployments.
             moduleContext.addManifestClassPath(warFile, RELATIVE_MODULE_BASE_URI, manifestcp);
-            
+
             for (String classpath : manifestcp) {
                 earContext.addToClassPath(module.resolve(classpath).toString());
             }
-            
+
         } catch (IOException e) {
             throw new DeploymentException("Problem deploying war", e);
         } finally {
@@ -455,19 +457,19 @@ public abstract class AbstractWebModuleB
         if (hasSecurityRealmName) {
             earContext.setHasSecurity(true);
         }
-        
+
       //Inform errors if login-config element contains more than one
         List<LoginConfig> loginConfigs = webApp.getLoginConfig();
         if (loginConfigs.size() > 1) {
             throw new DeploymentException("Web app " + webApp.getDisplayName() + " cannot have more than one login-config element.  Currently has " + loginConfigs.size() + " login-config elements.");
         }
-        
+
        //Inform errors if session-config element contains more than one
         List<SessionConfig> sessionConfigs = webApp.getSessionConfig();
         if (sessionConfigs.size() > 1) {
             throw new DeploymentException("Web app " + webApp.getDisplayName() + " cannot have more than one sesion-config element.  Currently has " + sessionConfigs.size() + " session-config elements.");
         }
-        
+
         //TODO think about how to provide a default security realm name
         XmlObject[] securityElements = XmlBeansUtil.selectSubstitutionGroupElements(SECURITY_QNAME, gerWebApp);
         if (securityElements.length > 0 && !hasSecurityRealmName) {
@@ -485,9 +487,9 @@ public abstract class AbstractWebModuleB
         } else {
             originalSpecDDVersion = identifySpecDDSchemaVersion(originalSpecDD);
         }
-        earContext.getGeneralData().put(INITIAL_WEB_XML_SCHEMA_VERSION, originalSpecDDVersion);
+        webModule.getEarContext().getGeneralData().put(INITIAL_WEB_XML_SCHEMA_VERSION, originalSpecDDVersion);
         //Process web fragments and annotations
-        if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.isMetadataComplete()) {
+        if (INITIAL_WEB_XML_SCHEMA_VERSION.get(webModule.getEarContext().getGeneralData()) >= 2.5f && !webApp.isMetadataComplete()) {
             MergeHelper.processWebFragmentsAndAnnotations(earContext, webModule, bundle, webApp);
         }
         MergeHelper.processServletContainerInitializer(earContext, webModule, bundle);
@@ -548,7 +550,7 @@ public abstract class AbstractWebModuleB
         }
         return schemaVersion;
     }
-    
+
     protected ComponentPermissions buildSpecSecurityConfig(EARContext earContext, WebApp webApp, Bundle bundle) {
         SpecSecurityBuilder builder = new SpecSecurityBuilder(new WebAppInfo());
         return builder.buildSpecSecurityConfig();
@@ -676,20 +678,20 @@ public abstract class AbstractWebModuleB
             throws DeploymentException {
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
-        
+
         String moduleName =  webModule.getName();
-        
+
         if (earContext.getSubModuleNames().contains(moduleName)){
             log.warn("Duplicated moduleName: '"+moduleName +"' is found ! deployer will rename it to: '"+moduleName +
                     "_duplicated' , please check your modules in application to make sure they don't share the same name");
             moduleName = moduleName +"_duplicated";
             earContext.getSubModuleNames().add(moduleName);
-        }   
-        
+        }
+
         earContext.getSubModuleNames().add(moduleName);
         webModule.getJndiContext().get(JndiScope.module).put("module/ModuleName", moduleName);
 
-        
+
         if (!webApp.isMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence of a
             // classFinder in the module will convey whether metadata-complete is set (or not)
@@ -730,7 +732,7 @@ public abstract class AbstractWebModuleB
         addGBeanDependencies(earContext, webModuleData);
         webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
         webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerName());
-        webModuleData.setAttribute("modulePath", webModule.isStandAlone() || webModule.getEarContext() != webModule.getRootEarContext() ? null : webModule.getTargetPath());
+        webModuleData.setAttribute("modulePath", webModule.isStandAlone() ? null : webModule.getTargetPath());
     }
 
     private static class InternWrapper implements XMLStreamReader {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java Wed Sep  7 15:10:16 2011
@@ -49,8 +49,8 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.util.CircularReferencesException;
 import org.apache.geronimo.j2ee.deployment.util.FragmentSortUtils;
-import org.apache.geronimo.j2ee.deployment.util.IllegalConfigurationException;
 import org.apache.geronimo.j2ee.deployment.util.FragmentSortUtils.Visitor;
+import org.apache.geronimo.j2ee.deployment.util.IllegalConfigurationException;
 import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.kernel.util.JoinUtils;
 import org.apache.geronimo.kernel.util.JoinUtils.NameCallback;
@@ -100,10 +100,10 @@ import org.apache.xbean.finder.BundleAnn
 import org.apache.xbean.finder.BundleAssignableClassFinder;
 import org.apache.xbean.osgi.bundle.util.BundleClassFinder;
 import org.apache.xbean.osgi.bundle.util.BundleResourceFinder;
+import org.apache.xbean.osgi.bundle.util.BundleResourceFinder.ResourceFinderCallback;
 import org.apache.xbean.osgi.bundle.util.ClassDiscoveryFilter;
 import org.apache.xbean.osgi.bundle.util.DiscoveryRange;
 import org.apache.xbean.osgi.bundle.util.ResourceDiscoveryFilter;
-import org.apache.xbean.osgi.bundle.util.BundleResourceFinder.ResourceFinderCallback;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.packageadmin.PackageAdmin;
@@ -174,14 +174,14 @@ public class MergeHelper {
         }
         // EXCLUDED_JAR_URLS is required for TLD scanning, ServletContainerInitializer scanning and ServletContextListeners.
         // So does it mean that we always need to scan web-fragment.xml whatever meta-complete is set with true or false.
-        Set<String> excludedURLs = AbstractWebModuleBuilder.EXCLUDED_JAR_URLS.get(earContext.getGeneralData());
+        Set<String> excludedURLs = AbstractWebModuleBuilder.EXCLUDED_JAR_URLS.get(module.getEarContext().getGeneralData());
         //Add left named web-fragment.xml file URLs to the EXCLUDED_JAR_URLS List
         for (WebFragmentEntry excludedFragment : unusedWebFragmentEntryMap.values()) {
             excludedURLs.add(excludedFragment.getJarURL());
         }
 
         WebFragmentEntry[] webFragmentEntries = orderedWebFragments.toArray(new WebFragmentEntry[orderedWebFragments.size()]);
-        saveOrderedLibAttribute(earContext, webFragmentEntries);
+        saveOrderedLibAttribute(earContext, module, webFragmentEntries);
         return webFragmentEntries;
     }
 
@@ -250,7 +250,7 @@ public class MergeHelper {
     public static void processServletContainerInitializer(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
         //ServletContainerInitializer
         ServiceReference reference = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
-        final Set<String> excludedJarNames = AbstractWebModuleBuilder.EXCLUDED_JAR_URLS.get(earContext.getGeneralData());
+        final Set<String> excludedJarNames = AbstractWebModuleBuilder.EXCLUDED_JAR_URLS.get(module.getEarContext().getGeneralData());
         final Set<String> servletContainerInitializers = new HashSet<String>();
         try {
             PackageAdmin packageAdmin = (PackageAdmin) bundle.getBundleContext().getService(reference);
@@ -326,7 +326,7 @@ public class MergeHelper {
                 Set<String> acceptedClassNames = bundleClassFinder.find();
                 servletContainerInitializerClassNamesMap.put(servletContainerInitializer, acceptedClassNames.size() > 0 ? acceptedClassNames : null);
             }
-            earContext.getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS, servletContainerInitializerClassNamesMap);
+            module.getEarContext().getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS, servletContainerInitializerClassNamesMap);
         } catch (Exception e) {
             throw new DeploymentException("Fail to scan javax.servlet.ServletContainerInitializer", e);
         } finally {
@@ -478,7 +478,7 @@ public class MergeHelper {
                 }
 
             }).toArray(new WebFragmentEntry[webFragmentEntryMap.values().size()]);
-            saveOrderedLibAttribute(earContext, webFragments);
+            saveOrderedLibAttribute(earContext, module, webFragments);
             return webFragments;
         } catch (IllegalConfigurationException e) {
             throw new DeploymentException("Jar file " + webFragmentEntryMap.get(e.getNodeName()).getJarURL() + " is not configured correctly for " + e.getMessage(), e);
@@ -558,7 +558,7 @@ public class MergeHelper {
         }
     }
 
-    private static void saveOrderedLibAttribute(EARContext earContext, WebFragmentEntry[] webFragmentEntries) {
+    private static void saveOrderedLibAttribute(EARContext earContext, Module module, WebFragmentEntry[] webFragmentEntries) {
         //Save ORDERED_LIBS Attribute
         List<String> orderedLibs = new ArrayList<String>();
         for (WebFragmentEntry webFragmentEntry : webFragmentEntries) {
@@ -570,6 +570,6 @@ public class MergeHelper {
                 }
             }
         }
-        earContext.getGeneralData().put(AbstractWebModuleBuilder.ORDERED_LIBS, orderedLibs);
+        module.getEarContext().getGeneralData().put(AbstractWebModuleBuilder.ORDERED_LIBS, orderedLibs);
     }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java Wed Sep  7 15:10:16 2011
@@ -19,6 +19,7 @@ package org.apache.geronimo.web25.deploy
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import java.net.URL;
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -27,9 +28,12 @@ import java.util.List;
 import java.util.Map;
 
 import junit.framework.Assert;
+
 import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeployableBundle;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -81,7 +85,8 @@ public class WebFragmentTest extends Xml
         jarURLWebFragmentMap.put("WEB-INF/lib/testC.jar", loadXmlObject("webfragments/absolute/webfragmentC.xml", WebFragment.class));
         jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/absolute/webfragmentD.xml", WebFragment.class));
         WebApp webApp = loadXmlObject("webfragments/absolute/web-withothers.xml", WebApp.class);
-        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+        EARContext rootContext = new DummyEARContext();
+        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
         Assert.assertEquals(4, webFragmentEntries.length);
         Assert.assertEquals("webfragmentD", webFragmentEntries[0].getName());
         Assert.assertEquals("webfragmentB", webFragmentEntries[1].getName());
@@ -104,7 +109,8 @@ public class WebFragmentTest extends Xml
         jarURLWebFragmentMap.put("WEB-INF/lib/testC.jar", loadXmlObject("webfragments/absolute/webfragmentC.xml", WebFragment.class));
         jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/absolute/webfragmentD.xml", WebFragment.class));
         WebApp webApp = loadXmlObject("webfragments/absolute/web-withoutothers.xml", WebApp.class);
-        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+        EARContext rootContext = new DummyEARContext();
+        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
         Assert.assertEquals(2, webFragmentEntries.length);
         Assert.assertEquals("webfragmentD", webFragmentEntries[0].getName());
         Assert.assertEquals("webfragmentA", webFragmentEntries[1].getName());
@@ -121,7 +127,8 @@ public class WebFragmentTest extends Xml
         //D -(after) -> others
         jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/relative/webfragmentD.xml", WebFragment.class));
         WebApp webApp = loadXmlObject("webfragments/relative/web.xml", WebApp.class);
-        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+        EARContext rootContext = new DummyEARContext();
+        WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
         Assert.assertEquals("webfragmentC", webFragmentEntries[0].getName());
         Assert.assertEquals("webfragmentB", webFragmentEntries[1].getName());
         Assert.assertEquals("webfragmentA", webFragmentEntries[2].getName());
@@ -143,7 +150,8 @@ public class WebFragmentTest extends Xml
             jarURLWebFragmentMap.put("WEB-INF/lib/testC.jar", loadXmlObject("webfragments/circus/circusA/webfragmentC.xml", WebFragment.class));
             jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/circus/circusA/webfragmentD.xml", WebFragment.class));
             WebApp webApp = loadXmlObject("webfragments/circus/circusA/web.xml", WebApp.class);
-            MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+            EARContext rootContext = new DummyEARContext();
+            WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
             fail("Circus Dependency should be found");
         } catch (DeploymentException e) {
             Assert.assertTrue(e.getMessage().indexOf("WEB-INF/lib/testA.jar") != -1);
@@ -166,7 +174,8 @@ public class WebFragmentTest extends Xml
             jarURLWebFragmentMap.put("WEB-INF/lib/testC.jar", loadXmlObject("webfragments/circus/circusB/webfragmentC.xml", WebFragment.class));
             jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/circus/circusB/webfragmentD.xml", WebFragment.class));
             WebApp webApp = loadXmlObject("webfragments/circus/circusB/web.xml", WebApp.class);
-            MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+            EARContext rootContext = new DummyEARContext();
+            WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
             fail("Circus Dependency should be found");
         } catch (DeploymentException e) {
             Assert.assertTrue(e.getMessage().indexOf("WEB-INF/lib/testA.jar") != -1 || e.getMessage().indexOf("WEB-INF/lib/testB.jar") != -1);
@@ -191,7 +200,8 @@ public class WebFragmentTest extends Xml
             //D -(after) -> A
             jarURLWebFragmentMap.put("WEB-INF/lib/testD.jar", loadXmlObject("webfragments/circus/circusC/webfragmentD.xml", WebFragment.class));
             WebApp webApp = loadXmlObject("webfragments/circus/circusC/web.xml", WebApp.class);
-            MergeHelper.sortWebFragments(new DummyEARContext(), null, null, webApp, jarURLWebFragmentMap);
+            EARContext rootContext = new DummyEARContext();
+            WebFragmentEntry[] webFragmentEntries = MergeHelper.sortWebFragments(rootContext, createDummyWebModule(rootContext), null, webApp, jarURLWebFragmentMap);
             fail("Circus Dependency should be found");
         } catch (DeploymentException e) {
             Assert.assertTrue(e.getMessage().indexOf("WEB-INF/lib/testA.jar") != -1 || e.getMessage().indexOf("WEB-INF/lib/testB.jar") != -1 || e.getMessage().indexOf("WEB-INF/lib/testD.jar") != -1);
@@ -208,6 +218,13 @@ public class WebFragmentTest extends Xml
         }
     }
 
+    private WebModule createDummyWebModule(EARContext rootContext) throws Exception {
+        WebModule webModule = new WebModule(true, new AbstractName(new URI("test/test/1.0/car?J2EEApplication=null,j2eeType=WebModule,name=test.war")), "test.war", new Environment(), new DeployableBundle(new MockBundle(WebFragmentTest.class.getClassLoader(), "", 1L)), "",
+                new WebApp(), null, "", "", "", null, null);
+        webModule.setEarContext(new DummyEARContext());
+        return webModule;
+    }
+
     public static class DummyConfigurationManager implements ConfigurationManager {
 
         @Override
@@ -435,8 +452,8 @@ public class WebFragmentTest extends Xml
          * }
          */
         public DummyEARContext() throws Exception {
-            super(FileUtils.createTempDir(), null, new Environment(), ConfigurationModuleType.WAR, null, new DummyConfigurationManager(), new MockBundleContext(new MockBundle(WebFragmentTest.class
-                    .getClassLoader(), "", 1L)), null, null, null, null, null, null);
+            super(FileUtils.createTempDir(), null, new Environment(), ConfigurationModuleType.WAR, null, new DummyConfigurationManager(), new MockBundleContext(new MockBundle(
+                    WebFragmentTest.class.getClassLoader(), "", 1L)), null, null, null, null, null, null);
         }
     }
 }

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java Wed Sep  7 15:10:16 2011
@@ -528,9 +528,9 @@ public class JettyModuleBuilder extends 
             //Save Deployment Attributes
             Map<String, Object> deploymentAttributes = new HashMap<String, Object>();
             deploymentAttributes.put(WebApplicationConstants.META_COMPLETE, webApp.isMetadataComplete());
-            deploymentAttributes.put(WebApplicationConstants.SCHEMA_VERSION, INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()));
-            deploymentAttributes.put(WebApplicationConstants.ORDERED_LIBS, AbstractWebModuleBuilder.ORDERED_LIBS.get(earContext.getGeneralData()));
-            deploymentAttributes.put(WebApplicationConstants.SERVLET_CONTAINER_INITIALIZERS, AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS.get(earContext.getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.SCHEMA_VERSION, INITIAL_WEB_XML_SCHEMA_VERSION.get(webModule.getEarContext().getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.ORDERED_LIBS, AbstractWebModuleBuilder.ORDERED_LIBS.get(webModule.getEarContext().getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.SERVLET_CONTAINER_INITIALIZERS, AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS.get(webModule.getEarContext().getGeneralData()));
             webModuleData.setAttribute("deploymentAttributes", deploymentAttributes);
 
             //TODO this may definitely not be the best place for this!
@@ -545,7 +545,7 @@ public class JettyModuleBuilder extends 
             //not truly metadata complete until MBEs have run
             if (!webApp.isMetadataComplete()) {
                 webApp.setMetadataComplete(true);
-                if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f) {
+                if (INITIAL_WEB_XML_SCHEMA_VERSION.get(webModule.getEarContext().getGeneralData()) >= 2.5f) {
                     String specDeploymentPlan = getSpecDDAsString(webModule);
                     module.setOriginalSpecDD(specDeploymentPlan);
                     earContext.addFile(new URI("./WEB-INF/web.xml"), specDeploymentPlan);

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java Wed Sep  7 15:10:16 2011
@@ -214,7 +214,7 @@ public class MyFacesModuleBuilderExtensi
         FacesConfig webAppFacesConfig = getWebAppFacesConfig(webModule);
 
         //Parse all faces-config.xml files found in META-INF folder
-        Set<ConfigurationResource> metaInfConfigurationResources = JSF_META_INF_CONFIGURATION_RESOURCES.get(earContext.getGeneralData());
+        Set<ConfigurationResource> metaInfConfigurationResources = JSF_META_INF_CONFIGURATION_RESOURCES.get(module.getEarContext().getGeneralData());
         List<FacesConfig> metaInfFacesConfigs = new ArrayList<FacesConfig>(metaInfConfigurationResources.size());
         for (ConfigurationResource configurationResource : metaInfConfigurationResources) {
             FacesConfig facesConfig = configurationResource.getFacesConfig();
@@ -262,7 +262,7 @@ public class MyFacesModuleBuilderExtensi
         GBeanData myFacesWebAppContextData = new GBeanData(myFacesWebAppContextName, MyFacesWebAppContext.class);
 
         Set<ConfigurationResource> faceletsLibraries = new HashSet<ConfigurationResource>();
-        faceletsLibraries.addAll(JSF_FACELET_CONFIG_RESOURCES.get(earContext.getGeneralData()));
+        faceletsLibraries.addAll(JSF_FACELET_CONFIG_RESOURCES.get(webModule.getEarContext().getGeneralData()));
         faceletsLibraries.addAll(getContextFaceletsLibraries(webApp, webModule));
         myFacesWebAppContextData.setAttribute("faceletConfigResources", faceletsLibraries);
 

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=1166214&r1=1166213&r2=1166214&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 Sep  7 15:10:16 2011
@@ -66,6 +66,7 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.deployment.AppClientModule;
 import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.FragmentContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
@@ -78,6 +79,7 @@ import org.apache.geronimo.kernel.GBeanA
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -89,7 +91,6 @@ import org.apache.geronimo.openejb.EjbCo
 import org.apache.geronimo.openejb.EjbDeployment;
 import org.apache.geronimo.openejb.EjbModuleImpl;
 import org.apache.geronimo.openejb.OpenEjbSystem;
-import org.apache.geronimo.openejb.cdi.SharedOwbContext;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
 import org.apache.geronimo.persistence.PersistenceUnitGBean;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
@@ -310,7 +311,7 @@ public class EjbModuleBuilder implements
         }
 
     }
-    
+
 
     private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, Module parentModule, Naming naming, ModuleIDBuilder idBuilder,
             String ddDir, boolean subModule) throws DeploymentException {
@@ -322,11 +323,11 @@ public class EjbModuleBuilder implements
             throw new IllegalArgumentException("targetPath must not end with a '/'");
 
         ClassLoader detectTempClassLoader = null;
-        
+
         ClassLoader ejbModuleTempClassLoader = null;
-        
+
         List<File> tempFileList = new ArrayList<File>();
-        
+
         try {
             // verify we have a valid file
             String jarPath = moduleFile.getName();
@@ -338,24 +339,24 @@ public class EjbModuleBuilder implements
             File jarFile = new File(moduleFile.getName());
 
             baseUrl = jarFile.toURI().toURL();
-            
+
             List<URL> libURLs = new ArrayList<URL>();
-            
+
             libURLs.add(baseUrl);
-            
+
             boolean standAlone = earEnvironment == null;
-        
+
            if (parentModule instanceof WebModule)  {
-              
+
                Deployable deployable = parentModule.getDeployable();
                if (!(deployable instanceof DeployableJarFile)) {
                    throw new IllegalArgumentException("Expected DeployableJarFile");
                }
-               
+
                 JarFile war = ((DeployableJarFile) deployable).getJarFile();
-                
+
                 Enumeration<JarEntry> entries = war.entries();
-            
+
                 while (entries.hasMoreElements()) {
                     String jarEntryName = entries.nextElement().getName();
                    if (jarEntryName.startsWith("WEB-INF/lib/") && jarEntryName.endsWith(".jar")) {
@@ -364,15 +365,15 @@ public class EjbModuleBuilder implements
                        libURLs.add(libJar.toURI().toURL());
                        libJar.deleteOnExit();
                     }
-                }  
-                
-                // The war it self is a ejbmodule. If the war is standalone, 
+                }
+
+                // The war it self is a ejbmodule. If the war is standalone,
                 // the corresponding ejbmodule is standalone too.
                 standAlone = parentModule.isStandAlone();
             }
-            
 
-            
+
+
             detectTempClassLoader = ClassLoaderUtil.createTempClassLoader(ClassLoaderUtil.createClassLoader(jarPath, libURLs.toArray(new URL[0]), OpenEJB.class.getClassLoader()));
 
             ResourceFinder finder = new ResourceFinder("", detectTempClassLoader, baseUrl);
@@ -384,7 +385,7 @@ public class EjbModuleBuilder implements
             // measure will explicitly look for specific known descriptor files and add them if
             // the getResourcesMap() method was unable to find them.  In this "bad jar" scenario
             // some extra features such as the openejb.altdd.prefix functionality will not work.
-            
+
             String[] doubleCheck = {"ejb-jar.xml", "geronimo-openejb.xml", "openejb-jar.xml", "beans.xml", "env-entries.properties", "web.xml"};
 
             for (String entry : doubleCheck) {
@@ -400,16 +401,16 @@ public class EjbModuleBuilder implements
 
 
             if (!isEjbModule(baseUrl,libURLs, detectTempClassLoader, descriptors)) {
-               
+
                 return null;
             }
-            
-            
+
+
             libURLs.clear();
             libURLs.add(baseUrl);
-            
+
             ejbModuleTempClassLoader = ClassLoaderUtil.createTempClassLoader(ClassLoaderUtil.createClassLoader(jarPath, libURLs.toArray(new URL[0]), OpenEJB.class.getClassLoader()));
-            
+
 
             // create the EJB Module
             org.apache.openejb.config.EjbModule ejbModule = new org.apache.openejb.config.EjbModule(ejbModuleTempClassLoader, null, jarPath, null, null);
@@ -439,15 +440,15 @@ public class EjbModuleBuilder implements
                     xmlCursor.toFirstChild();
                     qname = xmlCursor.getName();
                 }
-                
+
              while (xmlCursor.hasNextToken()){
-                 
+
                  qname = xmlCursor.getName();
                     if (qname == null || qname.getLocalPart() == null) {
                         xmlCursor.toNextToken();
                         continue;
                     }
-                
+
                 if (qname.getLocalPart().equals("openejb-jar")) {
                     ejbModule.getAltDDs().put("openejb-jar.xml", xmlCursor.xmlText());
                     break;
@@ -455,7 +456,7 @@ public class EjbModuleBuilder implements
                     ejbModule.getAltDDs().put("geronimo-openejb.xml", xmlCursor.xmlText());
                     break;
                 }
-                
+
                 xmlCursor.toNextToken();
 
                 }
@@ -497,10 +498,10 @@ public class EjbModuleBuilder implements
                 AbstractName earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
                 moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.EJB_MODULE);
             } else {
-                
+
                 AbstractName parentName = parentModule instanceof AppClientModule ? ((AppClientModule) parentModule)
                         .getAppClientName() : parentModule.getModuleName();
-                        
+
                 moduleName = naming.createChildName(parentName, targetPath, NameFactory.EJB_MODULE);
             }
 
@@ -550,18 +551,18 @@ public class EjbModuleBuilder implements
             }
             return module;
         } catch (DeploymentException e) {
-            
+
             throw e;
-            
+
         } catch (Exception e) {
 
             throw new DeploymentException(e);
-            
+
         }  finally {
-            
+
             releaseTempClassLoader(detectTempClassLoader);
             releaseTempClassLoader(ejbModuleTempClassLoader);
-            
+
             for (File file:tempFileList){
                 FileUtils.recursiveDelete(file);
             }
@@ -640,30 +641,31 @@ public class EjbModuleBuilder implements
         if (module instanceof EjbModule) {
             installModule(module, earContext);
             EARContext moduleContext;
-//        if (module.isStandAlone()) {
-            moduleContext = earContext;
-//        } else {
-//            Environment environment = earContext.getConfiguration().getEnvironment();
-//            File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
-////            configurationDir.mkdirs();
-//
-//            // construct the ejb app deployment context... this is the same class used by the ear context
-//            try {
-//                File inPlaceConfigurationDir = null;
-//                if (null != earContext.getInPlaceConfigurationDir()) {
-//                    inPlaceConfigurationDir = new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath());
-//                }
-//                moduleContext = new EARContext(configurationDir,
-//                        inPlaceConfigurationDir,
-//                        environment,
-//                        ConfigurationModuleType.EJB,
-//                        module.getModuleName(),
-//                        earContext);
-//            } catch (DeploymentException e) {
-//                cleanupConfigurationDir(configurationDir);
-//                throw e;
-//            }
-//        }
+            if (module.isStandAlone()) {
+                moduleContext = earContext;
+            } else {
+                moduleContext = new FragmentContext(earContext, ConfigurationModuleType.EJB);
+                //            Environment environment = earContext.getConfiguration().getEnvironment();
+                //            File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
+                ////            configurationDir.mkdirs();
+                //
+                //            // construct the ejb app deployment context... this is the same class used by the ear context
+                //            try {
+                //                File inPlaceConfigurationDir = null;
+                //                if (null != earContext.getInPlaceConfigurationDir()) {
+                //                    inPlaceConfigurationDir = new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath());
+                //                }
+                //                moduleContext = new EARContext(configurationDir,
+                //                        inPlaceConfigurationDir,
+                //                        environment,
+                //                        ConfigurationModuleType.EJB,
+                //                        module.getModuleName(),
+                //                        earContext);
+                //            } catch (DeploymentException e) {
+                //                cleanupConfigurationDir(configurationDir);
+                //                throw e;
+                //            }
+            }
             module.setEarContext(moduleContext);
             module.setRootEarContext(earContext);
             if (((EjbModule) module).getEjbJar().getAssemblyDescriptor() != null) {
@@ -709,11 +711,11 @@ public class EjbModuleBuilder implements
                         .getModuleLocations();
                 URI baseUri = URI.create(module.getTargetPath());
                 earContext.getCompleteManifestClassPath(module.getDeployable(), baseUri, URI.create("."), EjbModuleClasspaths, moduleLocations);
-                
+
                 for (String classpath:EjbModuleClasspaths){
                     earContext.addToClassPath(classpath);
                 }
-                
+
             }
             //earContext.addInclude(".", moduleFile);
         } catch (IOException e) {
@@ -755,7 +757,7 @@ public class EjbModuleBuilder implements
             LinkedHashSet<Module<?,?>> modules = module.getModules();
             for (Module<?,?> subModule: modules) {
                 if (subModule instanceof EjbModule)  {
-                    
+
                     if(module instanceof AppClientModule){
                         earContext = module.getEarContext();
                     }
@@ -764,11 +766,11 @@ public class EjbModuleBuilder implements
             }
         }
     }
-    
+
 
     private void doInitContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
         EjbModule ejbModule = (EjbModule) module;
-        
+
 
 
         AppInfo appInfo = getAppInfo(earContext, ejbModule, bundle);
@@ -812,7 +814,7 @@ public class EjbModuleBuilder implements
         // Add extra gbean declared in the geronimo-openejb.xml file
         serviceBuilders.build(ejbModule.getVendorDD(), earContext, ejbModule.getEarContext());
 
-       
+
         GBeanData ejbModuleGBeanData = new GBeanData(ejbModule.getModuleName(), EjbModuleImpl.class);
         try {
 
@@ -850,7 +852,7 @@ public class EjbModuleBuilder implements
                 module.setClassLoader(bundleLoader);
                 appModule.getEjbModules().add(module.getEjbModule());
             }
-            
+
             if(!ejbModule.isStandAlone())
             {
                appModule.setModuleId(ejbModule.getParentModule().getName());
@@ -1164,19 +1166,19 @@ public class EjbModuleBuilder implements
         }
         // add enc
         String moduleName = module.getName();
-        
+
         if (earContext.getSubModuleNames().size() > 1 && earContext.getSubModuleNames().contains(moduleName)){
             log.warn("Duplicated moduleName: '"+moduleName +"' is found ! deployer will rename it to: '"+moduleName +
                     "_duplicated' , please check your modules in application to make sure they don't share the same name");
             moduleName = moduleName +"_duplicated";
             earContext.getSubModuleNames().add(moduleName);
         }
-        
+
         if (!(module.getParentModule() instanceof WebModule) && !(module.getParentModule() instanceof AppClientModule)) {
             earContext.getSubModuleNames().add(moduleName);
             module.getJndiScope(JndiScope.module).put("module/ModuleName", moduleName);
         }
-        
+
         ejbDeploymentBuilder.buildEnc();
 
         Set<GBeanData> gBeanDatas = earContext.getConfiguration().findGBeanDatas(Collections.singleton(new AbstractNameQuery(PersistenceUnitGBean.class.getName())));
@@ -1445,18 +1447,18 @@ public class EjbModuleBuilder implements
             return appInfo;
         }
     }
-    
+
     public static class MessageDestinationInfo implements JndiConsumer {
-        
+
         private final IllegalStateException notAllowedException = new IllegalStateException(
                 "this instance is only used for adminObjectRefBuilder to get MessageDestination defined.");
         private final List<MessageDestination> specMessageDestinations;
-        
+
         public MessageDestinationInfo(List<MessageDestination> specMessageDestinations) {
             this.specMessageDestinations = specMessageDestinations == null ? new ArrayList<MessageDestination>()
                     : specMessageDestinations;
         }
-        
+
         @Override
         public Collection<DataSource> getDataSource() {
             throw notAllowedException;

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=1166214&r1=1166213&r2=1166214&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Wed Sep  7 15:10:16 2011
@@ -689,9 +689,9 @@ public class TomcatModuleBuilder extends
             //Save Deployment Attributes
             Map<String, Object> deploymentAttributes = new HashMap<String, Object>();
             deploymentAttributes.put(WebApplicationConstants.META_COMPLETE, webApp.isMetadataComplete());
-            deploymentAttributes.put(WebApplicationConstants.SCHEMA_VERSION, INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()));
-            deploymentAttributes.put(WebApplicationConstants.ORDERED_LIBS, AbstractWebModuleBuilder.ORDERED_LIBS.get(earContext.getGeneralData()));
-            deploymentAttributes.put(WebApplicationConstants.SERVLET_CONTAINER_INITIALIZERS, AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS.get(earContext.getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.SCHEMA_VERSION, INITIAL_WEB_XML_SCHEMA_VERSION.get(webModule.getEarContext().getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.ORDERED_LIBS, AbstractWebModuleBuilder.ORDERED_LIBS.get(webModule.getEarContext().getGeneralData()));
+            deploymentAttributes.put(WebApplicationConstants.SERVLET_CONTAINER_INITIALIZERS, AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS.get(webModule.getEarContext().getGeneralData()));
             webModuleData.setAttribute("deploymentAttributes", deploymentAttributes);
 
             //listeners added directly to the StandardContext will get loaded by the tomcat classloader, not the app classloader!
@@ -718,7 +718,7 @@ public class TomcatModuleBuilder extends
                 webModuleData.setReferencePattern("applicationPolicyConfigurationManager", EARContext.JACC_MANAGER_NAME_KEY.get(earContext.getGeneralData()));
             }
             //not truly metadata complete until MBEs have run
-            if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f) {
+            if (INITIAL_WEB_XML_SCHEMA_VERSION.get(module.getEarContext().getGeneralData()) >= 2.5f) {
                 webApp.setMetadataComplete(true);
                 String specDeploymentPlan = getSpecDDAsString(webModule);
                 module.setOriginalSpecDD(specDeploymentPlan);



Mime
View raw message