From 96e804f4c24890ff2e41ec350c590bb8f827e4e8 Mon Sep 17 00:00:00 2001 From: Gwenael Cattez Date: Thu, 1 Dec 2011 13:41:45 +0000 Subject: [PATCH] Adding jaxb binding file to frascati-interface-wsdl to generate serializable java class for XmlTypes, and convert wsdl:dateTime wsdl:date wsdl:time to java.util.Date --- .../modules/frascati-interface-wsdl/pom.xml | 24 +++++++++-------- .../ow2/frascati/wsdl/WsdlCompilerCXF.java | 26 ++++++++++--------- .../main/resources/jaxb-global-bindings.xml | 22 ++++++++++++++++ .../factory/AssemblyFactory.composite | 5 ++-- pom.xml | 1 + 5 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 frascati/modules/frascati-interface-wsdl/src/main/resources/jaxb-global-bindings.xml diff --git a/frascati/modules/frascati-interface-wsdl/pom.xml b/frascati/modules/frascati-interface-wsdl/pom.xml index 187b353ee..f22bde1eb 100644 --- a/frascati/modules/frascati-interface-wsdl/pom.xml +++ b/frascati/modules/frascati-interface-wsdl/pom.xml @@ -38,7 +38,6 @@ 1.5-SNAPSHOT - org.ow2.frascati frascati-interface-wsdl jar OW2 FraSCAti: SCA Interface WSDL Module @@ -132,24 +131,27 @@ + + org.jvnet.jaxb2_commons jaxb2-basics - - 0.5.0 - + ${jaxb2.version} - - org.jvnet.jaxb2_commons - + + - runtime - 0.4.1.5 + + org.jvnet.jaxb2_commons + jaxb2-basics-runtime + ${jaxb2.version} + + diff --git a/frascati/modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/WsdlCompilerCXF.java b/frascati/modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/WsdlCompilerCXF.java index c6908a6ee..17a21ea9d 100755 --- a/frascati/modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/WsdlCompilerCXF.java +++ b/frascati/modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/WsdlCompilerCXF.java @@ -20,33 +20,30 @@ * * Author: Philippe Merle * - * Contributor(s): + * Contributor(s): Gwenael Cattez * */ package org.ow2.frascati.wsdl; -import com.sun.xml.bind.api.impl.NameConverter; - +import java.net.URL; import java.util.HashMap; import java.util.Map; import javax.wsdl.Definition; import javax.wsdl.WSDLException; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; - import org.apache.cxf.tools.common.ToolContext; import org.apache.cxf.tools.wsdlto.WSDLToJava; - import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Property; - +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; import org.ow2.frascati.assembly.factory.api.ProcessingContext; import org.ow2.frascati.component.factory.api.MembraneGeneration; import org.ow2.frascati.util.AbstractLoggeable; import org.ow2.frascati.util.FrascatiException; +import com.sun.xml.bind.api.impl.NameConverter; /** * OW2 FraSCAti Assembly Factory WSDL compiler with Apache CXF. @@ -81,6 +78,9 @@ public class WsdlCompilerCXF @Reference(name = "membrane-generation") private MembraneGeneration membraneGeneration; + @Property(name = "binding-file-name") + private String bindingFileName = "jaxb-global-bindings.xml"; + /** * Reader of WSDL descriptions. */ @@ -153,10 +153,13 @@ public class WsdlCompilerCXF // TODO: Could be optimized to avoid to read the WSDL file twice. // Require to study the Apache CXF WSDL2Java class to find a more appropriate entry point. - String outputDirectory = this.membraneGeneration.getOutputDirectory() + '/' + targetDirectory; - String[] params = new String[]{ this.wsdl2javaOptions, "-d", outputDirectory , wsdlUri }; - log.info("Compiling WSDL '" + wsdlUri + "' into '" + outputDirectory + "'..."); + + URL bindingFileURL= Thread.currentThread().getContextClassLoader().getResource(bindingFileName); + String[] params = new String[]{this.wsdl2javaOptions , "-b" , bindingFileURL.toExternalForm() , "-d", outputDirectory , wsdlUri }; + + log.info("Compiling WSDL '" + wsdlUri + "' into '" + outputDirectory + "'..."); + try { // Compile the WSDL description with Apache CXF WSDL2Java Tool. new WSDLToJava(params).run(new ToolContext(), System.out); @@ -169,5 +172,4 @@ public class WsdlCompilerCXF // Add WSDL2Java output directory to the Juliac compiler at the first time needed. this.membraneGeneration.addJavaSource(outputDirectory); } - } diff --git a/frascati/modules/frascati-interface-wsdl/src/main/resources/jaxb-global-bindings.xml b/frascati/modules/frascati-interface-wsdl/src/main/resources/jaxb-global-bindings.xml new file mode 100644 index 000000000..1ade66f3f --- /dev/null +++ b/frascati/modules/frascati-interface-wsdl/src/main/resources/jaxb-global-bindings.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/frascati/modules/frascati-interface-wsdl/src/main/resources/org/ow2/frascati/assembly/factory/AssemblyFactory.composite b/frascati/modules/frascati-interface-wsdl/src/main/resources/org/ow2/frascati/assembly/factory/AssemblyFactory.composite index 10b0fb156..531c8d286 100644 --- a/frascati/modules/frascati-interface-wsdl/src/main/resources/org/ow2/frascati/assembly/factory/AssemblyFactory.composite +++ b/frascati/modules/frascati-interface-wsdl/src/main/resources/org/ow2/frascati/assembly/factory/AssemblyFactory.composite @@ -21,7 +21,7 @@ * * Author: Philippe Merle * - * Contributor(s): + * Contributor(s): Gwenael Cattez * --> - -xjc-XtoString + -xjc-XtoString generated-frascati-sources + jaxb-global-bindings.xml diff --git a/pom.xml b/pom.xml index e8245f418..f80119b5d 100644 --- a/pom.xml +++ b/pom.xml @@ -317,6 +317,7 @@ 2.9.1 2.1.13 1.7 + 0.6.0 -- GitLab