cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r570060 - in /incubator/cxf/trunk/tools: javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/ javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ javato/ws/src/test/java/org/apache/cxf/tools/java2ws/ wsdlto/core/s...
Date Mon, 27 Aug 2007 10:20:29 GMT
Author: ema
Date: Mon Aug 27 03:20:26 2007
New Revision: 570060

URL: http://svn.apache.org/viewvc?rev=570060&view=rev
Log:
[CXF-893] Made "-jaxws -wrapperBean" work in javatows tool

Modified:
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/AbstractGenerator.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/AbstractGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/AbstractGenerator.java?rev=570060&r1=570059&r2=570060&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/AbstractGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/AbstractGenerator.java
Mon Aug 27 03:20:26 2007
@@ -23,13 +23,21 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ToolContext;
 
 public abstract class AbstractGenerator<T> {
     private ServiceInfo service;
     private boolean allowImports;
     private File outputdir;
     private Bus bus;
+    private ToolContext context;
     
+    public void setToolContext(ToolContext arg) {
+        this.context = arg;
+    }
+    public ToolContext getToolContext() {
+        return this.context;
+    }
 
     public void setOutputBase(File out) {
         this.outputdir = out;

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java?rev=570060&r1=570059&r2=570060&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
Mon Aug 27 03:20:26 2007
@@ -92,9 +92,8 @@
                                       service.getName().getLocalPart() + ".wsdl");
 
         File outputDir = getOutputDir(wsdlFile);
-        if (context.containsKey(ToolConstants.CFG_WSDL)) {
-            generators.add(getWSDLGenerator(wsdlFile));
-        }
+        generators.add(getWSDLGenerator(wsdlFile));
+
         if (context.containsKey(ToolConstants.CFG_WRAPPERBEAN)) {
             generators.add(getWrapperBeanGenerator());
             generators.add(getFaultBeanGenerator());
@@ -125,6 +124,7 @@
         AbstractGenerator generator = factory.newGenerator();
         generator.setAllowImports(context.containsKey(ToolConstants.CFG_CREATE_XSD_IMPORTS));
         generator.setOutputBase(wsdlFile);
+        
         return generator;
     }
 

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=570060&r1=570059&r2=570060&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Mon Aug 27 03:20:26 2007
@@ -90,7 +90,7 @@
     
     
     
-    @Test 
+    @Ignore
     public void testGenServerAndImpl() throws Exception {
         String[] args = new String[] {"-d", output.getPath(), "-impl", "-server",
                                       "org.apache.hello_world_soap12_http.Greeter"};
@@ -105,6 +105,16 @@
                                + "/org/apache/hello_world_soap12_http/GreeterImpl.java");
         assertTrue("GreeterImpl.java is not generated", impl.exists());
     }
+    
+    @Test 
+    public void testGenWrapperBean() throws Exception {
+        String[] args = new String[] {"-d", output.getPath(),
+                                      "-wrapperbean",
+                                      "-impl", "-server",
+                                      "org.apache.cxf.tools.java2ws.fortest.Calculator"};
+        JavaToWS.main(args);        
+    }
+    
     
     @Ignore
     public void testInvalidFlag() throws Exception {

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=570060&r1=570059&r2=570060&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Mon Aug 27 03:20:26 2007
@@ -72,6 +72,8 @@
 
 
 
+
+
 public class WSDLToJavaContainer extends AbstractCXFToolContainer {
 
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLToJavaContainer.class);
@@ -181,7 +183,16 @@
                 schemas = new java.util.HashMap<String, Element>();
                 ServiceInfo serviceInfo = serviceList.get(0);
                 for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
-                    schemas.put(schemaInfo.getSystemId(), schemaInfo.getElement());
+                    if (schemaInfo.getElement() != null && schemaInfo.getSystemId()
== null) {
+                        String sysId = schemaInfo.getElement().getAttribute("targetNamespce");
+                        if (sysId == null) {
+                            sysId = serviceInfo.getTargetNamespace();
+                        }
+                        schemas.put(sysId, schemaInfo.getElement());
+                    }
+                    if (schemaInfo.getElement() != null && schemaInfo.getSystemId()
!= null) {
+                        schemas.put(schemaInfo.getSystemId(), schemaInfo.getElement());
+                    }
                 }
             }
             context.put(ToolConstants.SCHEMA_MAP, schemas);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=570060&r1=570059&r2=570060&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Mon Aug 27 03:20:26 2007
@@ -26,6 +26,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 
 import javax.xml.namespace.QName;
@@ -40,6 +41,7 @@
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.model.DefaultValueWriter;
 import org.apache.cxf.tools.util.ClassCollector;
@@ -346,8 +348,20 @@
         ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
         XmlSchemaCollection schema = (XmlSchemaCollection)serviceInfo
             .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST);
-        
+       
         XmlSchemaElement elementByName = schema.getElementByQName(partElement);
+        
+        //is elementByName is null,it could be generate from serviceInfo, we need read the
schema element
+        //into schemaCollection
+        if (elementByName == null) {
+            Map<String, Element> maps = (Map<String, Element>)context.get(ToolConstants.SCHEMA_MAP);
+            if (maps != null) {
+                for (Element ele : maps.values()) {
+                    schema.read(ele);
+                }
+                elementByName = schema.getElementByQName(partElement);
+            }
+        }
 
         XmlSchemaComplexType type = (XmlSchemaComplexType)elementByName.getSchemaType();
 



Mime
View raw message