Index: examples/echo/AsyncClient.java =================================================================== RCS file: /home/cvspublic/xml-rpc/examples/echo/AsyncClient.java,v retrieving revision 1.1 diff -u -r1.1 AsyncClient.java --- examples/echo/AsyncClient.java 8 Nov 2001 18:21:31 -0000 1.1 +++ examples/echo/AsyncClient.java 8 Jun 2002 11:29:39 -0000 @@ -54,10 +54,14 @@ */ -import org.apache.xmlrpc.*; -import java.util.Vector; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.net.URL; -import java.io.*; +import java.util.List; + +import org.apache.xmlrpc.AsyncCallback; +import org.apache.xmlrpc.XmlRpcClient; public class AsyncClient implements AsyncCallback { Index: examples/echo/Client.java =================================================================== RCS file: /home/cvspublic/xml-rpc/examples/echo/Client.java,v retrieving revision 1.1 diff -u -r1.1 Client.java --- examples/echo/Client.java 8 Nov 2001 18:21:31 -0000 1.1 +++ examples/echo/Client.java 8 Jun 2002 11:29:39 -0000 @@ -54,10 +54,12 @@ */ -import org.apache.xmlrpc.*; -import java.util.Vector; -import java.net.URL; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.List; + +import org.apache.xmlrpc.XmlRpcClient; public class Client { @@ -95,7 +97,7 @@ System.err.println ("Input will be sent to "+client.getURL ()); while ((token = d.readLine()) != null) { System.err.println ("sending: "+token); - Vector v = new Vector (); + List v = new Vector (); v.add (token); try { Object result = client.execute ("echo", v); Index: src/java/org/apache/xmlrpc/AggregateFactory.java =================================================================== RCS file: src/java/org/apache/xmlrpc/AggregateFactory.java diff -N src/java/org/apache/xmlrpc/AggregateFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/java/org/apache/xmlrpc/AggregateFactory.java 8 Jun 2002 11:29:43 -0000 @@ -0,0 +1,117 @@ +package org.apache.xmlrpc; + +/* + * 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 "XML-RPC" 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 + * . + */ + +import java.util.Map; +import java.util.List; + +public class AggregateFactory { + private static final String DEFAULT_MAP_CLASS = "java.util.Hashtable"; + private static final String DEFAULT_LIST_CLASS = "java.util.Vector"; + + public static Map newMap() { + try { + return (Map)mapClass.newInstance(); + } + catch (final IllegalAccessException e) { + } + catch (final InstantiationException e) { + } + + return new java.util.Hashtable(); + } + + public static List newList() { + try { + return (List)listClass.newInstance(); + } + catch (final IllegalAccessException e) { + } + catch (final InstantiationException e) { + } + + return new java.util.Vector(); + } + + private static final Class mapClass; + static { + Class map; + + try { + map = Class.forName(System.getProperty("xml-rpc.map", DEFAULT_MAP_CLASS)); + } + catch (final ClassNotFoundException e) { + map = java.util.Hashtable.class; + } + + mapClass = map; + } + + private static final Class listClass; + static { + Class list; + + try { + list = Class.forName(System.getProperty("xml-rpc.list", DEFAULT_LIST_CLASS)); + } + catch (final ClassNotFoundException e) { + list = java.util.Vector.class; + } + + listClass = list; + } +} + Index: src/java/org/apache/xmlrpc/AuthDemo.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/AuthDemo.java,v retrieving revision 1.2 diff -u -r1.2 AuthDemo.java --- src/java/org/apache/xmlrpc/AuthDemo.java 20 Mar 2002 15:11:03 -0000 1.2 +++ src/java/org/apache/xmlrpc/AuthDemo.java 8 Jun 2002 11:29:49 -0000 @@ -55,7 +55,7 @@ * . */ -import java.util.Vector; +import java.util.List; /** * @@ -67,7 +67,7 @@ /** * */ - public Object execute(String method, Vector v, String user, String password) + public Object execute(String method, List v, String user, String password) throws Exception { // our simplistic authentication guidelines never fail ;) Index: src/java/org/apache/xmlrpc/AuthenticatedXmlRpcHandler.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/AuthenticatedXmlRpcHandler.java,v retrieving revision 1.2 diff -u -r1.2 AuthenticatedXmlRpcHandler.java --- src/java/org/apache/xmlrpc/AuthenticatedXmlRpcHandler.java 20 Mar 2002 15:11:03 -0000 1.2 +++ src/java/org/apache/xmlrpc/AuthenticatedXmlRpcHandler.java 8 Jun 2002 11:29:55 -0000 @@ -55,7 +55,7 @@ * . */ -import java.util.Vector; +import java.util.List; /** * An XML-RPC handler that also handles user authentication. @@ -68,7 +68,7 @@ /** * Return the result, or throw an Exception if something went wrong. */ - public Object execute(String method, Vector params, String user, + public Object execute(String method, List params, String user, String password) throws Exception; } Index: src/java/org/apache/xmlrpc/Echo.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/Echo.java,v retrieving revision 1.3 diff -u -r1.3 Echo.java --- src/java/org/apache/xmlrpc/Echo.java 20 Mar 2002 15:11:03 -0000 1.3 +++ src/java/org/apache/xmlrpc/Echo.java 8 Jun 2002 11:29:55 -0000 @@ -55,7 +55,7 @@ * . */ -import java.util.Vector; +import java.util.List; /** * A simple handler which echos its input parameters. @@ -72,7 +72,7 @@ * @param parameters Handler input parameters. * @return The input parameters. */ - public Object execute(String method, Vector parameters) + public Object execute(String method, List parameters) throws Exception { return parameters; Index: src/java/org/apache/xmlrpc/WebServer.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/WebServer.java,v retrieving revision 1.11 diff -u -r1.11 WebServer.java --- src/java/org/apache/xmlrpc/WebServer.java 20 Mar 2002 15:11:03 -0000 1.11 +++ src/java/org/apache/xmlrpc/WebServer.java 8 Jun 2002 11:29:46 -0000 @@ -62,10 +62,11 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.util.ArrayList; import java.util.EmptyStackException; import java.util.Stack; import java.util.StringTokenizer; -import java.util.Vector; +import java.util.List; /** * A minimal web server that exclusively handles XML-RPC requests. @@ -82,7 +83,7 @@ protected int port; protected Thread listener; protected boolean paranoid; - protected Vector accept, deny; + protected List accept, deny; protected Stack threadpool; protected ThreadGroup runners; @@ -163,8 +164,8 @@ { this.port = port; xmlrpc = new XmlRpcServer(); - accept = new Vector(); - deny = new Vector(); + accept = new ArrayList(); + deny = new ArrayList(); threadpool = new Stack(); runners = new ThreadGroup("XML-RPC Runner"); @@ -256,7 +257,7 @@ try { AddressMatcher m = new AddressMatcher(address); - accept.addElement(m); + accept.add(m); } catch (Exception x) { @@ -278,7 +279,7 @@ try { AddressMatcher m = new AddressMatcher(address); - deny.addElement(m); + deny.add(m); } catch (Exception x) { @@ -298,7 +299,7 @@ byte address[] = s.getInetAddress().getAddress(); for (int i = 0; i < l; i++) { - AddressMatcher match = (AddressMatcher)deny.elementAt(i); + AddressMatcher match = (AddressMatcher)deny.get(i); if (match.matches(address)) { return false; @@ -307,7 +308,7 @@ l = accept.size(); for (int i = 0; i < l; i++) { - AddressMatcher match = (AddressMatcher)accept.elementAt(i); + AddressMatcher match = (AddressMatcher)accept.get(i); if (match.matches(address)) { return true; Index: src/java/org/apache/xmlrpc/XmlRpc.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java,v retrieving revision 1.22 diff -u -r1.22 XmlRpc.java --- src/java/org/apache/xmlrpc/XmlRpc.java 20 Mar 2002 15:11:03 -0000 1.22 +++ src/java/org/apache/xmlrpc/XmlRpc.java 8 Jun 2002 11:29:59 -0000 @@ -60,21 +60,26 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; + import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; + import java.util.Date; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import java.util.Properties; import java.util.Stack; -import java.util.Vector; +import java.util.List; + import org.xml.sax.AttributeList; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; import org.xml.sax.Parser; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; + import uk.co.wilson.xml.MinML; /** @@ -115,7 +120,7 @@ * The class name of SAX parser to use. */ private static Class parserClass; - private static Hashtable saxDrivers = new Hashtable (8); + private static Map saxDrivers = new HashMap(8); static { @@ -565,8 +570,8 @@ // the name to use for the next member of struct values String nextMemberName; - Hashtable struct; - Vector array; + Map struct; + List array; /** * Constructor. @@ -584,7 +589,7 @@ switch (type) { case ARRAY: - array.addElement(child.value); + array.add(child.value); break; case STRUCT: struct.put(nextMemberName, child.value); @@ -602,10 +607,10 @@ switch (type) { case ARRAY: - value = array = new Vector (); + value = array = AggregateFactory.newList(); break; case STRUCT: - value = struct = new Hashtable (); + value = struct = AggregateFactory.newMap(); break; } } @@ -769,26 +774,26 @@ this.write(Base64.encode((byte[]) obj)); endElement("base64"); } - else if (obj instanceof Vector) + else if (obj instanceof List) { startElement("array"); startElement("data"); - Vector array = (Vector) obj; + List array = (List) obj; int size = array.size(); for (int i = 0; i < size; i++) { - writeObject(array.elementAt(i)); + writeObject(array.get(i)); } endElement("data"); endElement("array"); } - else if (obj instanceof Hashtable) + else if (obj instanceof Map) { startElement("struct"); - Hashtable struct = (Hashtable) obj; - for (Enumeration e = struct.keys(); e.hasMoreElements(); ) + Map struct = (Map) obj; + for (Iterator i = struct.keySet().iterator(); i.hasNext(); ) { - String nextkey = (String) e.nextElement(); + String nextkey = (String) i.next(); Object nextval = struct.get(nextkey); startElement("member"); startElement("name"); Index: src/java/org/apache/xmlrpc/XmlRpcClient.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v retrieving revision 1.9 diff -u -r1.9 XmlRpcClient.java --- src/java/org/apache/xmlrpc/XmlRpcClient.java 20 Mar 2002 15:11:03 -0000 1.9 +++ src/java/org/apache/xmlrpc/XmlRpcClient.java 8 Jun 2002 11:29:54 -0000 @@ -63,9 +63,9 @@ import java.net.URL; import java.net.URLConnection; import java.util.EmptyStackException; -import java.util.Hashtable; +import java.util.Map; import java.util.Stack; -import java.util.Vector; +import java.util.List; import org.xml.sax.AttributeList; import org.xml.sax.SAXException; @@ -149,7 +149,7 @@ * @exception IOException: If the call could not be made because of lower * level problems. */ - public Object execute(String method, Vector params) + public Object execute(String method, List params) throws XmlRpcException, IOException { Worker worker = getWorker(false); @@ -170,7 +170,7 @@ * If the callback parameter is not null, it will be called later to handle * the result or error when the call is finished. */ - public void executeAsync(String method, Vector params, + public void executeAsync(String method, List params, AsyncCallback callback) { // if at least 4 threads are running, don't create any new ones, @@ -260,7 +260,7 @@ * @param params * @param callback */ - synchronized void enqueue(String method, Vector params, + synchronized void enqueue(String method, List params, AsyncCallback callback) { CallData call = new CallData(method, params, callback); @@ -326,7 +326,7 @@ * @param params * @param callback */ - public void start(String method, Vector params, + public void start(String method, List params, AsyncCallback callback) { this.call = new CallData(method, params, callback); @@ -350,7 +350,7 @@ /** * Execute an XML-RPC call and handle asyncronous callback. */ - void executeAsync(String method, Vector params, AsyncCallback callback) + void executeAsync(String method, List params, AsyncCallback callback) { Object res = null; try @@ -380,7 +380,7 @@ /** * Execute an XML-RPC call. */ - Object execute(String method, Vector params) + Object execute(String method, List params) throws XmlRpcException, IOException { fault = false; @@ -445,7 +445,7 @@ XmlRpcException exception = null; try { - Hashtable f =(Hashtable) result; + Map f =(Map) result; String faultString =(String) f.get("faultString"); int faultCode = Integer.parseInt( f.get("faultCode").toString()); @@ -477,7 +477,7 @@ /** * Generate an XML-RPC request from a method name and a parameter vector. */ - void writeRequest(XmlWriter writer, String method, Vector params) + void writeRequest(XmlWriter writer, String method, List params) throws IOException, XmlRpcException { writer.startElement("methodCall"); @@ -489,7 +489,7 @@ for (int i = 0; i < l; i++) { writer.startElement("param"); - writer.writeObject(params.elementAt(i)); + writer.writeObject(params.get(i)); writer.endElement("param"); } writer.endElement("params"); @@ -516,7 +516,7 @@ class CallData { String method; - Vector params; + List params; AsyncCallback callback; CallData next; @@ -524,7 +524,7 @@ * Make a call to be queued and then executed by the next free async * thread */ - public CallData(String method, Vector params, AsyncCallback callback) + public CallData(String method, List params, AsyncCallback callback) { this.method = method; this.params = params; @@ -544,16 +544,16 @@ { String url = args[0]; String method = args[1]; - Vector v = new Vector(); + List v = new java.util.Vector(); for (int i = 2; i < args.length; i++) { try { - v.addElement(new Integer(Integer.parseInt(args[i]))); + v.add(new Integer(Integer.parseInt(args[i]))); } catch(NumberFormatException nfx) { - v.addElement(args[i]); + v.add(args[i]); } } XmlRpcClient client = new XmlRpcClientLite(url); Index: src/java/org/apache/xmlrpc/XmlRpcClientLite.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientLite.java,v retrieving revision 1.7 diff -u -r1.7 XmlRpcClientLite.java --- src/java/org/apache/xmlrpc/XmlRpcClientLite.java 20 Mar 2002 15:11:03 -0000 1.7 +++ src/java/org/apache/xmlrpc/XmlRpcClientLite.java 8 Jun 2002 11:29:48 -0000 @@ -64,9 +64,9 @@ import java.net.Socket; import java.net.URL; import java.util.EmptyStackException; -import java.util.Hashtable; +import java.util.Map; import java.util.StringTokenizer; -import java.util.Vector; +import java.util.List; /** * A multithreaded, reusable XML-RPC client object. This version uses a homegrown @@ -167,7 +167,7 @@ * @throws XmlRpcException * @throws IOException */ - Object execute(String method, Vector params) + Object execute(String method, List params) throws XmlRpcException, IOException { long now = System.currentTimeMillis(); @@ -269,7 +269,7 @@ XmlRpcException exception = null; try { - Hashtable f = (Hashtable) result; + Map f = (Map) result; String faultString = (String) f.get("faultString"); int faultCode = Integer.parseInt( f.get("faultCode").toString()); @@ -492,16 +492,16 @@ String url = args[0]; String method = args[1]; XmlRpcClientLite client = new XmlRpcClientLite (url); - Vector v = new Vector (); + List v = new java.util.Vector (); for (int i = 2; i < args.length; i++) { try { - v.addElement(new Integer(Integer.parseInt(args[i]))); + v.add(new Integer(Integer.parseInt(args[i]))); } catch (NumberFormatException nfx) { - v.addElement(args[i]); + v.add(args[i]); } } // XmlRpc.setEncoding ("UTF-8"); Index: src/java/org/apache/xmlrpc/XmlRpcHandler.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcHandler.java,v retrieving revision 1.2 diff -u -r1.2 XmlRpcHandler.java --- src/java/org/apache/xmlrpc/XmlRpcHandler.java 20 Mar 2002 15:11:03 -0000 1.2 +++ src/java/org/apache/xmlrpc/XmlRpcHandler.java 8 Jun 2002 11:29:49 -0000 @@ -55,7 +55,7 @@ * . */ -import java.util.Vector; +import java.util.List; /** * The XML-RPC server uses this interface to call a method of an RPC handler. @@ -72,6 +72,6 @@ /** * Return the result, or throw an Exception if something went wrong. */ - public Object execute (String method, Vector params) + public Object execute (String method, List params) throws Exception; } Index: src/java/org/apache/xmlrpc/XmlRpcProxyServlet.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcProxyServlet.java,v retrieving revision 1.3 diff -u -r1.3 XmlRpcProxyServlet.java --- src/java/org/apache/xmlrpc/XmlRpcProxyServlet.java 20 Mar 2002 15:11:03 -0000 1.3 +++ src/java/org/apache/xmlrpc/XmlRpcProxyServlet.java 8 Jun 2002 11:29:54 -0000 @@ -55,14 +55,14 @@ * . */ +import java.io.IOException; +import java.io.OutputStream; + import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Vector; /** * A HttpServlet that acts as a XML-RPC proxy. Index: src/java/org/apache/xmlrpc/XmlRpcServer.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcServer.java,v retrieving revision 1.24 diff -u -r1.24 XmlRpcServer.java --- src/java/org/apache/xmlrpc/XmlRpcServer.java 20 Mar 2002 15:11:03 -0000 1.24 +++ src/java/org/apache/xmlrpc/XmlRpcServer.java 8 Jun 2002 11:29:52 -0000 @@ -61,10 +61,11 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.EmptyStackException; -import java.util.Hashtable; +import java.util.Map; import java.util.Stack; -import java.util.Vector; +import java.util.List; /** * A multithreaded, reusable XML-RPC server object. The name may be misleading @@ -80,7 +81,7 @@ { private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; - private Hashtable handlers; + private Map handlers; private Stack pool; private int workers; @@ -90,7 +91,7 @@ */ public XmlRpcServer() { - handlers = new Hashtable(); + handlers = AggregateFactory.newMap(); pool = new Stack(); workers = 0; } @@ -185,7 +186,7 @@ */ class Worker extends XmlRpc { - private Vector inParams; + private List inParams; private ByteArrayOutputStream buffer; private XmlWriter writer; @@ -194,7 +195,7 @@ */ protected Worker() { - inParams = new Vector(); + inParams = new ArrayList(); buffer = new ByteArrayOutputStream(); } @@ -212,7 +213,7 @@ { // Release most of our resources buffer.reset(); - inParams.removeAllElements(); + inParams.clear(); } } @@ -391,7 +392,7 @@ */ void objectParsed(Object what) { - inParams.addElement(what); + inParams.add(what); } /** @@ -417,7 +418,7 @@ throws XmlRpcException, IOException { // System.err.println("error: "+message); - Hashtable h = new Hashtable(); + Map h = AggregateFactory.newMap(); h.put("faultCode", new Integer(code)); h.put("faultString", message); writer.startElement("methodResponse"); @@ -452,7 +453,7 @@ /** * main method, sucht methode in object, wenn gefunden dann aufrufen. */ - public Object execute(String methodName, Vector params) throws Exception + public Object execute(String methodName, List params) throws Exception { // Array mit Classtype bilden, ObjectAry mit Values bilden Class[] argClasses = null; @@ -463,7 +464,7 @@ argValues = new Object[params.size()]; for (int i = 0; i < params.size(); i++) { - argValues[i] = params.elementAt(i); + argValues[i] = params.get(i); if (argValues[i] instanceof Integer) { argClasses[i] = Integer.TYPE; Index: src/java/org/apache/xmlrpc/applet/JSXmlRpcApplet.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/applet/JSXmlRpcApplet.java,v retrieving revision 1.3 diff -u -r1.3 JSXmlRpcApplet.java --- src/java/org/apache/xmlrpc/applet/JSXmlRpcApplet.java 20 Mar 2002 15:11:03 -0000 1.3 +++ src/java/org/apache/xmlrpc/applet/JSXmlRpcApplet.java 8 Jun 2002 11:30:06 -0000 @@ -56,8 +56,10 @@ */ import java.util.Date; -import java.util.Hashtable; -import java.util.Vector; +import java.util.Map; +import java.util.List; + +import org.apache.xmlrpc.AggregateFactory; /** @@ -67,8 +69,8 @@ * Explorer 4.0 on Windows 95/NT, but not on IE/Mac.

* * Results from XML-RPC calls are exposed to JavaScript as the are, i.e. - * <structs>s are Hashtables - * and <array>s are Vectors + * <structs>s are Hashtables + * and <array>s are Vectors * and can be accessed thru their public methods. It seems like Date objects are * not converted properly between JavaScript and Java, so the dateArg methods * take long values instead of Date objects as parameters (date.getTime()). @@ -80,7 +82,7 @@ public Object loaded = null; private String errorMessage; - private Vector arguments; + private List arguments; /** * @@ -88,7 +90,7 @@ public void init() { initClient(); - arguments = new Vector(); + arguments = AggregateFactory.newList(); loaded = Boolean.TRUE; System.out.println("JSXmlRpcApplet initialized"); } @@ -96,140 +98,140 @@ // add ints (primitve != object) to structs, vectors public void addIntArg(int value) { - arguments.addElement(new Integer(value)); + arguments.add(new Integer(value)); } - public void addIntArgToStruct(Hashtable struct, String key, int value) + public void addIntArgToStruct(Map struct, String key, int value) { struct.put(key, new Integer(value)); } - public void addIntArgToArray(Vector ary, int value) + public void addIntArgToArray(List ary, int value) { - ary.addElement(new Integer(value)); + ary.add(new Integer(value)); } // add floats/doubles to structs, vectors public void addDoubleArg(float value) { - arguments.addElement(new Double(value)); + arguments.add(new Double(value)); } - public void addDoubleArgToStruct(Hashtable struct, String key, float value) + public void addDoubleArgToStruct(Map struct, String key, float value) { struct.put(key, new Double(value)); } - public void addDoubleArgToArray(Vector ary, float value) + public void addDoubleArgToArray(List ary, float value) { - ary.addElement(new Double(value)); + ary.add(new Double(value)); } public void addDoubleArg(double value) { - arguments.addElement(new Double(value)); + arguments.add(new Double(value)); } - public void addDoubleArgToStruct(Hashtable struct, String key, double value) + public void addDoubleArgToStruct(Map struct, String key, double value) { struct.put(key, new Double(value)); } - public void addDoubleArgToArray(Vector ary, double value) + public void addDoubleArgToArray(List ary, double value) { - ary.addElement(new Double(value)); + ary.add(new Double(value)); } // add bools to structs, vectors public void addBooleanArg(boolean value) { - arguments.addElement(new Boolean(value)); + arguments.add(new Boolean(value)); } - public void addBooleanArgToStruct(Hashtable struct, String key, + public void addBooleanArgToStruct(Map struct, String key, boolean value) { struct.put(key, new Boolean(value)); } - public void addBooleanArgToArray(Vector ary, boolean value) + public void addBooleanArgToArray(List ary, boolean value) { - ary.addElement(new Boolean(value)); + ary.add(new Boolean(value)); } // add Dates to structs, vectors Date argument in SystemTimeMillis (seems to be the way) public void addDateArg(long dateNo) { - arguments.addElement(new Date(dateNo)); + arguments.add(new Date(dateNo)); } - public void addDateArgToStruct(Hashtable struct, String key, long dateNo) + public void addDateArgToStruct(Map struct, String key, long dateNo) { struct.put(key, new Date(dateNo)); } - public void addDateArgToArray(Vector ary, long dateNo) + public void addDateArgToArray(List ary, long dateNo) { - ary.addElement(new Date(dateNo)); + ary.add(new Date(dateNo)); } // add String arguments public void addStringArg(String str) { - arguments.addElement(str); + arguments.add(str); } - public void addStringArgToStruct(Hashtable struct, String key, String str) + public void addStringArgToStruct(Map struct, String key, String str) { struct.put(key, str); } - public void addStringArgToArray(Vector ary, String str) + public void addStringArgToArray(List ary, String str) { - ary.addElement (str); + ary.add(str); } // add Array arguments - public Vector addArrayArg() + public List addArrayArg() { - Vector v = new Vector(); - arguments.addElement(v); + List v = AggregateFactory.newList(); + arguments.add(v); return v; } - public Vector addArrayArgToStruct(Hashtable struct, String key) + public List addArrayArgToStruct(Map struct, String key) { - Vector v = new Vector(); + List v = AggregateFactory.newList(); struct.put(key, v); return v; } - public Vector addArrayArgToArray(Vector ary) + public List addArrayArgToArray(List ary) { - Vector v = new Vector(); - ary.addElement(v); + List v = AggregateFactory.newList(); + ary.add(v); return v; } // add Struct arguments - public Hashtable addStructArg() + public Map addStructArg() { - Hashtable ht = new Hashtable(); - arguments.addElement(ht); + Map ht = AggregateFactory.newMap(); + arguments.add(ht); return ht; } - public Hashtable addStructArgToStruct(Hashtable struct, String key) + public Map addStructArgToStruct(Map struct, String key) { - Hashtable ht = new Hashtable(); + Map ht = AggregateFactory.newMap(); struct.put(key, ht); return ht; } - public Hashtable addStructArgToArray(Vector ary) + public Map addStructArgToArray(List ary) { - Hashtable ht = new Hashtable(); - ary.addElement(ht); + Map ht = AggregateFactory.newMap(); + ary.add(ht); return ht; } @@ -241,7 +243,7 @@ public void reset() { - arguments = new Vector(); + arguments = AggregateFactory.newList(); } public Object execute(String methodName) @@ -263,7 +265,7 @@ } } // reset argument array for reuse - arguments = new Vector(); + arguments = AggregateFactory.newList(); showStatus(""); return returnValue; Index: src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java,v retrieving revision 1.4 diff -u -r1.4 SimpleXmlRpcClient.java --- src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java 20 Mar 2002 15:11:03 -0000 1.4 +++ src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java 8 Jun 2002 11:30:05 -0000 @@ -67,10 +67,12 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; import java.util.Stack; -import java.util.Vector; +import java.util.List; + +import org.apache.xmlrpc.AggregateFactory; import org.apache.xmlrpc.Base64; import org.xml.sax.AttributeList; import org.xml.sax.HandlerBase; @@ -122,7 +124,7 @@ * @throws XmlRpcException * @throws IOException */ - public Object execute(String method, Vector params) + public Object execute(String method, List params) throws XmlRpcException, IOException { return new XmlRpcSupport (url).execute (method, params); @@ -247,26 +249,26 @@ writer.write(Base64.encode((byte[]) what)); writer.endElement("base64"); } - else if (what instanceof Vector) + else if (what instanceof List) { writer.startElement("array"); writer.startElement("data"); - Vector v = (Vector) what; + List v = (List) what; int l2 = v.size(); for (int i2 = 0; i2 < l2; i2++) { - writeObject(v.elementAt(i2), writer); + writeObject(v.get(i2), writer); } writer.endElement("data"); writer.endElement("array"); } - else if (what instanceof Hashtable) + else if (what instanceof Map) { writer.startElement("struct"); - Hashtable h = (Hashtable) what; - for (Enumeration e = h.keys (); e.hasMoreElements (); ) + Map h = (Map) what; + for (Iterator i = h.keySet().iterator(); i.hasNext(); ) { - String nextkey = (String) e.nextElement (); + String nextkey = (String) i.next(); Object nextval = h.get(nextkey); writer.startElement("member"); writer.startElement("name"); @@ -294,7 +296,7 @@ * @exception IOException If the call could not be made for lower level * problems. */ - public Object execute(String method, Vector arguments) + public Object execute(String method, List arguments) throws XmlRpcException, IOException { fault = false; @@ -332,7 +334,7 @@ XmlRpcException exception = null; try { - Hashtable f = (Hashtable) result; + Map f = (Map) result; String faultString = (String) f.get("faultString"); int faultCode = Integer.parseInt(f.get("faultCode").toString()); exception = new XmlRpcException(faultCode, faultString.trim()); @@ -359,7 +361,7 @@ /** * Generate an XML-RPC request from a method name and a parameter vector. */ - void writeRequest (XmlWriter writer, String method, Vector params) + void writeRequest (XmlWriter writer, String method, List params) throws IOException { writer.startElement("methodCall"); @@ -371,7 +373,7 @@ for (int i = 0; i < l; i++) { writer.startElement("param"); - writeObject(params.elementAt (i), writer); + writeObject(params.get(i), writer); writer.endElement("param"); } writer.endElement("params"); @@ -564,8 +566,8 @@ // the name to use for the next member of struct values String nextMemberName; - Hashtable struct; - Vector array; + Map struct; + List array; /** * Constructor. @@ -582,7 +584,7 @@ { if (type == ARRAY) { - array.addElement(child.value); + array.add(child.value); } else if (type == STRUCT) { @@ -600,13 +602,13 @@ this.type = type; if (type == ARRAY) { - value = new Vector(); - array = new Vector(); + value = AggregateFactory.newList(); + array = AggregateFactory.newList(); } if (type == STRUCT) { - value = new Hashtable(); - struct = new Hashtable(); + value = AggregateFactory.newMap(); + struct = AggregateFactory.newMap(); } } Index: src/java/org/apache/xmlrpc/applet/XmlRpcApplet.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/applet/XmlRpcApplet.java,v retrieving revision 1.2 diff -u -r1.2 XmlRpcApplet.java --- src/java/org/apache/xmlrpc/applet/XmlRpcApplet.java 20 Mar 2002 15:11:03 -0000 1.2 +++ src/java/org/apache/xmlrpc/applet/XmlRpcApplet.java 8 Jun 2002 11:30:07 -0000 @@ -59,7 +59,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Vector; +import java.util.List; /** @@ -136,7 +136,7 @@ /** * Calls the XML-RPC server with the specified methodname and argument list. */ - public Object execute(String methodName, Vector arguments) + public Object execute(String methodName, List arguments) throws XmlRpcException, IOException { if (client == null) Index: src/java/org/apache/xmlrpc/fesi/FesiRpcExtension.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/fesi/FesiRpcExtension.java,v retrieving revision 1.2 diff -u -r1.2 FesiRpcExtension.java --- src/java/org/apache/xmlrpc/fesi/FesiRpcExtension.java 20 Mar 2002 15:11:04 -0000 1.2 +++ src/java/org/apache/xmlrpc/fesi/FesiRpcExtension.java 8 Jun 2002 11:30:01 -0000 @@ -71,7 +71,9 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Vector; +import java.util.List; + +import org.apache.xmlrpc.AggregateFactory; import org.apache.xmlrpc.XmlRpcClient; /** @@ -280,12 +282,12 @@ long now = System.currentTimeMillis(); Object retval = null; int l = arguments.length; - Vector v = new Vector(); + List v = AggregateFactory.newList(); for (int i = 0; i < l; i++) { Object arg = FesiRpcUtil.convertE2J(arguments[i]); // System.out.println ("converted to J: "+arg.getClass ()); - v.addElement(arg); + v.add(arg); } // System.out.println ("spent "+(System.currentTimeMillis ()-now)+" millis in argument conversion"); ESObject esretval = ObjectObject.createObject(evaluator); Index: src/java/org/apache/xmlrpc/fesi/FesiRpcServer.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/fesi/FesiRpcServer.java,v retrieving revision 1.2 diff -u -r1.2 FesiRpcServer.java --- src/java/org/apache/xmlrpc/fesi/FesiRpcServer.java 20 Mar 2002 15:11:04 -0000 1.2 +++ src/java/org/apache/xmlrpc/fesi/FesiRpcServer.java 8 Jun 2002 11:30:02 -0000 @@ -62,7 +62,7 @@ import FESI.Interpreter.Evaluator; import java.io.IOException; import java.util.StringTokenizer; -import java.util.Vector; +import java.util.List; import org.apache.xmlrpc.WebServer; import org.apache.xmlrpc.XmlRpcHandler; @@ -151,7 +151,7 @@ /** * */ - public Object execute(String method, Vector argvec) throws Exception + public Object execute(String method, List argvec) throws Exception { // convert arguments int l = argvec.size(); @@ -181,7 +181,7 @@ ESValue args[] = new ESValue[l]; for (int i = 0; i < l; i++) { - args[i] = FesiRpcUtil.convertJ2E(argvec.elementAt(i), + args[i] = FesiRpcUtil.convertJ2E(argvec.get(i), evaluator); } Object retval = FesiRpcUtil.convertE2J( Index: src/java/org/apache/xmlrpc/fesi/FesiRpcUtil.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/fesi/FesiRpcUtil.java,v retrieving revision 1.2 diff -u -r1.2 FesiRpcUtil.java --- src/java/org/apache/xmlrpc/fesi/FesiRpcUtil.java 20 Mar 2002 15:11:04 -0000 1.2 +++ src/java/org/apache/xmlrpc/fesi/FesiRpcUtil.java 8 Jun 2002 11:29:59 -0000 @@ -70,8 +70,11 @@ import FESI.Interpreter.Evaluator; import java.util.Date; import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; +import java.util.Iterator; +import java.util.Map; +import java.util.List; + +import org.apache.xmlrpc.AggregateFactory; import org.apache.xmlrpc.XmlRpc; /** @@ -89,26 +92,26 @@ { return ESNull.theNull; } - if (what instanceof Vector) + if (what instanceof List) { - Vector v = (Vector) what; + List v = (List) what; ArrayPrototype retval = new ArrayPrototype( evaluator.getArrayPrototype(), evaluator); int l = v.size(); for (int i = 0; i < l; i++) { - retval.putProperty(i, convertJ2E(v.elementAt(i), evaluator)); + retval.putProperty(i, convertJ2E(v.get(i), evaluator)); } return retval; } - if (what instanceof Hashtable) + if (what instanceof Map) { - Hashtable t = (Hashtable) what; + Map t = (Map) what; ESObject retval = new ObjectPrototype( evaluator.getObjectPrototype(), evaluator); - for (Enumeration e = t.keys(); e.hasMoreElements();) + for (Iterator i = t.keySet().iterator(); i.hasNext();) { - String next = (String) e.nextElement(); + String next = (String) i.next(); retval.putProperty(next, convertJ2E(t.get(next), evaluator), next.hashCode()); } @@ -149,18 +152,18 @@ { ArrayPrototype a = (ArrayPrototype) what; int l = a.size(); - Vector v = new Vector(); + List v = AggregateFactory.newList(); for (int i = 0; i < l; i++) { Object nj = convertE2J(a.getProperty(i)); - v.addElement(nj); + v.add(nj); } return v; } if (what instanceof ObjectPrototype) { ObjectPrototype o = (ObjectPrototype) what; - Hashtable t = new Hashtable(); + Map t = AggregateFactory.newMap(); for (Enumeration e = o.getProperties(); e.hasMoreElements();) { String next = (String) e.nextElement(); Index: src/java/org/apache/xmlrpc/secure/SecureXmlRpcClient.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/secure/SecureXmlRpcClient.java,v retrieving revision 1.3 diff -u -r1.3 SecureXmlRpcClient.java --- src/java/org/apache/xmlrpc/secure/SecureXmlRpcClient.java 13 Feb 2002 01:08:41 -0000 1.3 +++ src/java/org/apache/xmlrpc/secure/SecureXmlRpcClient.java 8 Jun 2002 11:30:03 -0000 @@ -55,11 +55,11 @@ * . */ -import java.net.*; -import java.io.*; -import java.util.*; -import org.xml.sax.*; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import org.apache.xmlrpc.AggregateFactory; import org.apache.xmlrpc.XmlRpcClient; /** @@ -109,11 +109,11 @@ try { String url = args[0]; String method = args[1]; - Vector v = new Vector (); + List v = AggregateFactory.newList(); for (int i=2; i. */ -import java.util.*; -import java.io.IOException; import java.net.URL; +import java.util.List; public class AsyncBenchmark implements Runnable @@ -78,11 +77,11 @@ { client = new XmlRpcClientLite (url); - Vector args = new Vector (); + List args = AggregateFactory.newList(); // Some JITs (Symantec, IBM) have problems with several Threads // starting all at the same time. // This initial XML-RPC call seems to pacify them. - args.addElement (new Integer (123)); + args.add (new Integer (123)); client.execute ("math.abs", args); start = System.currentTimeMillis (); @@ -99,10 +98,10 @@ for (int i = 0; i < loops; i++) { - Vector args = new Vector (); + List args = AggregateFactory.newList(); Integer n = new Integer ( Math.round ((int)(Math.random () * -1000))); - args.addElement (n); + args.add (n); client.executeAsync ("math.abs", args, new Callback (n)); calls += 1; } Index: src/test/org/apache/xmlrpc/Benchmark.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/test/org/apache/xmlrpc/Benchmark.java,v retrieving revision 1.2 diff -u -r1.2 Benchmark.java --- src/test/org/apache/xmlrpc/Benchmark.java 14 Nov 2001 15:12:01 -0000 1.2 +++ src/test/org/apache/xmlrpc/Benchmark.java 8 Jun 2002 11:29:40 -0000 @@ -55,8 +55,9 @@ * . */ -import java.util.*; import java.io.IOException; +import java.util.Date; +import java.util.List; public class Benchmark implements Runnable @@ -77,11 +78,11 @@ { client = new XmlRpcClientLite (url); - Vector args = new Vector (); + List args = AggregateFactory.newList(); // Some JITs (Symantec, IBM) have problems with several Threads // starting all at the same time. // This initial XML-RPC call seems to pacify them. - args.addElement (new Integer (123)); + args.add (new Integer (123)); client.execute ("math.abs", args); date = new Date (); date = new Date ((date.getTime() / 1000) * 1000); @@ -100,14 +101,14 @@ try { int val = (int)(-100 * Math.random ()); - Vector args = new Vector (); + List args = AggregateFactory.newList(); // ECHO STRING - // args.addElement (Integer.toString (val)); + // args.add (Integer.toString (val)); // ABS INT - args.addElement (new Integer (val)); + args.add (new Integer (val)); // ECHO DATE - // args.addElement (date); + // args.add (date); for (int i = 0; i < loops; i++) { @@ -115,7 +116,7 @@ // ABS INT Integer ret = (Integer) client.execute ("math.abs", args); // ECHO - // Vector v = (Vector) client.execute ("echo", args); + // List v = (List) client.execute ("echo", args); // ECHO DATE // Date d = (Date) v.elementAt (0); Index: src/test/org/apache/xmlrpc/ClientServerRpcTest.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/test/org/apache/xmlrpc/ClientServerRpcTest.java,v retrieving revision 1.9 diff -u -r1.9 ClientServerRpcTest.java --- src/test/org/apache/xmlrpc/ClientServerRpcTest.java 20 Feb 2002 01:38:24 -0000 1.9 +++ src/test/org/apache/xmlrpc/ClientServerRpcTest.java 8 Jun 2002 11:29:42 -0000 @@ -60,7 +60,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; -import java.util.Vector; +import java.util.List; import junit.framework.Test; import junit.framework.TestCase; @@ -247,7 +247,7 @@ { // Test the web server (which also tests the rpc server) // by connecting via the clients - Vector params = new Vector(); + List params = AggregateFactory.newList(); params.add(REQUEST_PARAM_VALUE); Object response = client.execute(HANDLER_NAME + ".echo", params); System.out.println(response); Index: src/test/org/apache/xmlrpc/TestBase64.java =================================================================== RCS file: /home/cvspublic/xml-rpc/src/test/org/apache/xmlrpc/TestBase64.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 TestBase64.java --- src/test/org/apache/xmlrpc/TestBase64.java 20 Jul 2001 19:38:20 -0000 1.1.1.1 +++ src/test/org/apache/xmlrpc/TestBase64.java 8 Jun 2002 11:29:43 -0000 @@ -55,8 +55,8 @@ * . */ -import java.util.*; import java.io.IOException; +import java.util.List; public class TestBase64 implements Runnable @@ -75,11 +75,11 @@ { client = new XmlRpcClientLite (url); - Vector args = new Vector (); + List args = AggregateFactory.newList(); // Some JITs (Symantec, IBM) have problems with several Threads // starting all at the same time. // This initial XML-RPC call seems to pacify them. - args.addElement (new Integer (123)); + args.add (new Integer (123)); client.execute ("math.abs", args); data = new byte[20000]; @@ -98,15 +98,15 @@ try { int val = (int)(-100 * Math.random ()); - Vector args = new Vector (); + List args = AggregateFactory.newList(); - args.addElement (data); + args.add (data); for (int i = 0; i < loops; i++) { - Vector v = (Vector) client.execute ("echo", args); - byte[] d = (byte[]) v.elementAt (0); + List v = (List) client.execute ("echo", args); + byte[] d = (byte[]) v.get(0); for (int j = 0; j < d.length; j++) if (d[j] != (byte) j) errors += 1;