geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r479477 - in /geronimo/server/branches/1.2/modules: geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/ geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ geronimo-jetty-builder/src/main/java/org/apac...
Date Mon, 27 Nov 2006 00:45:11 GMT
Author: djencks
Date: Sun Nov 26 16:45:10 2006
New Revision: 479477

URL: http://svn.apache.org/viewvc?view=rev&rev=479477
Log:
GERONIMO-2597 make web service builder optional and allow multiple builders

Modified:
    geronimo/server/branches/1.2/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
    geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
    geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
    geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
    geronimo/server/branches/1.2/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/MockWebServiceBuilder.java

Modified: geronimo/server/branches/1.2/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Sun Nov 26 16:45:10 2006
@@ -64,6 +64,7 @@
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.deployment.HandlerInfoInfo;
+import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortCompletionType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortType;
@@ -91,6 +92,7 @@
     private static final SOAPConstants SOAP_VERSION = SOAPConstants.SOAP11_CONSTANTS;
 
     private final Environment defaultEnvironment;
+    private static final String KEY = AxisBuilder.class.getName();
 
     public AxisBuilder() {
         defaultEnvironment = null;
@@ -101,26 +103,31 @@
     }
 
 
-    public Map findWebServices(JarFile moduleFile, boolean isEJB, Map servletLocations, Environment
environment) throws DeploymentException {
+    public void findWebServices(JarFile moduleFile, boolean isEJB, Map servletLocations,
Environment environment, Map sharedContext) throws DeploymentException {
         final String path = isEJB ? "META-INF/webservices.xml" : "WEB-INF/webservices.xml";
         try {
             URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, path);
-            Map result = WSDescriptorParser.parseWebServiceDescriptor(wsDDUrl, moduleFile,
isEJB, servletLocations);
-            if (result != null) {
+            Map portMap = WSDescriptorParser.parseWebServiceDescriptor(wsDDUrl, moduleFile,
isEJB, servletLocations);
+            if (portMap != null) {
                 if (defaultEnvironment != null) {
                     EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
                 }
-                return result;
+                sharedContext.put(KEY, portMap);
             }
         } catch (MalformedURLException e) {
             // The webservices.xml file doesn't exist.
         }
-        return Collections.EMPTY_MAP;
     }
 
-    public void configurePOJO(GBeanData targetGBean, Module module, Object portInfoObject,
String seiClassName, DeploymentContext context) throws DeploymentException {
+    public boolean configurePOJO(GBeanData targetGBean, String servletName, Module module,
String seiClassName, DeploymentContext context) throws DeploymentException {
         ClassLoader cl = context.getClassLoader();
-        PortInfo portInfo = (PortInfo) portInfoObject;
+        Map sharedContext = ((WebModule) module).getSharedContext();
+        Map portInfoMap = (Map) sharedContext.get(KEY);
+        PortInfo portInfo = (PortInfo) portInfoMap.get(servletName);
+        if (portInfo == null) {
+            //not ours
+            return false;
+        }
         ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, cl);
         JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc();
 
@@ -158,14 +165,20 @@
             throw new DeploymentException("Could not add webServiceContainerFactoryGBean",
e);
         }
         targetGBean.setReferencePattern("WebServiceContainerFactory", webServiceContainerFactoryName);
+        return true;
     }
 
-    public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject,
ClassLoader classLoader) throws DeploymentException {
-        PortInfo portInfo = (PortInfo) portInfoObject;
+    public boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile,
Map sharedContext, ClassLoader classLoader) throws DeploymentException {
+        Map portInfoMap = (Map) sharedContext.get(KEY);
+        PortInfo portInfo = (PortInfo) portInfoMap.get(ejbName);
+        if (portInfo == null) {
+            //not ours
+            return false;
+        }
         ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, classLoader);
         targetGBean.setAttribute("serviceInfo", serviceInfo);
         JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc();
-       URI location = portInfo.getContextURI();
+        URI location = portInfo.getContextURI();
         targetGBean.setAttribute("location", location);
         URI wsdlURI;
         try {
@@ -174,6 +187,7 @@
             throw new DeploymentException("Invalid wsdl URI", e);
         }
         targetGBean.setAttribute("wsdlURI", wsdlURI);
+        return true;
     }
 
 
@@ -284,7 +298,6 @@
 
         ServiceEndpointInterfaceMappingType[] endpointMappings = mapping.getServiceEndpointInterfaceMappingArray();
 
-
         //port type corresponds to SEI
         List operations = portType.getOperations();
         OperationInfo[] operationInfos = new OperationInfo[operations.size()];
@@ -480,7 +493,7 @@
         infoBuilder.addInterface(WebServiceBuilder.class);
         infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true);
 
-        infoBuilder.setConstructor(new String[] {"defaultEnvironment"});
+        infoBuilder.setConstructor(new String[]{"defaultEnvironment"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
Sun Nov 26 16:45:10 2006
@@ -33,11 +33,11 @@
  */
 public class EJBModule extends Module {
     private AbstractName moduleCmpEngineName;
-    private final Map portMap;
+    private final Map sharedContext;
 
-    public EJBModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
Map portMap) {
+    public EJBModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
Map sharedContext) {
         super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, null);
-        this.portMap = portMap;
+        this.sharedContext = sharedContext;
     }
 
     public ConfigurationModuleType getType() {
@@ -56,8 +56,8 @@
         this.moduleCmpEngineName = moduleCmpEngineName;
     }
 
-    public Map getPortMap() {
-        return portMap;
+    public Map getSharedContext() {
+        return sharedContext;
     }
 }
 

Modified: geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
Sun Nov 26 16:45:10 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.geronimo.j2ee.deployment;
 
-import java.util.Collections;
 import java.util.Map;
 import java.util.jar.JarFile;
 
@@ -33,15 +32,14 @@
  */
 public class UnavailableWebServiceBuilder implements WebServiceBuilder {
 
-    public Map findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations,
Environment environment) throws DeploymentException {
-        return  Collections.EMPTY_MAP;
+    public void findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations,
Environment environment, Map sharedContext) throws DeploymentException {
     }
 
-    public void configurePOJO(GBeanData targetGBean, Module module, Object portInfo, String
seiClassName, DeploymentContext context) throws DeploymentException {
+    public boolean configurePOJO(GBeanData targetGBean, String servletName, Module module,
String seiClassName, DeploymentContext context) throws DeploymentException {
         throw new DeploymentException("Web services are not available in this configuration");
     }
 
-    public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject,
ClassLoader classLoader) throws DeploymentException {
+    public boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile,
Map portInfoObject, ClassLoader classLoader) throws DeploymentException {
         throw new DeploymentException("Web services are not available in this configuration");
     }
 

Modified: geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
Sun Nov 26 16:45:10 2006
@@ -16,13 +16,9 @@
  */
 package org.apache.geronimo.j2ee.deployment;
 
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.Map;
 import java.util.jar.JarFile;
 
-import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -33,12 +29,12 @@
  */
 public class WebModule extends Module {
     private final String contextRoot;
-    private final Map portMap;
+    private final Map sharedContext;
 
-    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String contextRoot, Map portMap, String namespace) {
+    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String contextRoot, Map sharedContext, String namespace) {
         super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, namespace);
         this.contextRoot = contextRoot;
-        this.portMap = portMap;
+        this.sharedContext = sharedContext;
     }
 
     public String getContextRoot() {
@@ -49,8 +45,8 @@
         return ConfigurationModuleType.WAR;
     }
 
-    public Map getPortMap() {
-        return portMap;
+    public Map getSharedContext() {
+        return sharedContext;
     }
 
 }

Modified: geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
Sun Nov 26 16:45:10 2006
@@ -16,14 +16,13 @@
  */
 package org.apache.geronimo.j2ee.deployment;
 
+import java.util.Map;
+import java.util.jar.JarFile;
+
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.xmlbeans.XmlObject;
-
-import java.util.jar.JarFile;
-import java.util.Map;
 
 /**
  * @version $Rev$ $Date$
@@ -37,12 +36,12 @@
     * @param isEJB is this an EJB archive?
     * @param correctedPortLocations mapping between port locations and paths.
     * @param environment
-    * @return Mapping of servlet names to port information, or an
+    * @param sharedContext map of builder-specific key to map of servlet names to port information,
or an
     * empty map if no web services found.  Port information is opaque
     * to all except the WebServiceBuilder itself.
     * @throws DeploymentException if error encountered while introspecting the module.
     */
-   Map findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations, Environment
environment) throws DeploymentException;
+   void findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations, Environment
environment, Map sharedContext) throws DeploymentException;
 
     //obviously these need the deployment descriptors, but I'm not sure in what form yet.
     /**
@@ -50,22 +49,25 @@
      * The GBeanData will be for a ServletHolder like gbean that is adapted to holding a
ws stack that talks to a
      * POJO web service.  The web deployer is responsible for filling in the standard servlet
info such as init params.
      * @param targetGBean
+     * @param servletName
      * @param module
-     * @param portInfo
      * @param seiClassName
      * @param context
+     * @return true if this builder configured this pojo
      * @throws DeploymentException
      */
-    void configurePOJO(GBeanData targetGBean, Module module, Object portInfo, String seiClassName,
DeploymentContext context) throws DeploymentException;
+    boolean configurePOJO(GBeanData targetGBean, String servletName, Module module, String
seiClassName, DeploymentContext context) throws DeploymentException;
 
     /**
      * configure the supplied EJBContainer gbeandata to implement the ejb web service described
in the deployment descriptor
      * N.B. this method is a complete guess and should be replaced by something useable right
away!
      * @param targetGBean
+     * @param ejbName
      * @param moduleFile
+     * @param sharedContext
      * @param classLoader
      * @throws DeploymentException
      */
-    void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfo, ClassLoader
classLoader) throws DeploymentException;
+    boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile, Map sharedContext,
ClassLoader classLoader) throws DeploymentException;
 
 }

Modified: geronimo/server/branches/1.2/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Sun Nov 26 16:45:10 2006
@@ -56,7 +56,6 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.SingleElementCollection;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -129,7 +128,7 @@
     private final Collection defaultFilterMappings;
     private final GBeanData pojoWebServiceTemplate;
 
-    private final SingleElementCollection webServiceBuilder;
+    private final Collection webServiceBuilder;
     protected final NamespaceDrivenBuilderCollection clusteringBuilders;
 
     private final List defaultWelcomeFiles;
@@ -160,7 +159,7 @@
         this.defaultFilters = defaultFilters;
         this.defaultFilterMappings = defaultFilterMappings;
         this.pojoWebServiceTemplate = getGBeanData(kernel, pojoWebServiceTemplate);
-        this.webServiceBuilder = new SingleElementCollection(webServiceBuilder);
+        this.webServiceBuilder = webServiceBuilder;
         this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders,
GerClusteringDocument.type.getDocumentElementName());
 
         //todo locale mappings
@@ -168,10 +167,6 @@
         this.defaultWelcomeFiles = defaultWelcomeFiles;
     }
 
-    private WebServiceBuilder getWebServiceBuilder() {
-        return (WebServiceBuilder) webServiceBuilder.getElement();
-    }
-    
     private static GBeanData getGBeanData(Kernel kernel, Object template) throws GBeanNotFoundException
{
         if (template == null) {
             return null;
@@ -229,26 +224,26 @@
 
         EnvironmentType environmentType = jettyWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        
+
         Boolean distributable = webApp.getDistributableArray().length == 1 ? Boolean.TRUE
: Boolean.FALSE;
         if (Boolean.TRUE == distributable) {
             clusteringBuilders.buildEnvironment(jettyWebApp, environment);
         }
 
         getNamingBuilders().buildEnvironment(webApp, jettyWebApp, environment);
-        
+
         // Note: logic elsewhere depends on the default artifact ID being the file name less
extension (ConfigIDExtractor)
         String warName = "";
         File temp = new File(moduleFile.getName());
-        if(temp.isFile()) {
+        if (temp.isFile()) {
             warName = temp.getName();
-            if(warName.lastIndexOf('.') > -1) {
+            if (warName.lastIndexOf('.') > -1) {
                 warName = warName.substring(0, warName.lastIndexOf('.'));
             }
         } else {
             try {
                 warName = temp.getCanonicalFile().getName();
-                if(warName.equals("")) {
+                if (warName.equals("")) {
                     // Root directory
                     warName = "$root-dir$";
                 }
@@ -259,7 +254,11 @@
 
         Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
 
-        Map portMap = getWebServiceBuilder().findWebServices(moduleFile, false, servletNameToPathMap,
environment);
+        Map sharedContext = new HashMap();
+        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
+            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+            serviceBuilder.findWebServices(moduleFile, false, servletNameToPathMap, environment,
sharedContext);
+        }
         AbstractName moduleName;
         if (earName == null) {
             earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL,
NameFactory.J2EE_APPLICATION);
@@ -268,7 +267,7 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, jettyWebApp, specDD, contextRoot, portMap, JETTY_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, jettyWebApp, specDD, contextRoot, sharedContext, JETTY_NAMESPACE);
     }
 
     JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String
targetPath, WebAppType webApp) throws DeploymentException {
@@ -374,7 +373,7 @@
             buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap());
             buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
             Configuration earConfiguration = earContext.getConfiguration();
-            getNamingBuilders().buildNaming(webApp, jettyWebApp, earConfiguration, earConfiguration,
(Module)webModule, buildingContext);
+            getNamingBuilders().buildNaming(webApp, jettyWebApp, earConfiguration, earConfiguration,
(Module) webModule, buildingContext);
             Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
 
             webModuleData.setAttribute("componentContext", compContext);
@@ -409,20 +408,20 @@
             webModuleData.setAttribute(JettyWebAppContext.GBEAN_ATTR_SESSION_TIMEOUT,
                     (webApp.getSessionConfigArray().length == 1 && webApp.getSessionConfigArray(0).getSessionTimeout()
!= null) ?
                             new Integer(webApp.getSessionConfigArray(0).getSessionTimeout().getBigIntegerValue().intValue()
* 60) :
-                                defaultSessionTimeoutSeconds);
-            
+                            defaultSessionTimeoutSeconds);
+
             Boolean distributable = webApp.getDistributableArray().length == 1 ? Boolean.TRUE
: Boolean.FALSE;
             webModuleData.setAttribute("distributable", distributable);
             if (Boolean.TRUE == distributable) {
                 clusteringBuilders.build(jettyWebApp, earContext, moduleContext);
-                if (webModuleData.getReferencePatterns(JettyWebAppContext.GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY)
== null) {
+                if (webModuleData.getReferencePatterns(JettyWebAppContext.GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY)
== null)
+                {
                     log.warn("No clustering builders configured: app will not be clustered");
                     configureNoClustering(moduleContext, webModuleData);
                 }
             } else {
                 configureNoClustering(moduleContext, webModuleData);
             }
-            
 
             // configure mime mappings.
             configureMimeMappings(webApp, webModuleData);
@@ -441,7 +440,7 @@
 
             // configure login configs.
             configureLoginConfigs(module, webApp, jettyWebApp, webModuleData);
-            
+
             // Make sure that servlet mappings point to available servlets and never add
a duplicate pattern.
             Set knownServletMappings = new HashSet();
             Map servletMappings = new HashMap();
@@ -493,10 +492,9 @@
             }
 
             //set up servlet gbeans.
-            Map portMap = webModule.getPortMap();
 
             ServletType[] servletTypes = webApp.getServletArray();
-            addServlets(moduleName, webModule, servletTypes, servletMappings, securityRoles,
rolePermissions, portMap, moduleContext);
+            addServlets(moduleName, webModule, servletTypes, servletMappings, securityRoles,
rolePermissions, moduleContext);
 
             if (jettyWebApp.isSetSecurityRealmName()) {
                 configureSecurityRealm(earContext, webApp, jettyWebApp, webModuleData, securityRoles,
rolePermissions);
@@ -513,8 +511,8 @@
     }
 
     private void configureNoClustering(EARContext moduleContext, GBeanData webModuleData)
throws GBeanAlreadyExistsException {
-        AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),

-                "DefaultWebApplicationHandlerFactory", 
+        AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
+                "DefaultWebApplicationHandlerFactory",
                 NameFactory.GERONIMO_SERVICE);
         GBeanData beanData = new GBeanData(name, DefaultWebApplicationHandlerFactory.GBEAN_INFO);
         webModuleData.setReferencePattern(JettyWebAppContext.GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY,
name);
@@ -702,7 +700,7 @@
                 urlsForServlet.add(urlPattern);
             }
         }
-        
+
         return servletMappings;
     }
 
@@ -744,7 +742,7 @@
     private void configureTagLibs(Module module, WebAppType webApp, GBeanData webModuleData)
throws DeploymentException {
         JspConfigType[] jspConfigArray = webApp.getJspConfigArray();
         if (jspConfigArray.length > 1) {
-            throw new DeploymentException("Web app "+ module.getName() +" cannot have more
than one jsp-config element.  Currently has " + jspConfigArray.length +" jsp-config elements.");
+            throw new DeploymentException("Web app " + module.getName() + " cannot have more
than one jsp-config element.  Currently has " + jspConfigArray.length + " jsp-config elements.");
         }
         Map tagLibMap = new HashMap();
         for (int i = 0; i < jspConfigArray.length; i++) {
@@ -865,7 +863,6 @@
      * @param servletMappings a <code>Map</code> value
      * @param securityRoles   a <code>Set</code> value
      * @param rolePermissions a <code>Map</code> value
-     * @param portMap         a <code>Map</code> value
      * @param moduleContext
      * @throws DeploymentException if an error occurs
      */
@@ -875,7 +872,6 @@
             Map servletMappings,
             Set securityRoles,
             Map rolePermissions,
-            Map portMap,
             EARContext moduleContext) throws DeploymentException {
 
         // this TreeSet will order the ServletTypes based on whether
@@ -899,7 +895,7 @@
         AbstractName previousServlet = null;
         for (Iterator servlets = loadOrder.iterator(); servlets.hasNext();) {
             ServletType servletType = (ServletType) servlets.next();
-            previousServlet = addServlet(webModuleName, module, previousServlet, servletType,
servletMappings, securityRoles, rolePermissions, portMap, moduleContext);
+            previousServlet = addServlet(webModuleName, module, previousServlet, servletType,
servletMappings, securityRoles, rolePermissions, moduleContext);
         }
 
         // JACC v1.0 secion B.19
@@ -914,7 +910,6 @@
      * @param servletMappings
      * @param securityRoles
      * @param rolePermissions
-     * @param portMap
      * @param moduleContext
      * @return AbstractName of servlet gbean added
      * @throws DeploymentException
@@ -926,7 +921,6 @@
             Map servletMappings,
             Set securityRoles,
             Map rolePermissions,
-            Map portMap,
             EARContext moduleContext) throws DeploymentException {
         ClassLoader webClassLoader = moduleContext.getClassLoader();
         String servletName = servletType.getServletName().getStringValue().trim();
@@ -954,11 +948,21 @@
                 servletData = new GBeanData(pojoWebServiceTemplate);
                 servletData.setAbstractName(servletAbstractName);
                 //let the web service builder deal with configuring the gbean with the web
service stack
-                Object portInfo = portMap.get(servletName);
+//                Object portInfo = portMap.get(servletName);
 //                if (portInfo == null) {
 //                    throw new DeploymentException("No web service deployment info for servlet
name " + servletName); // TODO identify web app in message
 //                }
-                getWebServiceBuilder().configurePOJO(servletData, module, portInfo, servletClassName,
moduleContext);
+                boolean configured = false;
+                for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();)
{
+                    WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+                    if (serviceBuilder.configurePOJO(servletData, servletName, module, servletClassName,
moduleContext)) {
+                        configured = true;
+                        break;
+                    }
+                }
+                if (!configured) {
+                    throw new DeploymentException("POJO web service: " + servletName + "
not configured by any web service builder");
+                }
             }
         } else if (servletType.isSetJspFile()) {
             servletData = new GBeanData(servletAbstractName, JettyServletHolder.GBEAN_INFO);

Modified: geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Sun Nov 26 16:45:10 2006
@@ -96,7 +96,7 @@
     private final Environment defaultEnvironment;
     private final AbstractNameQuery tomcatContainerName;
 
-    private final SingleElementCollection webServiceBuilder;
+    private final Collection webServiceBuilder;
 
     private static final String TOMCAT_NAMESPACE = TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI();
 
@@ -112,11 +112,7 @@
         this.defaultEnvironment = defaultEnvironment;
 
         this.tomcatContainerName = tomcatContainerName;
-        this.webServiceBuilder = new SingleElementCollection(webServiceBuilder);
-    }
-
-    private WebServiceBuilder getWebServiceBuilder() {
-        return (WebServiceBuilder) webServiceBuilder.getElement();
+        this.webServiceBuilder = webServiceBuilder;
     }
 
     protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL
specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
@@ -193,7 +189,11 @@
 
         Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
 
-        Map portMap = getWebServiceBuilder().findWebServices(moduleFile, false, servletNameToPathMap,
environment);
+        Map sharedContext = new HashMap();
+        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
+            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+            serviceBuilder.findWebServices(moduleFile, false, servletNameToPathMap, environment,
sharedContext);
+        }
         AbstractName moduleName;
         if (earName == null) {
             earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL,
NameFactory.J2EE_APPLICATION);
@@ -202,7 +202,7 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, sharedContext, TOMCAT_NAMESPACE);
     }
 
 
@@ -357,7 +357,7 @@
                 AbstractName managerName = earContext.getNaming().createChildName(moduleName,
manager, ManagerGBean.J2EE_TYPE);
                 webModuleData.setReferencePattern("Manager", managerName);
             }
-            Map portMap = webModule.getPortMap();
+            Map portMap = webModule.getSharedContext();
 
             //Handle the role permissions and webservices on the servlets.
             ServletType[] servletTypes = webApp.getServletArray();
@@ -390,8 +390,17 @@
                         servletData.setAbstractName(servletAbstractName);
                         //let the web service builder deal with configuring the gbean with
the web service stack
                         //Here we just extract the factory reference
-                        Object portInfo = portMap.get(servletName);
-                        getWebServiceBuilder().configurePOJO(servletData, module, portInfo,
servletClassName, moduleContext);
+                        boolean configured = false;
+                        for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();)
{
+                            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+                            if (serviceBuilder.configurePOJO(servletData, servletName, module,
servletClassName, moduleContext)) {
+                                configured = true;
+                                break;
+                            }
+                        }
+                        if (!configured) {
+                            throw new DeploymentException("POJO web service: " + servletName
+ " not configured by any web service builder");
+                        }
                         ReferencePatterns patterns = servletData.getReferencePatterns("WebServiceContainerFactory");
                         AbstractName wsContainerFactoryName = patterns.getAbstractName();
                         webServices.put(servletName, wsContainerFactoryName);

Modified: geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/MockWebServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/MockWebServiceBuilder.java?view=diff&rev=479477&r1=479476&r2=479477
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/MockWebServiceBuilder.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-tomcat-builder/src/test/java/org/apache/geronimo/tomcat/deployment/MockWebServiceBuilder.java
Sun Nov 26 16:45:10 2006
@@ -17,29 +17,27 @@
 package org.apache.geronimo.tomcat.deployment;
 
 import java.util.Map;
-import java.util.Collections;
 import java.util.jar.JarFile;
 
-import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.webservices.SerializableWebServiceContainerFactoryGBean;
 
 /**
  * @version $Rev$ $Date$
  */
 public class MockWebServiceBuilder implements WebServiceBuilder {
-    public Map findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations,
Environment environment) throws DeploymentException {
-        return Collections.EMPTY_MAP;
+    public void findWebServices(JarFile moduleFile, boolean isEJB, Map correctedPortLocations,
Environment environment, Map sharedContext) throws DeploymentException {
     }
 
-    public void configurePOJO(GBeanData targetGBean, Module module, Object portInfo, String
seiClassName, DeploymentContext context) throws DeploymentException {
+    public boolean configurePOJO(GBeanData targetGBean, String servletName, Module module,
String seiClassName, DeploymentContext context) throws DeploymentException {
         AbstractName webServiceContainerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(),
"webServiceContainer", NameFactory.GERONIMO_SERVICE);
         GBeanData webServiceContainerFactoryGBean = new GBeanData(webServiceContainerFactoryName,
SerializableWebServiceContainerFactoryGBean.GBEAN_INFO);
         try {
@@ -48,8 +46,10 @@
             throw new DeploymentException("Could not add webServiceContainerFactoryGBean",
e);
         }
         targetGBean.setReferencePattern("WebServiceContainerFactory", webServiceContainerFactoryName);
+        return true;
     }
 
-    public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfo,
ClassLoader classLoader) throws DeploymentException {
+    public boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile,
Map sharedContext, ClassLoader classLoader) throws DeploymentException {
+        return true;
     }
 }



Mime
View raw message