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 ve...@apache.org on 2005/05/20 14:55:50 UTC
cvs commit: ws-axis/java/src/org/apache/axis/wsdl/gen Parser.java
venkat 2005/05/20 05:55:49
Modified: java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
java/src/org/apache/axis/wsdl/toJava Utils.java
java/src/org/apache/axis/wsdl/gen Parser.java
Added: java/test/wsdl/groups GroupsTestCase.java Groups.wsdl
build.xml SomeType.java
Log:
Checking in the patches and test case submitted by Steve Green for AXIS-1525. I have ran the JAX-RPC TCK test suite after the changes and ensured it is all green. Thanks Steve.
Revision Changes Path
1.1 ws-axis/java/test/wsdl/groups/GroupsTestCase.java
Index: GroupsTestCase.java
===================================================================
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
/**
* This tests the file generation of only the items that are referenced in WSDL
*
* @author Steve Green (steve.green@epok.net)
*/
package test.wsdl.groups;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class GroupsTestCase extends junit.framework.TestCase {
public GroupsTestCase(String name) {
super(name);
}
/**
* List of files which should be generated.
*/
protected Set shouldExist() {
HashSet set = new HashSet();
set.add("GroupsTestCase.java");
set.add("SomeType.java");
return set;
}
/**
* List of files which may or may not be generated.
*/
protected Set shouldNotExist() {
HashSet set = new HashSet();
set.add("SomeGroup.java");
return set;
}
/**
* The directory containing the files that should exist.
*/
protected String rootDir() {
return "build" + File.separator + "work" + File.separator +
"test" + File.separator + "wsdl" + File.separator +
"groups";
}
protected String getPrefix(String parent) {
if (parent == null || parent.length() == 0) {
return "";
}
else {
return parent + File.separator;
}
}
/** This method returns a array of String file paths, located within the
* supplied root directory. The string values are created relative to the
* specified parent so that the names get returned in the form of
* "file.java", "dir/file.java", "dir/dir/file.java", etc. This feature
* asslows the various file specs to include files in sub-directories as
* well as the root directory.
*/
protected String[] getPaths(File root, String parent) {
File files[] = root.listFiles();
if (files == null)
fail("Unable to get a list of files from " + root.getPath());
Set filePaths = new HashSet();
for(int i=0; i<files.length; i++) {
if (files[i].isDirectory()) {
String children[] = getPaths(files[i],
getPrefix(parent) + files[i].getName());
filePaths.addAll(Arrays.asList(children));
}
else {
filePaths.add(getPrefix(parent) + files[i].getName());
}
}
String paths[] = new String[filePaths.size()];
return (String[]) filePaths.toArray(paths);
}
public void testGroups() throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException {
// Test for the proper files
String rootDir = rootDir();
Set shouldExist = shouldExist();
Set shouldNotExist = shouldNotExist();
// open up the output directory and check what files exist.
File outputDir = new File(rootDir);
String[] files = getPaths(outputDir, null);
for (int i = 0; i < files.length; ++i) {
if (shouldExist.contains(files[i])) {
shouldExist.remove(files[i]);
}
else if (shouldNotExist.contains(files[i])) {
fail("The following file should not exist in " + rootDir +
", but does: " + files[i]);
}
}
if (shouldExist.size() > 0) {
fail("The following files should exist in " + rootDir +
", but do not: " + shouldExist);
}
// Test for the proper members
Class ourClass = Class.forName("test.wsdl.groups.SomeType");
ourClass.getDeclaredMethod("getA", null);
ourClass.getDeclaredMethod("getB", null);
ourClass.getDeclaredMethod("getZ", null);
return;
}
}
1.1 ws-axis/java/test/wsdl/groups/Groups.wsdl
Index: Groups.wsdl
===================================================================
<?xml version="1.0" encoding="utf-8" ?>
<definitions targetNamespace="http://test.com/reference"
xmlns:tns="http://test.com/reference"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xs:schema>
<xs:group name="SomeGroup">
<xs:sequence>
<xs:element name="a" type="xs:string"/>
<xs:element name="b" type="xs:string"/>
</xs:sequence>
</xs:group>
<xs:complexType name="SomeType">
<xs:sequence>
<xs:element name="z" type="xs:string"/>
<xs:group ref="tns:SomeGroup"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
</definitions>
1.1 ws-axis/java/test/wsdl/groups/build.xml
Index: build.xml
===================================================================
<?xml version="1.0" ?>
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
<!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
<!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
<!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
<!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
]>
<!-- ===================================================================
<description>
Test/Sample Component file for Axis
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To compile
ant compile
To execute
ant run
Author:
Matt Seibert mseibert@us.ibm.com
Copyright:
Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->
<project default="compile">
<property name="axis.home" location="../../.." />
<property name="componentName" value="test/wsdl/groups" />
&properties;
&paths;
&taskdefs;
&taskdefs_post_compile;
&targets;
<target name="clean" depends="setenv">
<echo message="Removing ${build.dir}/**/test/wsdl/groups" />
<echo message="componentName is ${componentName}"/>
<delete dir="${build.dir}/classes/test/wsdl/groups"/>
<delete dir="${build.dir}/work/test/wsdl/groups"/>
<delete dir="${build.dir}/classes/test/wsdl/groupsAll"/>
<delete dir="${build.dir}/work/test/wsdl/groupsAll"/>
</target>
<target name="compile" depends="clean">
<echo message="Compiling test.wsdl.groups"/>
<!-- Verify files generated based on what is referenced in WSDL -->
<wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
output="${axis.home}/build/work"
deployscope="none"
serverSide="no"
noimports="no"
verbose="no"
testcase="no">
<mapping namespace="http://test.com/reference" package="test.wsdl.groups"/>
</wsdl2java>
<!-- Same test as above but this time the -a flag is turned on -->
<wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
output="${axis.home}/build/work"
serverSide="no"
all="yes">
<mapping namespace="http://test.com/reference" package="test.wsdl.groupsAll"/>
</wsdl2java>
<copy todir="${build.dir}/work/test/wsdl/groups" overwrite="yes">
<fileset dir="${axis.home}/test/wsdl/groups">
<include name="*TestCase.java"/>
<include name="*Impl.java"/>
</fileset>
</copy>
<javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
debug="${debug}">
<classpath refid="classpath" />
<include name="test/wsdl/groups/*.java" />
<include name="test/wsdl/groupsAll/*.java" />
</javac>
</target>
<target name="run" >
<antcall target="execute-Component-noServer" />
</target>
</project>
1.1 ws-axis/java/test/wsdl/groups/SomeType.java
Index: SomeType.java
===================================================================
/**
* SomeType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2RC1 Oct 20, 2004 (05:49:44 EDT) WSDL2Java emitter.
*/
package com.epok.auth;
public class SomeType implements java.io.Serializable {
private java.lang.String z;
private java.lang.String a;
private java.lang.String b;
public SomeType() {
}
public SomeType(
java.lang.String z,
java.lang.String a,
java.lang.String b) {
this.z = z;
this.a = a;
this.b = b;
}
/**
* Gets the z value for this SomeType.
*
* @return z
*/
public java.lang.String getZ() {
return z;
}
/**
* Sets the z value for this SomeType.
*
* @param z
*/
public void setZ(java.lang.String z) {
this.z = z;
}
/**
* Gets the a value for this SomeType.
*
* @return a
*/
public java.lang.String getA() {
return a;
}
/**
* Sets the a value for this SomeType.
*
* @param a
*/
public void setA(java.lang.String a) {
this.a = a;
}
/**
* Gets the b value for this SomeType.
*
* @return b
*/
public java.lang.String getB() {
return b;
}
/**
* Sets the b value for this SomeType.
*
* @param b
*/
public void setB(java.lang.String b) {
this.b = b;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof SomeType)) return false;
SomeType other = (SomeType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.z==null && other.getZ()==null) ||
(this.z!=null &&
this.z.equals(other.getZ()))) &&
((this.a==null && other.getA()==null) ||
(this.a!=null &&
this.a.equals(other.getA()))) &&
((this.b==null && other.getB()==null) ||
(this.b!=null &&
this.b.equals(other.getB())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getZ() != null) {
_hashCode += getZ().hashCode();
}
if (getA() != null) {
_hashCode += getA().hashCode();
}
if (getB() != null) {
_hashCode += getB().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(SomeType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:auth:epok:com", "SomeType"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("z");
elemField.setXmlName(new javax.xml.namespace.QName("", "z"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("a");
elemField.setXmlName(new javax.xml.namespace.QName("", "a"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("b");
elemField.setXmlName(new javax.xml.namespace.QName("", "b"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
1.57 +155 -129 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- SchemaUtils.java 30 Apr 2005 18:31:40 -0000 1.56
+++ SchemaUtils.java 20 May 2005 12:55:49 -0000 1.57
@@ -1,12 +1,12 @@
/*
* Copyright 2001-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.
@@ -35,7 +35,7 @@
/**
* This class contains static utility methods specifically for schema type queries.
- *
+ *
* @author Rich Scheuerle (scheu@us.ibm.com)
*/
public class SchemaUtils {
@@ -58,7 +58,7 @@
// Under the complexType there could be complexContent with
// mixed="true"
NodeList children = node.getChildNodes();
-
+
for (int j = 0; j < children.getLength(); j++) {
Node kid = children.item(j);
if (isXSDNode(kid, "complexContent")) {
@@ -85,9 +85,9 @@
}
return null;
}
-
+
public static Node getListNode(Node node) {
- // Expecting a schema simpleType
+ // Expecting a schema simpleType
if (isXSDNode(node, "simpleType")) {
// Under the simpleType there could be list
NodeList children = node.getChildNodes();
@@ -104,19 +104,19 @@
public static boolean isSimpleTypeWithUnion(Node node) {
return (getUnionNode(node) != null);
}
-
+
/**
* This method checks out if the given node satisfies the 3rd condition
* of the "wrapper" style:
* such an element (a wrapper) must be of a complex type defined using the
* xsd:sequence compositor and containing only elements declarations.
* (excerpt from JAX-RPC spec 1.1 Maintenanace Review 2 Chapter 6 Section 4.1.)
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static boolean isWrappedType(Node node) {
-
+
if (node == null) {
return false;
}
@@ -143,7 +143,7 @@
// Under the complexType there could be complexContent/simpleContent
// and extension elements if this is a derived type.
// A wrapper element must be complex-typed.
-
+
NodeList children = node.getChildNodes();
for (int j = 0; j < children.getLength(); j++) {
@@ -158,8 +158,8 @@
// Under the complexType there may be choice, sequence, group and/or all nodes.
// (There may be other #text nodes, which we will ignore).
- // The complex type of a wrapper element must have only sequence
- // and again element declarations in the sequence.
+ // The complex type of a wrapper element must have only sequence
+ // and again element declarations in the sequence.
children = node.getChildNodes();
int len = children.getLength();
for (int j = 0; j < len; j++) {
@@ -204,11 +204,11 @@
}
}
}
- }
+ }
// allows void type
return true;
}
-
+
/**
* If the specified node represents a supported JAX-RPC complexType or
* simpleType, a Vector is returned which contains ElementDecls for the
@@ -221,10 +221,10 @@
* (use the getContainedAttributeTypes)
* If the specified node is not a supported
* JAX-RPC complexType/simpleType/element null is returned.
- *
- * @param node
- * @param symbolTable
- * @return
+ *
+ * @param node
+ * @param symbolTable
+ * @return
*/
public static Vector getContainedElementDeclarations(Node node,
SymbolTable symbolTable) {
@@ -298,7 +298,7 @@
if ((localName != null)
&& (localName.equals("extension") || localName.equals("restriction"))
&& Constants.isSchemaXSD(kid.getNamespaceURI())) {
-
+
// get the type of the extension/restriction from the "base" attribute
QName extendsOrRestrictsType =
Utils.getTypeQName(children.item(j),
@@ -344,6 +344,12 @@
return v;
} else if (isXSDNode(node, "group")) {
+ /*
+ * Does this else clause make any sense anymore if
+ * we're treating refs to xs:groups like a macro inclusion
+ * into the referencing type?
+ * Maybe this else clause should never be possible?
+ *
NodeList children = node.getChildNodes();
Vector v = new Vector();
int len = children.getLength();
@@ -362,6 +368,8 @@
}
}
return v;
+ */
+ return null;
} else {
// This may be a simpleType, return the type with the name "value"
@@ -400,10 +408,10 @@
/**
* Invoked by getContainedElementDeclarations to get the child element types
* and child element names underneath a Choice Node
- *
- * @param choiceNode
- * @param symbolTable
- * @return
+ *
+ * @param choiceNode
+ * @param symbolTable
+ * @return
*/
private static Vector processChoiceNode(Node choiceNode,
SymbolTable symbolTable) {
@@ -423,9 +431,9 @@
} else if (localName.equals("group")) {
v.addAll(processGroupNode(kid, symbolTable));
} else if (localName.equals("element")) {
- ElementDecl elem = processChildElementNode(kid,
+ ElementDecl elem = processChildElementNode(kid,
symbolTable);
-
+
if (elem != null) {
// XXX: forces minOccurs="0" so that a null choice
// element can be serialized ok.
@@ -453,7 +461,7 @@
/**
* Returns named child node.
- *
+ *
* @param parentNode Parent node.
* @param name Element name of child node to return.
*/
@@ -476,9 +484,9 @@
/**
* Returns all textual nodes of a subnode defined by a parent node
* and a path of element names to that subnode.
- *
+ *
* @param root Parent node.
- * @param path Path of element names to text of interest, delimited by "/".
+ * @param path Path of element names to text of interest, delimited by "/".
*/
public static String getTextByPath(Node root, String path) throws DOMException {
StringTokenizer st = new StringTokenizer(path, "/");
@@ -490,7 +498,7 @@
throw new DOMException(DOMException.NOT_FOUND_ERR, "could not find " + elementName);
node = child;
}
-
+
// should have found the node
String text = "";
NodeList children = node.getChildNodes();
@@ -510,10 +518,10 @@
}
/**
- * Returns the complete text of the child xsd:annotation/xsd:documentation
- * element from the provided node. Only the first annotation element and
+ * Returns the complete text of the child xsd:annotation/xsd:documentation
+ * element from the provided node. Only the first annotation element and
* the first documentation element in the annotation element will be used.
- *
+ *
* @param typeNode Parent node.
*/
public static String getAnnotationDocumentation(Node typeNode) {
@@ -536,7 +544,7 @@
} else {
documentationNode = null;
}
-
+
// should have found the node if it exists
String text = "";
if (documentationNode != null) {
@@ -560,10 +568,10 @@
/**
* Invoked by getContainedElementDeclarations to get the child element types
* and child element names underneath a Sequence Node
- *
- * @param sequenceNode
- * @param symbolTable
- * @return
+ *
+ * @param sequenceNode
+ * @param symbolTable
+ * @return
*/
private static Vector processSequenceNode(Node sequenceNode,
SymbolTable symbolTable) {
@@ -610,12 +618,12 @@
/**
* Invoked by getContainedElementDeclarations to get the child element types
- * and child element names underneath a group node. If a ref attribute is
+ * and child element names underneath a group node. If a ref attribute is
* specified, only the referenced group element is returned.
- *
- * @param groupNode
- * @param symbolTable
- * @return
+ *
+ * @param groupNode
+ * @param symbolTable
+ * @return
*/
private static Vector processGroupNode(Node groupNode,
SymbolTable symbolTable) {
@@ -646,8 +654,26 @@
// assignment compatible with 'org.apache.axis.wsdl.symbolTable.Type'.
Type type = (Type) symbolTable.getTypeEntry(nodeType, false);
- if (type != null) {
- v.add(new ElementDecl(type, nodeName));
+ if (type != null && type.getNode() != null) {
+ //v.add(new ElementDecl(type, nodeName));
+ Node node = type.getNode();
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName subNodeKind = Utils.getNodeQName(children.item(j));
+ if ((subNodeKind != null)
+ && Constants.isSchemaXSD(
+ subNodeKind.getNamespaceURI())) {
+ if (subNodeKind.getLocalPart().equals("sequence")) {
+ v.addAll(processSequenceNode(children.item(j),
+ symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("all")) {
+ v.addAll(processAllNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("choice")) {
+ v.addAll(processChoiceNode(children.item(j),
+ symbolTable));
+ }
+ }
+ }
}
}
return v;
@@ -657,10 +683,10 @@
/**
* Invoked by getContainedElementDeclarations to get the child element types
* and child element names underneath an all node.
- *
- * @param allNode
- * @param symbolTable
- * @return
+ *
+ * @param allNode
+ * @param symbolTable
+ * @return
*/
private static Vector processAllNode(Node allNode,
SymbolTable symbolTable) {
@@ -689,10 +715,10 @@
* <p/>
* If the specified node represents a supported JAX-RPC child element,
* we return an ElementDecl containing the child element name and type.
- *
- * @param elementNode
- * @param symbolTable
- * @return
+ *
+ * @param elementNode
+ * @param symbolTable
+ * @return
*/
private static ElementDecl processChildElementNode(Node elementNode,
SymbolTable symbolTable) {
@@ -702,7 +728,7 @@
BooleanHolder forElement = new BooleanHolder();
String comments = null;
comments = getAnnotationDocumentation(elementNode);
-
+
// The type qname is used to locate the TypeEntry, which is then
// used to retrieve the proper java name of the type.
QName nodeType = Utils.getTypeQName(elementNode, forElement, false);
@@ -770,9 +796,9 @@
/**
* Returns the WSDL2Java QName for the anonymous type of the element
* or null.
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static QName getElementAnonQName(Node node) {
@@ -795,9 +821,9 @@
/**
* Returns the WSDL2Java QName for the anonymous type of the attribute
* or null.
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static QName getAttributeAnonQName(Node node) {
@@ -819,9 +845,9 @@
/**
* If the specified node is a simple type or contains simpleContent, return true
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static boolean isSimpleTypeOrSimpleContent(Node node) {
@@ -890,7 +916,7 @@
* <p/>
* This can be used to determine that a given Node defines a
* schema "complexType" "element" and so forth.
- *
+ *
* @param node a <code>Node</code> value
* @param schemaLocalName a <code>String</code> value
* @return true if the node is matches the name in the schema namespace.
@@ -910,10 +936,10 @@
/**
* Look for the base type of node iff node is a complex type that has been
* derived by restriction; otherwise return null.
- *
- * @param node
- * @param symbolTable
- * @return
+ *
+ * @param node
+ * @param symbolTable
+ * @return
*/
public static TypeEntry getComplexElementRestrictionBase(Node node,
SymbolTable symbolTable) {
@@ -993,10 +1019,10 @@
/**
* If the specified node represents a supported JAX-RPC complexType/element
* which extends another complexType. The Type of the base is returned.
- *
- * @param node
- * @param symbolTable
- * @return
+ *
+ * @param node
+ * @param symbolTable
+ * @return
*/
public static TypeEntry getComplexElementExtensionBase(Node node,
SymbolTable symbolTable) {
@@ -1085,9 +1111,9 @@
/**
* If the specified node represents a 'normal' non-enumeration simpleType,
* the QName of the simpleType base is returned.
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static QName getSimpleTypeBase(Node node) {
@@ -1102,9 +1128,9 @@
/**
* Method getContainedSimpleTypes
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static QName[] getContainedSimpleTypes(Node node) {
@@ -1180,9 +1206,9 @@
/**
* Returns the contained restriction or extension node underneath
* the specified node. Returns null if not found
- *
- * @param node
- * @return
+ *
+ * @param node
+ * @return
*/
public static Node getRestrictionOrExtensionNode(Node node) {
@@ -1252,7 +1278,7 @@
/**
* If the specified node represents an array encoding of one of the following
* forms, then return the qname repesenting the element type of the array.
- *
+ *
* @param node is the node
* @param dims is the output value that contains the number of dimensions if return is not null
* @param itemQName will end up containing the "inner" QName for a
@@ -1291,7 +1317,7 @@
* <p/>
* <xsd:element ref="alias" maxOccurs="unbounded"/>
* returns qname for "alias"
- *
+ *
* @param node is the Node
* @return QName of the compoent of the collection
*/
@@ -1378,7 +1404,7 @@
/**
* If the specified node represents an array encoding of one of the following
* forms, then return the qname repesenting the element type of the array.
- *
+ *
* @param node is the node
* @param dims is the output value that contains the number of dimensions if return is not null
* @return QName or null
@@ -1482,7 +1508,7 @@
}
}
}
-
+
// Under the restriction there should be an attribute OR a sequence/all group node.
// (There may be other #text nodes, which we will ignore).
Node groupNode = null;
@@ -1622,10 +1648,10 @@
/**
* adds an attribute node's type and name to the vector
* helper used by getContainedAttributeTypes
- *
- * @param v
- * @param child
- * @param symbolTable
+ *
+ * @param v
+ * @param child
+ * @param symbolTable
*/
private static void addAttributeToVector(Vector v, Node child,
SymbolTable symbolTable) {
@@ -1680,7 +1706,7 @@
if (type instanceof org.apache.axis.wsdl.symbolTable.Element) {
type = ((org.apache.axis.wsdl.symbolTable.Element) type).getRefType();
}
-
+
// add type and name to vector, skip it if we couldn't parse it
// XXX - this may need to be revisited.
if ((type != null) && (attributeName != null)) {
@@ -1700,11 +1726,11 @@
/**
* adds an attribute to the vector
* helper used by addAttributeGroupToVector
- *
- * @param v
- * @param symbolTable
- * @param type
- * @param name
+ *
+ * @param v
+ * @param symbolTable
+ * @param type
+ * @param name
*/
private static void addAttributeToVector(Vector v, SymbolTable symbolTable,
QName type, QName name) {
@@ -1720,10 +1746,10 @@
/**
* adds each attribute group's attribute node to the vector
* helper used by getContainedAttributeTypes
- *
- * @param v
- * @param attrGrpnode
- * @param symbolTable
+ *
+ * @param v
+ * @param attrGrpnode
+ * @param symbolTable
*/
private static void addAttributeGroupToVector(Vector v, Node attrGrpnode,
SymbolTable symbolTable) {
@@ -1815,10 +1841,10 @@
* <attribute name="Male" type="boolean" />
* <attributeGroup ref="s0:MyAttrSet" />
* </complexType>
- *
- * @param node
- * @param symbolTable
- * @return
+ *
+ * @param node
+ * @param symbolTable
+ * @return
*/
public static Vector getContainedAttributeTypes(Node node,
SymbolTable symbolTable) {
@@ -1930,9 +1956,9 @@
/**
* Determine if a string is a simple XML Schema type
- *
- * @param s
- * @return
+ *
+ * @param s
+ * @return
*/
private static boolean isSimpleSchemaType(String s) {
@@ -1945,9 +1971,9 @@
/**
* Determine if a QName is a simple XML Schema type
- *
- * @param qname
- * @return
+ *
+ * @param qname
+ * @return
*/
public static boolean isSimpleSchemaType(QName qname) {
@@ -1962,21 +1988,21 @@
* Returns the base type of a given type with its symbol table.
* This logic is extracted from JavaTypeWriter's constructor() method
* for reusing.
- *
- * @param type
- * @param symbolTable
- * @return
+ *
+ * @param type
+ * @param symbolTable
+ * @return
*/
public static TypeEntry getBaseType(TypeEntry type, SymbolTable symbolTable) {
- Node node = type.getNode();
+ Node node = type.getNode();
TypeEntry base = getComplexElementExtensionBase(
node, symbolTable);
if (base == null) {
base = getComplexElementRestrictionBase(node, symbolTable);
- }
-
+ }
+
if (base == null) {
- QName baseQName = getSimpleTypeBase(node);
+ QName baseQName = getSimpleTypeBase(node);
if (baseQName != null) {
base = symbolTable.getType(baseQName);
}
@@ -1985,27 +2011,27 @@
}
/**
- * Returns whether the specified node represents a <xsd:simpleType>
+ * Returns whether the specified node represents a <xsd:simpleType>
* with a nested <xsd:list itemType="...">.
- * @param node
- * @return
+ * @param node
+ * @return
*/
public static boolean isListWithItemType(Node node) {
-
+
return getListItemType(node) != null;
}
/**
- * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
- * @param node
- * @return
+ * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
+ * @param node
+ * @return
*/
public static QName getListItemType(Node node) {
-
+
if (node == null) {
return null;
}
-
+
// If the node kind is an element, dive into it.
if (isXSDNode(node, "element")) {
NodeList children = node.getChildNodes();
@@ -2022,7 +2048,7 @@
for (int j = 0; j < children.getLength(); j++) {
if (isXSDNode(children.item(j), "list")) {
Node listNode = children.item(j);
- org.w3c.dom.Element listElement =
+ org.w3c.dom.Element listElement =
(org.w3c.dom.Element) listNode;
String type = listElement.getAttribute("itemType");
if (type.equals("")) {
1.95 +95 -83 ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- Utils.java 6 May 2005 02:28:10 -0000 1.94
+++ Utils.java 20 May 2005 12:55:49 -0000 1.95
@@ -1,12 +1,12 @@
/*
* Copyright 2001-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.
@@ -52,14 +52,14 @@
/**
* Class Utils
- *
+ *
* @version %I%, %G%
*/
public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
/** Field log */
protected static Log log = LogFactory.getLog(Utils.class.getName());
-
+
/**
* @see #holder(Parameter, Emitter)
*/
@@ -68,10 +68,10 @@
// For other fields the default values will do.
arg.setType(type);
return holder(arg, emitter);
- }
+ }
/**
* Given a type, return the Java mapping of that type's holder.
- *
+ *
* @param p parameter whose holder class name we want to obtain.
* @param emitter the only {@link Emitter} object embodying the running
* instance of WSDL2Java.
@@ -146,7 +146,7 @@
}
name = JavaUtils.replace(name, "java.lang.", "");
-
+
// This could be a special QName for a indexed property.
// If so, change the [] to Array.
name = JavaUtils.replace(name, "[]", "Array");
@@ -220,7 +220,7 @@
/**
* Add package to name
- *
+ *
* @param className full name of the class.
* @param newPkg name of the package to append
* @return String name with package name added
@@ -240,7 +240,7 @@
/**
* Given a fault message, return the fully qualified Java class name
* of the exception to be generated from this fault
- *
+ *
* @param faultMessage The WSDL fault message
* @param symbolTable the current symbol table
* @return A Java class name for the fault
@@ -256,7 +256,7 @@
/**
* Given a fault message, return the XML type of the exception data.
- *
+ *
* @param faultMessage The WSDL fault message object
* @param symbolTable the current symbol table
* @return A QName for the XML type of the data
@@ -272,7 +272,7 @@
/**
* Given a fault message, return TRUE if the fault is a complex type fault
- *
+ *
* @param faultMessage The WSDL fault message object
* @param symbolTable the current symbol table
* @return A Java class name for the fault
@@ -297,10 +297,10 @@
* The first element in the vector is the base type (an TypeEntry).
* Subsequent elements are values (Strings).
* If this is not an enumeration, null is returned.
- *
- * @param node
- * @param symbolTable
- * @return
+ *
+ * @param node
+ * @param symbolTable
+ * @return
*/
public static Vector getEnumerationBaseAndValues(Node node,
SymbolTable symbolTable) {
@@ -417,9 +417,9 @@
/**
* Capitalize the first character of the name.
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
public static String capitalizeFirstChar(String name) {
@@ -440,9 +440,9 @@
/**
* Prepend an underscore to the name
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
public static String addUnderscore(String name) {
@@ -455,9 +455,9 @@
/**
* Map an XML name to a valid Java identifier
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
public static String xmlNameToJava(String name) {
@@ -470,9 +470,9 @@
/**
* Map an XML name to a valid Java identifier w/ capitolized first letter
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
public static String xmlNameToJavaClass(String name) {
return capitalizeFirstChar(xmlNameToJava(name));
@@ -480,9 +480,9 @@
/**
* Method makePackageName
- *
- * @param namespace
- * @return
+ *
+ * @param namespace
+ * @return
*/
public static String makePackageName(String namespace) {
@@ -549,7 +549,7 @@
* Massage <tt>word</tt> into a form suitable for use in a Java package name.
* Append it to the target string buffer with a <tt>.</tt> delimiter iff
* <tt>word</tt> is not the first word in the package name.
- *
+ *
* @param sb the buffer to append to
* @param word the word to append
* @param firstWord a flag indicating whether this is the first word
@@ -589,9 +589,9 @@
/**
* Query Java Local Name
- *
- * @param fullName
- * @return
+ *
+ * @param fullName
+ * @return
*/
public static String getJavaLocalName(String fullName) {
return fullName.substring(fullName.lastIndexOf('.') + 1);
@@ -599,9 +599,9 @@
/**
* Query Java Package Name
- *
- * @param fullName
- * @return
+ *
+ * @param fullName
+ * @return
*/
public static String getJavaPackageName(String fullName) {
@@ -614,12 +614,12 @@
/**
* Does the given file already exist in the given namespace?
- *
- * @param name
- * @param namespace
- * @param namespaces
- * @return
- * @throws IOException
+ *
+ * @param name
+ * @param namespace
+ * @param namespaces
+ * @return
+ * @throws IOException
*/
public static boolean fileExists(
String name, String namespace, Namespaces namespaces)
@@ -646,10 +646,10 @@
/**
* Return a string with "var" wrapped as an Object type if needed
- *
- * @param type
- * @param var
- * @return
+ *
+ * @param type
+ * @param var
+ * @return
*/
public static String wrapPrimitiveType(TypeEntry type, String var) {
@@ -672,9 +672,9 @@
/**
* Return the Object variable 'var' cast to the appropriate type
* doing the right thing for the primitive types.
- *
- * @param var
- * @return
+ *
+ * @param var
+ * @return
*/
public static String getResponseString(Parameter param,
String var) {
@@ -683,7 +683,7 @@
}
String typeName = param.getType().getName();
MimeInfo mimeInfo = param.getMIMEInfo();
-
+
String mimeType = (mimeInfo == null)
? null
: mimeInfo.getType();
@@ -716,7 +716,7 @@
}
String objType = (String) TYPES.get(typeName);
-
+
if (objType != null) {
if (param.isOmittable()) {
typeName = objType;
@@ -725,29 +725,29 @@
"Value();";
}
}
-
+
return "(" + typeName + ") " + var + ";";
} // getResponseString
/**
* Method isPrimitiveType
- *
- * @param type
- * @return
+ *
+ * @param type
+ * @return
*/
public static boolean isPrimitiveType(TypeEntry type) {
return TYPES.get(type.getName()) != null;
} // isPrimitiveType
-
+
/**
* Return a "wrapper" type for the given type name. In other words,
* if it's a primitive type ("int") return the java wrapper class
* ("java.lang.Integer"). Otherwise return the type name itself.
- *
+ *
* @param type
* @return the name of a java wrapper class for the type, or the type's
* name if it's not primitive.
- */
+ */
public static String getWrapperType(String type) {
String ret = (String)TYPES.get(type);
return (ret == null) ? type : ret;
@@ -756,7 +756,7 @@
/**
* Return the operation QName. The namespace is determined from
* the soap:body namespace, if it exists, otherwise it is "".
- *
+ *
* @param bindingOper the operation
* @param bEntry the symbol table binding entry
* @param symbolTable SymbolTable
@@ -920,9 +920,9 @@
/**
* Common code for generating a QName in emitted code. Note that there's
* no semicolon at the end, so we can use this in a variety of contexts.
- *
- * @param qname
- * @return
+ *
+ * @param qname
+ * @return
*/
public static String getNewQName(javax.xml.namespace.QName qname) {
return "new javax.xml.namespace.QName(\"" + qname.getNamespaceURI()
@@ -938,9 +938,9 @@
* Get the parameter type name. If this is a MIME type, then
* figure out the appropriate type from the MIME type, otherwise
* use the name of the type itself.
- *
- * @param parm
- * @return
+ *
+ * @param parm
+ * @return
*/
public static String getParameterTypeName(Parameter parm) {
@@ -971,7 +971,7 @@
/**
* Get the QName that could be used in the xsi:type
* when serializing an object for this parameter/return
- *
+ *
* @param param is a parameter
* @return the QName of the parameter's xsi type
*/
@@ -987,7 +987,7 @@
/**
* Get the QName that could be used in the xsi:type
* when serializing an object of the given type.
- *
+ *
* @param te is the type entry
* @return the QName of the type's xsi type
*/
@@ -1025,7 +1025,7 @@
/**
* Given a MIME type, return the AXIS-specific type QName.
- *
+ *
* @param mimeName the MIME type name
* @return the AXIS-specific QName for the MIME type
*/
@@ -1051,9 +1051,9 @@
/**
* Are there any MIME parameters in the given binding?
- *
- * @param bEntry
- * @return
+ *
+ * @param bEntry
+ * @return
*/
public static boolean hasMIME(BindingEntry bEntry) {
@@ -1072,10 +1072,10 @@
/**
* Are there any MIME parameters in the given binding's operation?
- *
- * @param bEntry
- * @param operation
- * @return
+ *
+ * @param bEntry
+ * @param operation
+ * @return
*/
public static boolean hasMIME(BindingEntry bEntry,
BindingOperation operation) {
@@ -1182,11 +1182,11 @@
* <p/>
* Caller should expect to wrap the construction in a try/catch block
* if bThrow is set to <i>true</i>.
- *
+ *
* @param param info about the parameter we need a constructor for
* @param symbolTable used to lookup enumerations
* @param bThrow set to true if contructor needs try/catch block
- * @return
+ * @return
*/
public static String getConstructorForParam(Parameter param,
SymbolTable symbolTable,
@@ -1262,7 +1262,7 @@
return paramType + "." + enumeration;
}
-
+
if(param.getType().getRefType()!= null){
// Check for enumeration
Vector v2 = Utils.getEnumerationBaseAndValues(param.getType().getRefType().getNode(),
@@ -1283,7 +1283,8 @@
}
public static boolean shouldEmit(TypeEntry type) {
- // 1) Don't register types that are base (primitive) types or attributeGroups.
+ // 1) Don't register types that are base (primitive) types
+ // or attributeGroups or xs:groups.
// If the baseType != null && getRefType() != null this
// is a simpleType that must be registered.
// 2) Don't register the special types for collections
@@ -1295,10 +1296,21 @@
|| (type instanceof Element) || !type.isReferenced()
|| type.isOnlyLiteralReferenced()
|| ((type.getNode() != null)
- && type.getNode().getLocalName().equals(
- "attributeGroup"))));
+ && (isXsNode(type.getNode(), "group") ||
+ isXsNode(type.getNode(), "attributeGroup")))));
}
+
+ /**
+ * Determines if the DOM Node represents an xs:<node>
+ */
+ public static boolean isXsNode (Node node, String nameName)
+ {
+ return (node.getLocalName().equals(nameName)
+ && Constants.isSchemaXSD (node.getNamespaceURI ()));
+ }
+
+
public static QName getItemQName(TypeEntry te) {
if (te instanceof DefinedElement) {
te = te.getRefType();
1.25 +77 -74 ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Parser.java 13 Apr 2005 16:22:52 -0000 1.24
+++ Parser.java 20 May 2005 12:55:49 -0000 1.25
@@ -1,12 +1,12 @@
/*
* Copyright 2001-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.
@@ -23,6 +23,7 @@
import org.apache.axis.wsdl.symbolTable.ServiceEntry;
import org.apache.axis.wsdl.symbolTable.SymTabEntry;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
+import org.apache.axis.wsdl.toJava.Utils;
import org.apache.axis.wsdl.symbolTable.Type;
import org.apache.axis.wsdl.symbolTable.TypeEntry;
import org.w3c.dom.Document;
@@ -82,8 +83,8 @@
/**
* Method isDebug
- *
- * @return
+ *
+ * @return
*/
public boolean isDebug() {
return debug;
@@ -91,8 +92,8 @@
/**
* Method setDebug
- *
- * @param debug
+ *
+ * @param debug
*/
public void setDebug(boolean debug) {
this.debug = debug;
@@ -100,26 +101,26 @@
/**
* Method isQuiet
- *
- * @return
+ *
+ * @return
*/
public boolean isQuiet() {
return quiet;
- }
+ }
/**
* Method setQuiet
- *
+ *
* @param quiet
*/
public void setQuiet(boolean quiet) {
this.quiet = quiet;
- }
-
+ }
+
/**
* Method isImports
- *
- * @return
+ *
+ * @return
*/
public boolean isImports() {
return imports;
@@ -127,8 +128,8 @@
/**
* Method setImports
- *
- * @param imports
+ *
+ * @param imports
*/
public void setImports(boolean imports) {
this.imports = imports;
@@ -136,8 +137,8 @@
/**
* Method isVerbose
- *
- * @return
+ *
+ * @return
*/
public boolean isVerbose() {
return verbose;
@@ -145,8 +146,8 @@
/**
* Method setVerbose
- *
- * @param verbose
+ *
+ * @param verbose
*/
public void setVerbose(boolean verbose) {
this.verbose = verbose;
@@ -154,8 +155,8 @@
/**
* Method isNowrap
- *
- * @return
+ *
+ * @return
*/
public boolean isNowrap() {
return nowrap;
@@ -163,8 +164,8 @@
/**
* Method setNowrap
- *
- * @param nowrap
+ *
+ * @param nowrap
*/
public void setNowrap(boolean nowrap) {
this.nowrap = nowrap;
@@ -172,8 +173,8 @@
/**
* Return the current timeout setting
- *
- * @return
+ *
+ * @return
*/
public long getTimeout() {
return timeoutms;
@@ -181,8 +182,8 @@
/**
* Set the timeout, in milliseconds
- *
- * @param timeout
+ *
+ * @param timeout
*/
public void setTimeout(long timeout) {
this.timeoutms = timeout;
@@ -190,8 +191,8 @@
/**
* Method getUsername
- *
- * @return
+ *
+ * @return
*/
public String getUsername() {
return username;
@@ -199,8 +200,8 @@
/**
* Method setUsername
- *
- * @param username
+ *
+ * @param username
*/
public void setUsername(String username) {
this.username = username;
@@ -208,8 +209,8 @@
/**
* Method getPassword
- *
- * @return
+ *
+ * @return
*/
public String getPassword() {
return password;
@@ -217,8 +218,8 @@
/**
* Method setPassword
- *
- * @param password
+ *
+ * @param password
*/
public void setPassword(String password) {
this.password = password;
@@ -226,8 +227,8 @@
/**
* Method getFactory
- *
- * @return
+ *
+ * @return
*/
public GeneratorFactory getFactory() {
return genFactory;
@@ -235,8 +236,8 @@
/**
* Method setFactory
- *
- * @param factory
+ *
+ * @param factory
*/
public void setFactory(GeneratorFactory factory) {
this.genFactory = factory;
@@ -245,8 +246,8 @@
/**
* Get the symbol table. The symbol table is null until
* run is called.
- *
- * @return
+ *
+ * @return
*/
public SymbolTable getSymbolTable() {
return symbolTable;
@@ -255,8 +256,8 @@
/**
* Return the current definition. The current definition is
* null until run is called.
- *
- * @return
+ *
+ * @return
*/
public Definition getCurrentDefinition() {
@@ -268,8 +269,8 @@
/**
* Get the current WSDL URI. The WSDL URI is null until
* run is called.
- *
- * @return
+ *
+ * @return
*/
public String getWSDLURI() {
@@ -283,9 +284,9 @@
* <p/>
* This method will time out after the number of milliseconds specified
* by our timeoutms member.
- *
- * @param wsdlURI
- * @throws Exception
+ *
+ * @param wsdlURI
+ * @throws Exception
*/
public void run(String wsdlURI) throws Exception {
@@ -326,7 +327,7 @@
/**
* Class WSDLRunnable
- *
+ *
* @version %I%, %G%
*/
private class WSDLRunnable implements Runnable {
@@ -342,9 +343,9 @@
/**
* Constructor WSDLRunnable
- *
- * @param symbolTable
- * @param wsdlURI
+ *
+ * @param symbolTable
+ * @param wsdlURI
*/
public WSDLRunnable(SymbolTable symbolTable, String wsdlURI) {
this.symbolTable = symbolTable;
@@ -366,8 +367,8 @@
/**
* Method getFailure
- *
- * @return
+ *
+ * @return
*/
public Exception getFailure() {
return failure;
@@ -376,13 +377,13 @@
/**
* Call this method if your WSDL document has already been parsed as an XML DOM document.
- *
+ *
* @param context context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory.
* @param doc doc This is the XML Document containing the WSDL.
- * @throws IOException
- * @throws SAXException
- * @throws WSDLException
- * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws WSDLException
+ * @throws ParserConfigurationException
*/
public void run(String context, Document doc)
throws IOException, SAXException, WSDLException,
@@ -401,8 +402,8 @@
/**
* Method sanityCheck
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void sanityCheck(SymbolTable symbolTable) {
@@ -411,9 +412,9 @@
/**
* Method generate
- *
- * @param symbolTable
- * @throws IOException
+ *
+ * @param symbolTable
+ * @throws IOException
*/
private void generate(SymbolTable symbolTable) throws IOException {
@@ -487,9 +488,9 @@
/**
* Generate bindings (classes and class holders) for the complex types.
* If generating serverside (skeleton) spit out beanmappings
- *
- * @param symbolTable
- * @throws IOException
+ *
+ * @param symbolTable
+ * @throws IOException
*/
private void generateTypes(SymbolTable symbolTable) throws IOException {
@@ -501,7 +502,7 @@
// Write out the type if and only if:
// - we found its definition (getNode())
// - it is referenced
- // - it is not a base type or an attributeGroup
+ // - it is not a base type or an attributeGroup or xs:group
// - it is a Type (not an Element) or a CollectionElement
// (Note that types that are arrays are passed to getGenerator
// because they may require a Holder)
@@ -510,7 +511,8 @@
|| (type instanceof CollectionElement));
if ((type.getNode() != null)
- && !type.getNode().getLocalName().equals("attributeGroup")
+ && !Utils.isXsNode(type.getNode(), "attributeGroup")
+ && !Utils.isXsNode(type.getNode(), "group")
&& type.isReferenced() && isType
&& (type.getBaseType() == null)) {
Generator gen = genFactory.getGenerator(type, symbolTable);
@@ -518,7 +520,7 @@
gen.generate();
}
}
-
+
Map types = symbolTable.getTypeIndex();
Collection typeCollection = types.values();
for (Iterator i = typeCollection.iterator(); i.hasNext(); ) {
@@ -527,7 +529,7 @@
// Write out the type if and only if:
// - we found its definition (getNode())
// - it is referenced
- // - it is not a base type or an attributeGroup
+ // - it is not a base type or an attributeGroup or xs:group
// - it is a Type (not an Element) or a CollectionElement
// (Note that types that are arrays are passed to getGenerator
// because they may require a Holder)
@@ -536,7 +538,8 @@
|| (type instanceof CollectionElement));
if ((type.getNode() != null)
- && !type.getNode().getLocalName().equals("attributeGroup")
+ && !Utils.isXsNode(type.getNode(), "attributeGroup")
+ && !Utils.isXsNode(type.getNode(), "group")
&& type.isReferenced() && isType
&& (type.getBaseType() == null)) {
Generator gen = genFactory.getGenerator(type, symbolTable);
Re: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/gen Parser.java
Posted by Davanum Srinivas <da...@gmail.com>.
Venkat,
please don't discuss tck on the public mailing lists. use axis-tck@ for that.
thanks,
dims
On 20 May 2005 12:55:50 -0000, venkat@apache.org <ve...@apache.org> wrote:
> venkat 2005/05/20 05:55:49
>
> Modified: java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
> java/src/org/apache/axis/wsdl/toJava Utils.java
> java/src/org/apache/axis/wsdl/gen Parser.java
> Added: java/test/wsdl/groups GroupsTestCase.java Groups.wsdl
> build.xml SomeType.java
> Log:
> Checking in the patches and test case submitted by Steve Green for AXIS-1525. I have ran the JAX-RPC TCK test suite after the changes and ensured it is all green. Thanks Steve.
>
> Revision Changes Path
> 1.1 ws-axis/java/test/wsdl/groups/GroupsTestCase.java
>
> Index: GroupsTestCase.java
> ===================================================================
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> *
> * Licensed 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.
> */
>
> /**
> * This tests the file generation of only the items that are referenced in WSDL
> *
> * @author Steve Green (steve.green@epok.net)
> */
> package test.wsdl.groups;
>
> import java.io.File;
> import java.io.IOException;
> import java.lang.reflect.Method;
> import java.util.Arrays;
> import java.util.HashSet;
> import java.util.Set;
>
>
> public class GroupsTestCase extends junit.framework.TestCase {
> public GroupsTestCase(String name) {
> super(name);
> }
>
> /**
> * List of files which should be generated.
> */
> protected Set shouldExist() {
> HashSet set = new HashSet();
> set.add("GroupsTestCase.java");
> set.add("SomeType.java");
> return set;
> }
>
> /**
> * List of files which may or may not be generated.
> */
> protected Set shouldNotExist() {
> HashSet set = new HashSet();
> set.add("SomeGroup.java");
> return set;
> }
>
> /**
> * The directory containing the files that should exist.
> */
> protected String rootDir() {
> return "build" + File.separator + "work" + File.separator +
> "test" + File.separator + "wsdl" + File.separator +
> "groups";
> }
>
> protected String getPrefix(String parent) {
> if (parent == null || parent.length() == 0) {
> return "";
> }
> else {
> return parent + File.separator;
> }
> }
>
> /** This method returns a array of String file paths, located within the
> * supplied root directory. The string values are created relative to the
> * specified parent so that the names get returned in the form of
> * "file.java", "dir/file.java", "dir/dir/file.java", etc. This feature
> * asslows the various file specs to include files in sub-directories as
> * well as the root directory.
> */
> protected String[] getPaths(File root, String parent) {
> File files[] = root.listFiles();
> if (files == null)
> fail("Unable to get a list of files from " + root.getPath());
>
> Set filePaths = new HashSet();
> for(int i=0; i<files.length; i++) {
> if (files[i].isDirectory()) {
> String children[] = getPaths(files[i],
> getPrefix(parent) + files[i].getName());
> filePaths.addAll(Arrays.asList(children));
> }
> else {
> filePaths.add(getPrefix(parent) + files[i].getName());
> }
> }
> String paths[] = new String[filePaths.size()];
> return (String[]) filePaths.toArray(paths);
> }
>
>
> public void testGroups() throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException {
>
> // Test for the proper files
>
> String rootDir = rootDir();
> Set shouldExist = shouldExist();
> Set shouldNotExist = shouldNotExist();
>
> // open up the output directory and check what files exist.
> File outputDir = new File(rootDir);
>
> String[] files = getPaths(outputDir, null);
>
> for (int i = 0; i < files.length; ++i) {
> if (shouldExist.contains(files[i])) {
> shouldExist.remove(files[i]);
> }
> else if (shouldNotExist.contains(files[i])) {
> fail("The following file should not exist in " + rootDir +
> ", but does: " + files[i]);
> }
> }
>
> if (shouldExist.size() > 0) {
> fail("The following files should exist in " + rootDir +
> ", but do not: " + shouldExist);
> }
>
> // Test for the proper members
>
> Class ourClass = Class.forName("test.wsdl.groups.SomeType");
> ourClass.getDeclaredMethod("getA", null);
> ourClass.getDeclaredMethod("getB", null);
> ourClass.getDeclaredMethod("getZ", null);
>
> return;
> }
> }
>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/Groups.wsdl
>
> Index: Groups.wsdl
> ===================================================================
> <?xml version="1.0" encoding="utf-8" ?>
>
> <definitions targetNamespace="http://test.com/reference"
> xmlns:tns="http://test.com/reference"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/">
>
> <types>
> <xs:schema>
>
> <xs:group name="SomeGroup">
> <xs:sequence>
> <xs:element name="a" type="xs:string"/>
> <xs:element name="b" type="xs:string"/>
> </xs:sequence>
> </xs:group>
>
> <xs:complexType name="SomeType">
> <xs:sequence>
> <xs:element name="z" type="xs:string"/>
> <xs:group ref="tns:SomeGroup"/>
> </xs:sequence>
> </xs:complexType>
>
> </xs:schema>
> </types>
>
> </definitions>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/build.xml
>
> Index: build.xml
> ===================================================================
> <?xml version="1.0" ?>
> <!DOCTYPE project [
> <!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
> <!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
> <!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
> <!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
> <!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
> ]>
>
> <!-- ===================================================================
> <description>
> Test/Sample Component file for Axis
>
> Notes:
> This is a build file for use with the Jakarta Ant build tool.
>
> Prerequisites:
>
> jakarta-ant from http://jakarta.apache.org
>
> Build Instructions:
> To compile
> ant compile
> To execute
> ant run
>
> Author:
> Matt Seibert mseibert@us.ibm.com
>
> Copyright:
> Copyright (c) 2002-2003 Apache Software Foundation.
> </description>
> ==================================================================== -->
>
> <project default="compile">
>
> <property name="axis.home" location="../../.." />
> <property name="componentName" value="test/wsdl/groups" />
> &properties;
> &paths;
> &taskdefs;
> &taskdefs_post_compile;
> &targets;
>
> <target name="clean" depends="setenv">
> <echo message="Removing ${build.dir}/**/test/wsdl/groups" />
> <echo message="componentName is ${componentName}"/>
> <delete dir="${build.dir}/classes/test/wsdl/groups"/>
> <delete dir="${build.dir}/work/test/wsdl/groups"/>
> <delete dir="${build.dir}/classes/test/wsdl/groupsAll"/>
> <delete dir="${build.dir}/work/test/wsdl/groupsAll"/>
> </target>
>
>
> <target name="compile" depends="clean">
> <echo message="Compiling test.wsdl.groups"/>
> <!-- Verify files generated based on what is referenced in WSDL -->
> <wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
> output="${axis.home}/build/work"
> deployscope="none"
> serverSide="no"
> noimports="no"
> verbose="no"
> testcase="no">
> <mapping namespace="http://test.com/reference" package="test.wsdl.groups"/>
> </wsdl2java>
>
> <!-- Same test as above but this time the -a flag is turned on -->
> <wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
> output="${axis.home}/build/work"
> serverSide="no"
> all="yes">
> <mapping namespace="http://test.com/reference" package="test.wsdl.groupsAll"/>
> </wsdl2java>
>
> <copy todir="${build.dir}/work/test/wsdl/groups" overwrite="yes">
> <fileset dir="${axis.home}/test/wsdl/groups">
> <include name="*TestCase.java"/>
> <include name="*Impl.java"/>
> </fileset>
> </copy>
>
> <javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
> debug="${debug}">
> <classpath refid="classpath" />
> <include name="test/wsdl/groups/*.java" />
> <include name="test/wsdl/groupsAll/*.java" />
> </javac>
>
> </target>
>
> <target name="run" >
> <antcall target="execute-Component-noServer" />
> </target>
>
> </project>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/SomeType.java
>
> Index: SomeType.java
> ===================================================================
> /**
> * SomeType.java
> *
> * This file was auto-generated from WSDL
> * by the Apache Axis 1.2RC1 Oct 20, 2004 (05:49:44 EDT) WSDL2Java emitter.
> */
>
> package com.epok.auth;
>
> public class SomeType implements java.io.Serializable {
> private java.lang.String z;
> private java.lang.String a;
> private java.lang.String b;
>
> public SomeType() {
> }
>
> public SomeType(
> java.lang.String z,
> java.lang.String a,
> java.lang.String b) {
> this.z = z;
> this.a = a;
> this.b = b;
> }
>
>
> /**
> * Gets the z value for this SomeType.
> *
> * @return z
> */
> public java.lang.String getZ() {
> return z;
> }
>
>
> /**
> * Sets the z value for this SomeType.
> *
> * @param z
> */
> public void setZ(java.lang.String z) {
> this.z = z;
> }
>
>
> /**
> * Gets the a value for this SomeType.
> *
> * @return a
> */
> public java.lang.String getA() {
> return a;
> }
>
>
> /**
> * Sets the a value for this SomeType.
> *
> * @param a
> */
> public void setA(java.lang.String a) {
> this.a = a;
> }
>
>
> /**
> * Gets the b value for this SomeType.
> *
> * @return b
> */
> public java.lang.String getB() {
> return b;
> }
>
>
> /**
> * Sets the b value for this SomeType.
> *
> * @param b
> */
> public void setB(java.lang.String b) {
> this.b = b;
> }
>
> private java.lang.Object __equalsCalc = null;
> public synchronized boolean equals(java.lang.Object obj) {
> if (!(obj instanceof SomeType)) return false;
> SomeType other = (SomeType) obj;
> if (obj == null) return false;
> if (this == obj) return true;
> if (__equalsCalc != null) {
> return (__equalsCalc == obj);
> }
> __equalsCalc = obj;
> boolean _equals;
> _equals = true &&
> ((this.z==null && other.getZ()==null) ||
> (this.z!=null &&
> this.z.equals(other.getZ()))) &&
> ((this.a==null && other.getA()==null) ||
> (this.a!=null &&
> this.a.equals(other.getA()))) &&
> ((this.b==null && other.getB()==null) ||
> (this.b!=null &&
> this.b.equals(other.getB())));
> __equalsCalc = null;
> return _equals;
> }
>
> private boolean __hashCodeCalc = false;
> public synchronized int hashCode() {
> if (__hashCodeCalc) {
> return 0;
> }
> __hashCodeCalc = true;
> int _hashCode = 1;
> if (getZ() != null) {
> _hashCode += getZ().hashCode();
> }
> if (getA() != null) {
> _hashCode += getA().hashCode();
> }
> if (getB() != null) {
> _hashCode += getB().hashCode();
> }
> __hashCodeCalc = false;
> return _hashCode;
> }
>
> // Type metadata
> private static org.apache.axis.description.TypeDesc typeDesc =
> new org.apache.axis.description.TypeDesc(SomeType.class, true);
>
> static {
> typeDesc.setXmlType(new javax.xml.namespace.QName("urn:auth:epok:com", "SomeType"));
> org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("z");
> elemField.setXmlName(new javax.xml.namespace.QName("", "z"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("a");
> elemField.setXmlName(new javax.xml.namespace.QName("", "a"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("b");
> elemField.setXmlName(new javax.xml.namespace.QName("", "b"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> }
>
> /**
> * Return type metadata object
> */
> public static org.apache.axis.description.TypeDesc getTypeDesc() {
> return typeDesc;
> }
>
> /**
> * Get Custom Serializer
> */
> public static org.apache.axis.encoding.Serializer getSerializer(
> java.lang.String mechType,
> java.lang.Class _javaType,
> javax.xml.namespace.QName _xmlType) {
> return
> new org.apache.axis.encoding.ser.BeanSerializer(
> _javaType, _xmlType, typeDesc);
> }
>
> /**
> * Get Custom Deserializer
> */
> public static org.apache.axis.encoding.Deserializer getDeserializer(
> java.lang.String mechType,
> java.lang.Class _javaType,
> javax.xml.namespace.QName _xmlType) {
> return
> new org.apache.axis.encoding.ser.BeanDeserializer(
> _javaType, _xmlType, typeDesc);
> }
>
> }
>
>
>
> 1.57 +155 -129 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
>
> Index: SchemaUtils.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
> retrieving revision 1.56
> retrieving revision 1.57
> diff -u -r1.56 -r1.57
> --- SchemaUtils.java 30 Apr 2005 18:31:40 -0000 1.56
> +++ SchemaUtils.java 20 May 2005 12:55:49 -0000 1.57
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -35,7 +35,7 @@
>
> /**
> * This class contains static utility methods specifically for schema type queries.
> - *
> + *
> * @author Rich Scheuerle (scheu@us.ibm.com)
> */
> public class SchemaUtils {
> @@ -58,7 +58,7 @@
> // Under the complexType there could be complexContent with
> // mixed="true"
> NodeList children = node.getChildNodes();
> -
> +
> for (int j = 0; j < children.getLength(); j++) {
> Node kid = children.item(j);
> if (isXSDNode(kid, "complexContent")) {
> @@ -85,9 +85,9 @@
> }
> return null;
> }
> -
> +
> public static Node getListNode(Node node) {
> - // Expecting a schema simpleType
> + // Expecting a schema simpleType
> if (isXSDNode(node, "simpleType")) {
> // Under the simpleType there could be list
> NodeList children = node.getChildNodes();
> @@ -104,19 +104,19 @@
> public static boolean isSimpleTypeWithUnion(Node node) {
> return (getUnionNode(node) != null);
> }
> -
> +
> /**
> * This method checks out if the given node satisfies the 3rd condition
> * of the "wrapper" style:
> * such an element (a wrapper) must be of a complex type defined using the
> * xsd:sequence compositor and containing only elements declarations.
> * (excerpt from JAX-RPC spec 1.1 Maintenanace Review 2 Chapter 6 Section 4.1.)
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static boolean isWrappedType(Node node) {
> -
> +
> if (node == null) {
> return false;
> }
> @@ -143,7 +143,7 @@
> // Under the complexType there could be complexContent/simpleContent
> // and extension elements if this is a derived type.
> // A wrapper element must be complex-typed.
> -
> +
> NodeList children = node.getChildNodes();
>
> for (int j = 0; j < children.getLength(); j++) {
> @@ -158,8 +158,8 @@
>
> // Under the complexType there may be choice, sequence, group and/or all nodes.
> // (There may be other #text nodes, which we will ignore).
> - // The complex type of a wrapper element must have only sequence
> - // and again element declarations in the sequence.
> + // The complex type of a wrapper element must have only sequence
> + // and again element declarations in the sequence.
> children = node.getChildNodes();
> int len = children.getLength();
> for (int j = 0; j < len; j++) {
> @@ -204,11 +204,11 @@
> }
> }
> }
> - }
> + }
> // allows void type
> return true;
> }
> -
> +
> /**
> * If the specified node represents a supported JAX-RPC complexType or
> * simpleType, a Vector is returned which contains ElementDecls for the
> @@ -221,10 +221,10 @@
> * (use the getContainedAttributeTypes)
> * If the specified node is not a supported
> * JAX-RPC complexType/simpleType/element null is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getContainedElementDeclarations(Node node,
> SymbolTable symbolTable) {
> @@ -298,7 +298,7 @@
> if ((localName != null)
> && (localName.equals("extension") || localName.equals("restriction"))
> && Constants.isSchemaXSD(kid.getNamespaceURI())) {
> -
> +
> // get the type of the extension/restriction from the "base" attribute
> QName extendsOrRestrictsType =
> Utils.getTypeQName(children.item(j),
> @@ -344,6 +344,12 @@
>
> return v;
> } else if (isXSDNode(node, "group")) {
> + /*
> + * Does this else clause make any sense anymore if
> + * we're treating refs to xs:groups like a macro inclusion
> + * into the referencing type?
> + * Maybe this else clause should never be possible?
> + *
> NodeList children = node.getChildNodes();
> Vector v = new Vector();
> int len = children.getLength();
> @@ -362,6 +368,8 @@
> }
> }
> return v;
> + */
> + return null;
> } else {
>
> // This may be a simpleType, return the type with the name "value"
> @@ -400,10 +408,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath a Choice Node
> - *
> - * @param choiceNode
> - * @param symbolTable
> - * @return
> + *
> + * @param choiceNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processChoiceNode(Node choiceNode,
> SymbolTable symbolTable) {
> @@ -423,9 +431,9 @@
> } else if (localName.equals("group")) {
> v.addAll(processGroupNode(kid, symbolTable));
> } else if (localName.equals("element")) {
> - ElementDecl elem = processChildElementNode(kid,
> + ElementDecl elem = processChildElementNode(kid,
> symbolTable);
> -
> +
> if (elem != null) {
> // XXX: forces minOccurs="0" so that a null choice
> // element can be serialized ok.
> @@ -453,7 +461,7 @@
>
> /**
> * Returns named child node.
> - *
> + *
> * @param parentNode Parent node.
> * @param name Element name of child node to return.
> */
> @@ -476,9 +484,9 @@
> /**
> * Returns all textual nodes of a subnode defined by a parent node
> * and a path of element names to that subnode.
> - *
> + *
> * @param root Parent node.
> - * @param path Path of element names to text of interest, delimited by "/".
> + * @param path Path of element names to text of interest, delimited by "/".
> */
> public static String getTextByPath(Node root, String path) throws DOMException {
> StringTokenizer st = new StringTokenizer(path, "/");
> @@ -490,7 +498,7 @@
> throw new DOMException(DOMException.NOT_FOUND_ERR, "could not find " + elementName);
> node = child;
> }
> -
> +
> // should have found the node
> String text = "";
> NodeList children = node.getChildNodes();
> @@ -510,10 +518,10 @@
> }
>
> /**
> - * Returns the complete text of the child xsd:annotation/xsd:documentation
> - * element from the provided node. Only the first annotation element and
> + * Returns the complete text of the child xsd:annotation/xsd:documentation
> + * element from the provided node. Only the first annotation element and
> * the first documentation element in the annotation element will be used.
> - *
> + *
> * @param typeNode Parent node.
> */
> public static String getAnnotationDocumentation(Node typeNode) {
> @@ -536,7 +544,7 @@
> } else {
> documentationNode = null;
> }
> -
> +
> // should have found the node if it exists
> String text = "";
> if (documentationNode != null) {
> @@ -560,10 +568,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath a Sequence Node
> - *
> - * @param sequenceNode
> - * @param symbolTable
> - * @return
> + *
> + * @param sequenceNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processSequenceNode(Node sequenceNode,
> SymbolTable symbolTable) {
> @@ -610,12 +618,12 @@
>
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> - * and child element names underneath a group node. If a ref attribute is
> + * and child element names underneath a group node. If a ref attribute is
> * specified, only the referenced group element is returned.
> - *
> - * @param groupNode
> - * @param symbolTable
> - * @return
> + *
> + * @param groupNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processGroupNode(Node groupNode,
> SymbolTable symbolTable) {
> @@ -646,8 +654,26 @@
> // assignment compatible with 'org.apache.axis.wsdl.symbolTable.Type'.
> Type type = (Type) symbolTable.getTypeEntry(nodeType, false);
>
> - if (type != null) {
> - v.add(new ElementDecl(type, nodeName));
> + if (type != null && type.getNode() != null) {
> + //v.add(new ElementDecl(type, nodeName));
> + Node node = type.getNode();
> + NodeList children = node.getChildNodes();
> + for (int j = 0; j < children.getLength(); j++) {
> + QName subNodeKind = Utils.getNodeQName(children.item(j));
> + if ((subNodeKind != null)
> + && Constants.isSchemaXSD(
> + subNodeKind.getNamespaceURI())) {
> + if (subNodeKind.getLocalPart().equals("sequence")) {
> + v.addAll(processSequenceNode(children.item(j),
> + symbolTable));
> + } else if (subNodeKind.getLocalPart().equals("all")) {
> + v.addAll(processAllNode(children.item(j), symbolTable));
> + } else if (subNodeKind.getLocalPart().equals("choice")) {
> + v.addAll(processChoiceNode(children.item(j),
> + symbolTable));
> + }
> + }
> + }
> }
> }
> return v;
> @@ -657,10 +683,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath an all node.
> - *
> - * @param allNode
> - * @param symbolTable
> - * @return
> + *
> + * @param allNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processAllNode(Node allNode,
> SymbolTable symbolTable) {
> @@ -689,10 +715,10 @@
> * <p/>
> * If the specified node represents a supported JAX-RPC child element,
> * we return an ElementDecl containing the child element name and type.
> - *
> - * @param elementNode
> - * @param symbolTable
> - * @return
> + *
> + * @param elementNode
> + * @param symbolTable
> + * @return
> */
> private static ElementDecl processChildElementNode(Node elementNode,
> SymbolTable symbolTable) {
> @@ -702,7 +728,7 @@
> BooleanHolder forElement = new BooleanHolder();
> String comments = null;
> comments = getAnnotationDocumentation(elementNode);
> -
> +
> // The type qname is used to locate the TypeEntry, which is then
> // used to retrieve the proper java name of the type.
> QName nodeType = Utils.getTypeQName(elementNode, forElement, false);
> @@ -770,9 +796,9 @@
> /**
> * Returns the WSDL2Java QName for the anonymous type of the element
> * or null.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getElementAnonQName(Node node) {
>
> @@ -795,9 +821,9 @@
> /**
> * Returns the WSDL2Java QName for the anonymous type of the attribute
> * or null.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getAttributeAnonQName(Node node) {
>
> @@ -819,9 +845,9 @@
>
> /**
> * If the specified node is a simple type or contains simpleContent, return true
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static boolean isSimpleTypeOrSimpleContent(Node node) {
>
> @@ -890,7 +916,7 @@
> * <p/>
> * This can be used to determine that a given Node defines a
> * schema "complexType" "element" and so forth.
> - *
> + *
> * @param node a <code>Node</code> value
> * @param schemaLocalName a <code>String</code> value
> * @return true if the node is matches the name in the schema namespace.
> @@ -910,10 +936,10 @@
> /**
> * Look for the base type of node iff node is a complex type that has been
> * derived by restriction; otherwise return null.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getComplexElementRestrictionBase(Node node,
> SymbolTable symbolTable) {
> @@ -993,10 +1019,10 @@
> /**
> * If the specified node represents a supported JAX-RPC complexType/element
> * which extends another complexType. The Type of the base is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getComplexElementExtensionBase(Node node,
> SymbolTable symbolTable) {
> @@ -1085,9 +1111,9 @@
> /**
> * If the specified node represents a 'normal' non-enumeration simpleType,
> * the QName of the simpleType base is returned.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getSimpleTypeBase(Node node) {
>
> @@ -1102,9 +1128,9 @@
>
> /**
> * Method getContainedSimpleTypes
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName[] getContainedSimpleTypes(Node node) {
>
> @@ -1180,9 +1206,9 @@
> /**
> * Returns the contained restriction or extension node underneath
> * the specified node. Returns null if not found
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static Node getRestrictionOrExtensionNode(Node node) {
>
> @@ -1252,7 +1278,7 @@
> /**
> * If the specified node represents an array encoding of one of the following
> * forms, then return the qname repesenting the element type of the array.
> - *
> + *
> * @param node is the node
> * @param dims is the output value that contains the number of dimensions if return is not null
> * @param itemQName will end up containing the "inner" QName for a
> @@ -1291,7 +1317,7 @@
> * <p/>
> * <xsd:element ref="alias" maxOccurs="unbounded"/>
> * returns qname for "alias"
> - *
> + *
> * @param node is the Node
> * @return QName of the compoent of the collection
> */
> @@ -1378,7 +1404,7 @@
> /**
> * If the specified node represents an array encoding of one of the following
> * forms, then return the qname repesenting the element type of the array.
> - *
> + *
> * @param node is the node
> * @param dims is the output value that contains the number of dimensions if return is not null
> * @return QName or null
> @@ -1482,7 +1508,7 @@
> }
> }
> }
> -
> +
> // Under the restriction there should be an attribute OR a sequence/all group node.
> // (There may be other #text nodes, which we will ignore).
> Node groupNode = null;
> @@ -1622,10 +1648,10 @@
> /**
> * adds an attribute node's type and name to the vector
> * helper used by getContainedAttributeTypes
> - *
> - * @param v
> - * @param child
> - * @param symbolTable
> + *
> + * @param v
> + * @param child
> + * @param symbolTable
> */
> private static void addAttributeToVector(Vector v, Node child,
> SymbolTable symbolTable) {
> @@ -1680,7 +1706,7 @@
> if (type instanceof org.apache.axis.wsdl.symbolTable.Element) {
> type = ((org.apache.axis.wsdl.symbolTable.Element) type).getRefType();
> }
> -
> +
> // add type and name to vector, skip it if we couldn't parse it
> // XXX - this may need to be revisited.
> if ((type != null) && (attributeName != null)) {
> @@ -1700,11 +1726,11 @@
> /**
> * adds an attribute to the vector
> * helper used by addAttributeGroupToVector
> - *
> - * @param v
> - * @param symbolTable
> - * @param type
> - * @param name
> + *
> + * @param v
> + * @param symbolTable
> + * @param type
> + * @param name
> */
> private static void addAttributeToVector(Vector v, SymbolTable symbolTable,
> QName type, QName name) {
> @@ -1720,10 +1746,10 @@
> /**
> * adds each attribute group's attribute node to the vector
> * helper used by getContainedAttributeTypes
> - *
> - * @param v
> - * @param attrGrpnode
> - * @param symbolTable
> + *
> + * @param v
> + * @param attrGrpnode
> + * @param symbolTable
> */
> private static void addAttributeGroupToVector(Vector v, Node attrGrpnode,
> SymbolTable symbolTable) {
> @@ -1815,10 +1841,10 @@
> * <attribute name="Male" type="boolean" />
> * <attributeGroup ref="s0:MyAttrSet" />
> * </complexType>
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getContainedAttributeTypes(Node node,
> SymbolTable symbolTable) {
> @@ -1930,9 +1956,9 @@
>
> /**
> * Determine if a string is a simple XML Schema type
> - *
> - * @param s
> - * @return
> + *
> + * @param s
> + * @return
> */
> private static boolean isSimpleSchemaType(String s) {
>
> @@ -1945,9 +1971,9 @@
>
> /**
> * Determine if a QName is a simple XML Schema type
> - *
> - * @param qname
> - * @return
> + *
> + * @param qname
> + * @return
> */
> public static boolean isSimpleSchemaType(QName qname) {
>
> @@ -1962,21 +1988,21 @@
> * Returns the base type of a given type with its symbol table.
> * This logic is extracted from JavaTypeWriter's constructor() method
> * for reusing.
> - *
> - * @param type
> - * @param symbolTable
> - * @return
> + *
> + * @param type
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getBaseType(TypeEntry type, SymbolTable symbolTable) {
> - Node node = type.getNode();
> + Node node = type.getNode();
> TypeEntry base = getComplexElementExtensionBase(
> node, symbolTable);
> if (base == null) {
> base = getComplexElementRestrictionBase(node, symbolTable);
> - }
> -
> + }
> +
> if (base == null) {
> - QName baseQName = getSimpleTypeBase(node);
> + QName baseQName = getSimpleTypeBase(node);
> if (baseQName != null) {
> base = symbolTable.getType(baseQName);
> }
> @@ -1985,27 +2011,27 @@
> }
>
> /**
> - * Returns whether the specified node represents a <xsd:simpleType>
> + * Returns whether the specified node represents a <xsd:simpleType>
> * with a nested <xsd:list itemType="...">.
> - * @param node
> - * @return
> + * @param node
> + * @return
> */
> public static boolean isListWithItemType(Node node) {
> -
> +
> return getListItemType(node) != null;
> }
>
> /**
> - * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
> - * @param node
> - * @return
> + * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
> + * @param node
> + * @return
> */
> public static QName getListItemType(Node node) {
> -
> +
> if (node == null) {
> return null;
> }
> -
> +
> // If the node kind is an element, dive into it.
> if (isXSDNode(node, "element")) {
> NodeList children = node.getChildNodes();
> @@ -2022,7 +2048,7 @@
> for (int j = 0; j < children.getLength(); j++) {
> if (isXSDNode(children.item(j), "list")) {
> Node listNode = children.item(j);
> - org.w3c.dom.Element listElement =
> + org.w3c.dom.Element listElement =
> (org.w3c.dom.Element) listNode;
> String type = listElement.getAttribute("itemType");
> if (type.equals("")) {
>
>
>
> 1.95 +95 -83 ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
>
> Index: Utils.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
> retrieving revision 1.94
> retrieving revision 1.95
> diff -u -r1.94 -r1.95
> --- Utils.java 6 May 2005 02:28:10 -0000 1.94
> +++ Utils.java 20 May 2005 12:55:49 -0000 1.95
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -52,14 +52,14 @@
>
> /**
> * Class Utils
> - *
> + *
> * @version %I%, %G%
> */
> public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
>
> /** Field log */
> protected static Log log = LogFactory.getLog(Utils.class.getName());
> -
> +
> /**
> * @see #holder(Parameter, Emitter)
> */
> @@ -68,10 +68,10 @@
> // For other fields the default values will do.
> arg.setType(type);
> return holder(arg, emitter);
> - }
> + }
> /**
> * Given a type, return the Java mapping of that type's holder.
> - *
> + *
> * @param p parameter whose holder class name we want to obtain.
> * @param emitter the only {@link Emitter} object embodying the running
> * instance of WSDL2Java.
> @@ -146,7 +146,7 @@
> }
>
> name = JavaUtils.replace(name, "java.lang.", "");
> -
> +
> // This could be a special QName for a indexed property.
> // If so, change the [] to Array.
> name = JavaUtils.replace(name, "[]", "Array");
> @@ -220,7 +220,7 @@
>
> /**
> * Add package to name
> - *
> + *
> * @param className full name of the class.
> * @param newPkg name of the package to append
> * @return String name with package name added
> @@ -240,7 +240,7 @@
> /**
> * Given a fault message, return the fully qualified Java class name
> * of the exception to be generated from this fault
> - *
> + *
> * @param faultMessage The WSDL fault message
> * @param symbolTable the current symbol table
> * @return A Java class name for the fault
> @@ -256,7 +256,7 @@
>
> /**
> * Given a fault message, return the XML type of the exception data.
> - *
> + *
> * @param faultMessage The WSDL fault message object
> * @param symbolTable the current symbol table
> * @return A QName for the XML type of the data
> @@ -272,7 +272,7 @@
>
> /**
> * Given a fault message, return TRUE if the fault is a complex type fault
> - *
> + *
> * @param faultMessage The WSDL fault message object
> * @param symbolTable the current symbol table
> * @return A Java class name for the fault
> @@ -297,10 +297,10 @@
> * The first element in the vector is the base type (an TypeEntry).
> * Subsequent elements are values (Strings).
> * If this is not an enumeration, null is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getEnumerationBaseAndValues(Node node,
> SymbolTable symbolTable) {
> @@ -417,9 +417,9 @@
>
> /**
> * Capitalize the first character of the name.
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String capitalizeFirstChar(String name) {
>
> @@ -440,9 +440,9 @@
>
> /**
> * Prepend an underscore to the name
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String addUnderscore(String name) {
>
> @@ -455,9 +455,9 @@
>
> /**
> * Map an XML name to a valid Java identifier
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String xmlNameToJava(String name) {
>
> @@ -470,9 +470,9 @@
>
> /**
> * Map an XML name to a valid Java identifier w/ capitolized first letter
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String xmlNameToJavaClass(String name) {
> return capitalizeFirstChar(xmlNameToJava(name));
> @@ -480,9 +480,9 @@
>
> /**
> * Method makePackageName
> - *
> - * @param namespace
> - * @return
> + *
> + * @param namespace
> + * @return
> */
> public static String makePackageName(String namespace) {
>
> @@ -549,7 +549,7 @@
> * Massage <tt>word</tt> into a form suitable for use in a Java package name.
> * Append it to the target string buffer with a <tt>.</tt> delimiter iff
> * <tt>word</tt> is not the first word in the package name.
> - *
> + *
> * @param sb the buffer to append to
> * @param word the word to append
> * @param firstWord a flag indicating whether this is the first word
> @@ -589,9 +589,9 @@
>
> /**
> * Query Java Local Name
> - *
> - * @param fullName
> - * @return
> + *
> + * @param fullName
> + * @return
> */
> public static String getJavaLocalName(String fullName) {
> return fullName.substring(fullName.lastIndexOf('.') + 1);
> @@ -599,9 +599,9 @@
>
> /**
> * Query Java Package Name
> - *
> - * @param fullName
> - * @return
> + *
> + * @param fullName
> + * @return
> */
> public static String getJavaPackageName(String fullName) {
>
> @@ -614,12 +614,12 @@
>
> /**
> * Does the given file already exist in the given namespace?
> - *
> - * @param name
> - * @param namespace
> - * @param namespaces
> - * @return
> - * @throws IOException
> + *
> + * @param name
> + * @param namespace
> + * @param namespaces
> + * @return
> + * @throws IOException
> */
> public static boolean fileExists(
> String name, String namespace, Namespaces namespaces)
> @@ -646,10 +646,10 @@
>
> /**
> * Return a string with "var" wrapped as an Object type if needed
> - *
> - * @param type
> - * @param var
> - * @return
> + *
> + * @param type
> + * @param var
> + * @return
> */
> public static String wrapPrimitiveType(TypeEntry type, String var) {
>
> @@ -672,9 +672,9 @@
> /**
> * Return the Object variable 'var' cast to the appropriate type
> * doing the right thing for the primitive types.
> - *
> - * @param var
> - * @return
> + *
> + * @param var
> + * @return
> */
> public static String getResponseString(Parameter param,
> String var) {
> @@ -683,7 +683,7 @@
> }
> String typeName = param.getType().getName();
> MimeInfo mimeInfo = param.getMIMEInfo();
> -
> +
> String mimeType = (mimeInfo == null)
> ? null
> : mimeInfo.getType();
> @@ -716,7 +716,7 @@
> }
>
> String objType = (String) TYPES.get(typeName);
> -
> +
> if (objType != null) {
> if (param.isOmittable()) {
> typeName = objType;
> @@ -725,29 +725,29 @@
> "Value();";
> }
> }
> -
> +
> return "(" + typeName + ") " + var + ";";
> } // getResponseString
>
> /**
> * Method isPrimitiveType
> - *
> - * @param type
> - * @return
> + *
> + * @param type
> + * @return
> */
> public static boolean isPrimitiveType(TypeEntry type) {
> return TYPES.get(type.getName()) != null;
> } // isPrimitiveType
> -
> +
> /**
> * Return a "wrapper" type for the given type name. In other words,
> * if it's a primitive type ("int") return the java wrapper class
> * ("java.lang.Integer"). Otherwise return the type name itself.
> - *
> + *
> * @param type
> * @return the name of a java wrapper class for the type, or the type's
> * name if it's not primitive.
> - */
> + */
> public static String getWrapperType(String type) {
> String ret = (String)TYPES.get(type);
> return (ret == null) ? type : ret;
> @@ -756,7 +756,7 @@
> /**
> * Return the operation QName. The namespace is determined from
> * the soap:body namespace, if it exists, otherwise it is "".
> - *
> + *
> * @param bindingOper the operation
> * @param bEntry the symbol table binding entry
> * @param symbolTable SymbolTable
> @@ -920,9 +920,9 @@
> /**
> * Common code for generating a QName in emitted code. Note that there's
> * no semicolon at the end, so we can use this in a variety of contexts.
> - *
> - * @param qname
> - * @return
> + *
> + * @param qname
> + * @return
> */
> public static String getNewQName(javax.xml.namespace.QName qname) {
> return "new javax.xml.namespace.QName(\"" + qname.getNamespaceURI()
> @@ -938,9 +938,9 @@
> * Get the parameter type name. If this is a MIME type, then
> * figure out the appropriate type from the MIME type, otherwise
> * use the name of the type itself.
> - *
> - * @param parm
> - * @return
> + *
> + * @param parm
> + * @return
> */
> public static String getParameterTypeName(Parameter parm) {
>
> @@ -971,7 +971,7 @@
> /**
> * Get the QName that could be used in the xsi:type
> * when serializing an object for this parameter/return
> - *
> + *
> * @param param is a parameter
> * @return the QName of the parameter's xsi type
> */
> @@ -987,7 +987,7 @@
> /**
> * Get the QName that could be used in the xsi:type
> * when serializing an object of the given type.
> - *
> + *
> * @param te is the type entry
> * @return the QName of the type's xsi type
> */
> @@ -1025,7 +1025,7 @@
>
> /**
> * Given a MIME type, return the AXIS-specific type QName.
> - *
> + *
> * @param mimeName the MIME type name
> * @return the AXIS-specific QName for the MIME type
> */
> @@ -1051,9 +1051,9 @@
>
> /**
> * Are there any MIME parameters in the given binding?
> - *
> - * @param bEntry
> - * @return
> + *
> + * @param bEntry
> + * @return
> */
> public static boolean hasMIME(BindingEntry bEntry) {
>
> @@ -1072,10 +1072,10 @@
>
> /**
> * Are there any MIME parameters in the given binding's operation?
> - *
> - * @param bEntry
> - * @param operation
> - * @return
> + *
> + * @param bEntry
> + * @param operation
> + * @return
> */
> public static boolean hasMIME(BindingEntry bEntry,
> BindingOperation operation) {
> @@ -1182,11 +1182,11 @@
> * <p/>
> * Caller should expect to wrap the construction in a try/catch block
> * if bThrow is set to <i>true</i>.
> - *
> + *
> * @param param info about the parameter we need a constructor for
> * @param symbolTable used to lookup enumerations
> * @param bThrow set to true if contructor needs try/catch block
> - * @return
> + * @return
> */
> public static String getConstructorForParam(Parameter param,
> SymbolTable symbolTable,
> @@ -1262,7 +1262,7 @@
>
> return paramType + "." + enumeration;
> }
> -
> +
> if(param.getType().getRefType()!= null){
> // Check for enumeration
> Vector v2 = Utils.getEnumerationBaseAndValues(param.getType().getRefType().getNode(),
> @@ -1283,7 +1283,8 @@
> }
>
> public static boolean shouldEmit(TypeEntry type) {
> - // 1) Don't register types that are base (primitive) types or attributeGroups.
> + // 1) Don't register types that are base (primitive) types
> + // or attributeGroups or xs:groups.
> // If the baseType != null && getRefType() != null this
> // is a simpleType that must be registered.
> // 2) Don't register the special types for collections
> @@ -1295,10 +1296,21 @@
> || (type instanceof Element) || !type.isReferenced()
> || type.isOnlyLiteralReferenced()
> || ((type.getNode() != null)
> - && type.getNode().getLocalName().equals(
> - "attributeGroup"))));
> + && (isXsNode(type.getNode(), "group") ||
> + isXsNode(type.getNode(), "attributeGroup")))));
> }
>
> +
> + /**
> + * Determines if the DOM Node represents an xs:<node>
> + */
> + public static boolean isXsNode (Node node, String nameName)
> + {
> + return (node.getLocalName().equals(nameName)
> + && Constants.isSchemaXSD (node.getNamespaceURI ()));
> + }
> +
> +
> public static QName getItemQName(TypeEntry te) {
> if (te instanceof DefinedElement) {
> te = te.getRefType();
>
>
>
> 1.25 +77 -74 ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java
>
> Index: Parser.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java,v
> retrieving revision 1.24
> retrieving revision 1.25
> diff -u -r1.24 -r1.25
> --- Parser.java 13 Apr 2005 16:22:52 -0000 1.24
> +++ Parser.java 20 May 2005 12:55:49 -0000 1.25
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -23,6 +23,7 @@
> import org.apache.axis.wsdl.symbolTable.ServiceEntry;
> import org.apache.axis.wsdl.symbolTable.SymTabEntry;
> import org.apache.axis.wsdl.symbolTable.SymbolTable;
> +import org.apache.axis.wsdl.toJava.Utils;
> import org.apache.axis.wsdl.symbolTable.Type;
> import org.apache.axis.wsdl.symbolTable.TypeEntry;
> import org.w3c.dom.Document;
> @@ -82,8 +83,8 @@
>
> /**
> * Method isDebug
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isDebug() {
> return debug;
> @@ -91,8 +92,8 @@
>
> /**
> * Method setDebug
> - *
> - * @param debug
> + *
> + * @param debug
> */
> public void setDebug(boolean debug) {
> this.debug = debug;
> @@ -100,26 +101,26 @@
>
> /**
> * Method isQuiet
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isQuiet() {
> return quiet;
> - }
> + }
>
> /**
> * Method setQuiet
> - *
> + *
> * @param quiet
> */
> public void setQuiet(boolean quiet) {
> this.quiet = quiet;
> - }
> -
> + }
> +
> /**
> * Method isImports
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isImports() {
> return imports;
> @@ -127,8 +128,8 @@
>
> /**
> * Method setImports
> - *
> - * @param imports
> + *
> + * @param imports
> */
> public void setImports(boolean imports) {
> this.imports = imports;
> @@ -136,8 +137,8 @@
>
> /**
> * Method isVerbose
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isVerbose() {
> return verbose;
> @@ -145,8 +146,8 @@
>
> /**
> * Method setVerbose
> - *
> - * @param verbose
> + *
> + * @param verbose
> */
> public void setVerbose(boolean verbose) {
> this.verbose = verbose;
> @@ -154,8 +155,8 @@
>
> /**
> * Method isNowrap
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isNowrap() {
> return nowrap;
> @@ -163,8 +164,8 @@
>
> /**
> * Method setNowrap
> - *
> - * @param nowrap
> + *
> + * @param nowrap
> */
> public void setNowrap(boolean nowrap) {
> this.nowrap = nowrap;
> @@ -172,8 +173,8 @@
>
> /**
> * Return the current timeout setting
> - *
> - * @return
> + *
> + * @return
> */
> public long getTimeout() {
> return timeoutms;
> @@ -181,8 +182,8 @@
>
> /**
> * Set the timeout, in milliseconds
> - *
> - * @param timeout
> + *
> + * @param timeout
> */
> public void setTimeout(long timeout) {
> this.timeoutms = timeout;
> @@ -190,8 +191,8 @@
>
> /**
> * Method getUsername
> - *
> - * @return
> + *
> + * @return
> */
> public String getUsername() {
> return username;
> @@ -199,8 +200,8 @@
>
> /**
> * Method setUsername
> - *
> - * @param username
> + *
> + * @param username
> */
> public void setUsername(String username) {
> this.username = username;
> @@ -208,8 +209,8 @@
>
> /**
> * Method getPassword
> - *
> - * @return
> + *
> + * @return
> */
> public String getPassword() {
> return password;
> @@ -217,8 +218,8 @@
>
> /**
> * Method setPassword
> - *
> - * @param password
> + *
> + * @param password
> */
> public void setPassword(String password) {
> this.password = password;
> @@ -226,8 +227,8 @@
>
> /**
> * Method getFactory
> - *
> - * @return
> + *
> + * @return
> */
> public GeneratorFactory getFactory() {
> return genFactory;
> @@ -235,8 +236,8 @@
>
> /**
> * Method setFactory
> - *
> - * @param factory
> + *
> + * @param factory
> */
> public void setFactory(GeneratorFactory factory) {
> this.genFactory = factory;
> @@ -245,8 +246,8 @@
> /**
> * Get the symbol table. The symbol table is null until
> * run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public SymbolTable getSymbolTable() {
> return symbolTable;
> @@ -255,8 +256,8 @@
> /**
> * Return the current definition. The current definition is
> * null until run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public Definition getCurrentDefinition() {
>
> @@ -268,8 +269,8 @@
> /**
> * Get the current WSDL URI. The WSDL URI is null until
> * run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public String getWSDLURI() {
>
> @@ -283,9 +284,9 @@
> * <p/>
> * This method will time out after the number of milliseconds specified
> * by our timeoutms member.
> - *
> - * @param wsdlURI
> - * @throws Exception
> + *
> + * @param wsdlURI
> + * @throws Exception
> */
> public void run(String wsdlURI) throws Exception {
>
> @@ -326,7 +327,7 @@
>
> /**
> * Class WSDLRunnable
> - *
> + *
> * @version %I%, %G%
> */
> private class WSDLRunnable implements Runnable {
> @@ -342,9 +343,9 @@
>
> /**
> * Constructor WSDLRunnable
> - *
> - * @param symbolTable
> - * @param wsdlURI
> + *
> + * @param symbolTable
> + * @param wsdlURI
> */
> public WSDLRunnable(SymbolTable symbolTable, String wsdlURI) {
> this.symbolTable = symbolTable;
> @@ -366,8 +367,8 @@
>
> /**
> * Method getFailure
> - *
> - * @return
> + *
> + * @return
> */
> public Exception getFailure() {
> return failure;
> @@ -376,13 +377,13 @@
>
> /**
> * Call this method if your WSDL document has already been parsed as an XML DOM document.
> - *
> + *
> * @param context context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory.
> * @param doc doc This is the XML Document containing the WSDL.
> - * @throws IOException
> - * @throws SAXException
> - * @throws WSDLException
> - * @throws ParserConfigurationException
> + * @throws IOException
> + * @throws SAXException
> + * @throws WSDLException
> + * @throws ParserConfigurationException
> */
> public void run(String context, Document doc)
> throws IOException, SAXException, WSDLException,
> @@ -401,8 +402,8 @@
>
> /**
> * Method sanityCheck
> - *
> - * @param symbolTable
> + *
> + * @param symbolTable
> */
> protected void sanityCheck(SymbolTable symbolTable) {
>
> @@ -411,9 +412,9 @@
>
> /**
> * Method generate
> - *
> - * @param symbolTable
> - * @throws IOException
> + *
> + * @param symbolTable
> + * @throws IOException
> */
> private void generate(SymbolTable symbolTable) throws IOException {
>
> @@ -487,9 +488,9 @@
> /**
> * Generate bindings (classes and class holders) for the complex types.
> * If generating serverside (skeleton) spit out beanmappings
> - *
> - * @param symbolTable
> - * @throws IOException
> + *
> + * @param symbolTable
> + * @throws IOException
> */
> private void generateTypes(SymbolTable symbolTable) throws IOException {
>
> @@ -501,7 +502,7 @@
> // Write out the type if and only if:
> // - we found its definition (getNode())
> // - it is referenced
> - // - it is not a base type or an attributeGroup
> + // - it is not a base type or an attributeGroup or xs:group
> // - it is a Type (not an Element) or a CollectionElement
> // (Note that types that are arrays are passed to getGenerator
> // because they may require a Holder)
> @@ -510,7 +511,8 @@
> || (type instanceof CollectionElement));
>
> if ((type.getNode() != null)
> - && !type.getNode().getLocalName().equals("attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "group")
> && type.isReferenced() && isType
> && (type.getBaseType() == null)) {
> Generator gen = genFactory.getGenerator(type, symbolTable);
> @@ -518,7 +520,7 @@
> gen.generate();
> }
> }
> -
> +
> Map types = symbolTable.getTypeIndex();
> Collection typeCollection = types.values();
> for (Iterator i = typeCollection.iterator(); i.hasNext(); ) {
> @@ -527,7 +529,7 @@
> // Write out the type if and only if:
> // - we found its definition (getNode())
> // - it is referenced
> - // - it is not a base type or an attributeGroup
> + // - it is not a base type or an attributeGroup or xs:group
> // - it is a Type (not an Element) or a CollectionElement
> // (Note that types that are arrays are passed to getGenerator
> // because they may require a Holder)
> @@ -536,7 +538,8 @@
> || (type instanceof CollectionElement));
>
> if ((type.getNode() != null)
> - && !type.getNode().getLocalName().equals("attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "group")
> && type.isReferenced() && isType
> && (type.getBaseType() == null)) {
> Generator gen = genFactory.getGenerator(type, symbolTable);
>
>
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/gen Parser.java
Posted by Davanum Srinivas <da...@gmail.com>.
Venkat,
please don't discuss tck on the public mailing lists. use axis-tck@ for that.
thanks,
dims
On 20 May 2005 12:55:50 -0000, venkat@apache.org <ve...@apache.org> wrote:
> venkat 2005/05/20 05:55:49
>
> Modified: java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
> java/src/org/apache/axis/wsdl/toJava Utils.java
> java/src/org/apache/axis/wsdl/gen Parser.java
> Added: java/test/wsdl/groups GroupsTestCase.java Groups.wsdl
> build.xml SomeType.java
> Log:
> Checking in the patches and test case submitted by Steve Green for AXIS-1525. I have ran the JAX-RPC TCK test suite after the changes and ensured it is all green. Thanks Steve.
>
> Revision Changes Path
> 1.1 ws-axis/java/test/wsdl/groups/GroupsTestCase.java
>
> Index: GroupsTestCase.java
> ===================================================================
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> *
> * Licensed 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.
> */
>
> /**
> * This tests the file generation of only the items that are referenced in WSDL
> *
> * @author Steve Green (steve.green@epok.net)
> */
> package test.wsdl.groups;
>
> import java.io.File;
> import java.io.IOException;
> import java.lang.reflect.Method;
> import java.util.Arrays;
> import java.util.HashSet;
> import java.util.Set;
>
>
> public class GroupsTestCase extends junit.framework.TestCase {
> public GroupsTestCase(String name) {
> super(name);
> }
>
> /**
> * List of files which should be generated.
> */
> protected Set shouldExist() {
> HashSet set = new HashSet();
> set.add("GroupsTestCase.java");
> set.add("SomeType.java");
> return set;
> }
>
> /**
> * List of files which may or may not be generated.
> */
> protected Set shouldNotExist() {
> HashSet set = new HashSet();
> set.add("SomeGroup.java");
> return set;
> }
>
> /**
> * The directory containing the files that should exist.
> */
> protected String rootDir() {
> return "build" + File.separator + "work" + File.separator +
> "test" + File.separator + "wsdl" + File.separator +
> "groups";
> }
>
> protected String getPrefix(String parent) {
> if (parent == null || parent.length() == 0) {
> return "";
> }
> else {
> return parent + File.separator;
> }
> }
>
> /** This method returns a array of String file paths, located within the
> * supplied root directory. The string values are created relative to the
> * specified parent so that the names get returned in the form of
> * "file.java", "dir/file.java", "dir/dir/file.java", etc. This feature
> * asslows the various file specs to include files in sub-directories as
> * well as the root directory.
> */
> protected String[] getPaths(File root, String parent) {
> File files[] = root.listFiles();
> if (files == null)
> fail("Unable to get a list of files from " + root.getPath());
>
> Set filePaths = new HashSet();
> for(int i=0; i<files.length; i++) {
> if (files[i].isDirectory()) {
> String children[] = getPaths(files[i],
> getPrefix(parent) + files[i].getName());
> filePaths.addAll(Arrays.asList(children));
> }
> else {
> filePaths.add(getPrefix(parent) + files[i].getName());
> }
> }
> String paths[] = new String[filePaths.size()];
> return (String[]) filePaths.toArray(paths);
> }
>
>
> public void testGroups() throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException {
>
> // Test for the proper files
>
> String rootDir = rootDir();
> Set shouldExist = shouldExist();
> Set shouldNotExist = shouldNotExist();
>
> // open up the output directory and check what files exist.
> File outputDir = new File(rootDir);
>
> String[] files = getPaths(outputDir, null);
>
> for (int i = 0; i < files.length; ++i) {
> if (shouldExist.contains(files[i])) {
> shouldExist.remove(files[i]);
> }
> else if (shouldNotExist.contains(files[i])) {
> fail("The following file should not exist in " + rootDir +
> ", but does: " + files[i]);
> }
> }
>
> if (shouldExist.size() > 0) {
> fail("The following files should exist in " + rootDir +
> ", but do not: " + shouldExist);
> }
>
> // Test for the proper members
>
> Class ourClass = Class.forName("test.wsdl.groups.SomeType");
> ourClass.getDeclaredMethod("getA", null);
> ourClass.getDeclaredMethod("getB", null);
> ourClass.getDeclaredMethod("getZ", null);
>
> return;
> }
> }
>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/Groups.wsdl
>
> Index: Groups.wsdl
> ===================================================================
> <?xml version="1.0" encoding="utf-8" ?>
>
> <definitions targetNamespace="http://test.com/reference"
> xmlns:tns="http://test.com/reference"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/">
>
> <types>
> <xs:schema>
>
> <xs:group name="SomeGroup">
> <xs:sequence>
> <xs:element name="a" type="xs:string"/>
> <xs:element name="b" type="xs:string"/>
> </xs:sequence>
> </xs:group>
>
> <xs:complexType name="SomeType">
> <xs:sequence>
> <xs:element name="z" type="xs:string"/>
> <xs:group ref="tns:SomeGroup"/>
> </xs:sequence>
> </xs:complexType>
>
> </xs:schema>
> </types>
>
> </definitions>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/build.xml
>
> Index: build.xml
> ===================================================================
> <?xml version="1.0" ?>
> <!DOCTYPE project [
> <!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
> <!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
> <!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
> <!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
> <!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
> ]>
>
> <!-- ===================================================================
> <description>
> Test/Sample Component file for Axis
>
> Notes:
> This is a build file for use with the Jakarta Ant build tool.
>
> Prerequisites:
>
> jakarta-ant from http://jakarta.apache.org
>
> Build Instructions:
> To compile
> ant compile
> To execute
> ant run
>
> Author:
> Matt Seibert mseibert@us.ibm.com
>
> Copyright:
> Copyright (c) 2002-2003 Apache Software Foundation.
> </description>
> ==================================================================== -->
>
> <project default="compile">
>
> <property name="axis.home" location="../../.." />
> <property name="componentName" value="test/wsdl/groups" />
> &properties;
> &paths;
> &taskdefs;
> &taskdefs_post_compile;
> &targets;
>
> <target name="clean" depends="setenv">
> <echo message="Removing ${build.dir}/**/test/wsdl/groups" />
> <echo message="componentName is ${componentName}"/>
> <delete dir="${build.dir}/classes/test/wsdl/groups"/>
> <delete dir="${build.dir}/work/test/wsdl/groups"/>
> <delete dir="${build.dir}/classes/test/wsdl/groupsAll"/>
> <delete dir="${build.dir}/work/test/wsdl/groupsAll"/>
> </target>
>
>
> <target name="compile" depends="clean">
> <echo message="Compiling test.wsdl.groups"/>
> <!-- Verify files generated based on what is referenced in WSDL -->
> <wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
> output="${axis.home}/build/work"
> deployscope="none"
> serverSide="no"
> noimports="no"
> verbose="no"
> testcase="no">
> <mapping namespace="http://test.com/reference" package="test.wsdl.groups"/>
> </wsdl2java>
>
> <!-- Same test as above but this time the -a flag is turned on -->
> <wsdl2java url="${axis.home}/test/wsdl/groups/Groups.wsdl"
> output="${axis.home}/build/work"
> serverSide="no"
> all="yes">
> <mapping namespace="http://test.com/reference" package="test.wsdl.groupsAll"/>
> </wsdl2java>
>
> <copy todir="${build.dir}/work/test/wsdl/groups" overwrite="yes">
> <fileset dir="${axis.home}/test/wsdl/groups">
> <include name="*TestCase.java"/>
> <include name="*Impl.java"/>
> </fileset>
> </copy>
>
> <javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
> debug="${debug}">
> <classpath refid="classpath" />
> <include name="test/wsdl/groups/*.java" />
> <include name="test/wsdl/groupsAll/*.java" />
> </javac>
>
> </target>
>
> <target name="run" >
> <antcall target="execute-Component-noServer" />
> </target>
>
> </project>
>
>
>
> 1.1 ws-axis/java/test/wsdl/groups/SomeType.java
>
> Index: SomeType.java
> ===================================================================
> /**
> * SomeType.java
> *
> * This file was auto-generated from WSDL
> * by the Apache Axis 1.2RC1 Oct 20, 2004 (05:49:44 EDT) WSDL2Java emitter.
> */
>
> package com.epok.auth;
>
> public class SomeType implements java.io.Serializable {
> private java.lang.String z;
> private java.lang.String a;
> private java.lang.String b;
>
> public SomeType() {
> }
>
> public SomeType(
> java.lang.String z,
> java.lang.String a,
> java.lang.String b) {
> this.z = z;
> this.a = a;
> this.b = b;
> }
>
>
> /**
> * Gets the z value for this SomeType.
> *
> * @return z
> */
> public java.lang.String getZ() {
> return z;
> }
>
>
> /**
> * Sets the z value for this SomeType.
> *
> * @param z
> */
> public void setZ(java.lang.String z) {
> this.z = z;
> }
>
>
> /**
> * Gets the a value for this SomeType.
> *
> * @return a
> */
> public java.lang.String getA() {
> return a;
> }
>
>
> /**
> * Sets the a value for this SomeType.
> *
> * @param a
> */
> public void setA(java.lang.String a) {
> this.a = a;
> }
>
>
> /**
> * Gets the b value for this SomeType.
> *
> * @return b
> */
> public java.lang.String getB() {
> return b;
> }
>
>
> /**
> * Sets the b value for this SomeType.
> *
> * @param b
> */
> public void setB(java.lang.String b) {
> this.b = b;
> }
>
> private java.lang.Object __equalsCalc = null;
> public synchronized boolean equals(java.lang.Object obj) {
> if (!(obj instanceof SomeType)) return false;
> SomeType other = (SomeType) obj;
> if (obj == null) return false;
> if (this == obj) return true;
> if (__equalsCalc != null) {
> return (__equalsCalc == obj);
> }
> __equalsCalc = obj;
> boolean _equals;
> _equals = true &&
> ((this.z==null && other.getZ()==null) ||
> (this.z!=null &&
> this.z.equals(other.getZ()))) &&
> ((this.a==null && other.getA()==null) ||
> (this.a!=null &&
> this.a.equals(other.getA()))) &&
> ((this.b==null && other.getB()==null) ||
> (this.b!=null &&
> this.b.equals(other.getB())));
> __equalsCalc = null;
> return _equals;
> }
>
> private boolean __hashCodeCalc = false;
> public synchronized int hashCode() {
> if (__hashCodeCalc) {
> return 0;
> }
> __hashCodeCalc = true;
> int _hashCode = 1;
> if (getZ() != null) {
> _hashCode += getZ().hashCode();
> }
> if (getA() != null) {
> _hashCode += getA().hashCode();
> }
> if (getB() != null) {
> _hashCode += getB().hashCode();
> }
> __hashCodeCalc = false;
> return _hashCode;
> }
>
> // Type metadata
> private static org.apache.axis.description.TypeDesc typeDesc =
> new org.apache.axis.description.TypeDesc(SomeType.class, true);
>
> static {
> typeDesc.setXmlType(new javax.xml.namespace.QName("urn:auth:epok:com", "SomeType"));
> org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("z");
> elemField.setXmlName(new javax.xml.namespace.QName("", "z"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("a");
> elemField.setXmlName(new javax.xml.namespace.QName("", "a"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> elemField = new org.apache.axis.description.ElementDesc();
> elemField.setFieldName("b");
> elemField.setXmlName(new javax.xml.namespace.QName("", "b"));
> elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
> typeDesc.addFieldDesc(elemField);
> }
>
> /**
> * Return type metadata object
> */
> public static org.apache.axis.description.TypeDesc getTypeDesc() {
> return typeDesc;
> }
>
> /**
> * Get Custom Serializer
> */
> public static org.apache.axis.encoding.Serializer getSerializer(
> java.lang.String mechType,
> java.lang.Class _javaType,
> javax.xml.namespace.QName _xmlType) {
> return
> new org.apache.axis.encoding.ser.BeanSerializer(
> _javaType, _xmlType, typeDesc);
> }
>
> /**
> * Get Custom Deserializer
> */
> public static org.apache.axis.encoding.Deserializer getDeserializer(
> java.lang.String mechType,
> java.lang.Class _javaType,
> javax.xml.namespace.QName _xmlType) {
> return
> new org.apache.axis.encoding.ser.BeanDeserializer(
> _javaType, _xmlType, typeDesc);
> }
>
> }
>
>
>
> 1.57 +155 -129 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
>
> Index: SchemaUtils.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
> retrieving revision 1.56
> retrieving revision 1.57
> diff -u -r1.56 -r1.57
> --- SchemaUtils.java 30 Apr 2005 18:31:40 -0000 1.56
> +++ SchemaUtils.java 20 May 2005 12:55:49 -0000 1.57
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -35,7 +35,7 @@
>
> /**
> * This class contains static utility methods specifically for schema type queries.
> - *
> + *
> * @author Rich Scheuerle (scheu@us.ibm.com)
> */
> public class SchemaUtils {
> @@ -58,7 +58,7 @@
> // Under the complexType there could be complexContent with
> // mixed="true"
> NodeList children = node.getChildNodes();
> -
> +
> for (int j = 0; j < children.getLength(); j++) {
> Node kid = children.item(j);
> if (isXSDNode(kid, "complexContent")) {
> @@ -85,9 +85,9 @@
> }
> return null;
> }
> -
> +
> public static Node getListNode(Node node) {
> - // Expecting a schema simpleType
> + // Expecting a schema simpleType
> if (isXSDNode(node, "simpleType")) {
> // Under the simpleType there could be list
> NodeList children = node.getChildNodes();
> @@ -104,19 +104,19 @@
> public static boolean isSimpleTypeWithUnion(Node node) {
> return (getUnionNode(node) != null);
> }
> -
> +
> /**
> * This method checks out if the given node satisfies the 3rd condition
> * of the "wrapper" style:
> * such an element (a wrapper) must be of a complex type defined using the
> * xsd:sequence compositor and containing only elements declarations.
> * (excerpt from JAX-RPC spec 1.1 Maintenanace Review 2 Chapter 6 Section 4.1.)
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static boolean isWrappedType(Node node) {
> -
> +
> if (node == null) {
> return false;
> }
> @@ -143,7 +143,7 @@
> // Under the complexType there could be complexContent/simpleContent
> // and extension elements if this is a derived type.
> // A wrapper element must be complex-typed.
> -
> +
> NodeList children = node.getChildNodes();
>
> for (int j = 0; j < children.getLength(); j++) {
> @@ -158,8 +158,8 @@
>
> // Under the complexType there may be choice, sequence, group and/or all nodes.
> // (There may be other #text nodes, which we will ignore).
> - // The complex type of a wrapper element must have only sequence
> - // and again element declarations in the sequence.
> + // The complex type of a wrapper element must have only sequence
> + // and again element declarations in the sequence.
> children = node.getChildNodes();
> int len = children.getLength();
> for (int j = 0; j < len; j++) {
> @@ -204,11 +204,11 @@
> }
> }
> }
> - }
> + }
> // allows void type
> return true;
> }
> -
> +
> /**
> * If the specified node represents a supported JAX-RPC complexType or
> * simpleType, a Vector is returned which contains ElementDecls for the
> @@ -221,10 +221,10 @@
> * (use the getContainedAttributeTypes)
> * If the specified node is not a supported
> * JAX-RPC complexType/simpleType/element null is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getContainedElementDeclarations(Node node,
> SymbolTable symbolTable) {
> @@ -298,7 +298,7 @@
> if ((localName != null)
> && (localName.equals("extension") || localName.equals("restriction"))
> && Constants.isSchemaXSD(kid.getNamespaceURI())) {
> -
> +
> // get the type of the extension/restriction from the "base" attribute
> QName extendsOrRestrictsType =
> Utils.getTypeQName(children.item(j),
> @@ -344,6 +344,12 @@
>
> return v;
> } else if (isXSDNode(node, "group")) {
> + /*
> + * Does this else clause make any sense anymore if
> + * we're treating refs to xs:groups like a macro inclusion
> + * into the referencing type?
> + * Maybe this else clause should never be possible?
> + *
> NodeList children = node.getChildNodes();
> Vector v = new Vector();
> int len = children.getLength();
> @@ -362,6 +368,8 @@
> }
> }
> return v;
> + */
> + return null;
> } else {
>
> // This may be a simpleType, return the type with the name "value"
> @@ -400,10 +408,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath a Choice Node
> - *
> - * @param choiceNode
> - * @param symbolTable
> - * @return
> + *
> + * @param choiceNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processChoiceNode(Node choiceNode,
> SymbolTable symbolTable) {
> @@ -423,9 +431,9 @@
> } else if (localName.equals("group")) {
> v.addAll(processGroupNode(kid, symbolTable));
> } else if (localName.equals("element")) {
> - ElementDecl elem = processChildElementNode(kid,
> + ElementDecl elem = processChildElementNode(kid,
> symbolTable);
> -
> +
> if (elem != null) {
> // XXX: forces minOccurs="0" so that a null choice
> // element can be serialized ok.
> @@ -453,7 +461,7 @@
>
> /**
> * Returns named child node.
> - *
> + *
> * @param parentNode Parent node.
> * @param name Element name of child node to return.
> */
> @@ -476,9 +484,9 @@
> /**
> * Returns all textual nodes of a subnode defined by a parent node
> * and a path of element names to that subnode.
> - *
> + *
> * @param root Parent node.
> - * @param path Path of element names to text of interest, delimited by "/".
> + * @param path Path of element names to text of interest, delimited by "/".
> */
> public static String getTextByPath(Node root, String path) throws DOMException {
> StringTokenizer st = new StringTokenizer(path, "/");
> @@ -490,7 +498,7 @@
> throw new DOMException(DOMException.NOT_FOUND_ERR, "could not find " + elementName);
> node = child;
> }
> -
> +
> // should have found the node
> String text = "";
> NodeList children = node.getChildNodes();
> @@ -510,10 +518,10 @@
> }
>
> /**
> - * Returns the complete text of the child xsd:annotation/xsd:documentation
> - * element from the provided node. Only the first annotation element and
> + * Returns the complete text of the child xsd:annotation/xsd:documentation
> + * element from the provided node. Only the first annotation element and
> * the first documentation element in the annotation element will be used.
> - *
> + *
> * @param typeNode Parent node.
> */
> public static String getAnnotationDocumentation(Node typeNode) {
> @@ -536,7 +544,7 @@
> } else {
> documentationNode = null;
> }
> -
> +
> // should have found the node if it exists
> String text = "";
> if (documentationNode != null) {
> @@ -560,10 +568,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath a Sequence Node
> - *
> - * @param sequenceNode
> - * @param symbolTable
> - * @return
> + *
> + * @param sequenceNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processSequenceNode(Node sequenceNode,
> SymbolTable symbolTable) {
> @@ -610,12 +618,12 @@
>
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> - * and child element names underneath a group node. If a ref attribute is
> + * and child element names underneath a group node. If a ref attribute is
> * specified, only the referenced group element is returned.
> - *
> - * @param groupNode
> - * @param symbolTable
> - * @return
> + *
> + * @param groupNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processGroupNode(Node groupNode,
> SymbolTable symbolTable) {
> @@ -646,8 +654,26 @@
> // assignment compatible with 'org.apache.axis.wsdl.symbolTable.Type'.
> Type type = (Type) symbolTable.getTypeEntry(nodeType, false);
>
> - if (type != null) {
> - v.add(new ElementDecl(type, nodeName));
> + if (type != null && type.getNode() != null) {
> + //v.add(new ElementDecl(type, nodeName));
> + Node node = type.getNode();
> + NodeList children = node.getChildNodes();
> + for (int j = 0; j < children.getLength(); j++) {
> + QName subNodeKind = Utils.getNodeQName(children.item(j));
> + if ((subNodeKind != null)
> + && Constants.isSchemaXSD(
> + subNodeKind.getNamespaceURI())) {
> + if (subNodeKind.getLocalPart().equals("sequence")) {
> + v.addAll(processSequenceNode(children.item(j),
> + symbolTable));
> + } else if (subNodeKind.getLocalPart().equals("all")) {
> + v.addAll(processAllNode(children.item(j), symbolTable));
> + } else if (subNodeKind.getLocalPart().equals("choice")) {
> + v.addAll(processChoiceNode(children.item(j),
> + symbolTable));
> + }
> + }
> + }
> }
> }
> return v;
> @@ -657,10 +683,10 @@
> /**
> * Invoked by getContainedElementDeclarations to get the child element types
> * and child element names underneath an all node.
> - *
> - * @param allNode
> - * @param symbolTable
> - * @return
> + *
> + * @param allNode
> + * @param symbolTable
> + * @return
> */
> private static Vector processAllNode(Node allNode,
> SymbolTable symbolTable) {
> @@ -689,10 +715,10 @@
> * <p/>
> * If the specified node represents a supported JAX-RPC child element,
> * we return an ElementDecl containing the child element name and type.
> - *
> - * @param elementNode
> - * @param symbolTable
> - * @return
> + *
> + * @param elementNode
> + * @param symbolTable
> + * @return
> */
> private static ElementDecl processChildElementNode(Node elementNode,
> SymbolTable symbolTable) {
> @@ -702,7 +728,7 @@
> BooleanHolder forElement = new BooleanHolder();
> String comments = null;
> comments = getAnnotationDocumentation(elementNode);
> -
> +
> // The type qname is used to locate the TypeEntry, which is then
> // used to retrieve the proper java name of the type.
> QName nodeType = Utils.getTypeQName(elementNode, forElement, false);
> @@ -770,9 +796,9 @@
> /**
> * Returns the WSDL2Java QName for the anonymous type of the element
> * or null.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getElementAnonQName(Node node) {
>
> @@ -795,9 +821,9 @@
> /**
> * Returns the WSDL2Java QName for the anonymous type of the attribute
> * or null.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getAttributeAnonQName(Node node) {
>
> @@ -819,9 +845,9 @@
>
> /**
> * If the specified node is a simple type or contains simpleContent, return true
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static boolean isSimpleTypeOrSimpleContent(Node node) {
>
> @@ -890,7 +916,7 @@
> * <p/>
> * This can be used to determine that a given Node defines a
> * schema "complexType" "element" and so forth.
> - *
> + *
> * @param node a <code>Node</code> value
> * @param schemaLocalName a <code>String</code> value
> * @return true if the node is matches the name in the schema namespace.
> @@ -910,10 +936,10 @@
> /**
> * Look for the base type of node iff node is a complex type that has been
> * derived by restriction; otherwise return null.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getComplexElementRestrictionBase(Node node,
> SymbolTable symbolTable) {
> @@ -993,10 +1019,10 @@
> /**
> * If the specified node represents a supported JAX-RPC complexType/element
> * which extends another complexType. The Type of the base is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getComplexElementExtensionBase(Node node,
> SymbolTable symbolTable) {
> @@ -1085,9 +1111,9 @@
> /**
> * If the specified node represents a 'normal' non-enumeration simpleType,
> * the QName of the simpleType base is returned.
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName getSimpleTypeBase(Node node) {
>
> @@ -1102,9 +1128,9 @@
>
> /**
> * Method getContainedSimpleTypes
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static QName[] getContainedSimpleTypes(Node node) {
>
> @@ -1180,9 +1206,9 @@
> /**
> * Returns the contained restriction or extension node underneath
> * the specified node. Returns null if not found
> - *
> - * @param node
> - * @return
> + *
> + * @param node
> + * @return
> */
> public static Node getRestrictionOrExtensionNode(Node node) {
>
> @@ -1252,7 +1278,7 @@
> /**
> * If the specified node represents an array encoding of one of the following
> * forms, then return the qname repesenting the element type of the array.
> - *
> + *
> * @param node is the node
> * @param dims is the output value that contains the number of dimensions if return is not null
> * @param itemQName will end up containing the "inner" QName for a
> @@ -1291,7 +1317,7 @@
> * <p/>
> * <xsd:element ref="alias" maxOccurs="unbounded"/>
> * returns qname for "alias"
> - *
> + *
> * @param node is the Node
> * @return QName of the compoent of the collection
> */
> @@ -1378,7 +1404,7 @@
> /**
> * If the specified node represents an array encoding of one of the following
> * forms, then return the qname repesenting the element type of the array.
> - *
> + *
> * @param node is the node
> * @param dims is the output value that contains the number of dimensions if return is not null
> * @return QName or null
> @@ -1482,7 +1508,7 @@
> }
> }
> }
> -
> +
> // Under the restriction there should be an attribute OR a sequence/all group node.
> // (There may be other #text nodes, which we will ignore).
> Node groupNode = null;
> @@ -1622,10 +1648,10 @@
> /**
> * adds an attribute node's type and name to the vector
> * helper used by getContainedAttributeTypes
> - *
> - * @param v
> - * @param child
> - * @param symbolTable
> + *
> + * @param v
> + * @param child
> + * @param symbolTable
> */
> private static void addAttributeToVector(Vector v, Node child,
> SymbolTable symbolTable) {
> @@ -1680,7 +1706,7 @@
> if (type instanceof org.apache.axis.wsdl.symbolTable.Element) {
> type = ((org.apache.axis.wsdl.symbolTable.Element) type).getRefType();
> }
> -
> +
> // add type and name to vector, skip it if we couldn't parse it
> // XXX - this may need to be revisited.
> if ((type != null) && (attributeName != null)) {
> @@ -1700,11 +1726,11 @@
> /**
> * adds an attribute to the vector
> * helper used by addAttributeGroupToVector
> - *
> - * @param v
> - * @param symbolTable
> - * @param type
> - * @param name
> + *
> + * @param v
> + * @param symbolTable
> + * @param type
> + * @param name
> */
> private static void addAttributeToVector(Vector v, SymbolTable symbolTable,
> QName type, QName name) {
> @@ -1720,10 +1746,10 @@
> /**
> * adds each attribute group's attribute node to the vector
> * helper used by getContainedAttributeTypes
> - *
> - * @param v
> - * @param attrGrpnode
> - * @param symbolTable
> + *
> + * @param v
> + * @param attrGrpnode
> + * @param symbolTable
> */
> private static void addAttributeGroupToVector(Vector v, Node attrGrpnode,
> SymbolTable symbolTable) {
> @@ -1815,10 +1841,10 @@
> * <attribute name="Male" type="boolean" />
> * <attributeGroup ref="s0:MyAttrSet" />
> * </complexType>
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getContainedAttributeTypes(Node node,
> SymbolTable symbolTable) {
> @@ -1930,9 +1956,9 @@
>
> /**
> * Determine if a string is a simple XML Schema type
> - *
> - * @param s
> - * @return
> + *
> + * @param s
> + * @return
> */
> private static boolean isSimpleSchemaType(String s) {
>
> @@ -1945,9 +1971,9 @@
>
> /**
> * Determine if a QName is a simple XML Schema type
> - *
> - * @param qname
> - * @return
> + *
> + * @param qname
> + * @return
> */
> public static boolean isSimpleSchemaType(QName qname) {
>
> @@ -1962,21 +1988,21 @@
> * Returns the base type of a given type with its symbol table.
> * This logic is extracted from JavaTypeWriter's constructor() method
> * for reusing.
> - *
> - * @param type
> - * @param symbolTable
> - * @return
> + *
> + * @param type
> + * @param symbolTable
> + * @return
> */
> public static TypeEntry getBaseType(TypeEntry type, SymbolTable symbolTable) {
> - Node node = type.getNode();
> + Node node = type.getNode();
> TypeEntry base = getComplexElementExtensionBase(
> node, symbolTable);
> if (base == null) {
> base = getComplexElementRestrictionBase(node, symbolTable);
> - }
> -
> + }
> +
> if (base == null) {
> - QName baseQName = getSimpleTypeBase(node);
> + QName baseQName = getSimpleTypeBase(node);
> if (baseQName != null) {
> base = symbolTable.getType(baseQName);
> }
> @@ -1985,27 +2011,27 @@
> }
>
> /**
> - * Returns whether the specified node represents a <xsd:simpleType>
> + * Returns whether the specified node represents a <xsd:simpleType>
> * with a nested <xsd:list itemType="...">.
> - * @param node
> - * @return
> + * @param node
> + * @return
> */
> public static boolean isListWithItemType(Node node) {
> -
> +
> return getListItemType(node) != null;
> }
>
> /**
> - * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
> - * @param node
> - * @return
> + * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>
> + * @param node
> + * @return
> */
> public static QName getListItemType(Node node) {
> -
> +
> if (node == null) {
> return null;
> }
> -
> +
> // If the node kind is an element, dive into it.
> if (isXSDNode(node, "element")) {
> NodeList children = node.getChildNodes();
> @@ -2022,7 +2048,7 @@
> for (int j = 0; j < children.getLength(); j++) {
> if (isXSDNode(children.item(j), "list")) {
> Node listNode = children.item(j);
> - org.w3c.dom.Element listElement =
> + org.w3c.dom.Element listElement =
> (org.w3c.dom.Element) listNode;
> String type = listElement.getAttribute("itemType");
> if (type.equals("")) {
>
>
>
> 1.95 +95 -83 ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
>
> Index: Utils.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
> retrieving revision 1.94
> retrieving revision 1.95
> diff -u -r1.94 -r1.95
> --- Utils.java 6 May 2005 02:28:10 -0000 1.94
> +++ Utils.java 20 May 2005 12:55:49 -0000 1.95
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -52,14 +52,14 @@
>
> /**
> * Class Utils
> - *
> + *
> * @version %I%, %G%
> */
> public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
>
> /** Field log */
> protected static Log log = LogFactory.getLog(Utils.class.getName());
> -
> +
> /**
> * @see #holder(Parameter, Emitter)
> */
> @@ -68,10 +68,10 @@
> // For other fields the default values will do.
> arg.setType(type);
> return holder(arg, emitter);
> - }
> + }
> /**
> * Given a type, return the Java mapping of that type's holder.
> - *
> + *
> * @param p parameter whose holder class name we want to obtain.
> * @param emitter the only {@link Emitter} object embodying the running
> * instance of WSDL2Java.
> @@ -146,7 +146,7 @@
> }
>
> name = JavaUtils.replace(name, "java.lang.", "");
> -
> +
> // This could be a special QName for a indexed property.
> // If so, change the [] to Array.
> name = JavaUtils.replace(name, "[]", "Array");
> @@ -220,7 +220,7 @@
>
> /**
> * Add package to name
> - *
> + *
> * @param className full name of the class.
> * @param newPkg name of the package to append
> * @return String name with package name added
> @@ -240,7 +240,7 @@
> /**
> * Given a fault message, return the fully qualified Java class name
> * of the exception to be generated from this fault
> - *
> + *
> * @param faultMessage The WSDL fault message
> * @param symbolTable the current symbol table
> * @return A Java class name for the fault
> @@ -256,7 +256,7 @@
>
> /**
> * Given a fault message, return the XML type of the exception data.
> - *
> + *
> * @param faultMessage The WSDL fault message object
> * @param symbolTable the current symbol table
> * @return A QName for the XML type of the data
> @@ -272,7 +272,7 @@
>
> /**
> * Given a fault message, return TRUE if the fault is a complex type fault
> - *
> + *
> * @param faultMessage The WSDL fault message object
> * @param symbolTable the current symbol table
> * @return A Java class name for the fault
> @@ -297,10 +297,10 @@
> * The first element in the vector is the base type (an TypeEntry).
> * Subsequent elements are values (Strings).
> * If this is not an enumeration, null is returned.
> - *
> - * @param node
> - * @param symbolTable
> - * @return
> + *
> + * @param node
> + * @param symbolTable
> + * @return
> */
> public static Vector getEnumerationBaseAndValues(Node node,
> SymbolTable symbolTable) {
> @@ -417,9 +417,9 @@
>
> /**
> * Capitalize the first character of the name.
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String capitalizeFirstChar(String name) {
>
> @@ -440,9 +440,9 @@
>
> /**
> * Prepend an underscore to the name
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String addUnderscore(String name) {
>
> @@ -455,9 +455,9 @@
>
> /**
> * Map an XML name to a valid Java identifier
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String xmlNameToJava(String name) {
>
> @@ -470,9 +470,9 @@
>
> /**
> * Map an XML name to a valid Java identifier w/ capitolized first letter
> - *
> - * @param name
> - * @return
> + *
> + * @param name
> + * @return
> */
> public static String xmlNameToJavaClass(String name) {
> return capitalizeFirstChar(xmlNameToJava(name));
> @@ -480,9 +480,9 @@
>
> /**
> * Method makePackageName
> - *
> - * @param namespace
> - * @return
> + *
> + * @param namespace
> + * @return
> */
> public static String makePackageName(String namespace) {
>
> @@ -549,7 +549,7 @@
> * Massage <tt>word</tt> into a form suitable for use in a Java package name.
> * Append it to the target string buffer with a <tt>.</tt> delimiter iff
> * <tt>word</tt> is not the first word in the package name.
> - *
> + *
> * @param sb the buffer to append to
> * @param word the word to append
> * @param firstWord a flag indicating whether this is the first word
> @@ -589,9 +589,9 @@
>
> /**
> * Query Java Local Name
> - *
> - * @param fullName
> - * @return
> + *
> + * @param fullName
> + * @return
> */
> public static String getJavaLocalName(String fullName) {
> return fullName.substring(fullName.lastIndexOf('.') + 1);
> @@ -599,9 +599,9 @@
>
> /**
> * Query Java Package Name
> - *
> - * @param fullName
> - * @return
> + *
> + * @param fullName
> + * @return
> */
> public static String getJavaPackageName(String fullName) {
>
> @@ -614,12 +614,12 @@
>
> /**
> * Does the given file already exist in the given namespace?
> - *
> - * @param name
> - * @param namespace
> - * @param namespaces
> - * @return
> - * @throws IOException
> + *
> + * @param name
> + * @param namespace
> + * @param namespaces
> + * @return
> + * @throws IOException
> */
> public static boolean fileExists(
> String name, String namespace, Namespaces namespaces)
> @@ -646,10 +646,10 @@
>
> /**
> * Return a string with "var" wrapped as an Object type if needed
> - *
> - * @param type
> - * @param var
> - * @return
> + *
> + * @param type
> + * @param var
> + * @return
> */
> public static String wrapPrimitiveType(TypeEntry type, String var) {
>
> @@ -672,9 +672,9 @@
> /**
> * Return the Object variable 'var' cast to the appropriate type
> * doing the right thing for the primitive types.
> - *
> - * @param var
> - * @return
> + *
> + * @param var
> + * @return
> */
> public static String getResponseString(Parameter param,
> String var) {
> @@ -683,7 +683,7 @@
> }
> String typeName = param.getType().getName();
> MimeInfo mimeInfo = param.getMIMEInfo();
> -
> +
> String mimeType = (mimeInfo == null)
> ? null
> : mimeInfo.getType();
> @@ -716,7 +716,7 @@
> }
>
> String objType = (String) TYPES.get(typeName);
> -
> +
> if (objType != null) {
> if (param.isOmittable()) {
> typeName = objType;
> @@ -725,29 +725,29 @@
> "Value();";
> }
> }
> -
> +
> return "(" + typeName + ") " + var + ";";
> } // getResponseString
>
> /**
> * Method isPrimitiveType
> - *
> - * @param type
> - * @return
> + *
> + * @param type
> + * @return
> */
> public static boolean isPrimitiveType(TypeEntry type) {
> return TYPES.get(type.getName()) != null;
> } // isPrimitiveType
> -
> +
> /**
> * Return a "wrapper" type for the given type name. In other words,
> * if it's a primitive type ("int") return the java wrapper class
> * ("java.lang.Integer"). Otherwise return the type name itself.
> - *
> + *
> * @param type
> * @return the name of a java wrapper class for the type, or the type's
> * name if it's not primitive.
> - */
> + */
> public static String getWrapperType(String type) {
> String ret = (String)TYPES.get(type);
> return (ret == null) ? type : ret;
> @@ -756,7 +756,7 @@
> /**
> * Return the operation QName. The namespace is determined from
> * the soap:body namespace, if it exists, otherwise it is "".
> - *
> + *
> * @param bindingOper the operation
> * @param bEntry the symbol table binding entry
> * @param symbolTable SymbolTable
> @@ -920,9 +920,9 @@
> /**
> * Common code for generating a QName in emitted code. Note that there's
> * no semicolon at the end, so we can use this in a variety of contexts.
> - *
> - * @param qname
> - * @return
> + *
> + * @param qname
> + * @return
> */
> public static String getNewQName(javax.xml.namespace.QName qname) {
> return "new javax.xml.namespace.QName(\"" + qname.getNamespaceURI()
> @@ -938,9 +938,9 @@
> * Get the parameter type name. If this is a MIME type, then
> * figure out the appropriate type from the MIME type, otherwise
> * use the name of the type itself.
> - *
> - * @param parm
> - * @return
> + *
> + * @param parm
> + * @return
> */
> public static String getParameterTypeName(Parameter parm) {
>
> @@ -971,7 +971,7 @@
> /**
> * Get the QName that could be used in the xsi:type
> * when serializing an object for this parameter/return
> - *
> + *
> * @param param is a parameter
> * @return the QName of the parameter's xsi type
> */
> @@ -987,7 +987,7 @@
> /**
> * Get the QName that could be used in the xsi:type
> * when serializing an object of the given type.
> - *
> + *
> * @param te is the type entry
> * @return the QName of the type's xsi type
> */
> @@ -1025,7 +1025,7 @@
>
> /**
> * Given a MIME type, return the AXIS-specific type QName.
> - *
> + *
> * @param mimeName the MIME type name
> * @return the AXIS-specific QName for the MIME type
> */
> @@ -1051,9 +1051,9 @@
>
> /**
> * Are there any MIME parameters in the given binding?
> - *
> - * @param bEntry
> - * @return
> + *
> + * @param bEntry
> + * @return
> */
> public static boolean hasMIME(BindingEntry bEntry) {
>
> @@ -1072,10 +1072,10 @@
>
> /**
> * Are there any MIME parameters in the given binding's operation?
> - *
> - * @param bEntry
> - * @param operation
> - * @return
> + *
> + * @param bEntry
> + * @param operation
> + * @return
> */
> public static boolean hasMIME(BindingEntry bEntry,
> BindingOperation operation) {
> @@ -1182,11 +1182,11 @@
> * <p/>
> * Caller should expect to wrap the construction in a try/catch block
> * if bThrow is set to <i>true</i>.
> - *
> + *
> * @param param info about the parameter we need a constructor for
> * @param symbolTable used to lookup enumerations
> * @param bThrow set to true if contructor needs try/catch block
> - * @return
> + * @return
> */
> public static String getConstructorForParam(Parameter param,
> SymbolTable symbolTable,
> @@ -1262,7 +1262,7 @@
>
> return paramType + "." + enumeration;
> }
> -
> +
> if(param.getType().getRefType()!= null){
> // Check for enumeration
> Vector v2 = Utils.getEnumerationBaseAndValues(param.getType().getRefType().getNode(),
> @@ -1283,7 +1283,8 @@
> }
>
> public static boolean shouldEmit(TypeEntry type) {
> - // 1) Don't register types that are base (primitive) types or attributeGroups.
> + // 1) Don't register types that are base (primitive) types
> + // or attributeGroups or xs:groups.
> // If the baseType != null && getRefType() != null this
> // is a simpleType that must be registered.
> // 2) Don't register the special types for collections
> @@ -1295,10 +1296,21 @@
> || (type instanceof Element) || !type.isReferenced()
> || type.isOnlyLiteralReferenced()
> || ((type.getNode() != null)
> - && type.getNode().getLocalName().equals(
> - "attributeGroup"))));
> + && (isXsNode(type.getNode(), "group") ||
> + isXsNode(type.getNode(), "attributeGroup")))));
> }
>
> +
> + /**
> + * Determines if the DOM Node represents an xs:<node>
> + */
> + public static boolean isXsNode (Node node, String nameName)
> + {
> + return (node.getLocalName().equals(nameName)
> + && Constants.isSchemaXSD (node.getNamespaceURI ()));
> + }
> +
> +
> public static QName getItemQName(TypeEntry te) {
> if (te instanceof DefinedElement) {
> te = te.getRefType();
>
>
>
> 1.25 +77 -74 ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java
>
> Index: Parser.java
> ===================================================================
> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java,v
> retrieving revision 1.24
> retrieving revision 1.25
> diff -u -r1.24 -r1.25
> --- Parser.java 13 Apr 2005 16:22:52 -0000 1.24
> +++ Parser.java 20 May 2005 12:55:49 -0000 1.25
> @@ -1,12 +1,12 @@
> /*
> * Copyright 2001-2004 The Apache Software Foundation.
> - *
> + *
> * Licensed 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.
> @@ -23,6 +23,7 @@
> import org.apache.axis.wsdl.symbolTable.ServiceEntry;
> import org.apache.axis.wsdl.symbolTable.SymTabEntry;
> import org.apache.axis.wsdl.symbolTable.SymbolTable;
> +import org.apache.axis.wsdl.toJava.Utils;
> import org.apache.axis.wsdl.symbolTable.Type;
> import org.apache.axis.wsdl.symbolTable.TypeEntry;
> import org.w3c.dom.Document;
> @@ -82,8 +83,8 @@
>
> /**
> * Method isDebug
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isDebug() {
> return debug;
> @@ -91,8 +92,8 @@
>
> /**
> * Method setDebug
> - *
> - * @param debug
> + *
> + * @param debug
> */
> public void setDebug(boolean debug) {
> this.debug = debug;
> @@ -100,26 +101,26 @@
>
> /**
> * Method isQuiet
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isQuiet() {
> return quiet;
> - }
> + }
>
> /**
> * Method setQuiet
> - *
> + *
> * @param quiet
> */
> public void setQuiet(boolean quiet) {
> this.quiet = quiet;
> - }
> -
> + }
> +
> /**
> * Method isImports
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isImports() {
> return imports;
> @@ -127,8 +128,8 @@
>
> /**
> * Method setImports
> - *
> - * @param imports
> + *
> + * @param imports
> */
> public void setImports(boolean imports) {
> this.imports = imports;
> @@ -136,8 +137,8 @@
>
> /**
> * Method isVerbose
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isVerbose() {
> return verbose;
> @@ -145,8 +146,8 @@
>
> /**
> * Method setVerbose
> - *
> - * @param verbose
> + *
> + * @param verbose
> */
> public void setVerbose(boolean verbose) {
> this.verbose = verbose;
> @@ -154,8 +155,8 @@
>
> /**
> * Method isNowrap
> - *
> - * @return
> + *
> + * @return
> */
> public boolean isNowrap() {
> return nowrap;
> @@ -163,8 +164,8 @@
>
> /**
> * Method setNowrap
> - *
> - * @param nowrap
> + *
> + * @param nowrap
> */
> public void setNowrap(boolean nowrap) {
> this.nowrap = nowrap;
> @@ -172,8 +173,8 @@
>
> /**
> * Return the current timeout setting
> - *
> - * @return
> + *
> + * @return
> */
> public long getTimeout() {
> return timeoutms;
> @@ -181,8 +182,8 @@
>
> /**
> * Set the timeout, in milliseconds
> - *
> - * @param timeout
> + *
> + * @param timeout
> */
> public void setTimeout(long timeout) {
> this.timeoutms = timeout;
> @@ -190,8 +191,8 @@
>
> /**
> * Method getUsername
> - *
> - * @return
> + *
> + * @return
> */
> public String getUsername() {
> return username;
> @@ -199,8 +200,8 @@
>
> /**
> * Method setUsername
> - *
> - * @param username
> + *
> + * @param username
> */
> public void setUsername(String username) {
> this.username = username;
> @@ -208,8 +209,8 @@
>
> /**
> * Method getPassword
> - *
> - * @return
> + *
> + * @return
> */
> public String getPassword() {
> return password;
> @@ -217,8 +218,8 @@
>
> /**
> * Method setPassword
> - *
> - * @param password
> + *
> + * @param password
> */
> public void setPassword(String password) {
> this.password = password;
> @@ -226,8 +227,8 @@
>
> /**
> * Method getFactory
> - *
> - * @return
> + *
> + * @return
> */
> public GeneratorFactory getFactory() {
> return genFactory;
> @@ -235,8 +236,8 @@
>
> /**
> * Method setFactory
> - *
> - * @param factory
> + *
> + * @param factory
> */
> public void setFactory(GeneratorFactory factory) {
> this.genFactory = factory;
> @@ -245,8 +246,8 @@
> /**
> * Get the symbol table. The symbol table is null until
> * run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public SymbolTable getSymbolTable() {
> return symbolTable;
> @@ -255,8 +256,8 @@
> /**
> * Return the current definition. The current definition is
> * null until run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public Definition getCurrentDefinition() {
>
> @@ -268,8 +269,8 @@
> /**
> * Get the current WSDL URI. The WSDL URI is null until
> * run is called.
> - *
> - * @return
> + *
> + * @return
> */
> public String getWSDLURI() {
>
> @@ -283,9 +284,9 @@
> * <p/>
> * This method will time out after the number of milliseconds specified
> * by our timeoutms member.
> - *
> - * @param wsdlURI
> - * @throws Exception
> + *
> + * @param wsdlURI
> + * @throws Exception
> */
> public void run(String wsdlURI) throws Exception {
>
> @@ -326,7 +327,7 @@
>
> /**
> * Class WSDLRunnable
> - *
> + *
> * @version %I%, %G%
> */
> private class WSDLRunnable implements Runnable {
> @@ -342,9 +343,9 @@
>
> /**
> * Constructor WSDLRunnable
> - *
> - * @param symbolTable
> - * @param wsdlURI
> + *
> + * @param symbolTable
> + * @param wsdlURI
> */
> public WSDLRunnable(SymbolTable symbolTable, String wsdlURI) {
> this.symbolTable = symbolTable;
> @@ -366,8 +367,8 @@
>
> /**
> * Method getFailure
> - *
> - * @return
> + *
> + * @return
> */
> public Exception getFailure() {
> return failure;
> @@ -376,13 +377,13 @@
>
> /**
> * Call this method if your WSDL document has already been parsed as an XML DOM document.
> - *
> + *
> * @param context context This is directory context for the Document. If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work). If context is null, then the context becomes the current directory.
> * @param doc doc This is the XML Document containing the WSDL.
> - * @throws IOException
> - * @throws SAXException
> - * @throws WSDLException
> - * @throws ParserConfigurationException
> + * @throws IOException
> + * @throws SAXException
> + * @throws WSDLException
> + * @throws ParserConfigurationException
> */
> public void run(String context, Document doc)
> throws IOException, SAXException, WSDLException,
> @@ -401,8 +402,8 @@
>
> /**
> * Method sanityCheck
> - *
> - * @param symbolTable
> + *
> + * @param symbolTable
> */
> protected void sanityCheck(SymbolTable symbolTable) {
>
> @@ -411,9 +412,9 @@
>
> /**
> * Method generate
> - *
> - * @param symbolTable
> - * @throws IOException
> + *
> + * @param symbolTable
> + * @throws IOException
> */
> private void generate(SymbolTable symbolTable) throws IOException {
>
> @@ -487,9 +488,9 @@
> /**
> * Generate bindings (classes and class holders) for the complex types.
> * If generating serverside (skeleton) spit out beanmappings
> - *
> - * @param symbolTable
> - * @throws IOException
> + *
> + * @param symbolTable
> + * @throws IOException
> */
> private void generateTypes(SymbolTable symbolTable) throws IOException {
>
> @@ -501,7 +502,7 @@
> // Write out the type if and only if:
> // - we found its definition (getNode())
> // - it is referenced
> - // - it is not a base type or an attributeGroup
> + // - it is not a base type or an attributeGroup or xs:group
> // - it is a Type (not an Element) or a CollectionElement
> // (Note that types that are arrays are passed to getGenerator
> // because they may require a Holder)
> @@ -510,7 +511,8 @@
> || (type instanceof CollectionElement));
>
> if ((type.getNode() != null)
> - && !type.getNode().getLocalName().equals("attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "group")
> && type.isReferenced() && isType
> && (type.getBaseType() == null)) {
> Generator gen = genFactory.getGenerator(type, symbolTable);
> @@ -518,7 +520,7 @@
> gen.generate();
> }
> }
> -
> +
> Map types = symbolTable.getTypeIndex();
> Collection typeCollection = types.values();
> for (Iterator i = typeCollection.iterator(); i.hasNext(); ) {
> @@ -527,7 +529,7 @@
> // Write out the type if and only if:
> // - we found its definition (getNode())
> // - it is referenced
> - // - it is not a base type or an attributeGroup
> + // - it is not a base type or an attributeGroup or xs:group
> // - it is a Type (not an Element) or a CollectionElement
> // (Note that types that are arrays are passed to getGenerator
> // because they may require a Holder)
> @@ -536,7 +538,8 @@
> || (type instanceof CollectionElement));
>
> if ((type.getNode() != null)
> - && !type.getNode().getLocalName().equals("attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "attributeGroup")
> + && !Utils.isXsNode(type.getNode(), "group")
> && type.isReferenced() && isType
> && (type.getBaseType() == null)) {
> Generator gen = genFactory.getGenerator(type, symbolTable);
>
>
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/