This was a bugfix... I thought we were dealing with docs *and* bugzilla...?
--Glen ----- Original Message ----- From: "Russell Butek" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 4:42 PM Subject: Re: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java JavaStubWriter.java > <releaseManagerHat> > > Hey! No new stuff until we get beta 2 out the door! > > </releaseManagerHat> > > Russell Butek > [EMAIL PROTECTED] > > > [EMAIL PROTECTED] on 04/16/2002 03:26:32 PM > > Please respond to [EMAIL PROTECTED] > > To: [EMAIL PROTECTED] > cc: > Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava > Emitter.java JavaStubWriter.java > > > > gdaniels 02/04/16 13:26:32 > > Modified: java/src/org/apache/axis AxisServiceConfig.java > java/src/org/apache/axis/description TypeDesc.java > java/src/org/apache/axis/encoding > DefaultSOAP12TypeMappingImpl.java > DefaultTypeMappingImpl.java > java/src/org/apache/axis/encoding/ser ArrayDeserializer.java > ArraySerializer.java > java/src/org/apache/axis/utils JavaUtils.java > java/src/org/apache/axis/wsdl/toJava Emitter.java > JavaStubWriter.java > Log: > * Support Collections, not just Lists. > > * Some more code cleanup, remove dead imports, fix JavaDocs, etc. > > * Add a slot to hold XMLType in TypeDesc > > Revision Changes Path > 1.6 +0 -2 > xml-axis/java/src/org/apache/axis/AxisServiceConfig.java > > Index: AxisServiceConfig.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/AxisServiceConfig.java,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -u -r1.5 -r1.6 > --- AxisServiceConfig.java 13 Feb 2002 20:55:42 -0000 1.5 > +++ AxisServiceConfig.java 16 Apr 2002 20:26:32 -0000 1.6 > @@ -65,8 +65,6 @@ > { > /** Get the allowed method names. > * > - * (The only method right now) > - * > * @return a space-delimited list of method names which may be > called > * via SOAP. > */ > > > > 1.10 +15 -3 > xml-axis/java/src/org/apache/axis/description/TypeDesc.java > > Index: TypeDesc.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/description/TypeDesc.java,v > retrieving revision 1.9 > retrieving revision 1.10 > diff -u -r1.9 -r1.10 > --- TypeDesc.java 3 Apr 2002 06:09:55 -0000 1.9 > +++ TypeDesc.java 16 Apr 2002 20:26:32 -0000 1.10 > @@ -58,9 +58,8 @@ > import org.apache.axis.encoding.ser.BeanSerializer; > > import javax.xml.rpc.namespace.QName; > -import java.util.HashMap; > -import java.lang.reflect.Array; > import java.lang.reflect.Method; > +import java.util.HashMap; > > /** > * A TypeDesc represents a Java<->XML data binding. It is essentially > @@ -113,8 +112,13 @@ > return null; > } > > + /** The Java class for this type */ > private Class javaClass = null; > - > + > + /** The XML type QName for this type */ > + private QName xmlType = null; > + > + /** The various fields in here */ > private FieldDesc [] fields; > > /** A cache of FieldDescs by name */ > @@ -343,5 +347,13 @@ > */ > public boolean hasAttributes() { > return _hasAttributes; > + } > + > + public QName getXmlType() { > + return xmlType; > + } > + > + public void setXmlType(QName xmlType) { > + this.xmlType = xmlType; > } > } > > > > 1.3 +1 -27 > xml-axis/java/src/org/apache/axis/encoding/DefaultSOAP12TypeMappingImpl.java > > > Index: DefaultSOAP12TypeMappingImpl.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultSOAP12TypeMappingIm pl.java,v > > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- DefaultSOAP12TypeMappingImpl.java 15 Apr 2002 02:35:57 -0000 1.2 > +++ DefaultSOAP12TypeMappingImpl.java 16 Apr 2002 20:26:32 -0000 1.3 > @@ -56,34 +56,8 @@ > package org.apache.axis.encoding; > > import org.apache.axis.Constants; > - > -import javax.xml.rpc.namespace.QName; > -import javax.xml.rpc.JAXRPCException; > - > -import java.util.ArrayList; > -import java.util.HashMap; > - > -import org.apache.axis.encoding.ser.ArraySerializerFactory; > -import org.apache.axis.encoding.ser.ArrayDeserializerFactory; > -import org.apache.axis.encoding.ser.BeanSerializerFactory; > -import org.apache.axis.encoding.ser.BeanDeserializerFactory; > -import org.apache.axis.encoding.ser.DateSerializerFactory; > -import org.apache.axis.encoding.ser.DateDeserializerFactory; > -import org.apache.axis.encoding.ser.Base64SerializerFactory; > import org.apache.axis.encoding.ser.Base64DeserializerFactory; > -import org.apache.axis.encoding.ser.MapSerializerFactory; > -import org.apache.axis.encoding.ser.MapDeserializerFactory; > -import org.apache.axis.encoding.ser.HexSerializerFactory; > -import org.apache.axis.encoding.ser.HexDeserializerFactory; > -import org.apache.axis.encoding.ser.ElementSerializerFactory; > -import org.apache.axis.encoding.ser.ElementDeserializerFactory; > -import org.apache.axis.encoding.ser.VectorDeserializerFactory; > -import org.apache.axis.encoding.ser.SimpleDeserializerFactory; > -import org.apache.axis.encoding.ser.SimplePrimitiveSerializerFactory; > -import org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory; > -import java.util.Vector; > -import java.util.Hashtable; > -import java.util.List; > +import org.apache.axis.encoding.ser.Base64SerializerFactory; > > /** > * @author Rich Scheuerle ([EMAIL PROTECTED]) > > > > 1.21 +5 -5 > xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java > > Index: DefaultTypeMappingImpl.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.jav a,v > > retrieving revision 1.20 > retrieving revision 1.21 > diff -u -r1.20 -r1.21 > --- DefaultTypeMappingImpl.java 15 Apr 2002 02:35:57 -0000 1.20 > +++ DefaultTypeMappingImpl.java 16 Apr 2002 20:26:32 -0000 1.21 > @@ -287,14 +287,14 @@ > // which is the reason that ArrayList is associated with > SOAP_ARRAY. > // In addition, handle all objects that implement the List > interface > // as a SOAP_ARRAY > - myRegister(Constants.SOAP_ARRAY, java.util.List.class, > - new ArraySerializerFactory(), > - new ArrayDeserializerFactory(), > - false); > - myRegister(Constants.SOAP_ARRAY, java.util.ArrayList.class, > + myRegister(Constants.SOAP_ARRAY, java.util.Collection.class, > new ArraySerializerFactory(), > new ArrayDeserializerFactory(), > false); > +// myRegister(Constants.SOAP_ARRAY, > java.util.ArrayList.class, > +// new ArraySerializerFactory(), > +// new ArrayDeserializerFactory(), > +// false); > myRegister(Constants.SOAP_ARRAY, Object[].class, > new ArraySerializerFactory(), > new ArrayDeserializerFactory(), > > > > 1.10 +9 -21 > xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java > > Index: ArrayDeserializer.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java ,v > > retrieving revision 1.9 > retrieving revision 1.10 > diff -u -r1.9 -r1.10 > --- ArrayDeserializer.java 25 Mar 2002 04:44:02 -0000 1.9 > +++ ArrayDeserializer.java 16 Apr 2002 20:26:32 -0000 1.10 > @@ -55,35 +55,23 @@ > > package org.apache.axis.encoding.ser; > > -import org.xml.sax.Attributes; > -import org.xml.sax.SAXException; > -import org.xml.sax.helpers.AttributesImpl; > - > -import javax.xml.rpc.namespace.QName; > -import java.io.IOException; > -import org.apache.axis.message.SOAPHandler; > -import org.apache.axis.encoding.Serializer; > -import org.apache.axis.encoding.SerializerFactory; > -import org.apache.axis.encoding.SerializationContext; > -import org.apache.axis.encoding.Deserializer; > -import org.apache.axis.encoding.DeserializerTarget; > -import org.apache.axis.encoding.DeserializerFactory; > +import org.apache.axis.Constants; > import org.apache.axis.encoding.DeserializationContext; > +import org.apache.axis.encoding.Deserializer; > import org.apache.axis.encoding.DeserializerImpl; > -import org.apache.axis.Constants; > +import org.apache.axis.encoding.DeserializerTarget; > +import org.apache.axis.message.SOAPHandler; > import org.apache.axis.utils.JavaUtils; > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > +import org.xml.sax.Attributes; > +import org.xml.sax.SAXException; > > -import java.lang.reflect.Array; > +import javax.xml.rpc.namespace.QName; > import java.util.ArrayList; > import java.util.HashMap; > import java.util.HashSet; > -import java.util.Stack; > -import java.util.Vector; > -import java.util.List; > import java.util.StringTokenizer; > -import java.beans.IntrospectionException; > > > /** > @@ -547,7 +535,7 @@ > * For example "[2]" returns 2. > * For example "[2,3]" depends on the size of the multiple > dimensions. > * if the dimensions are "[3,5]" then 13 is returned (2*5) + 3. > - * @param string representing index text > + * @param text representing index text > * @param exceptKey exception message key > * @return index > */ > @@ -630,7 +618,7 @@ > > /** > * Converts multiple index to single index. > - * @param Array list of multiple indices > + * @param indexArray list of multiple indices > * @return single index > */ > private int toSingleIndex(ArrayList indexArray) { > > > > 1.16 +35 -39 > xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java > > Index: ArraySerializer.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java,v > > retrieving revision 1.15 > retrieving revision 1.16 > diff -u -r1.15 -r1.16 > --- ArraySerializer.java 4 Apr 2002 22:30:24 -0000 1.15 > +++ ArraySerializer.java 16 Apr 2002 20:26:32 -0000 1.16 > @@ -55,39 +55,21 @@ > > package org.apache.axis.encoding.ser; > > -import org.xml.sax.Attributes; > -import org.xml.sax.SAXException; > -import org.xml.sax.helpers.AttributesImpl; > - > +import org.apache.axis.Constants; > +import org.apache.axis.encoding.SerializationContext; > +import org.apache.axis.encoding.Serializer; > +import org.apache.axis.utils.JavaUtils; > +import org.apache.axis.wsdl.fromJava.Types; > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > +import org.xml.sax.Attributes; > +import org.xml.sax.helpers.AttributesImpl; > > import javax.xml.rpc.namespace.QName; > import java.io.IOException; > - > -import org.apache.axis.Constants; > -import org.apache.axis.encoding.Serializer; > -import org.apache.axis.encoding.SerializerFactory; > -import org.apache.axis.encoding.SerializationContext; > -import org.apache.axis.encoding.Deserializer; > -import org.apache.axis.encoding.DeserializerFactory; > -import org.apache.axis.encoding.DeserializationContext; > -import org.apache.axis.encoding.DeserializerImpl; > - > -import org.apache.axis.Constants; > -import org.apache.axis.wsdl.fromJava.Types; > -import org.apache.axis.utils.JavaUtils; > -import org.w3c.dom.Element; > -import org.w3c.dom.Document; > - > import java.lang.reflect.Array; > -import java.util.ArrayList; > -import java.util.Hashtable; > -import java.util.HashSet; > -import java.util.List; > -import java.util.StringTokenizer; > - > -import java.beans.IntrospectionException; > +import java.util.Collection; > +import java.util.Iterator; > > /** > * An ArraySerializer handles serializing of arrays. > @@ -120,14 +102,14 @@ > throw new IOException(JavaUtils.getMessage > ("cantDoNullArray00")); > > Class cls = value.getClass(); > - List list = null; > + Collection list = null; > > if (!cls.isArray()) { > - if (!(value instanceof List)) { > + if (!(value instanceof Collection)) { > throw new IOException( > JavaUtils.getMessage("cantSerialize00", > cls.getName())); > } > - list = (List)value; > + list = (Collection)value; > } > > Class componentType; > @@ -276,15 +258,29 @@ > > if (dim2Len < 0) { > // Normal case, serialize each array element > - for (int index = 0; index < len; index++) { > - Object aValue = (list == null) ? Array.get(value, index) > : list.get(index); > - Class aClass = (aValue == null) ? null : aValue.getClass > (); > - > - // Serialize the element. > - context.serialize(elementName, null, aValue, aClass, > - componentQName, // prefered type QName > - true, // Send null values > - false); // Don't send xsi:type if it > matches preferred QName > + if (list == null) { > + for (int index = 0; index < len; index++) { > + Object aValue = Array.get(value, index); > + Class aClass = (aValue == null) ? null : > aValue.getClass(); > + > + // Serialize the element. > + context.serialize(elementName, null, aValue, aClass, > + componentQName, // prefered type > QName > + true, // Send null values > + false); // Don't send xsi:type if > it matches preferred QName > + } > + } else { > + for (Iterator iterator = list.iterator(); > iterator.hasNext();) { > + Object aValue = (Object)iterator.next(); > + Class aClass = (aValue == null) ? null : > aValue.getClass(); > + > + // Serialize the element. > + context.serialize(elementName, null, aValue, aClass, > + componentQName, // prefered type > QName > + true, // Send null values > + false); // Don't send xsi:type if > it matches preferred QName > + > + } > } > } else { > // Serialize as a 2 dimensional array > > > > 1.42 +20 -14 > xml-axis/java/src/org/apache/axis/utils/JavaUtils.java > > Index: JavaUtils.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v > retrieving revision 1.41 > retrieving revision 1.42 > diff -u -r1.41 -r1.42 > --- JavaUtils.java 15 Apr 2002 02:35:58 -0000 1.41 > +++ JavaUtils.java 16 Apr 2002 20:26:32 -0000 1.42 > @@ -64,10 +64,11 @@ > import java.text.Collator; > import java.text.MessageFormat; > import java.util.Arrays; > -import java.util.List; > import java.util.Locale; > import java.util.MissingResourceException; > import java.util.ResourceBundle; > +import java.util.Collection; > +import java.util.Iterator; > > /** Utility class to deal with Java language related issues, such > * as type conversions. > @@ -213,7 +214,7 @@ > > > // Return if no conversion is available > - if (!(arg instanceof List || > + if (!(arg instanceof Collection || > (arg != null && arg.getClass().isArray())) && > ((destHeldType == null && argHeldType == null) || > (destHeldType != null && argHeldType != null))) { > @@ -268,7 +269,7 @@ > if (arg.getClass().isArray()) { > length = Array.getLength(arg); > } else { > - length = ((List) arg).size(); > + length = ((Collection) arg).size(); > } > if (destClass.isArray()) { > if (destClass.getComponentType().isPrimitive()) { > @@ -281,8 +282,10 @@ > Array.set(array, i, Array.get(arg, i)); > } > } else { > - for (int i = 0; i < length; i++) { > - Array.set(array, i, ((List) arg).get(i)); > + int idx = 0; > + for (Iterator i = ((Collection)arg).iterator(); > + i.hasNext();) { > + Array.set(array, idx++, i.next()); > } > } > destValue = array; > @@ -303,18 +306,20 @@ > destClass.getComponentType > ()); > } > } else { > - for (int i = 0; i < length; i++) { > - array[i] = convert(((List) arg).get(i), > + int idx = 0; > + for (Iterator i = ((Collection)arg).iterator(); > + i.hasNext();) { > + array[idx++] = convert(i.next(), > destClass.getComponentType > ()); > } > } > destValue = array; > } > } > - else if (List.class.isAssignableFrom(destClass)) { > - List newList = null; > + else if (Collection.class.isAssignableFrom(destClass)) { > + Collection newList = null; > try { > - newList = (List)destClass.newInstance(); > + newList = (Collection)destClass.newInstance(); > } catch (Exception e) { > // Couldn't build one for some reason... so forget it. > return arg; > @@ -325,8 +330,9 @@ > newList.add(Array.get(arg, j)); > } > } else { > - for (int j = 0; j < length; j++) { > - newList.add(((List) arg).get(j)); > + for (Iterator j = ((Collection)arg).iterator(); > + j.hasNext();) { > + newList.add(j.next()); > } > } > destValue = newList; > @@ -369,8 +375,8 @@ > return true; > > // If it's List -> Array or vice versa, we're good. > - if ((List.class.isAssignableFrom(src) || src.isArray()) && > - (List.class.isAssignableFrom(dest) || dest.isArray())) > + if ((Collection.class.isAssignableFrom(src) || src.isArray > ()) && > + (Collection.class.isAssignableFrom(dest) || dest.isArray > ())) > return true; > > if ((src == Hex.class && dest == byte[].class) || > > > > 1.32 +10 -23 > xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java > > Index: Emitter.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v > retrieving revision 1.31 > retrieving revision 1.32 > diff -u -r1.31 -r1.32 > --- Emitter.java 11 Apr 2002 15:45:09 -0000 1.31 > +++ Emitter.java 16 Apr 2002 20:26:32 -0000 1.32 > @@ -60,34 +60,22 @@ > import org.apache.axis.utils.CLUtil; > import org.apache.axis.utils.JavaUtils; > import org.apache.axis.utils.XMLUtils; > - > import org.w3c.dom.Document; > > import javax.wsdl.Binding; > import javax.wsdl.Definition; > -import javax.wsdl.Message; > -import javax.wsdl.PortType; > -import javax.wsdl.Service; > import javax.wsdl.WSDLException; > import javax.wsdl.factory.WSDLFactory; > import javax.wsdl.xml.WSDLReader; > - > import java.io.File; > import java.io.FileInputStream; > import java.io.IOException; > - > -import java.util.ArrayList; > import java.util.Enumeration; > import java.util.HashMap; > import java.util.Iterator; > import java.util.List; > -import java.util.Map; > import java.util.Properties; > import java.util.Vector; > -import javax.wsdl.QName; > - > -import org.apache.axis.encoding.TypeMapping; > -import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl; > > /** > * This class produces java files for stubs, skeletons, and types from a > @@ -154,7 +142,7 @@ > public WriterFactory getWriterFactory() { return writerFactory;} > /** > * Call this method if you have a uri for the WSDL document > - * @param String wsdlURI the location of the WSDL file. > + * @param uri wsdlURI the location of the WSDL file. > */ > public void emit(String uri) throws IOException, WSDLException { > if (bVerbose) > @@ -169,8 +157,8 @@ > > /** > * Call this method if your WSDL document has already been parsed as > an XML DOM document. > - * @param String 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 Document doc This is the XML Document containing the WSDL. > + * @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. > */ > public void emit(String context, Document doc) throws IOException, > WSDLException { > currentWSDLURI = context; > @@ -294,7 +282,7 @@ > > /** > * Turn on/off server skeleton creation > - * @param boolean value > + * @param value > */ > public void generateServerSide(boolean value) { > this.bEmitServer = value; > @@ -309,7 +297,7 @@ > > /** > * Turn on/off server skeleton deploy > - * @param boolean value > + * @param value > */ > public void deploySkeleton(boolean value) { > bDeploySkeleton = value; > @@ -324,7 +312,7 @@ > > /** > * Turn on/off Helper class generation > - * @param boolean value > + * @param value > */ > public void setHelperGeneration(boolean value) { > bHelperGeneration = value; > @@ -339,7 +327,7 @@ > > /** > * Turn on/off test case creation > - * @param boolean value > + * @param value > */ > public void generateTestCase(boolean value) { > this.bEmitTestCase = value; > @@ -354,7 +342,7 @@ > > /** > * Turn on/off generation of elements from imported files. > - * @param boolean generateImports > + * @param generateImports > */ > public void generateImports(boolean generateImports) { > this.bGenerateImports = generateImports; > @@ -373,7 +361,7 @@ > > /** > * Turn on/off debug messages. > - * @param boolean value > + * @param value > */ > public void debug(boolean value) { > bDebug = value; > @@ -388,7 +376,7 @@ > > /** > * Turn on/off verbose messages > - * @param boolean value > + * @param value > */ > public void verbose(boolean value) { > this.bVerbose = value; > @@ -591,7 +579,6 @@ > > public static void main(String[] args) { > String wsdlURI = null; > - HashMap namespaceMap = new HashMap(); > Emitter emitter = new Emitter(new NoopWriterFactory()); > > // Parse the arguments > > > > 1.55 +9 -17 > 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.54 > retrieving revision 1.55 > diff -u -r1.54 -r1.55 > --- JavaStubWriter.java 5 Apr 2002 21:24:32 -0000 1.54 > +++ JavaStubWriter.java 16 Apr 2002 20:26:32 -0000 1.55 > @@ -54,35 +54,28 @@ > */ > package org.apache.axis.wsdl.toJava; > > -import java.io.IOException; > - > -import java.util.Collection; > -import java.util.HashMap; > -import java.util.HashSet; > -import java.util.Iterator; > -import java.util.List; > -import java.util.Map; > -import java.util.Vector; > +import org.apache.axis.utils.JavaUtils; > +import org.w3c.dom.Node; > > import javax.wsdl.Binding; > import javax.wsdl.BindingInput; > import javax.wsdl.BindingOperation; > import javax.wsdl.BindingOutput; > import javax.wsdl.Fault; > -import javax.wsdl.Input; > import javax.wsdl.Operation; > import javax.wsdl.OperationType; > -import javax.wsdl.Output; > import javax.wsdl.Part; > import javax.wsdl.PortType; > import javax.wsdl.QName; > - > -import org.w3c.dom.Node; > - > import javax.wsdl.extensions.soap.SOAPBody; > import javax.wsdl.extensions.soap.SOAPOperation; > - > -import org.apache.axis.utils.JavaUtils; > +import java.io.IOException; > +import java.util.Collection; > +import java.util.HashSet; > +import java.util.Iterator; > +import java.util.List; > +import java.util.Map; > +import java.util.Vector; > > /** > * This is Wsdl2java's stub writer. It writes the <BindingName>Stub.java > @@ -114,7 +107,6 @@ > PortType portType = binding.getPortType(); > PortTypeEntry ptEntry = > symbolTable.getPortTypeEntry(portType.getQName()); > - String name = Utils.xmlNameToJavaClass(qname.getLocalPart()); > > // If there is not literal use, the interface name is the > portType name. > // Otherwise it is the binding name. > > > > >