You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by hg...@apache.org on 2006/05/08 10:35:41 UTC

svn commit: r404967 - in /webservices/xmlrpc/trunk: common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java src/changes/changes.xml src/site/apt/types.apt

Author: hgomez
Date: Mon May  8 01:35:38 2006
New Revision: 404967

URL: http://svn.apache.org/viewcvs?rev=404967&view=rev
Log:
Add support for BigDecimal and BigInteger in extension mode

Modified:
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java
    webservices/xmlrpc/trunk/src/changes/changes.xml
    webservices/xmlrpc/trunk/src/site/apt/types.apt

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java?rev=404967&r1=404966&r2=404967&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java Mon May  8 01:35:38 2006
@@ -16,11 +16,15 @@
 package org.apache.xmlrpc.common;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.ws.commons.util.NamespaceContextImpl;
+import org.apache.xmlrpc.parser.BigDecimalParser;
+import org.apache.xmlrpc.parser.BigIntegerParser;
 import org.apache.xmlrpc.parser.BooleanParser;
 import org.apache.xmlrpc.parser.ByteArrayParser;
 import org.apache.xmlrpc.parser.DateParser;
@@ -37,6 +41,8 @@
 import org.apache.xmlrpc.parser.SerializableParser;
 import org.apache.xmlrpc.parser.StringParser;
 import org.apache.xmlrpc.parser.TypeParser;
+import org.apache.xmlrpc.serializer.BigDecimalSerializer;
+import org.apache.xmlrpc.serializer.BigIntegerSerializer;
 import org.apache.xmlrpc.serializer.BooleanSerializer;
 import org.apache.xmlrpc.serializer.ByteArraySerializer;
 import org.apache.xmlrpc.serializer.DateSerializer;
@@ -73,7 +79,9 @@
 	private static final TypeSerializer LONG_SERIALIZER = new I8Serializer();
 	private static final TypeSerializer FLOAT_SERIALIZER = new FloatSerializer();
 	private static final TypeSerializer NODE_SERIALIZER = new NodeSerializer();
-	private static final TypeSerializer SERIALIZABLE_SERIALIZER = new SerializableSerializer();
+    private static final TypeSerializer SERIALIZABLE_SERIALIZER = new SerializableSerializer();
+    private static final TypeSerializer BIGDECIMAL_SERIALIZER = new BigDecimalSerializer();
+    private static final TypeSerializer BIGINTEGER_SERIALIZER = new BigIntegerSerializer();
 
 	private final XmlRpcController controller;
 
@@ -148,6 +156,18 @@
 			} else {
 				throw new SAXException(new XmlRpcExtensionException("DOM nodes aren't supported, if isEnabledForExtensions() == false"));
 			}
+        } else if (pObject instanceof BigInteger) {
+            if (pConfig.isEnabledForExtensions()) {
+                return BIGINTEGER_SERIALIZER;
+            } else {
+                throw new SAXException(new XmlRpcExtensionException("BigInteger values aren't supported, if isEnabledForExtensions() == false"));
+            }
+        } else if (pObject instanceof BigDecimal) {
+            if (pConfig.isEnabledForExtensions()) {
+                return BIGDECIMAL_SERIALIZER;
+            } else {
+                throw new SAXException(new XmlRpcExtensionException("BigDecimal values aren't supported, if isEnabledForExtensions() == false"));
+            }
 		} else if (pObject instanceof Serializable) {
 			if (pConfig.isEnabledForExtensions()) {
 				return SERIALIZABLE_SERIALIZER;
@@ -174,8 +194,12 @@
 				return new I8Parser();
 			} else if (FloatSerializer.FLOAT_TAG.equals(pLocalName)) {
 				return new FloatParser();
-			} else if (NodeSerializer.DOM_TAG.equals(pLocalName)) {
-				return new NodeParser();
+            } else if (NodeSerializer.DOM_TAG.equals(pLocalName)) {
+                return new NodeParser();
+            } else if (BigDecimalSerializer.BIGDECIMAL_TAG.equals(pLocalName)) {
+                return new BigDecimalParser();
+            } else if (BigIntegerSerializer.BIGINTEGER_TAG.equals(pLocalName)) {
+                return new BigIntegerParser();
 			} else if (SerializableSerializer.SERIALIZABLE_TAG.equals(pLocalName)) {
 				return new SerializableParser();
 			}

Modified: webservices/xmlrpc/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/src/changes/changes.xml?rev=404967&r1=404966&r2=404967&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/src/changes/changes.xml (original)
+++ webservices/xmlrpc/trunk/src/changes/changes.xml Mon May  8 01:35:38 2006
@@ -10,6 +10,9 @@
         was terminated with a line feed, which is invalid for
         use in HTTP headers.
       </action>
+      <action dev="hgomez" type="enhancement">
+        add support for BigDecimal and BigInteger in extensions.
+      </action>
       <action dev="jochen" type="fix" due-to="Walter Mundt"
           due-to-email="Walter.Mundt@coleengineering.com">
           Nested object arrays could not be parsed.

Modified: webservices/xmlrpc/trunk/src/site/apt/types.apt
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/src/site/apt/types.apt?rev=404967&r1=404966&r2=404967&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/src/site/apt/types.apt (original)
+++ webservices/xmlrpc/trunk/src/site/apt/types.apt Mon May  8 01:35:38 2006
@@ -67,6 +67,10 @@
 |                      |                    | transmitted as a base 64 encoded    |
 |                      |                    | byte array.                         |
 *----------------------+--------------------+-------------------------------------+
+| BigDecimal           | <ex:bigdecimal>    | A BigDecimal                        |
+*----------------------+--------------------+-------------------------------------+
+| BigInteger           | <ex:biginteger>    | A BigInteger                        |
+*----------------------+--------------------+-------------------------------------+
 
   In the above table, the prefix <<<ex>>> refers to the namespace URI
   <<<http://ws.apache.org/xmlrpc/namespaces/extensions>>>.