cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1058189 - in /cxf/branches/2.3.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/
Date Wed, 12 Jan 2011 15:27:21 GMT
Author: dkulp
Date: Wed Jan 12 15:27:21 2011
New Revision: 1058189

URL: http://svn.apache.org/viewvc?rev=1058189&view=rev
Log:
Merged revisions 1058163 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1058163 | dkulp | 2011-01-12 10:00:08 -0500 (Wed, 12 Jan 2011) | 2 lines
  
  [CXF-3092,CXF-3093] Make sure the Documentation annotaions are handled
  at endpoint selection time, not when the server is created.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
    cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=1058189&r1=1058188&r2=1058189&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
Wed Jan 12 15:27:21 2011
@@ -87,6 +87,7 @@ public class AnnotationsFactoryBeanListe
             break;
         }
         case ENDPOINT_SELECTED: {
+            Class<?> implCls = args.length > 3 ? (Class<?>)args[3] : null;
             Class<?> cls = (Class<?>)args[2];
             Endpoint ep = (Endpoint)args[1];
             Bus bus = factory.getBus();
@@ -103,6 +104,27 @@ public class AnnotationsFactoryBeanListe
             if (props != null) {
                 addEndpointProperties(ep, bus, props.value());
             }
+            // To avoid the NPE
+            if (implCls == null || implCls == cls) {
+                return;
+            }
+            WSDLDocumentation doc = implCls.getAnnotation(WSDLDocumentation.class);
+            if (doc != null) {
+                addDocumentation(ep, WSDLDocumentation.Placement.SERVICE, doc);
+            }
+            WSDLDocumentationCollection col = implCls.getAnnotation(WSDLDocumentationCollection.class);
+            if (col != null) {
+                addDocumentation(ep, WSDLDocumentation.Placement.SERVICE, col.value());
+            }
+            InterfaceInfo i = ep.getEndpointInfo().getInterface();
+            List<WSDLDocumentation> docs = CastUtils.cast((List<?>)i.removeProperty(EXTRA_DOCUMENTATION));
+            if (docs != null) {
+                addDocumentation(ep, 
+                                 WSDLDocumentation.Placement.SERVICE,
+                                 docs.toArray(new WSDLDocumentation[docs.size()]));
+            }
+            addBindingOperationDocs(ep);
+            
             break; 
         }
         case SERVER_CREATED: {
@@ -116,27 +138,11 @@ public class AnnotationsFactoryBeanListe
             addSchemaValidationSupport(server.getEndpoint(), cls.getAnnotation(SchemaValidation.class));
             addFastInfosetSupport(server.getEndpoint(), cls.getAnnotation(FastInfoset.class));
             addLoggingSupport(server.getEndpoint(), bus, cls.getAnnotation(Logging.class));
-            WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
-            if (doc != null) {
-                addDocumentation(server, WSDLDocumentation.Placement.SERVICE, doc);
-            }
-            WSDLDocumentationCollection col = cls.getAnnotation(WSDLDocumentationCollection.class);
-            if (col != null) {
-                addDocumentation(server, WSDLDocumentation.Placement.SERVICE, col.value());
-            }
-            InterfaceInfo i = server.getEndpoint().getEndpointInfo().getInterface();
-            List<WSDLDocumentation> docs = CastUtils.cast((List<?>)i.removeProperty(EXTRA_DOCUMENTATION));
-            if (docs != null) {
-                addDocumentation(server, 
-                                 WSDLDocumentation.Placement.SERVICE,
-                                 docs.toArray(new WSDLDocumentation[docs.size()]));
-            }
             addEndpointProperties(server.getEndpoint(), bus, cls.getAnnotation(EndpointProperty.class));
             EndpointProperties props = cls.getAnnotation(EndpointProperties.class);
             if (props != null) {
                 addEndpointProperties(server.getEndpoint(), bus, props.value());
             }
-            addBindingOperationDocs(server);
             setScope(factory, server, cls);
             break;
         }
@@ -272,8 +278,8 @@ public class AnnotationsFactoryBeanListe
         }
     }
 
-    private void addBindingOperationDocs(Server server) {
-        for (BindingOperationInfo binfo : server.getEndpoint().getBinding()
+    private void addBindingOperationDocs(Endpoint ep) {
+        for (BindingOperationInfo binfo : ep.getBinding()
                 .getBindingInfo().getOperations()) {
             List<WSDLDocumentation> later = CastUtils.cast((List<?>)binfo.getOperationInfo()
                                                                .getProperty(EXTRA_DOCUMENTATION));
@@ -390,7 +396,7 @@ public class AnnotationsFactoryBeanListe
             }
         }
     }
-    private void addDocumentation(Server server, 
+    private void addDocumentation(Endpoint ep, 
                                   WSDLDocumentation.Placement defPlace,
                                   WSDLDocumentation ... values) {
         for (WSDLDocumentation doc : values) {
@@ -400,20 +406,20 @@ public class AnnotationsFactoryBeanListe
             }
             switch (p) {
             case PORT_TYPE:
-                server.getEndpoint().getEndpointInfo().getService()
+                ep.getEndpointInfo().getService()
                     .getInterface().setDocumentation(doc.value());
                 break;
             case TOP:
-                server.getEndpoint().getEndpointInfo().getService().setTopLevelDoc(doc.value());
+                ep.getEndpointInfo().getService().setTopLevelDoc(doc.value());
                 break;
             case SERVICE:
-                server.getEndpoint().getEndpointInfo().getService().setDocumentation(doc.value());
+                ep.getEndpointInfo().getService().setDocumentation(doc.value());
                 break;
             case SERVICE_PORT:
-                server.getEndpoint().getEndpointInfo().setDocumentation(doc.value());
+                ep.getEndpointInfo().setDocumentation(doc.value());
                 break;
             case BINDING:
-                server.getEndpoint().getEndpointInfo().getBinding().setDocumentation(doc.value());
+                ep.getEndpointInfo().getBinding().setDocumentation(doc.value());
                 break;
             default:
                 //nothing?

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java?rev=1058189&r1=1058188&r2=1058189&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
Wed Jan 12 15:27:21 2011
@@ -115,7 +115,7 @@ public interface FactoryBeanListener {
         CLIENT_CREATED, 
         
         /**
-         * EndpointInfo, Endpoint, Class
+         * EndpointInfo, Endpoint, SEI Class, Class 
          */
         ENDPOINT_SELECTED,
         

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java?rev=1058189&r1=1058188&r2=1058189&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
Wed Jan 12 15:27:21 2011
@@ -40,6 +40,7 @@ import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.junit.Test;
@@ -154,6 +155,22 @@ public class CodeFirstWSDLTest extends A
                           d.getDocumentElement());
         assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding
doc",
                           d.getDocumentElement());
+        
+        
+        JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
+        builder.setServiceClass(CXF3093Impl.class);
+        ServiceInfo serviceInfo = builder.createService();
+        wsdlBuilder = new ServiceWSDLBuilder(bus, serviceInfo);
+        
+        def = wsdlBuilder.build();
+        d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
+        //org.apache.cxf.helpers.XMLUtils.printDOM(d);
+        assertXPathEquals("//wsdl:definitions/wsdl:documentation", "My top level documentation",
+                          d.getDocumentElement());
+        assertXPathEquals("//wsdl:definitions/wsdl:portType/wsdl:documentation", "My portType
documentation",
+                          d.getDocumentElement());
+        assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding
doc",
+                          d.getDocumentElement());
     }
 
     @WebService(targetNamespace = "http://www.example.org/contract/DoubleIt")
@@ -180,7 +197,7 @@ public class CodeFirstWSDLTest extends A
     
     @Test
     public void testDocumentationOnImpl() throws Exception {
-        //CXF-3093
+        //CXF-3092
         EndpointImpl ep = (EndpointImpl)Endpoint.publish("local://foo", new CXF3092Impl());
         ServiceWSDLBuilder wsdlBuilder = 
             new ServiceWSDLBuilder(bus, ep.getService().getServiceInfos().get(0));
@@ -193,6 +210,21 @@ public class CodeFirstWSDLTest extends A
                           d.getDocumentElement());
         assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding
doc",
                           d.getDocumentElement());
+        
+        JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
+        builder.setServiceClass(CXF3092Impl.class);
+        ServiceInfo serviceInfo = builder.createService();
+        wsdlBuilder = new ServiceWSDLBuilder(bus, serviceInfo);
+        
+        def = wsdlBuilder.build();
+        d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
+        //org.apache.cxf.helpers.XMLUtils.printDOM(d);
+        assertXPathEquals("//wsdl:definitions/wsdl:documentation", "My top level documentation",
+                          d.getDocumentElement());
+        assertXPathEquals("//wsdl:definitions/wsdl:service/wsdl:documentation", "My Service
documentation",
+                          d.getDocumentElement());
+        assertXPathEquals("//wsdl:definitions/wsdl:binding/wsdl:documentation", "My binding
doc",
+                          d.getDocumentElement());
     }
 
     @WebService(targetNamespace = "http://www.example.org/contract/DoubleIt")

Modified: cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=1058189&r1=1058188&r2=1058189&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
Wed Jan 12 15:27:21 2011
@@ -191,7 +191,7 @@ public abstract class AbstractWSDLBasedE
             ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
         }
         serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep,
-                                 serviceFactory.getServiceClass());
+                                 serviceFactory.getServiceClass(), getServiceClass());
         return ep;
     }
     private void modifyTransportIdPerAddress(EndpointInfo ei) {



Mime
View raw message