geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r781487 - in /geronimo/server/branches/2.1/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/...
Date Wed, 03 Jun 2009 17:26:40 GMT
Author: gawor
Date: Wed Jun  3 17:26:39 2009
New Revision: 781487

URL: http://svn.apache.org/viewvc?rev=781487&view=rev
Log:
catch @WebServiceProvider servies without WSDL early (GERONIMO-4664)

Modified:
    geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
    geronimo/server/branches/2.1/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
    geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
    geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java

Modified: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?rev=781487&r1=781486&r2=781487&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
(original)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
Wed Jun  3 17:26:39 2009
@@ -26,8 +26,6 @@
 import java.util.Map;
 import java.util.jar.JarFile;
 
-import javax.xml.ws.http.HTTPBinding;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.axis2.pojo.POJOWebServiceContainerFactoryGBean;
@@ -192,17 +190,22 @@
     @Override
     protected void initialize(GBeanData targetGBean, Class serviceClass, PortInfo portInfo,
Module module) 
         throws DeploymentException {
+        String serviceName = (portInfo.getServiceName() == null ? serviceClass.getName()
: portInfo.getServiceName());
         if (isWsdlSet(portInfo, serviceClass)) {
-            log.debug("Service " + portInfo.getServiceName() + " has WSDL.");
+            log.debug("Service " + serviceName + " has WSDL.");
             return;
-        }
+        }        
         
         if (isHTTPBinding(portInfo, serviceClass)) {
-            log.debug("Service " + portInfo.getServiceName() + " is HTTPBinding.  Only SOAP
1.1 or 1.2 is supported.");
+            log.debug("Service " + serviceName + " has HTTPBinding.");
             return;
         }
         
-        log.debug("Service " + portInfo.getServiceName() + " does not have WSDL. Generating
WSDL...");
+        if (JAXWSUtils.isWebServiceProvider(serviceClass)) {
+            throw new DeploymentException("WSDL must be specified for @WebServiceProvider
service " + serviceName);
+        }
+        
+        log.debug("Service " + serviceName + " does not have WSDL. Generating WSDL...");
 
         WsdlGenerator generator = new WsdlGenerator();
         generator.setAxis2SAAJ();
@@ -222,32 +225,9 @@
         String wsdlFile = generator.generateWsdl(module, serviceClass.getName(), module.getEarContext(),
portInfo);
         portInfo.setWsdlFile(wsdlFile);
         
-        log.debug("Generated " + wsdlFile + " for service " + portInfo.getServiceName());
       
-    }
-    
-    private boolean isWsdlSet(PortInfo portInfo, Class serviceClass) {
-        return (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().trim().equals(""))
-                || JAXWSUtils.containsWsdlLocation(serviceClass, serviceClass.getClassLoader());
+        log.debug("Generated " + wsdlFile + " for service " + serviceName);
     }
     
-    private boolean isHTTPBinding(PortInfo portInfo, Class serviceClass) {
-        String bindingURI = "";
-        String bindingURIFromAnnot;
-        
-        if (portInfo.getProtocolBinding() != null) {
-            bindingURI = JAXWSUtils.getBindingURI(portInfo.getProtocolBinding());
-        }        
-        bindingURIFromAnnot = JAXWSUtils.getBindingURIFromAnnot(serviceClass, serviceClass.getClassLoader());
-        
-        if (bindingURI != null && !bindingURI.trim().equals("")) {
-            return bindingURI.equals(HTTPBinding.HTTP_BINDING);
-        } else if (bindingURIFromAnnot != null && !bindingURIFromAnnot.trim().equals(""))
{
-            return bindingURIFromAnnot.equals(HTTPBinding.HTTP_BINDING);
-        } 
-        
-        return false;  
-    }
-        
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/server/branches/2.1/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java?rev=781487&r1=781486&r2=781487&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
(original)
+++ geronimo/server/branches/2.1/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
Wed Jun  3 17:26:39 2009
@@ -198,11 +198,22 @@
     
     private void generateWSDL(Class serviceClass, PortInfo portInfo, Module module) 
         throws DeploymentException {
+        String serviceName = (portInfo.getServiceName() == null ? serviceClass.getName()
: portInfo.getServiceName());
         if (isWsdlSet(portInfo, serviceClass)) {
-            LOG.debug("Service " + portInfo.getServiceName() + " has WSDL.");
+            LOG.debug("Service " + serviceName + " has WSDL.");
             return;
         }        
-        LOG.debug("Service " + portInfo.getServiceName() + " does not have WSDL. Generating
WSDL...");
+        
+        if (isHTTPBinding(portInfo, serviceClass)) {
+            LOG.debug("Service " + serviceName + " has HTTPBinding.");
+            return;
+        }
+        
+        if (JAXWSUtils.isWebServiceProvider(serviceClass)) {
+            throw new DeploymentException("WSDL must be specified for @WebServiceProvider
service " + serviceName);
+        }
+
+        LOG.debug("Service " + serviceName + " does not have WSDL. Generating WSDL...");
 
         WsdlGenerator generator = new WsdlGenerator();
         generator.setSunSAAJ();
@@ -224,14 +235,9 @@
         String wsdlFile = generator.generateWsdl(module, serviceClass.getName(), module.getEarContext(),
portInfo);
         portInfo.setWsdlFile(wsdlFile);
         
-        LOG.debug("Generated " + wsdlFile + " for service " + portInfo.getServiceName());

+        LOG.debug("Generated " + wsdlFile + " for service " + serviceName);
     }   
-    
-    private boolean isWsdlSet(PortInfo portInfo, Class serviceClass) {
-        return (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().trim().equals(""))
-                || JAXWSUtils.containsWsdlLocation(serviceClass, serviceClass.getClassLoader());
-    }    
-    
+        
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java?rev=781487&r1=781486&r2=781487&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
(original)
+++ geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
Wed Jun  3 17:26:39 2009
@@ -23,6 +23,8 @@
 import java.util.Map;
 import java.util.jar.JarFile;
 
+import javax.xml.ws.http.HTTPBinding;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
@@ -228,4 +230,28 @@
             throw new DeploymentException("Unable to load Web Service class: " + className,
ex);
         }
     }
+
+    protected boolean isWsdlSet(PortInfo portInfo, Class serviceClass) {
+        return (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().trim().equals(""))
+                || JAXWSUtils.containsWsdlLocation(serviceClass, serviceClass.getClassLoader());
+    }
+    
+    protected boolean isHTTPBinding(PortInfo portInfo, Class serviceClass) {
+        String bindingURI = "";
+        String bindingURIFromAnnot;
+        
+        if (portInfo.getProtocolBinding() != null) {
+            bindingURI = JAXWSUtils.getBindingURI(portInfo.getProtocolBinding());
+        }        
+        bindingURIFromAnnot = JAXWSUtils.getBindingURIFromAnnot(serviceClass, serviceClass.getClassLoader());
+        
+        if (bindingURI != null && !bindingURI.trim().equals("")) {
+            return bindingURI.equals(HTTPBinding.HTTP_BINDING);
+        } else if (bindingURIFromAnnot != null && !bindingURIFromAnnot.trim().equals(""))
{
+            return bindingURIFromAnnot.equals(HTTPBinding.HTTP_BINDING);
+        } 
+        
+        return false;  
+    }
+
 }

Modified: geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java?rev=781487&r1=781486&r2=781487&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
(original)
+++ geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
Wed Jun  3 17:26:39 2009
@@ -76,6 +76,10 @@
                  isProperWebService(clazz));
     }
     
+    public static boolean isWebServiceProvider(Class clazz) {
+        return (clazz.isAnnotationPresent(WebServiceProvider.class) && isProperWebService(clazz));
+    }
+
     private static boolean isProperWebService(Class clazz) {
         int modifiers = clazz.getModifiers();
         return (Modifier.isPublic(modifiers) &&



Mime
View raw message