You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2002/08/15 23:27:48 UTC
cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.wsdl
scheu 2002/08/15 14:27:48
Modified: java/src/org/apache/axis/wsdl/symbolTable
CollectionType.java SchemaUtils.java
SymbolTable.java TypeEntry.java Utils.java
java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
JavaStubWriter.java Utils.java
java/test/wsdl/types ComprehensiveTypes.wsdl
Added: java/src/org/apache/axis/wsdl/symbolTable
CollectionElement.java CollectionTE.java
Log:
Fix for Bugzilla http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9665
Problem:
Constructs with a combination of ref and maxOccurs are not supported.
For example:
<element ref="Z" minOccurs=0 maxOccurs="unbounded"/>
Solution:
Added a CollectionElement symbolTable entry that is
similar to the CollectionType symbolTable entry.
Changes were necessary in SymbolTable to recognize
this case and add a CollectionElement to the symbol table.
Other minor changes were made, and a test of this construct
was added to the comprehensive types test.
Revision Changes Path
1.3 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/CollectionType.java
Index: CollectionType.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/CollectionType.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CollectionType.java 20 Jun 2002 20:35:47 -0000 1.2
+++ CollectionType.java 15 Aug 2002 21:27:47 -0000 1.3
@@ -66,7 +66,7 @@
* 'collection of bars', In such cases a collection type is
* added with the special QName <name>[<minOccurs>, <maxOccurs>]
*/
-public class CollectionType extends DefinedType {
+public class CollectionType extends DefinedType implements CollectionTE {
public CollectionType(QName pqName, TypeEntry refType, Node pNode, String dims) {
super(pqName, refType, pNode, dims);
}
1.12 +6 -10 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SchemaUtils.java 8 Aug 2002 15:17:10 -0000 1.11
+++ SchemaUtils.java 15 Aug 2002 21:27:47 -0000 1.12
@@ -336,13 +336,9 @@
*/
private static ElementDecl processChildElementNode(Node elementNode,
SymbolTable symbolTable) {
- // Get the name and type qnames.
- // The type qname is used to locate the TypeEntry, which is then
- // used to retrieve the proper java name of the type.
+ // Get the name qnames.
QName nodeName = Utils.getNodeNameQName(elementNode);
BooleanHolder forElement = new BooleanHolder();
- QName nodeType = Utils.getNodeTypeRefQName(elementNode, forElement);
-
// An element inside a complex type is either qualified or unqualified.
// If the ref= attribute is used, the name of the ref'd element is used
@@ -365,15 +361,15 @@
nodeName = new QName("", nodeName.getLocalPart());
}
}
- } else {
- nodeName = nodeType;
}
+
+ // 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.getNodeTypeRefQName(elementNode, forElement);
if (nodeType == null) {
nodeType = getElementAnonQName(elementNode);
forElement.value = false;
- }
-
-
+ }
TypeEntry type = (TypeEntry)symbolTable.getTypeEntry(nodeType,
forElement.value);
if (type != null) {
1.24 +24 -11 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- SymbolTable.java 14 Aug 2002 19:16:15 -0000 1.23
+++ SymbolTable.java 15 Aug 2002 21:27:47 -0000 1.24
@@ -879,20 +879,33 @@
if (type == null) {
// See if this is a special QName for collections
if (qName.getLocalPart().indexOf("[") > 0) {
- // Get the TypeEntry for the collection element
QName typeAttr = Utils.getNodeTypeRefQName(node, "type");
- TypeEntry collEl = getTypeEntry(typeAttr, false);
- if (collEl == null) {
- // Collection Element Type not defined yet, add one.
- String baseName = btm.getBaseName(typeAttr);
- if (baseName != null) {
- collEl = new BaseType(typeAttr);
- } else {
- collEl = new UndefinedType(typeAttr);
+ if (typeAttr != null) {
+ // Case of type and maxOccurs
+ TypeEntry collEl = getTypeEntry(typeAttr, false);
+ if (collEl == null) {
+ // Collection Element Type not defined yet, add one.
+ String baseName = btm.getBaseName(typeAttr);
+ if (baseName != null) {
+ collEl = new BaseType(typeAttr);
+ } else {
+ collEl = new UndefinedType(typeAttr);
+ }
+ symbolTablePut(collEl);
+ }
+ symbolTablePut(new CollectionType(qName, collEl, node, "[]"));
+ } else {
+ // Case of ref and maxOccurs
+ QName refAttr = Utils.getNodeTypeRefQName(node, "ref");
+ if (refAttr != null) {
+ TypeEntry collEl = getTypeEntry(refAttr, true);
+ if (collEl == null) {
+ collEl = new UndefinedElement(refAttr);
+ symbolTablePut(collEl);
+ }
+ symbolTablePut(new CollectionElement(qName, collEl, node, "[]"));
}
- symbolTablePut(collEl);
}
- symbolTablePut(new CollectionType(qName, collEl, node, "[]"));
} else {
// Add a BaseType or Undefined Type/Element
String baseName = btm.getBaseName(qName);
1.4 +2 -2 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java
Index: TypeEntry.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TypeEntry.java 22 Jul 2002 12:28:47 -0000 1.3
+++ TypeEntry.java 15 Aug 2002 21:27:47 -0000 1.4
@@ -79,8 +79,8 @@
* Type Element
* | |
* (BaseType, (DefinedElement,
- * CollectionType UndefinedElement)
- * DefinedType,
+ * CollectionType CollectionElement,
+ * DefinedType, UndefinedElement)
* UndefinedType)
*
* UndefinedType and UndefinedElement are placeholders when the real type or element
1.16 +5 -11 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Utils.java 8 Aug 2002 15:17:11 -0000 1.15
+++ Utils.java 15 Aug 2002 21:27:47 -0000 1.16
@@ -273,12 +273,16 @@
if (node == null) return null;
forElement.value = false; // Assume QName returned is for a type
- // If the node has "type" and "maxOccurs" then the type is really
+ // If the node has "type"/"ref" and "maxOccurs" then the type is really
// a collection. There is no qname in the wsdl which we can use to represent
// the collection, so we need to invent one.
// The local part of the qname is changed to <local>[minOccurs, maxOccurs]
// The namespace uri is changed to the targetNamespace of this node
QName qName= getNodeTypeRefQName(node, "type");
+ if (qName == null) {
+ forElement.value = true;
+ qName = getNodeTypeRefQName(node, "ref");
+ }
if (qName != null) {
String maxOccursValue = getAttribute(node, "maxOccurs");
String minOccursValue = getAttribute(node, "minOccurs");
@@ -294,21 +298,11 @@
qName = getNillableQName(qName);
} else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
String localPart = qName.getLocalPart();
-// localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
-// qName.setLocalPart(localPart);
-// String namespace = getScopedAttribute(node, "targetNamespace");
-// if (namespace != null)
-// qName.setNamespaceURI(namespace);
localPart += "[" + maxOccursValue + "]";
qName = new QName(qName.getNamespaceURI(), localPart);
}
}
- // Both "ref" and "element" reference elements
- if (qName == null) {
- forElement.value = true;
- qName = getNodeTypeRefQName(node, "ref");
- }
// A WSDL Part uses the element attribute instead of the ref attribute
if (qName == null) {
forElement.value = true;
1.1 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/CollectionElement.java
Index: CollectionElement.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.wsdl.symbolTable;
import org.w3c.dom.Node;
import javax.xml.namespace.QName;
/**
* This Element is for a QName that is a 'collection'.
* For example,
* <element ref="bar" maxOccurs="unbounded" />
* We need a way to indicate in the symbol table that a foo is
* 'collection of bars', In such cases a collection element is
* added with the special QName <name>[<minOccurs>, <maxOccurs>]
*/
public class CollectionElement extends DefinedElement implements CollectionTE {
public CollectionElement(QName pqName, TypeEntry refType, Node pNode, String dims) {
super(pqName, refType, pNode, dims);
}
};
1.1 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/CollectionTE.java
Index: CollectionTE.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.wsdl.symbolTable;
import org.w3c.dom.Node;
import javax.xml.namespace.QName;
/*
* Common marker interface for CollectionType and CollectionElement
*/
public interface CollectionTE {
};
1.58 +2 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
Index: JavaDeployWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- JavaDeployWriter.java 9 Aug 2002 13:56:25 -0000 1.57
+++ JavaDeployWriter.java 15 Aug 2002 21:27:47 -0000 1.58
@@ -79,7 +79,7 @@
import org.apache.axis.wsdl.symbolTable.BindingEntry;
import org.apache.axis.wsdl.symbolTable.Element;
-import org.apache.axis.wsdl.symbolTable.CollectionType;
+import org.apache.axis.wsdl.symbolTable.CollectionTE;
import org.apache.axis.wsdl.symbolTable.Parameter;
import org.apache.axis.wsdl.symbolTable.Parameters;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
@@ -212,7 +212,7 @@
// 3) Don't register types that are not referenced
// or only referenced in a literal context.
if ((type.getBaseType() != null && type.getRefType() == null) ||
- type instanceof CollectionType ||
+ type instanceof CollectionTE ||
type instanceof Element ||
!type.isReferenced() ||
type.isOnlyLiteralReferenced()) {
1.84 +2 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- JavaStubWriter.java 14 Aug 2002 19:16:15 -0000 1.83
+++ JavaStubWriter.java 15 Aug 2002 21:27:47 -0000 1.84
@@ -78,7 +78,7 @@
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
-import org.apache.axis.wsdl.symbolTable.CollectionType;
+import org.apache.axis.wsdl.symbolTable.CollectionTE;
import org.apache.axis.wsdl.symbolTable.Element;
import org.apache.axis.wsdl.symbolTable.Parameter;
import org.apache.axis.wsdl.symbolTable.Parameters;
@@ -420,7 +420,7 @@
// 3) Don't register types that are not referenced
// or only referenced in a literal context.
if ((type.getBaseType() != null && type.getRefType() == null) ||
- type instanceof CollectionType ||
+ type instanceof CollectionTE ||
type instanceof Element ||
!type.isReferenced() ||
type.isOnlyLiteralReferenced()) {
1.49 +3 -3 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- Utils.java 13 Aug 2002 12:45:24 -0000 1.48
+++ Utils.java 15 Aug 2002 21:27:47 -0000 1.49
@@ -59,7 +59,7 @@
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
-import org.apache.axis.wsdl.symbolTable.CollectionType;
+import org.apache.axis.wsdl.symbolTable.CollectionTE;
import org.apache.axis.wsdl.symbolTable.Element;
import org.apache.axis.wsdl.symbolTable.MessageEntry;
import org.apache.axis.wsdl.symbolTable.Parameter;
@@ -638,7 +638,7 @@
te.getRefType() != null) {
te = te.getRefType();
}
- // If the TypeEntry is a CollectionType, use
+ // If the TypeEntry is a CollectionTE, use
// the TypeEntry representing the component Type
// So for example a parameter that takes a
// collection type for
@@ -648,7 +648,7 @@
// <QName of xsd:string>,
// String[])
if (te != null &&
- te instanceof CollectionType &&
+ te instanceof CollectionTE &&
te.getRefType() != null) {
te = te.getRefType();
}
1.34 +3 -0 xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
Index: ComprehensiveTypes.wsdl
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ComprehensiveTypes.wsdl 8 Aug 2002 16:44:14 -0000 1.33
+++ ComprehensiveTypes.wsdl 15 Aug 2002 21:27:48 -0000 1.34
@@ -76,6 +76,7 @@
<xsd:element name="one" type="typens:simple"/> <!-- Ref to a simple type -->
<xsd:element name="two" type="typens2:fwd"/> <!-- Forward type use to dif namespace -->
<xsd:element ref="typens2:three"/> <!-- Forward ref use to a dif namespace -->
+ <xsd:element ref="typens:enumValue" maxOccurs="unbounded" /> <!-- ref & maxOccurs -->
<xsd:element name="enum1" type="typens:enumString"/>
<xsd:element name="enum2" type="typens:enumInt"/>
<xsd:element name="enum3" type="typens:enumLong"/>
@@ -104,6 +105,8 @@
</xsd:attribute>
</xsd:complexType>
</xsd:element>
+
+ <xsd:element name="enumValue" type="typens:enum"/>
<xsd:complexType name="time">
<xsd:simpleContent>