cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r603842 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/tools/common/ tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/ tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ tools/w...
Date Thu, 13 Dec 2007 06:51:35 GMT
Author: ema
Date: Wed Dec 12 22:51:31 2007
New Revision: 603842

URL: http://svn.apache.org/viewvc?rev=603842&view=rev
Log:
[CXF-1248]Map was:EndpointReferenceType to javax.xml.ws.wsaddressing.W3CEndpointReference

Added:
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/w3c-epr.wsdl
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?rev=603842&r1=603841&r2=603842&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Wed
Dec 12 22:51:31 2007
@@ -28,6 +28,7 @@
     public static final String SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
     public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
     public static final String WSDL_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/";
+    public static final String WSA_NAMESPACE_URI = "http://www.w3.org/2005/08/addressing";
     
     /**
      * Tools permit caller to pass in additional bean definitions.
@@ -85,6 +86,7 @@
     public static final String CFG_ANT = "ant";
     public static final String CFG_LIB_REF = "library.references";
     public static final String CFG_ANT_PROP = "ant.prop";
+    public static final String CFG_NO_ADDRESS_BINDING = "noAddressBinding";
 
 
 

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=603842&r1=603841&r2=603842&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
Wed Dec 12 22:51:31 2007
@@ -95,9 +95,10 @@
     @SuppressWarnings("unchecked")
     public void execute() throws ToolException {
         if (!hasInfoOption()) {
+            //TODO: After runtime support w3c EPR mapping ,this will be removed
+            context.put(ToolConstants.CFG_NO_ADDRESS_BINDING, ToolConstants.CFG_NO_ADDRESS_BINDING);
             buildToolContext();
             validate(context);
-
             FrontEndProfile frontend = context.get(FrontEndProfile.class);
 
             if (frontend == null) {
@@ -276,7 +277,9 @@
 
     public void loadDefaultNSPackageMapping(ToolContext env) {
         if (!env.hasExcludeNamespace(DEFAULT_NS2PACKAGE)
-            && env.getBooleanValue(ToolConstants.CFG_DEFAULT_NS, "true")) {
+            && env.getBooleanValue(ToolConstants.CFG_DEFAULT_NS, "true")
+            && env.get(ToolConstants.CFG_NO_ADDRESS_BINDING) != null) {
+            //currently namespace2pacakge.cfg only contains wsadressing mapping
             env.loadDefaultNS2Pck(getResourceAsStream("namespace2package.cfg"));
         }
         if (env.getBooleanValue(ToolConstants.CFG_DEFAULT_EX, "true")) {
@@ -300,6 +303,9 @@
                 String excludePackagename = pns[j];
                 if (pos != -1) {
                     String ns = pns[j].substring(0, pos);
+                    if (ns.equals(ToolConstants.WSA_NAMESPACE_URI)) {
+                        env.put(ToolConstants.CFG_NO_ADDRESS_BINDING, ToolConstants.CFG_NO_ADDRESS_BINDING);
+                    }
                     excludePackagename = pns[j].substring(pos + 1);
                     env.addExcludeNamespacePackageMap(ns, excludePackagename);
                     env.addNamespacePackageMap(ns, excludePackagename);
@@ -324,6 +330,9 @@
                 String packagename = pns[j];
                 if (pos != -1) {
                     String ns = pns[j].substring(0, pos);
+                    if (ns.equals(ToolConstants.WSA_NAMESPACE_URI)) {
+                        env.put(ToolConstants.CFG_NO_ADDRESS_BINDING, ToolConstants.CFG_NO_ADDRESS_BINDING);
+                    }
                     packagename = pns[j].substring(pos + 1);
                     env.addNamespacePackageMap(ns, packagename);
                 } else {

Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=603842&r1=603841&r2=603842&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Wed Dec 12 22:51:31 2007
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.io.Writer;
 import java.lang.reflect.Field;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -174,34 +175,51 @@
             schemaCompiler.setDefaultPackageName(context.getPackageName());
         }  
         
-
+        Options opts = null;
+        opts = getOptions(schemaCompiler);
+        
+        Vector<String> args = new Vector<String>();
+        if (context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null) {
+            //hard code to enabale jaxb extensions
+            args.add("-extension");
+            URL bindingFileUrl = getClass().getResource("W3CEPRJaxbBinding.xml");
+            InputSource ins = new InputSource(bindingFileUrl.toString());
+            schemaCompiler.parseSchema(ins);
+        }
+        
         if (context.get(ToolConstants.CFG_XJC_ARGS) != null) {
             String xjcArgs = (String)context.get(ToolConstants.CFG_XJC_ARGS);
-            Vector<String> args = new Vector<String>();
             StringTokenizer tokenizer = new StringTokenizer(xjcArgs, ",", false);
             while (tokenizer.hasMoreTokens()) {
                 String arg = tokenizer.nextToken();
                 args.add(arg);
                 LOG.log(Level.FINE, "xjc arg:" + arg);
             }
-            Options opts = null;
+        }
+        if (context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null
+            || context.get(ToolConstants.CFG_XJC_ARGS) != null) {
             try {
-                opts = getOptions(schemaCompiler);
-                // keep parseArguments happy, supply dummy required command-line opts
+
+                // keep parseArguments happy, supply dummy required command-line
+                // opts
                 opts.addGrammar(new InputSource("null"));
-                opts.parseArguments(args.toArray(new String[]{}));
+                opts.parseArguments(args.toArray(new String[] {}));
             } catch (BadCommandLineException e) {
-                String msg = "XJC reported 'BadCommandLineException' for -xjc argument:"
+ xjcArgs;
+                String msg = "XJC reported 'BadCommandLineException' for -xjc argument:";
+                for (String arg : args) {
+                    msg = msg + arg + " ";
+                }
                 LOG.log(Level.FINE, msg, e);
                 if (opts != null) {
                     String pluginUsage = getPluginUsageString(opts);
-                    if ("-X".equals(xjcArgs)) {
+                    msg = msg + System.getProperty("line.separator");
+                    if (args.contains("-X")) {
                         msg = pluginUsage;
                     } else {
                         msg += pluginUsage;
                     }
                 }
-                
+
                 throw new ToolException(msg, e);
             }
         }

Added: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml?rev=603842&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
(added)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
Wed Dec 12 22:51:31 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:wsa="http://www.w3.org/2005/08/addressing"
version="2.1">
+	<bindings scd="x-schema::wsa" if-exists="true">
+		<schemaBindings map="false" />
+		<bindings scd="wsa:EndpointReference">
+			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
+		</bindings>
+		<bindings scd="~wsa:EndpointReferenceType">
+			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
+		</bindings>
+	</bindings>
+</bindings>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=603842&r1=603841&r2=603842&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
Wed Dec 12 22:51:31 2007
@@ -269,6 +269,14 @@
                 </associatedArgument>
                 <switch>xjc</switch>
             </option>
+            
+           <option id="noAddressBinding" maxOccurs="1">
+                <annotation>
+                    Do not use address jaxb binding file to map wsa:EndpointReferenceType

+                    or wsa:EndpointReference to javax.xml.ws.wsaddressing.W3CEndpointReference
+                </annotation>
+                <switch>noAddressBinding</switch>
+            </option>
 
         </optionGroup>
         <optionGroup id="common_options">

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=603842&r1=603841&r2=603842&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Wed Dec 12 22:51:31 2007
@@ -257,7 +257,7 @@
 
     @Test
     public void testDefaultLoadNSMappingOFF() throws Exception {
-        String[] args = new String[] {"-dns", "false", "-d", output.getCanonicalPath(),
+        String[] args = new String[] {"-dns", "false", "-d", output.getCanonicalPath(), "-noAddressBinding",
                                       getLocation("/wsdl2java_wsdl/basic_callback.wsdl")};
 
         WSDLToJava.main(args);
@@ -280,7 +280,7 @@
 
     @Test
     public void testDefaultLoadNSMappingON() throws Exception {
-        String[] args = new String[] {"-d", output.getCanonicalPath(),
+        String[] args = new String[] {"-d", output.getCanonicalPath(), "-noAddressBinding",
                                       getLocation("/wsdl2java_wsdl/basic_callback.wsdl")};
 
         WSDLToJava.main(args);
@@ -412,6 +412,7 @@
     @Test
     public void testDefatultNsMap() throws Exception {
         env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
+        env.put(ToolConstants.CFG_NO_ADDRESS_BINDING, ToolConstants.CFG_NO_ADDRESS_BINDING);
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf492/locator.wsdl"));
         processor.setContext(env);
         processor.execute();
@@ -466,7 +467,7 @@
 
     @Test
     public void testDefaultNSWithPkg() throws Exception {
-        String[] args = new String[] {"-d", output.getCanonicalPath(), "-p", "org.cxf",
+        String[] args = new String[] {"-d", output.getCanonicalPath(), "-p", "org.cxf", "-noAddressBinding",
                                       getLocation("/wsdl2java_wsdl/basic_callback.wsdl")};
 
         WSDLToJava.main(args);

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=603842&r1=603841&r2=603842&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Wed Dec 12 22:51:31 2007
@@ -1164,4 +1164,17 @@
             assertTrue(e.getMessage().indexOf(": is not a valid char in the targetNamespace")
!= -1);
         }
     }
+    //TODO:This will be removed when runtime supports this mapping
+    @org.junit.Ignore
+    public void testW3CEPR() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/w3c-epr.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        Class sei = this.classLoader.loadClass("org.apache.w3c.epr.AddNumbersPortType");
+        Method method = sei.getMethod("addNumbers", 
+                                      new Class[]{javax.xml.ws.wsaddressing.W3CEndpointReference.class});
+        assertNotNull("wsdl2java does not map w3c:EndpointReferenceType to javax.xml.ws.EndpointReference"
+                      , method);
+    }
+    
 }

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/w3c-epr.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/w3c-epr.wsdl?rev=603842&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/w3c-epr.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/w3c-epr.wsdl Wed
Dec 12 22:51:31 2007
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<definitions name="AddNumbers" targetNamespace="http://apache.org/w3c/epr"
+	xmlns:tns="http://apache.org/w3c/epr"
+	xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:wsa="http://www.w3.org/2005/08/addressing"
+	xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
+	<types>
+		<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified"
+			targetNamespace="http://apache.org/w3c/epr">
+			<import namespace="http://www.w3.org/2005/08/addressing"
+				schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd" />
+			<element name="addNumbersResponse" type="xsd:string" />
+
+			<complexType name="addNumbers">
+				<sequence>
+					<element name="number1" type="xsd:int" />
+					<element name="number2" type="xsd:int" />
+				</sequence>
+			</complexType>
+			<element name="addNumbers" type="wsa:EndpointReferenceType" />
+
+			<element name="AddNumbersFault" type="tns:AddNumbersFault" />
+			<complexType name="AddNumbersFault">
+				<sequence>
+					<element name="detail" type="xsd:string" />
+					<element name="message" type="xsd:string" />
+				</sequence>
+			</complexType>
+		</xsd:schema>
+	</types>
+	<message name="addNumbers">
+		<part name="parameters" element="tns:addNumbers" />
+	</message>
+	<message name="addNumbersResponse">
+		<part name="result" element="tns:AddNumbersFault" />
+	</message>
+
+
+	<message name="addNumbersFault">
+		<part name="result" element="tns:addNumbersResponse" />
+	</message>
+
+
+	<portType name="AddNumbersPortType">
+		<operation name="addNumbers">
+			<input message="tns:addNumbers" />
+			<output message="tns:addNumbersResponse" />
+			<fault name="addNumbersFault" message="tns:addNumbersFault" />
+		</operation>
+	</portType>
+	<binding name="AddNumbersBinding" type="tns:AddNumbersPortType">
+		<wsaw:UsingAddressing wsdl:required="false" />
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+		<operation name="addNumbers">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+	</binding>
+	<service name="AddNumbersService">
+		<port name="AddNumbersPort" binding="tns:AddNumbersBinding">
+			<soap:address
+				location="http://localhost:9000/SoapContext/SoapPort" />
+
+		</port>
+	</service>
+</definitions>
\ No newline at end of file



Mime
View raw message