geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r202433 - in /geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis/src/java/org/apache/geronimo/axis/server/ client-builder/src/java/org/apache/geronimo/client/builder/ connector-builder/src/java/org/apache/g...
Date Wed, 29 Jun 2005 21:34:37 GMT
Author: djencks
Date: Wed Jun 29 14:34:34 2005
New Revision: 202433

URL: http://svn.apache.org/viewcvs?rev=202433&view=rev
Log:
fix wsdl query rewriting.  this should be reviewed at leisure.  Involves a ModuleBuilder interface
change.

Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
    geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Wed Jun 29 14:34:34 2005
@@ -102,8 +102,8 @@
 
     //WebServiceBuilder
 
-    public Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB)
throws DeploymentException {
-        return WSDescriptorParser.parseWebServiceDescriptor(wsDDUrl, moduleFile, isEJB);
+    public Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB,
Map servletLocations) throws DeploymentException {
+        return WSDescriptorParser.parseWebServiceDescriptor(wsDDUrl, moduleFile, isEJB, servletLocations);
     }
 
     public void configurePOJO(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject,
String seiClassName, ClassLoader classLoader) throws DeploymentException {

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
Wed Jun 29 14:34:34 2005
@@ -29,6 +29,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collections;
 import java.util.jar.JarFile;
 import javax.wsdl.Binding;
 import javax.wsdl.BindingInput;
@@ -74,7 +75,7 @@
     private static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
     private static final QName ADDRESS_QNAME = new QName(SOAP_NS, "address");
     private static final QName LOCATION_QNAME = new QName("", "location");
-    private static final String LOCATION_REPLACEMENT_TOKEN = AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN;
+//    private static final String LOCATION_REPLACEMENT_TOKEN = AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN;
 
 
     private static void validateLightweightMapping(Definition definition) throws DeploymentException
{
@@ -86,7 +87,8 @@
         Map portComponentsMap = null;
         try {
             URL webservicesURL = DeploymentUtil.createJarURL(jarFile, "META-INF/webservices.xml");
-            portComponentsMap = WSDescriptorParser.parseWebServiceDescriptor(webservicesURL,
jarFile, true);
+            //todo make sure ejbs can't be deployed elsewhere
+            portComponentsMap = WSDescriptorParser.parseWebServiceDescriptor(webservicesURL,
jarFile, true, Collections.EMPTY_MAP);
         } catch (MalformedURLException e1) {
             throw new DeploymentException("Invalid URL to webservices.xml", e1);
         }
@@ -290,7 +292,7 @@
 //                }
 //                wsdlMap.put(key.toString(), definition);
             } else if (value instanceof DefinitionsDocument) {
-                DefinitionsDocument doc = (DefinitionsDocument) value;
+                DefinitionsDocument doc = (DefinitionsDocument) ((DefinitionsDocument) value).copy();
                 TDefinitions definitions = doc.getDefinitions();
                 TImport[] imports = definitions.getImportArray();
                 for (int i = 0; i < imports.length; i++) {
@@ -316,24 +318,25 @@
                         typeCursor.dispose();
                     }
                 }
+                //now done in SchemaInfoBuilder
                 //prepare for location substitution
-                TService[] services = definitions.getServiceArray();
-                for (int i = 0; i < services.length; i++) {
-                    TService service = services[i];
-                    TPort[] ports = service.getPortArray();
-                    for (int j = 0; j < ports.length; j++) {
-                        TPort port = ports[j];
-                        XmlCursor portCursor = port.newCursor();
-                        try {
-                            if (portCursor.toChild(ADDRESS_QNAME)) {
-                                //TODO rewrite the path from the actual deployed location,
and just replace the schema/host/port
-                                portCursor.setAttributeText(LOCATION_QNAME, LOCATION_REPLACEMENT_TOKEN);
-                            }
-                        } finally {
-                            portCursor.dispose();
-                        }
-                    }
-                }
+//                TService[] services = definitions.getServiceArray();
+//                for (int i = 0; i < services.length; i++) {
+//                    TService service = services[i];
+//                    TPort[] ports = service.getPortArray();
+//                    for (int j = 0; j < ports.length; j++) {
+//                        TPort port = ports[j];
+//                        XmlCursor portCursor = port.newCursor();
+//                        try {
+//                            if (portCursor.toChild(ADDRESS_QNAME)) {
+//                                //TODO rewrite the path from the actual deployed location,
and just replace the schema/host/port
+//                                portCursor.setAttributeText(LOCATION_QNAME, LOCATION_REPLACEMENT_TOKEN);
+//                            }
+//                        } finally {
+//                            portCursor.dispose();
+//                        }
+//                    }
+//                }
                 wsdlMap.put(key.toString(), doc.toString());
             } else {
                 throw new DeploymentException("Unexpected element in wsdlMap at location:
" + key + ", value: " + value);
@@ -367,11 +370,12 @@
             if (importLocationURI.isAbsolute() || importLocationURI.getPath().startsWith("/"))
{
                 return importLocationURI;
             }
-            return new URI(null,
+            URI queryURI =  new URI(null,
                     null,
                     contextURI.getPath(),
                     "wsdl=" + key.resolve(importLocationURI),
                     null);
+            return queryURI;
         } catch (URISyntaxException e) {
             throw new DeploymentException("Could not construct wsdl location URI", e);
         }

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
Wed Jun 29 14:34:34 2005
@@ -51,6 +51,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.xbeans.wsdl.DefinitionsDocument;
+import org.apache.geronimo.axis.server.AxisWebServiceContainer;
 import org.apache.xmlbeans.SchemaField;
 import org.apache.xmlbeans.SchemaGlobalElement;
 import org.apache.xmlbeans.SchemaParticle;
@@ -557,6 +558,20 @@
         }
     }
 
+    public void movePortLocation(String portComponentName, String servletLocation) throws
DeploymentException {
+        Map services = definition.getServices();
+        for (Iterator iterator = services.values().iterator(); iterator.hasNext();) {
+            Service service = (Service) iterator.next();
+            Port port = service.getPort(portComponentName);
+            if (port != null) {
+                SOAPAddress soapAddress = (SOAPAddress) getExtensibilityElement(SOAPAddress.class,
port.getExtensibilityElements());
+                soapAddress.setLocationURI(AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN
+ "/" +  servletLocation);
+                return;
+            }
+        }
+        throw new DeploymentException("No port found with name " + portComponentName + "
expected at " + servletLocation);
+    }
+
     private class JarEntityResolver implements EntityResolver {
 
         private final static String PROJECT_URL_PREFIX = "project://local/";
@@ -584,12 +599,12 @@
     class JarWSDLLocator implements WSDLLocator {
 
         private final URI wsdlURI;
-        private final WSDLReader wsdlReader;
+//        private final WSDLReader wsdlReader;
         private URI latestImportURI;
 
         public JarWSDLLocator(URI wsdlURI, WSDLReader wsdlReader) {
             this.wsdlURI = wsdlURI;
-            this.wsdlReader = wsdlReader;
+//            this.wsdlReader = wsdlReader;
         }
 
         public InputSource getBaseInputSource() {

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java
Wed Jun 29 14:34:34 2005
@@ -283,10 +283,11 @@
      * @param webservicesType
      * @param moduleFile
      * @param isEJB
+     * @param servletLocations
      * @return
      * @throws org.apache.geronimo.common.DeploymentException
      */
-    public static Map parseWebServiceDescriptor(WebservicesType webservicesType, JarFile
moduleFile, boolean isEJB) throws DeploymentException {
+    public static Map parseWebServiceDescriptor(WebservicesType webservicesType, JarFile
moduleFile, boolean isEJB, Map servletLocations) throws DeploymentException {
         Map portMap = new HashMap();
         WebserviceDescriptionType[] webserviceDescriptions = webservicesType.getWebserviceDescriptionArray();
         for (int i = 0; i < webserviceDescriptions.length; i++) {
@@ -314,6 +315,7 @@
                 seiMappings.put(seiMapping.getServiceEndpointInterface().getStringValue(),
seiMapping);
             }
 
+//            Map portLocations = new HashMap();
             PortComponentType[] portComponents = webserviceDescription.getPortComponentArray();
             for (int j = 0; j < portComponents.length; j++) {
                 PortComponentType portComponent = portComponents[j];
@@ -327,6 +329,12 @@
                 String linkName;
                 if (serviceImplBeanType.isSetServletLink()) {
                     linkName = serviceImplBeanType.getServletLink().getStringValue().trim();
+                    String servletLocation = (String) servletLocations.get(linkName);
+                    if (servletLocation == null) {
+                        throw new DeploymentException("No servlet mapping for port " + portQName);
+                    }
+                    schemaInfoBuilder.movePortLocation(portComponentName, servletLocation);
+//                    portLocations.put(portComponentName, servletLocation);
                 } else {
                     linkName = serviceImplBeanType.getEjbLink().getStringValue().trim();
                 }
@@ -351,7 +359,7 @@
         }
         return portMap;
     }
-    
+
     private static URI getAddressLocation(Port port) throws DeploymentException {
         SOAPAddress soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class,
port.getExtensibilityElements());
         String locationURIString = soapAddress.getLocationURI();
@@ -364,12 +372,12 @@
         }
     }
 
-    public static Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean
isEJB) throws DeploymentException {
+    public static Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean
isEJB, Map servletLocations) throws DeploymentException {
         try {
             WebservicesDocument webservicesDocument = WebservicesDocument.Factory.parse(wsDDUrl);
             SchemaConversionUtils.validateDD(webservicesDocument);
             WebservicesType webservicesType = webservicesDocument.getWebservices();
-            return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB);
+            return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB, servletLocations);
         } catch (XmlException e) {
             throw new DeploymentException("Could not read descriptor document", e);
         } catch (IOException e) {

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
Wed Jun 29 14:34:34 2005
@@ -22,7 +22,6 @@
 import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 import javax.wsdl.OperationType;
-import javax.wsdl.WSDLException;
 import javax.xml.soap.MimeHeader;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPMessage;
@@ -60,7 +59,6 @@
 
     private final ClassLoader classLoader;
     private final Map wsdlMap;
-//    private transient WSDLWriter wsdlWriter;
 
     public AxisWebServiceContainer(URI location, URI wsdlURL, SOAPService service, Map wsdlMap,
ClassLoader classLoader) {
         this.location = location;
@@ -68,8 +66,6 @@
         this.service = service;
         this.wsdlMap = wsdlMap;
         this.classLoader = classLoader;
-//        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-//        wsdlWriter = wsdlFactory.newWSDLWriter();
     }
 
     public void invoke(Request req, Response res) throws Exception {
@@ -229,6 +225,7 @@
 
     public void getWsdl(Request request, Response response) throws Exception {
         URI realLocation = request.getURI();
+//        log.info("Request at " + realLocation);
         String query = realLocation.getQuery();
         if (query == null || !query.toLowerCase().startsWith("wsdl")) {
             throw new IllegalStateException("request must contain a  wsdl or WSDL parameter:
" + request.getParameters());
@@ -243,75 +240,19 @@
         if (wsdl == null) {
             throw new IllegalStateException("No wsdl or schema known at location: " + locationKey);
         }
-//        if (wsdl instanceof String) {
-//            log.info("===========XSD==============" + locationKey);
-//            log.info(wsdl);
             URI updated = new URI(realLocation.getScheme(),
                     realLocation.getUserInfo(),
                     realLocation.getHost(),
                     realLocation.getPort(),
-                    realLocation.getPath(), //TODO this is very wrong for services containing
more than one port.
+                    null,  //try null for no path
                     null,
                     null);
             String replaced = ((String)wsdl).replaceAll(LOCATION_REPLACEMENT_TOKEN, updated.toString());
             response.getOutputStream().write(replaced.getBytes());
-//        } else {
-//             Definition definition = (Definition) wsdl;
-//            synchronized (definition) {
-//                Map services = definition.getServices();
-//                for (Iterator iter1 = services.values().iterator(); iter1.hasNext();) {
-//                    Service service = (Service) iter1.next();
-//                    Map ports = service.getPorts();
-//                    for (Iterator iter2 = ports.values().iterator(); iter2.hasNext();)
{
-//                        Port port = (Port) iter2.next();
-//                        for (Iterator iter3 = port.getExtensibilityElements().iterator();
iter3.hasNext();) {
-//                            ExtensibilityElement element = (ExtensibilityElement) iter3.next();
-//                            if (element instanceof SOAPAddress) {
-//                                SOAPAddress soapAddress = (SOAPAddress) element;
-//                                // We replace the host and port here.
-//                                String oldLocation = soapAddress.getLocationURI();
-//                                URI oldLocationURI = new URI(oldLocation);
-//                                URI updated = new URI(realLocation.getScheme(),
-//                                        realLocation.getUserInfo(),
-//                                        realLocation.getHost(),
-//                                        realLocation.getPort(),
-//                                        oldLocationURI.getPath(), // Humm is this right?
-//                                        null,
-//                                        null);
-//                                soapAddress.setLocationURI(updated.toString());
-//                            }
-//                        }
-//                    }
-//                }
-//                log.info("===========WSDL==============" + locationKey);
-//                OutputStream baos = new java.io.ByteArrayOutputStream();
-//                wsdlWriter.writeWSDL(definition, baos);
-//                log.info(baos.toString());
-
-                // Dump the WSDL dom to the output stream
-//                OutputStream out = response.getOutputStream();
-//                wsdlWriter.writeWSDL(definition, out);
-//
-//            }
-//        }
     }
 
     public URI getLocation() {
         return location;
     }
-
-//    private void readObject(ObjectInputStream in) throws IOException {
-//        try {
-//            in.defaultReadObject();
-//        } catch (ClassNotFoundException e) {
-//            throw (IOException)new IOException("Could not deserialize!").initCause(e);
-//        }
-//        try {
-//            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-//            wsdlWriter = wsdlFactory.newWSDLWriter();
-//        } catch (WSDLException e) {
-//            throw (IOException)new IOException("Could not construct transient wsdlWriter").initCause(e);
-//        }
-//    }
 
 }

Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Wed Jun 29 14:34:34 2005
@@ -127,7 +127,7 @@
         return createModule(plan, moduleFile, "app-client", null, null, true);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return createModule(plan, moduleFile, targetPath, specDDUrl, earConfigId, false);
     }
 
@@ -425,7 +425,7 @@
                                 }
                             }
                             XmlObject connectorPlan = resource.getConnector();
-                            Module connectorModule = connectorModuleBuilder.createModule(connectorPlan,
connectorFile, path, null, null);
+                            Module connectorModule = connectorModuleBuilder.createModule(connectorPlan,
connectorFile, path, null, null, null);
                             resourceModules.add(connectorModule);
                             connectorModuleBuilder.installModule(connectorFile, appClientDeploymentContext,
connectorModule);
                         }

Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Wed Jun 29 14:34:34 2005
@@ -144,7 +144,7 @@
         return createModule(plan, moduleFile, "rar", null, true);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return createModule(plan, moduleFile, targetPath, specDDUrl, false);
     }
 

Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
(original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
Wed Jun 29 14:34:34 2005
@@ -324,7 +324,7 @@
             Thread.currentThread().setContextClassLoader(cl);
 
             JarFile rarJarFile = DeploymentUtil.createJarFile(rarFile);
-            Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile,
j2eeContext.getJ2eeModuleName(), action.getSpecDD(), null);
+            Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile,
j2eeContext.getJ2eeModuleName(), action.getSpecDD(), null, null);
             if (module == null) {
                 throw new DeploymentException("Was not a connector module");
             }

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Wed Jun 29 14:34:34 2005
@@ -442,6 +442,7 @@
                 String modulePath;
                 ModuleBuilder builder;
 
+                Object moduleContextInfo = null;
                 String moduleTypeName;
                 if (moduleXml.isSetEjb()) {
                     modulePath = moduleXml.getEjb().getStringValue();
@@ -457,6 +458,7 @@
                     }
                     builder = webConfigBuilder;
                     moduleTypeName = "a war";
+                    moduleContextInfo = moduleXml.getWeb().getContextRoot().getStringValue().trim();
                 } else if (moduleXml.isSetConnector()) {
                     modulePath = moduleXml.getConnector().getStringValue();
                     if (connectorConfigBuilder == null) {
@@ -497,15 +499,16 @@
                         moduleFile,
                         modulePath,
                         altSpecDD,
-                        URI.create(gerApplication.getConfigId()));
+                        URI.create(gerApplication.getConfigId()),
+                        moduleContextInfo);
 
                 if (module == null) {
                     throw new DeploymentException("Module was not " + moduleTypeName + ":
" + modulePath);
                 }
 
-                if (module instanceof WebModule) {
-                    ((WebModule) module).setContextRoot(moduleXml.getWeb().getContextRoot().getStringValue());
-                }
+//                if (module instanceof WebModule) {
+//                    ((WebModule) module).setContextRoot(moduleXml.getWeb().getContextRoot().getStringValue());
+//                }
 
                 modules.add(module);
             }

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
Wed Jun 29 14:34:34 2005
@@ -29,7 +29,7 @@
 public interface ModuleBuilder {
     Module createModule(File plan, JarFile moduleFile) throws DeploymentException;
 
-    Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException;
+    Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException;
 
     void installModule(JarFile earFile, EARContext earContext, Module module) throws DeploymentException;
 

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
Wed Jun 29 14:34:34 2005
@@ -32,7 +32,7 @@
  */
 public class UnavailableWebServiceBuilder implements WebServiceBuilder {
 
-    public Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB)
throws DeploymentException {
+    public Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB,
Map correctedPortLocations) throws DeploymentException {
         return new HashMap();
     }
 

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
Wed Jun 29 14:34:34 2005
@@ -27,7 +27,7 @@
  */
 public interface WebServiceBuilder {
 
-    Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB) throws
DeploymentException;
+    Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB, Map correctedPortLocations)
throws DeploymentException;
 
     //obviously these need the deployment descriptors, but I'm not sure in what form yet.
     /**

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
Wed Jun 29 14:34:34 2005
@@ -40,7 +40,7 @@
         return new ConnectorModule(true, null, null, moduleFile, "connector", null, null,
null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return new ConnectorModule(false, null, null, moduleFile, targetPath, null, null,
null);
     }
 

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
Wed Jun 29 14:34:34 2005
@@ -40,7 +40,7 @@
         return new EJBModule(true, null, null, moduleFile, "ejb.jar", null, null, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return new EJBModule(false, null, null, moduleFile, targetPath, null, null, null);
     }
 

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
Wed Jun 29 14:34:34 2005
@@ -41,7 +41,7 @@
         return new WebModule(true, null, null, moduleFile, "war", null, null, null, portMap);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return new WebModule(false, null, null, moduleFile, targetPath, null, null, null,
portMap);
     }
 

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Wed Jun 29 14:34:34 2005
@@ -162,14 +162,14 @@
     }
 
     public Module createModule(File plan, JarFile moduleFile) throws DeploymentException
{
-        return createModule(plan, moduleFile, "war", null, true);
+        return createModule(plan, moduleFile, "war", null, true, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false);
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo);
     }
 
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
boolean standAlone) throws DeploymentException {
+    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
boolean standAlone, String contextRoot) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -200,18 +200,23 @@
         }
         check(webApp);
 
+        // parse vendor dd
+        JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
+        if (contextRoot == null) {
+            contextRoot = jettyWebApp.getContextRoot();
+        }
+
+        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
+
         //look for a webservices dd
         Map portMap = Collections.EMPTY_MAP;
         try {
             URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
-            portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile, false);
+            portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile, false,
servletNameToPathMap);
         } catch (MalformedURLException e) {
             //no descriptor
         }
 
-        // parse vendor dd
-        JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
-
         // get the ids from either the application plan or for a stand alone module from
the specific deployer
         URI configId = null;
         try {
@@ -232,8 +237,26 @@
         }
 
         WebModule module = new WebModule(standAlone, configId, parentId, moduleFile, targetPath,
webApp, jettyWebApp, specDD, portMap);
-        module.setContextRoot(jettyWebApp.getContextRoot());
+        module.setContextRoot(contextRoot);
         return module;
+    }
+
+    /**
+     * Some servlets will have multiple url patterns.  However, webservice servlets
+     * will only have one, which is what this method is intended for.
+     * @param webApp
+     * @param contextRoot
+     * @return
+     */
+    private Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
+        Map map = new HashMap();
+        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
+        for (int j = 0; j < servletMappings.length; j++) {
+            ServletMappingType servletMapping = servletMappings[j];
+            String servletName = servletMapping.getServletName().getStringValue().trim();
+            map.put(servletName, contextRoot + servletMapping.getUrlPattern().getStringValue());
+        }
+        return map;
     }
 
     JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String
targetPath, WebAppType webApp) throws DeploymentException {

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=202433&r1=202432&r2=202433&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Wed Jun 29 14:34:34 2005
@@ -140,7 +140,7 @@
         return createModule(plan, moduleFile, "war", null, true);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
URI earConfigId, Object moduleContextInfo) throws DeploymentException {
         return createModule(plan, moduleFile, targetPath, specDDUrl, false);
     }
 
@@ -177,10 +177,12 @@
 
         //look for a webservices dd
         Map portMap = Collections.EMPTY_MAP;
+        //TODO make this like jetty !!
+        Map servletNameToPathMap = new HashMap();
         if (webServiceBuilder != null) {
             try {
                 URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
-                portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile,
false);
+                portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile,
false, servletNameToPathMap);
             } catch (MalformedURLException e) {
                 //no descriptor
             }



Mime
View raw message