geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r480154 - /geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
Date Tue, 28 Nov 2006 18:45:29 GMT
Author: jbohn
Date: Tue Nov 28 10:45:28 2006
New Revision: 480154

URL: http://svn.apache.org/viewvc?view=rev&rev=480154
Log:
Add updates to match trunk changes in rev 479496:
GERONIMO-2597 make web service builder optional and allow multiple builders

Modified:
    geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java

Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java?view=diff&rev=480154&r1=480153&r2=480154
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
Tue Nov 28 10:45:28 2006
@@ -57,7 +57,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;
@@ -131,7 +130,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;
@@ -162,7 +161,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
@@ -170,10 +169,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;
@@ -247,7 +242,12 @@
 
         Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
 
-        Map portMap = getWebServiceBuilder().findWebServices(moduleFile, false, servletNameToPathMap,
environment);        AbstractName moduleName;
+        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);
             moduleName = naming.createChildName(earName, environment.getConfigId().toString(),
NameFactory.WEB_MODULE);
@@ -255,7 +255,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 {
@@ -489,10 +489,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);
@@ -875,7 +874,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      an <code>EARContext</code> value
      * @throws DeploymentException if an error occurs
      */
@@ -884,7 +882,7 @@
             ServletType[] servletTypes,
             Map servletMappings,
             Set securityRoles,
-            Map rolePermissions, Map portMap,
+            Map rolePermissions,
             EARContext moduleContext) throws DeploymentException {
 
         // this TreeSet will order the ServletTypes based on whether
@@ -908,7 +906,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
@@ -923,7 +921,6 @@
      * @param servletMappings
      * @param securityRoles
      * @param rolePermissions
-     * @param portMap
      * @param moduleContext
      * @return AbstractName of servlet gbean added
      * @throws DeploymentException
@@ -934,7 +931,7 @@
             ServletType servletType,
             Map servletMappings,
             Set securityRoles,
-            Map rolePermissions, Map portMap,
+            Map rolePermissions,
             EARContext moduleContext) throws DeploymentException {
         String servletName = servletType.getServletName().getStringValue().trim();
         AbstractName servletAbstractName = moduleContext.getNaming().createChildName(webModuleName,
servletName, NameFactory.SERVLET);
@@ -962,11 +959,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);



Mime
View raw message