geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1101342 - in /geronimo/server/trunk/plugins: axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/ cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/ jaxws/geronimo-jaxws-builder/src/main/java/o...
Date Tue, 10 May 2011 06:58:39 GMT
Author: rwonly
Date: Tue May 10 06:58:39 2011
New Revision: 1101342

URL: http://svn.apache.org/viewvc?rev=1101342&view=rev
Log:
GERONIMO-5839 only normalize the wsdl path for a) an ear contains a war, b) an ear contains
a war which contains an ejb.

Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2ServiceRefBuilder.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFServiceRefBuilder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?rev=1101342&r1=1101341&r2=1101342&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
Tue May 10 06:58:39 2011
@@ -214,20 +214,20 @@ public class Axis2Builder extends JAXWSS
         String serviceName = (portInfo.getServiceName() == null ? serviceClass.getName()
: portInfo.getServiceName());
         String wsdlFile = portInfo.getWsdlFile();
         if(wsdlFile != null && wsdlFile.trim().length() > 0) {
+            //TODO Workaround codes for web modules in the EAR package, need to add web module
name prefix
+            portInfo.setWsdlFile(JAXWSBuilderUtils.normalizeWsdlPath(module, wsdlFile));
+            
             if (log.isDebugEnabled()) {
                 log.debug("Service " + serviceName + " has WSDL. " + portInfo.getWsdlFile());
             }
-            //TODO Workaround codes for web modules in the EAR package, need to add web module
name prefix
-            if (JAXWSBuilderUtils.isWSDLNormalizedRequired(module, wsdlFile)) {
-                portInfo.setWsdlFile(module.getTargetPathURI().resolve(wsdlFile).toString());
-            }
             return;
-        } else if(JAXWSUtils.containsWsdlLocation(serviceClass, bundle)){
+        } 
+        
+        if(JAXWSUtils.containsWsdlLocation(serviceClass, bundle)){
             wsdlFile = JAXWSUtils.getServiceWsdlLocation(serviceClass, bundle);
             //TODO Workaround codes for web modules in the EAR package, need to add web module
name prefix
-            if (JAXWSBuilderUtils.isWSDLNormalizedRequired(module, wsdlFile)) {
-                portInfo.setWsdlFile(module.getTargetPathURI().resolve(wsdlFile).toString());
-            }
+            portInfo.setWsdlFile(JAXWSBuilderUtils.normalizeWsdlPath(module, wsdlFile));
+            
             if(log.isDebugEnabled()) {
                 log.debug("Service "  + serviceName + " has WSDL configured in annotation
" + wsdlFile + " and is resolved as " + portInfo.getWsdlFile());
             }

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2ServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2ServiceRefBuilder.java?rev=1101342&r1=1101341&r2=1101342&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2ServiceRefBuilder.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2ServiceRefBuilder.java
Tue May 10 06:58:39 2011
@@ -71,9 +71,8 @@ public class Axis2ServiceRefBuilder exte
 
         wsdlURI = builder.getWsdlURI();
         //TODO For non standalone web application, it is embbed of directory style in the
EAR package
-        if (JAXWSBuilderUtils.isWSDLNormalizedRequired(module, wsdlURI.toString())) {
-            wsdlURI = module.getTargetPathURI().resolve(wsdlURI);
-        }
+        wsdlURI = JAXWSBuilderUtils.normalizeWsdlPath(module, wsdlURI);
+
         serviceQName = builder.getServiceQName();
         Map<Object, EndpointInfo> seiInfoMap = builder.getEndpointInfo();
 

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java?rev=1101342&r1=1101341&r2=1101342&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
Tue May 10 06:58:39 2011
@@ -220,12 +220,12 @@ public class CXFBuilder extends JAXWSSer
         String serviceName = (portInfo.getServiceName() == null ? serviceClass.getName()
: portInfo.getServiceName());
         String wsdlFile = portInfo.getWsdlFile();
         if (isWsdlSet(portInfo, serviceClass, bundle)) {
+
+            portInfo.setWsdlFile(JAXWSBuilderUtils.normalizeWsdlPath(module, wsdlFile));
+
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Service " + serviceName + " has WSDL.");
             }
-            if (JAXWSBuilderUtils.isWSDLNormalizedRequired(module, wsdlFile)) {
-                portInfo.setWsdlFile(module.getTargetPathURI().resolve(wsdlFile).toString());
-            }
             return;
         }
 

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFServiceRefBuilder.java?rev=1101342&r1=1101341&r2=1101342&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFServiceRefBuilder.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFServiceRefBuilder.java
Tue May 10 06:58:39 2011
@@ -64,9 +64,8 @@ public class CXFServiceRefBuilder extend
         wsdlURI = builder.getWsdlURI();
 
         //TODO For non standalone web application, it is embbed of directory style in the
EAR package
-        if (JAXWSBuilderUtils.isWSDLNormalizedRequired(module, wsdlURI.toString())) {
-            wsdlURI = module.getTargetPathURI().resolve(wsdlURI);
-        }
+        wsdlURI = JAXWSBuilderUtils.normalizeWsdlPath(module, wsdlURI);
+
         serviceQName = builder.getServiceQName();
         Map<Object, EndpointInfo> seiInfoMap = builder.getEndpointInfo();
 

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java?rev=1101342&r1=1101341&r2=1101342&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
Tue May 10 06:58:39 2011
@@ -17,13 +17,14 @@
 
 package org.apache.geronimo.jaxws.builder;
 
+import java.net.URI;
 import java.net.URL;
 
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 
 public class JAXWSBuilderUtils {    
-    public static boolean isURL(String name) {
+    private static boolean isURL(String name) {
         try {
             new URL(name);
             return true;
@@ -32,9 +33,52 @@ public class JAXWSBuilderUtils {    
         }
     }
 
-    public static boolean isWSDLNormalizedRequired(Module module, String wsdlLocation) {
-        return (module.getType().equals(ConfigurationModuleType.WAR) || (module.getType().equals(ConfigurationModuleType.EJB)
&& module.getParentModule() != null && module.getParentModule().getType()
-                .equals(ConfigurationModuleType.WAR)))
-                && !isURL(wsdlLocation);
+    public static String normalizeWsdlPath(Module module, String wsdlLocation){
+        // is Absolute URL path
+        if (isURL(wsdlLocation)) return wsdlLocation;
+        
+        // EAR
+        //   L WAR
+        if (module.getType().equals(ConfigurationModuleType.WAR) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.EAR))
+            return module.getTargetPathURI().resolve(wsdlLocation).toString();
+        
+        // EAR 
+        //   L WAR
+        //       L EJB
+        if (module.getType().equals(ConfigurationModuleType.EJB) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.WAR)
+                && module.getParentModule().getParentModule() != null &&
module.getParentModule().getParentModule().getType().equals(ConfigurationModuleType.EAR))
+            return module.getParentModule().getTargetPathURI().resolve(wsdlLocation).toString();
+        
+            
+        return wsdlLocation;
+    }
+    
+    private static boolean isURL(URI name) {
+        try {
+            name.toURL();
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    public static URI normalizeWsdlPath(Module module, URI wsdlUri){
+        // is Absolute URL path
+        if (isURL(wsdlUri)) return wsdlUri;
+        
+        // EAR
+        //   L WAR
+        if (module.getType().equals(ConfigurationModuleType.WAR) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.EAR))
+            return module.getTargetPathURI().resolve(wsdlUri);
+        
+        // EAR 
+        //   L WAR
+        //       L EJB
+        if (module.getType().equals(ConfigurationModuleType.EJB) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.WAR)
+                && module.getParentModule().getParentModule() != null &&
module.getParentModule().getParentModule().getType().equals(ConfigurationModuleType.EAR))
+            return module.getParentModule().getTargetPathURI().resolve(wsdlUri);
+        
+            
+        return wsdlUri;
     }
 }



Mime
View raw message