Author: dkulp
Date: Wed Feb 27 13:20:08 2008
New Revision: 631732
URL: http://svn.apache.org/viewvc?rev=631732&view=rev
Log:
[CXF-1126] Add -ant option to java2ws to allow it to create a build.xml
Cleanup the generated code a bit to make sure it's formatted a bit more
consistent
Added:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
(with props)
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/SimpleFrontEndProcessor.java
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
Wed Feb 27 13:20:08 2008
@@ -72,16 +72,23 @@
<option id="client" maxOccurs="1">
<annotation>
- Specify to genearte client side code
+ Specify to generate client side code
</annotation>
<switch>client</switch>
</option>
<option id="server" maxOccurs="1">
<annotation>
- Specify to genearte server side code
+ Specify to generate server side code
</annotation>
<switch>server</switch>
+ </option>
+
+ <option id="ant" maxOccurs="1">
+ <annotation>
+ Specify to generate an Ant build.xml
file
+ </annotation>
+ <switch>ant</switch>
</option>
<option id="outputfile" maxOccurs="1">
Added:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java?rev=631732&view=auto
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
(added)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
Wed Feb 27 13:20:08 2008
@@ -0,0 +1,81 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.tools.java2wsdl.processor.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.ToolException;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaModel;
+import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
+
+public class AntGenerator extends AbstractGenerator {
+
+ private static final String BUILD_TEMPLATE
+ = "org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm";
+
+
+ public void register(final ClassCollector collector, String packageName,
String fileName) {
+ //nothing to do
+ }
+
+ public boolean passthrough() {
+ if (env.optionSet(ToolConstants.CFG_ANT)) {
+ return false;
+ }
+ return true;
+ }
+
+ public void generate(ToolContext penv) throws ToolException {
+ this.env = penv;
+ if (passthrough()) {
+ return;
+ }
+
+ JavaModel javaModel = env.get(JavaModel.class);
+ Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+
+
+ Map<String, String> serverClassNamesMap = new HashMap<String,
String>();
+ Map<String, String> clientClassNamesMap = new HashMap<String,
String>();
+ for (JavaInterface intf : interfaces.values()) {
+ clientClassNamesMap.put(intf.getName() + "Client",
+ intf.getFullClassName() + "Client");
+ serverClassNamesMap.put(intf.getName() + "Server",
+ intf.getFullClassName() + "Server");
+ }
+
+ clearAttributes();
+ setAttributes("clientClassNamesMap", clientClassNamesMap);
+ setAttributes("serverClassNamesMap", serverClassNamesMap);
+
+ setAttributes("srcdir", (String)penv.get(ToolConstants.CFG_SOURCEDIR));
+ setAttributes("clsdir", (String)penv.get(ToolConstants.CFG_CLASSDIR));
+ setAttributes("classpath",
(String)penv.get(ToolConstants.CFG_CLASSPATH));
+ setAttributes("classpath",
(String)penv.get(ToolConstants.CFG_CLASSPATH));
+
+ setCommonAttributes();
+ doWrite(BUILD_TEMPLATE, parseOutputName(null, "build", ".xml"));
+ }
+}
Propchange:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/AntGenerator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm?rev=631732&view=auto
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm
(added)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/build.xml.vm
Wed Feb 27 13:20:08 2008
@@ -0,0 +1,168 @@
+## 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.
+<?xml version="1.0"?>
+<!--
+ Generated by Java2WS.
+
+ This file was generated by $fullversion
+ $currentdate
+ Generated source version: $version
+
+-->
+
+<project name="cxf java2ws" default="build" basedir=".">
+
+ <property environment="env"/>
+ <property name="build.classes.dir" location ="${clsdir}"/>
+ <property name="build.src.dir" location ="${srcdir}"/>
+ <path id="project.classpath">
+ <pathelement path="${classpath}"/>
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <!-- find the tools jar -->
+ <available property="tools.jar" value="$${env.JAVA_HOME}/lib/tools.jar"
+ file="${env.JAVA_HOME}/lib/tools.jar"/>
+ <path id="jdk.tools.classpath">
+ <pathelement location="${tools.jar}"/>
+ </path>
+
+ <condition property="is.java.version.15">
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <equals arg1="${ant.java.version}" arg2="1.6"/>
+ </or>
+ </condition>
+
+ <fail message="cxf requires Java version 1.5 or higher. You are currently
using Java version ${ant.java.version}."
+ unless="is.java.version.15"/>
+
+ <!-- Determine cxf.home, either from the environment variable CXF_HOME
+ - or using ../..
+ -->
+ <condition property="cxf.home" value="${env.CXF_HOME}">
+ <isset property="env.CXF_HOME"/>
+ </condition>
+
+ <fail message="Please set CXF_HOME environment variable."
unless="cxf.home"/>
+
+ <!-- Determine cxf.jar.file, either ${cxf.home}/build/lib/cxf.jar
+ - in a source distribution, or
${cxf.home}/lib/cxf-manifest-incubator.jar in a binary
+ - distribution.
+ -->
+ <condition property="cxf-manifest-incubator.jar.file"
value="${cxf.home}/build/lib/cxf-manifest-incubator.jar">
+ <available file="cxf-manifest-incubator.jar" type="file"
filepath="${cxf.home}/build/lib"/>
+ </condition>
+ <property name="cxf-manifest-incubator.jar.file"
value="${cxf.home}/lib/cxf-manifest-incubator.jar"/>
+
+ <fail message="The location ${cxf.home} does not seem to contain a cxf
installation; if you are importing this common build file from a location other
than the cxf samples directory then you need to set the cxf_HOME environment
variable.">
+ <condition>
+ <not>
+ <isset property="cxf-manifest-incubator.jar.file" />
+ </not>
+ </condition>
+ </fail>
+
+ <!-- Determine the tools directory, either ${cxf.home}/tools
+ - in a source distribution, or ${cxf.home}/lib in a binary
+ - distribution.
+ -->
+ <condition property="thirdparty.tools.dir" value="${cxf.home}/tools">
+ <available file="tools" type="dir" filepath="${cxf.home}"/>
+ </condition>
+
+ <condition property="thirdparty.tools.dir" value="${cxf.home}/lib">
+ <available file="lib" type="dir" filepath="${cxf.home}"/>
+ </condition>
+
+ <property name="cxf.etc.dir" location="${cxf.home}/etc"/>
+
+ <path id="cxf.classpath">
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${cxf-manifest-incubator.jar.file}"/>
+ </path>
+
+#foreach ($targetName in $clientClassNamesMap.keySet())
+ <target name="$targetName" description="Run
$clientClassNamesMap.get($targetName)" depends="compile">
+ <property name="param" value=""/>
+ <cxfrun classname="$clientClassNamesMap.get($targetName)"/>
+ </target>
+#end
+
+#foreach ($target in $serverClassNamesMap.keySet())
+ <target name="${target}" description="Run
$serverClassNamesMap.get($target)" depends="compile">
+ <cxfrun classname="$serverClassNamesMap.get($target)"/>
+ </target>
+#end
+
+
+
+ <target name="compile">
+ <mkdir dir="${build.classes.dir}"/>
+ <javac srcdir="${build.src.dir}" destdir="${build.classes.dir}"
debug="true">
+ <classpath>
+ <path refid="cxf.classpath"/>
+ <path refid="project.classpath" />
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.classes.dir}"/>
+ <delete file="${java.timestamp.file}"/>
+ <delete file="demo.log"/>
+ </target>
+
+ <target name="build" depends="compile" description="build demo code"/>
+
+ <macrodef name="cxfrun">
+ <attribute name="classname"/>
+ <attribute name="param1" default=""/>
+ <attribute name="param2" default=""/>
+ <attribute name="param3" default=""/>
+ <attribute name="param4" default=""/>
+ <attribute name="param5" default=""/>
+ <attribute name="jvmarg1" default="-D"/>
+ <attribute name="jvmarg2" default="-D"/>
+ <attribute name="jvmarg3" default="-D"/>
+ <attribute name="jvmarg4" default="-D"/>
+ <attribute name="jvmarg5" default="-D"/>
+ <sequential>
+ <java classname="@{classname}" fork="yes">
+ <classpath>
+ <path refid="cxf.classpath"/>
+ <path refid="project.classpath" />
+ </classpath>
+ <arg value="@{param1}"/>
+ <arg value="@{param2}"/>
+ <arg value="@{param3}"/>
+ <arg value="@{param4}"/>
+ <arg value="@{param5}"/>
+ <jvmarg value="@{jvmarg1}"/>
+ <jvmarg value="@{jvmarg2}"/>
+ <jvmarg value="@{jvmarg3}"/>
+ <jvmarg value="@{jvmarg4}"/>
+ <jvmarg value="@{jvmarg5}"/>
+ <assertions>
+ <enable package="org.apache.cxf"/>
+ </assertions>
+ <sysproperty key="java.util.logging.config.file"
value="${cxf.etc.dir}/logging.properties"/>
+ <sysproperty key="log4j.configuration"
value="file:///${cxf.etc.dir}/log4j.properties"/>
+ </java>
+ </sequential>
+ </macrodef>
+</project>
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
Wed Feb 27 13:20:08 2008
@@ -49,17 +49,18 @@
import org.apache.cxf.tools.common.model.JavaReturn;
import org.apache.cxf.tools.common.model.JavaType.Style;
import org.apache.cxf.tools.java2ws.util.JavaFirstUtil;
-import
org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.AbstractJaxwsGenerator;
+import org.apache.cxf.tools.java2wsdl.processor.internal.AntGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsClientGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsImplGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsSEIGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsServerGenerator;
+import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
public class JAXWSFrontEndProcessor implements Processor {
private static final String SEI_SUFFIX = "_PortType";
private static final Logger LOG =
LogUtils.getL7dLogger(JAXWSFrontEndProcessor.class);
private ToolContext context;
- private List<AbstractJaxwsGenerator> generators = new
ArrayList<AbstractJaxwsGenerator>();
+ private List<AbstractGenerator> generators = new
ArrayList<AbstractGenerator>();
private List<String> infList = new ArrayList<String>();
@SuppressWarnings("unchecked")
@@ -83,8 +84,9 @@
generators.add(new JaxwsImplGenerator());
generators.add(new JaxwsServerGenerator());
generators.add(new JaxwsClientGenerator());
+ generators.add(new AntGenerator());
- for (AbstractJaxwsGenerator generator : generators) {
+ for (AbstractGenerator generator : generators) {
generator.generate(context);
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-client.vm
Wed Feb 27 13:20:08 2008
@@ -26,13 +26,14 @@
import javax.xml.ws.soap.SOAPBinding;
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
*/
- public class ${intf.Name}Client {
- public static void main(String[] args) {
+public class ${intf.Name}Client {
+
+ public static void main(String[] args) throws Exception {
QName serviceName = new QName("${service.NamespaceURI}",
"${service.LocalPart}");
QName portName = new QName("${port.NamespaceURI}",
"${port.LocalPart}");
@@ -41,5 +42,7 @@
"${address}");
${intf.FullClassName} client = service.getPort(portName,
${intf.FullClassName}.class);
+ // Insert code to invoke methods on the client here
}
- }
\ No newline at end of file
+
+}
\ No newline at end of file
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-impl.vm
Wed Feb 27 13:20:08 2008
@@ -24,18 +24,19 @@
import javax.jws.WebService;
/**
- * This cla ss was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
*/
[EMAIL PROTECTED](endpointInterface = "${intf.FullClassName}",
serviceName="${service.LocalPart}")
[EMAIL PROTECTED](endpointInterface = "${intf.FullClassName}", serviceName =
"${service.LocalPart}")
public class ${intf.Name}Impl implements $intf.Name {
#foreach ($method in $intf.Methods)
- public $method.return.ClassName
${method.Name}(#if($method.ParameterList.size() ==
0))#end#if($method.ParameterList.size() != 0)#foreach ($param in
${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0)
throws#foreach($exception in $method.Exceptions)
$exception.ClassName#if($method.Exceptions.size() !=
$velocityCount),#end#end#end {
+
+ public $method.return.ClassName
${method.Name}(#if($method.ParameterList.size() ==
0))#end#if($method.ParameterList.size() != 0)#foreach ($param in
${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0)
throws#foreach($exception in $method.Exceptions)
$exception.ClassName#if($method.Exceptions.size() !=
$velocityCount),#end#end#end {
#foreach ($parameter in $method.Parameters)
#if ($parameter.Style.toString() == "IN")
- System.out.println($parameter.Name);#end#end
+ System.out.println($parameter.Name);#end#end
#foreach ($parameter in $method.Parameter)
#if ($parameter.Style.toString() == "OUT")
#set($paramValueName = "${parameter.Name}Value")
@@ -44,21 +45,21 @@
#end
#end
- #if ($method.return.ClassName != "void")try {
+ #if ($method.return.ClassName != "void")try {
${method.return.writeDefaultValue(${out}, " ",
${method.Name}, "_return")}
return _return;
- } catch (Exception ex) {
+ } catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
- }
+ }
#end
#if ($method.Exceptions.size() > 0)
#foreach($exception in $method.Exceptions)
- //throw new ${exception.ClassName}("${exception.Name}...");
+ //throw new ${exception.ClassName}("${exception.Name}...");
#end
#end
- }
+ }
#end
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-sei.vm
Wed Feb 27 13:20:08 2008
@@ -27,7 +27,7 @@
#end
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/template/javafirst-server.vm
Wed Feb 27 13:20:08 2008
@@ -20,7 +20,7 @@
import javax.xml.ws.Endpoint;
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/SimpleFrontEndProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/SimpleFrontEndProcessor.java?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/SimpleFrontEndProcessor.java
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/SimpleFrontEndProcessor.java
Wed Feb 27 13:20:08 2008
@@ -29,15 +29,16 @@
import org.apache.cxf.tools.common.model.JavaInterface;
import org.apache.cxf.tools.common.model.JavaModel;
import org.apache.cxf.tools.java2ws.util.JavaFirstUtil;
-import
org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.AbstractSimpleGenerator;
+import org.apache.cxf.tools.java2wsdl.processor.internal.AntGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleClientGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleImplGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleSEIGenerator;
import
org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleServerGenerator;
+import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
public class SimpleFrontEndProcessor implements Processor {
private ToolContext context;
- private List<AbstractSimpleGenerator> generators = new
ArrayList<AbstractSimpleGenerator>();
+ private List<AbstractGenerator> generators = new
ArrayList<AbstractGenerator>();
@SuppressWarnings("unchecked")
public void process() throws ToolException {
List<ServiceInfo> services =
(List<ServiceInfo>)context.get(ToolConstants.SERVICE_LIST);
@@ -52,8 +53,9 @@
generators.add(new SimpleImplGenerator());
generators.add(new SimpleServerGenerator());
generators.add(new SimpleClientGenerator());
+ generators.add(new AntGenerator());
- for (AbstractSimpleGenerator generator : generators) {
+ for (AbstractGenerator generator : generators) {
generator.generate(context);
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/client.vm
Wed Feb 27 13:20:08 2008
@@ -27,12 +27,13 @@
import org.apache.cxf.aegis.databinding.AegisDatabinding;
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
- * Generated source version: $version
+ * Generated source version: $version
*/
public class ${intf.Name}Client {
- public static void main(String[] args) {
+
+ public static void main(String[] args) throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress("${address}");
@@ -41,5 +42,8 @@
clientBean.setServiceClass(${seiClass}.class);
proxyFactory.getServiceFactory().setDataBinding(new
AegisDatabinding());
${seiClass} client = (${seiClass})proxyFactory.create();
+
+ // Insert code to invoke methods on the client here
}
+
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/impl.vm
Wed Feb 27 13:20:08 2008
@@ -23,7 +23,7 @@
package $intf.PackageName;
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
@@ -31,10 +31,11 @@
public class ${intf.Name}Impl implements ${seiClass} {
#foreach ($method in $intf.Methods)
- public $method.return.ClassName
${method.Name}(#if($method.ParameterList.size() ==
0))#end#if($method.ParameterList.size() != 0)#foreach ($param in
${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0)
throws#foreach($exception in $method.Exceptions)
$exception.ClassName#if($method.Exceptions.size() !=
$velocityCount),#end#end#end {
+
+ public $method.return.ClassName
${method.Name}(#if($method.ParameterList.size() ==
0))#end#if($method.ParameterList.size() != 0)#foreach ($param in
${method.ParameterList})$param#end)#end#if($method.Exceptions.size() > 0)
throws#foreach($exception in $method.Exceptions)
$exception.ClassName#if($method.Exceptions.size() !=
$velocityCount),#end#end#end {
#foreach ($parameter in $method.Parameters)
#if ($parameter.Style.toString() == "IN")
- System.out.println($parameter.Name);#end#end
+ System.out.println($parameter.Name);#end#end
#foreach ($parameter in $method.Parameter)
#if ($parameter.Style.toString() == "OUT")
#set($paramValueName = "${parameter.Name}Value")
@@ -43,21 +44,21 @@
#end
#end
- #if ($method.return.ClassName != "void")try {
+ #if ($method.return.ClassName != "void")try {
${method.return.writeDefaultValue(${out}, " ",
${method.Name}, "_return")}
return _return;
- } catch (Exception ex) {
+ } catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
- }
+ }
#end
#if ($method.Exceptions.size() > 0)
#foreach($exception in $method.Exceptions)
- //throw new ${exception.ClassName}("${exception.Name}...");
+ //throw new ${exception.ClassName}("${exception.Name}...");
#end
#end
- }
+ }
#end
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/sei.vm
Wed Feb 27 13:20:08 2008
@@ -27,7 +27,7 @@
#end
/**
- * This class was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/template/server.vm
Wed Feb 27 13:20:08 2008
@@ -26,12 +26,13 @@
import org.apache.cxf.aegis.databinding.AegisDatabinding;
/**
- * This cla ss was generated by the CXF $version
+ * This class was generated by $fullversion
* $currentdate
* Generated source version: $version
*
*/
- public class ${intf.Name}Server {
+public class ${intf.Name}Server {
+
public static void main(String[] args) {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setBus(CXFBusFactory.getDefaultBus());
@@ -44,4 +45,5 @@
svrBean.create();
System.out.println("Server started");
}
- }
\ No newline at end of file
+
+}
\ No newline at end of file
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=631732&r1=631731&r2=631732&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
Wed Feb 27 13:20:08 2008
@@ -205,8 +205,13 @@
assertTrue("Greeter_GreeterPort_Server.java was not generated",
server.exists());
assertTrue("Impl was not generated", impl.exists());
String implContent = FileUtils.getStringFromFile(impl);
- assertTrue("serviceName annotation was not generated",
- implContent.indexOf("serviceName=\"GreeterService\"") > -1);
+
+ int idx = implContent.indexOf("serviceName");
+ assertFalse("serviceName annotation was not generated", idx == -1);
+ implContent = implContent.substring(idx + 11).trim();
+ implContent = implContent.substring(1).trim();
+ assertTrue("serviceName annotation was not generated\n" + implContent,
+ implContent.startsWith("\"GreeterService\""));
}
@Test
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm?rev=631732&r1=631731&r2=631732&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/build.vm
Wed Feb 27 13:20:08 2008
@@ -17,12 +17,10 @@
<?xml version="1.0"?>
<!--
Generated by WSDLToJava Compiler.
- /**
- * This class was generated by $fullversion
- * $currentdate
- * Generated source version: $version
- *
- */
+
+ This class was generated by $fullversion
+ $currentdate
+ Generated source version: $version
-->
<project name="cxf wsdltojava" default="build" basedir=".">
@@ -40,10 +38,13 @@
</path>
<condition property="is.java.version.15">
- <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <equals arg1="${ant.java.version}" arg2="1.6"/>
+ </or>
</condition>
- <fail message="cxf requires Java version 1.5. You are currently using Java
version ${ant.java.version}."
+ <fail message="cxf requires Java version 1.5 or higher. You are currently
using Java version ${ant.java.version}."
unless="is.java.version.15"/>
<!-- Determine cxf.home, either from the environment variable CXF_HOME