You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/01/15 14:33:41 UTC
cvs commit: ws-axis/java/tools/org/apache/axis/tools/ant/wsdl Java2WsdlAntTask.java TypeMappingVersionEnum.java Wsdl2javaAntTask.java
dims 2005/01/15 05:33:41
Modified: java/test/wsdl/document build.xml
java/test/wsdl/roundtrip build.xml
java/src/org/apache/axis/wsdl/toJava Emitter.java
JavaGeneratorFactory.java
java/src/org/apache/axis/wsdl Java2WSDL.java WSDL2Java.java
java/tools/org/apache/axis/tools/ant/wsdl
Java2WsdlAntTask.java TypeMappingVersionEnum.java
Wsdl2javaAntTask.java
Log:
- trying to standardize which typemappingimpl is used and when
- making sure that existing test harness and tck harness don't break
- roundtrip has it's own typemapping version "1.0"
- sync'ed all the ant tasks and command line tools
- looks like we need more cleanup :(
Revision Changes Path
1.4 +0 -1 ws-axis/java/test/wsdl/document/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdl/document/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.xml 2 Jun 2004 17:05:18 -0000 1.3
+++ build.xml 15 Jan 2005 13:33:41 -0000 1.4
@@ -73,7 +73,6 @@
className= "test.wsdl.document.TestService"
useInheritedMethods="false"
namespace="http://document.wsdl.test"
- typeMappingVersion="1.2"
location="http://localhost:8080/axis/services/DocumentTest">
<mapping namespace="http://document.wsdl.test" package="test.wsdl.document"/>
</java2wsdl>
1.10 +3 -3 ws-axis/java/test/wsdl/roundtrip/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdl/roundtrip/build.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- build.xml 2 Jun 2004 17:05:21 -0000 1.9
+++ build.xml 15 Jan 2005 13:33:41 -0000 1.10
@@ -90,7 +90,7 @@
useInheritedMethods="false"
namespace="http://roundtrip.wsdl.test"
namespaceImpl="http://roundtrip.wsdl.test"
- typeMappingVersion="1.2"
+ typeMappingVersion="1.0"
location="http://localhost:8080/axis/services/RoundtripTest"
locationImport="file://build/work/test/wsdl/roundtrip/RoundtripIntf.wsdl">
<mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
@@ -102,7 +102,7 @@
className= "test.wsdl.roundtrip.RoundtripPortType"
useInheritedMethods="false"
namespace="http://roundtrip.wsdl.test"
- typeMappingVersion="1.2"
+ typeMappingVersion="1.0"
location="http://localhost:8080/axis/services/RoundtripTest">
<mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
</java2wsdl>
@@ -115,7 +115,7 @@
className= "test.wsdl.roundtrip.RoundtripPortType"
useInheritedMethods="false"
namespace="http://roundtrip.wsdl.test"
- typeMappingVersion="1.2"
+ typeMappingVersion="1.0"
location="http://localhost:8080/axis/services/RoundtripTest2">
<mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
</java2wsdl>
1.76 +41 -3 ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- Emitter.java 14 Dec 2004 20:22:28 -0000 1.75
+++ Emitter.java 15 Jan 2005 13:33:41 -0000 1.76
@@ -17,7 +17,9 @@
import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.encoding.DefaultTypeMappingImpl;
import org.apache.axis.enum.Scope;
+import org.apache.axis.enum.Use;
import org.apache.axis.i18n.Messages;
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.JavaUtils;
@@ -61,7 +63,7 @@
protected HashMap namespaceMap = new HashMap();
/** Field typeMappingVersion */
- protected String typeMappingVersion = "1.1";
+ protected String typeMappingVersion = "1.2";
/** Field baseTypeMapping */
protected BaseTypeMapping baseTypeMapping = null;
@@ -138,6 +140,9 @@
*/
private String implementationClassName = null;
+ /** Field defaultTM */
+ private TypeMapping defaultTM = null; // Default TM
+
/**
* Default constructor.
*/
@@ -399,6 +404,28 @@
}
/**
+ * Returns the default <code>TypeMapping</code> used by the service
+ *
+ * @return the default <code>TypeMapping</code> used by the service
+ */
+ public TypeMapping getDefaultTypeMapping() {
+ if (defaultTM == null) {
+ defaultTM =
+ DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ }
+ return defaultTM;
+ }
+
+ /**
+ * Sets the default <code>TypeMapping</code> used by the service
+ *
+ * @param defaultTM the default <code>TypeMapping</code> used by the service
+ */
+ public void setDefaultTypeMapping(TypeMapping defaultTM) {
+ this.defaultTM = defaultTM;
+ }
+
+ /**
* <B>WARNING: NOT IMPLEMENTED</B>
* <p>
* Turn on the JAX-RPC 1.1 type mappings, which maps
@@ -756,10 +783,21 @@
* @param typeMappingVersion
*/
public void setTypeMappingVersion(String typeMappingVersion) {
+ if(defaultTM == null) {
+ if (typeMappingVersion.equals("1.0")) {
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
+ } else if (typeMappingVersion.equals("1.1")) {
+ defaultTM=DefaultTypeMappingImpl.getSingleton();
+ } else if (typeMappingVersion.equals("1.2")) {
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ } else {
+ throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
+ }
+ setDefaultTypeMapping(defaultTM);
+ }
baseTypeMapping = new BaseTypeMapping() {
- final TypeMapping defaultTM =
- DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
+ final TypeMapping defaultTM = getDefaultTypeMapping();
public String getBaseName(QName qNameIn) {
1.62 +3 -2 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
Index: JavaGeneratorFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- JavaGeneratorFactory.java 15 Dec 2004 22:45:25 -0000 1.61
+++ JavaGeneratorFactory.java 15 Jan 2005 13:33:41 -0000 1.62
@@ -1565,11 +1565,12 @@
* @return
*/
public BaseTypeMapping getBaseTypeMapping() {
+
+ final TypeMapping defaultTM = (emitter != null) ? emitter.getDefaultTypeMapping() :
+ DefaultTypeMappingImpl.getSingleton();
if (btm == null) {
btm = new BaseTypeMapping() {
-
- TypeMapping defaultTM = DefaultTypeMappingImpl.getSingleton();
public String getBaseName(QName qNameIn) {
1.45 +6 -6 ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
Index: Java2WSDL.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- Java2WSDL.java 14 Dec 2004 20:22:28 -0000 1.44
+++ Java2WSDL.java 15 Jan 2005 13:33:41 -0000 1.45
@@ -24,7 +24,6 @@
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.fromJava.Emitter;
-import org.apache.axis.constants.Use;
import java.util.HashMap;
import java.util.List;
@@ -411,11 +410,12 @@
case TYPEMAPPING_OPT:
value = option.getArgument();
- // This switch is totally bogus, ignore it
- if (value.equals("1.1") || value.equals("1.2")) {
- // This is just wrong see validate options for the real stuff
-// emitter.setDefaultTypeMapping(
-// DefaultTypeMappingImpl.getSingleton());
+ if (value.equals("1.0")) {
+ emitter.setDefaultTypeMapping(DefaultSOAPEncodingTypeMappingImpl.create());
+ } else if (value.equals("1.1")) {
+ emitter.setDefaultTypeMapping(DefaultTypeMappingImpl.getSingleton());
+ } else if (value.equals("1.2")) {
+ emitter.setDefaultTypeMapping(DefaultSOAPEncodingTypeMappingImpl.createWithDelegate());
} else {
System.out.println(
Messages.getMessage("j2wBadTypeMapping00"));
1.53 +4 -2 ws-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java
Index: WSDL2Java.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- WSDL2Java.java 14 Dec 2004 20:22:28 -0000 1.52
+++ WSDL2Java.java 15 Jan 2005 13:33:41 -0000 1.53
@@ -283,8 +283,10 @@
case TYPEMAPPING_OPT:
String tmValue = option.getArgument();
- if (tmValue.equals("1.1")) {
- emitter.setTypeMappingVersion("1.1");
+ if (tmValue.equals("1.0")) {
+ emitter.setTypeMappingVersion("1.0");
+ } else if (tmValue.equals("1.1")) {
+ emitter.setTypeMappingVersion("1.1");
} else if (tmValue.equals("1.2")) {
emitter.setTypeMappingVersion("1.2");
} else {
1.23 +53 -29 ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java
Index: Java2WsdlAntTask.java
===================================================================
RCS file: /home/cvs/ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Java2WsdlAntTask.java 23 Dec 2004 04:22:49 -0000 1.22
+++ Java2WsdlAntTask.java 15 Jan 2005 13:33:41 -0000 1.23
@@ -20,12 +20,14 @@
import org.apache.axis.encoding.TypeMappingImpl;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.utils.ClassUtils;
+import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.fromJava.Emitter;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
import java.io.File;
import java.io.PrintWriter;
@@ -141,24 +143,22 @@
* @throws BuildException
*/
public void execute() throws BuildException {
- if (classpath != null) {
- AntClassLoader cl = new AntClassLoader(
- getClass().getClassLoader(),
- getProject(),
- classpath,
- false);
- log("Using CLASSPATH: " + cl.getClasspath(),
- Project.MSG_VERBOSE);
- ClassUtils.setDefaultClassLoader(cl);
- //add extra classes to the classpath when the classpath attr is not null
- if(extraClasses!=null) {
- StringTokenizer tokenizer = new StringTokenizer(extraClasses, " ,");
- while (tokenizer.hasMoreTokens()) {
- String clsName = tokenizer.nextToken();
- ClassUtils.setClassLoader(clsName, cl);
- }
+ Path p = createClasspath();
+ AntClassLoader cl = new AntClassLoader(getClass().getClassLoader(),
+ getProject(),
+ p,
+ false);
+
+ ClassUtils.setDefaultClassLoader(cl);
+ //add extra classes to the classpath when the classpath attr is not null
+ if (extraClasses != null) {
+ StringTokenizer tokenizer = new StringTokenizer(extraClasses, " ,");
+ while (tokenizer.hasMoreTokens()) {
+ String clsName = tokenizer.nextToken();
+ ClassUtils.setClassLoader(clsName, cl);
}
}
+
try {
traceParams(Project.MSG_VERBOSE);
validate();
@@ -193,10 +193,14 @@
emitter.setExtraClasses(extraClasses);
}
- if (typeMappingVersion.equals("1.1")) {
+ if (typeMappingVersion.equals("1.0")) {
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
+ } else if (typeMappingVersion.equals("1.1")) {
defaultTM=DefaultTypeMappingImpl.getSingleton();
+ } else if (typeMappingVersion.equals("1.2")) {
+ defaultTM=DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
} else {
- defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
+ throw new BuildException(Messages.getMessage("j2wBadTypeMapping00"));
}
emitter.setDefaultTypeMapping(defaultTM);
// Create TypeMapping and register complex types
@@ -257,17 +261,6 @@
}
/**
- * add a classpath containing the java classes.
- * @return
- */
- public Path createClasspath() {
- if (classpath == null) {
- classpath = new Path(getProject());
- }
- return classpath.createPath();
- }
-
- /**
* The name of the output WSDL file.
* If not specified, a suitable default WSDL file is written into
* the current directory.
@@ -501,5 +494,36 @@
*/
public void addComplexType(ComplexType ct) {
complexTypes.add(ct);
+ }
+
+ /**
+ * Set the optional classpath
+ *
+ * @param classpath the classpath to use when loading class
+ */
+ public void setClasspath(Path classpath) {
+ createClasspath().append(classpath);
+ }
+
+ /**
+ * Set the optional classpath
+ *
+ * @return a path instance to be configured by the Ant core.
+ */
+ public Path createClasspath() {
+ if (classpath == null) {
+ classpath = new Path(getProject());
+ classpath = classpath.concatSystemClasspath();
+ }
+ return classpath.createPath();
+ }
+
+ /**
+ * Set the reference to an optional classpath
+ *
+ * @param r the id of the Ant path instance to act as the classpath
+ */
+ public void setClasspathRef(Reference r) {
+ createClasspath().setRefid(r);
}
}
1.3 +1 -1 ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/TypeMappingVersionEnum.java
Index: TypeMappingVersionEnum.java
===================================================================
RCS file: /home/cvs/ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/TypeMappingVersionEnum.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TypeMappingVersionEnum.java 25 Feb 2004 14:03:06 -0000 1.2
+++ TypeMappingVersionEnum.java 15 Jan 2005 13:33:41 -0000 1.3
@@ -24,7 +24,7 @@
*/
public class TypeMappingVersionEnum extends EnumeratedAttribute {
public String[] getValues() {
- return new String[]{"1.1", "1.2"};
+ return new String[]{"1.0", "1.1", "1.2"};
}
/**
1.25 +1 -1 ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Wsdl2javaAntTask.java
Index: Wsdl2javaAntTask.java
===================================================================
RCS file: /home/cvs/ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Wsdl2javaAntTask.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Wsdl2javaAntTask.java 14 Jan 2005 15:34:27 -0000 1.24
+++ Wsdl2javaAntTask.java 15 Jan 2005 13:33:41 -0000 1.25
@@ -94,7 +94,7 @@
private String protocolHandlerPkgs = "";
private String deployScope = "";
private String url = "";
- private String typeMappingVersion = TypeMappingVersionEnum.DEFAULT_VERSION;
+ private String typeMappingVersion = "1.2";
private long timeout = 45000;
private File namespaceMappingFile = null;
private MappingSet mappings = new MappingSet();