geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r208809 - in /geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/
Date Sat, 02 Jul 2005 00:03:04 GMT
Author: djencks
Date: Fri Jul  1 17:02:58 2005
New Revision: 208809

URL: http://svn.apache.org/viewcvs?rev=208809&view=rev
Log:
fix broken openejb and tomcat wsdl-lookup tests

Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.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/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/PortInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java?rev=208809&r1=208808&r2=208809&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java
Fri Jul  1 17:02:58 2005
@@ -29,7 +29,7 @@
  * @version $Rev:  $ $Date:  $
  */
 public class PortInfo {
-    private final String portName;
+    private final String portComponentName;
     private final QName portQName;
     private final SchemaInfoBuilder schemaInfoBuilder;
     private final JavaWsdlMappingType javaWsdlMapping;
@@ -41,8 +41,8 @@
 
     private final String wsdlLocation;
 
-    public PortInfo(String portName, QName portQName, SchemaInfoBuilder schemaInfoBuilder,
JavaWsdlMappingType javaWsdlMapping, String seiInterfaceName, PortComponentHandlerType[] handlers,
Port port, ServiceEndpointInterfaceMappingType seiMapping, String wsdlLocation, URI contextURI)
{
-        this.portName = portName;
+    public PortInfo(String portComponentName, QName portQName, SchemaInfoBuilder schemaInfoBuilder,
JavaWsdlMappingType javaWsdlMapping, String seiInterfaceName, PortComponentHandlerType[] handlers,
Port port, ServiceEndpointInterfaceMappingType seiMapping, String wsdlLocation, URI contextURI)
{
+        this.portComponentName = portComponentName;
         this.portQName = portQName;
         this.schemaInfoBuilder = schemaInfoBuilder;
         this.javaWsdlMapping = javaWsdlMapping;
@@ -58,12 +58,8 @@
         return wsdlLocation;
     }
 
-    public String getPortName() {
-        return getPortComponentName();
-    }
-
     public String getPortComponentName() {
-        return portName;
+        return portComponentName;
     }
 
     public QName getPortQName() {

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=208809&r1=208808&r2=208809&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
Fri Jul  1 17:02:58 2005
@@ -577,28 +577,22 @@
                     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, AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN
+ "/" + servletLocation);
+                            if (servletLocation == null) {
+                                String original = portCursor.getAttributeText(LOCATION_QNAME);
+                                URI originalURI = new URI(original);
+                                servletLocation = originalURI.getPath();
+                            }
+                            portCursor.setAttributeText(LOCATION_QNAME, AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN
+ servletLocation);
                             return;
                         }
+                    } catch (URISyntaxException e) {
+                        throw new DeploymentException("Could not construct URI for ejb location
in wsdl", e);
                     } finally {
                         portCursor.dispose();
                     }
                 }
             }
         }
-
-
-//        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);
     }
 
@@ -666,7 +660,6 @@
                 ZipEntry entry = moduleFile.getEntry(latestImportURI.toString());
                 importInputStream = moduleFile.getInputStream(entry);
                 try {
-//                    Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new
InputSource(importInputStream));
                     DefinitionsDocument definition = DefinitionsDocument.Factory.parse(importInputStream);
                     importInputStream.close();
                     wsdlMap.put(latestImportURI, definition);

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=208809&r1=208808&r2=208809&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
Fri Jul  1 17:02:58 2005
@@ -333,10 +333,10 @@
                     if (servletLocation == null) {
                         throw new DeploymentException("No servlet mapping for port " + portQName);
                     }
-                    schemaInfoBuilder.movePortLocation(portComponentName, servletLocation);
-//                    portLocations.put(portComponentName, servletLocation);
+                    schemaInfoBuilder.movePortLocation(portQName.getLocalPart(), servletLocation);
                 } else {
                     linkName = serviceImplBeanType.getEjbLink().getStringValue().trim();
+                    schemaInfoBuilder.movePortLocation(portQName.getLocalPart(), null);
                 }
                 PortComponentHandlerType[] handlers = portComponent.getHandlerArray();
 

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=208809&r1=208808&r2=208809&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
Fri Jul  1 17:02:58 2005
@@ -249,6 +249,7 @@
      * @return
      */
     private Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
+        contextRoot = "/" + contextRoot;
         Map map = new HashMap();
         ServletMappingType[] servletMappings = webApp.getServletMappingArray();
         for (int j = 0; j < servletMappings.length; j++) {

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=208809&r1=208808&r2=208809&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
Fri Jul  1 17:02:58 2005
@@ -137,14 +137,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, Object moduleContextInfo) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false);
+        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 '/'";
@@ -175,18 +175,6 @@
         }
         check(webApp);
 
-        //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, servletNameToPathMap);
-            } catch (MalformedURLException e) {
-                //no descriptor
-            }
-        }
 
         // parse vendor dd
         TomcatWebAppType tomcatWebApp = getTomcatWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
@@ -209,10 +197,44 @@
         } else {
             parentId = defaultParentId;
         }
+        if (contextRoot == null) {
+            contextRoot = tomcatWebApp.getContextRoot();
+        }
+        //look for a webservices dd
+        Map portMap = Collections.EMPTY_MAP;
+        //TODO Jeff, please review
+        Map servletNameToPathMap = buildServletNameToPathMap(webApp, contextRoot);
+        if (webServiceBuilder != null) {
+            try {
+                URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
+                portMap = webServiceBuilder.parseWebServiceDescriptor(wsDDUrl, moduleFile,
false, servletNameToPathMap);
+            } catch (MalformedURLException e) {
+                //no descriptor
+            }
+        }
 
         WebModule module = new WebModule(standAlone, configId, parentId, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, portMap);
-        module.setContextRoot(tomcatWebApp.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) {
+        contextRoot = "/" + 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;
     }
 
     TomcatWebAppType getTomcatWebApp(Object plan, JarFile moduleFile, boolean standAlone,
String targetPath, WebAppType webApp) throws DeploymentException {



Mime
View raw message