axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Haddad <hadd...@icarus.apache.org>
Subject added support for xsd:Name, xsd:NMTOKEN, xsd:NCName
Date Tue, 13 Aug 2002 13:09:32 GMT
Axis-dev -  early in the morning, I added support for xsd:NCName,
xsd:NMTOKEN, xsd:Name. Also, I removed the custom deserializers for Token,
NormalizedString, and Unsigned*.

For some reason, my commits are not generating cvs mail, but the
repository is being properly updated.

Here is the diff and file mods:

A src/org/apache/axis/types/Name.java
A src/org/apache/axis/types/NCName.java
A src/org/apache/axis/types/NMToken.java
A test/encoding/TestName.java
A test/encoding/TestNCName.java
A test/encoding/TestNMToken.java
M src/org/apache/axis/Constants.java
M src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
M src/org/apache/axis/types/UnsignedByte.java
M src/org/apache/axis/types/UnsignedInt.java
M src/org/apache/axis/types/UnsignedLong.java
M src/org/apache/axis/types/UnsignedShort.java
M src/org/apache/axis/utils/axisNLS.properties
M test/encoding/PackageTests.java
M test/encoding/TestDeser2001.java


Index: src/org/apache/axis/Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.78
diff -u -r1.78 Constants.java
--- src/org/apache/axis/Constants.java	9 Aug 2002 15:18:30 -0000
1.78
+++ src/org/apache/axis/Constants.java	13 Aug 2002 05:52:28 -0000
@@ -452,13 +452,16 @@
     public static final QName XSD_UNSIGNEDINT = new
QName(URI_2001_SCHEMA_XSD, "unsignedInt");
     public static final QName XSD_UNSIGNEDSHORT = new
QName(URI_2001_SCHEMA_XSD, "unsignedShort");
     public static final QName XSD_UNSIGNEDBYTE = new
QName(URI_2001_SCHEMA_XSD, "unsignedByte");
-
+
     public static final QName XSD_YEARMONTH = new
QName(URI_2001_SCHEMA_XSD, "gYearMonth");
     public static final QName XSD_MONTHDAY = new
QName(URI_2001_SCHEMA_XSD, "gMonthDay");
     public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD,
"gYear");
     public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD,
"gMonth");
     public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD,
"gDay");
-
+
+    public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD,
"Name");
+    public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD,
"NCName");
+    public static final QName XSD_NMTOKEN = new
+ QName(URI_2001_SCHEMA_XSD, "NMTOKEN");

     public static final QName SOAP_BASE64 = new
QName(URI_DEFAULT_SOAP_ENC, "base64");
     public static final QName SOAP_STRING = new
QName(URI_DEFAULT_SOAP_ENC, "string");
Index: src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
retrieving revision 1.42
diff -u -r1.42 DefaultTypeMappingImpl.java
--- src/org/apache/axis/encoding/DefaultTypeMappingImpl.java	9 Aug 2002
15:18:30 -0000	1.42
+++ src/org/apache/axis/encoding/DefaultTypeMappingImpl.java	13 Aug
2002 05:52:30 -0000
@@ -327,7 +327,7 @@
                    new
SimpleDeserializerFactory(org.apache.axis.types.MonthDay.class,
                                              Constants.XSD_MONTHDAY),
                    true);
-
+
         // Serialize all extensions of Map to SOAP_MAP
         // The SOAP_MAP will be deserialized into a HashMap by default.
         myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,
@@ -375,67 +375,75 @@

         // xsd:token
         myRegister(Constants.XSD_TOKEN,
org.apache.axis.types.Token.class,
-                new
TokenSerializerFactory(org.apache.axis.types.Token.class,
-                    Constants.XSD_TOKEN),
-                new TokenDeserializerFactory(
-                    org.apache.axis.types.Token.class,
-                    Constants.XSD_TOKEN),
-                false);
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.Token.class,
+                                             Constants.XSD_TOKEN),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.Token.class,
+                                             Constants.XSD_TOKEN),
+                   true);

         // a xsd:normalizedString
-        myRegister(Constants.XSD_NORMALIZEDSTRING,
-                org.apache.axis.types.NormalizedString.class,
-                new NormalizedStringSerializerFactory(
-                    org.apache.axis.types.NormalizedString.class,
-                    Constants.XSD_NORMALIZEDSTRING),
-                new NormalizedStringDeserializerFactory(
-                    org.apache.axis.types.NormalizedString.class,
-                    Constants.XSD_NORMALIZEDSTRING),
-                false);
+        myRegister(Constants.XSD_NORMALIZEDSTRING,
org.apache.axis.types.NormalizedString.class,
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.NormalizedString.class,
+
Constants.XSD_NORMALIZEDSTRING),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.NormalizedString.class,
+
Constants.XSD_NORMALIZEDSTRING),
+                   true);

         // a xsd:unsignedLong
-        myRegister(Constants.XSD_UNSIGNEDLONG,
-                org.apache.axis.types.UnsignedLong.class,
-                new UnsignedLongSerializerFactory(
-                    org.apache.axis.types.UnsignedLong.class,
-                    Constants.XSD_UNSIGNEDLONG),
-                new UnsignedLongDeserializerFactory(
-                    org.apache.axis.types.UnsignedLong.class,
-                    Constants.XSD_UNSIGNEDLONG),
-                false);
+        myRegister(Constants.XSD_UNSIGNEDLONG,
org.apache.axis.types.UnsignedLong.class,
+             new
SimplePrimitiveSerializerFactory(org.apache.axis.types.UnsignedLong.class,
+
Constants.XSD_UNSIGNEDLONG),
+             new
SimpleDeserializerFactory(org.apache.axis.types.UnsignedLong.class,
+                                           Constants.XSD_UNSIGNEDLONG),
+             true);

         // a xsd:unsignedInt
-        myRegister(Constants.XSD_UNSIGNEDINT,
-                org.apache.axis.types.UnsignedInt.class,
-                new UnsignedIntSerializerFactory(
-                    org.apache.axis.types.UnsignedInt.class,
-                    Constants.XSD_UNSIGNEDINT),
-                new UnsignedIntDeserializerFactory(
-                    org.apache.axis.types.UnsignedInt.class,
-                    Constants.XSD_UNSIGNEDINT),
-                false);
+        myRegister(Constants.XSD_UNSIGNEDINT,
org.apache.axis.types.UnsignedInt.class,
+             new
SimplePrimitiveSerializerFactory(org.apache.axis.types.UnsignedInt.class,
+
Constants.XSD_UNSIGNEDINT),
+             new
SimpleDeserializerFactory(org.apache.axis.types.UnsignedInt.class,
+                                           Constants.XSD_UNSIGNEDINT),
+             true);

         // a xsd:unsignedShort
-        myRegister(Constants.XSD_UNSIGNEDSHORT,
-                org.apache.axis.types.UnsignedShort.class,
-                new UnsignedShortSerializerFactory(
-                    org.apache.axis.types.UnsignedShort.class,
-                    Constants.XSD_UNSIGNEDSHORT),
-                new UnsignedShortDeserializerFactory(
-                    org.apache.axis.types.UnsignedShort.class,
-                    Constants.XSD_UNSIGNEDSHORT),
-                false);
+        myRegister(Constants.XSD_UNSIGNEDSHORT,
org.apache.axis.types.UnsignedShort.class,
+             new
SimplePrimitiveSerializerFactory(org.apache.axis.types.UnsignedShort.class,
+
Constants.XSD_UNSIGNEDSHORT),
+             new
SimpleDeserializerFactory(org.apache.axis.types.UnsignedShort.class,
+                                           Constants.XSD_UNSIGNEDSHORT),
+             true);

         // a xsd:unsignedByte
-        myRegister(Constants.XSD_UNSIGNEDBYTE,
-                org.apache.axis.types.UnsignedByte.class,
-                new UnsignedByteSerializerFactory(
-                    org.apache.axis.types.UnsignedByte.class,
-                    Constants.XSD_UNSIGNEDBYTE),
-                new UnsignedByteDeserializerFactory(
-                    org.apache.axis.types.UnsignedByte.class,
-                    Constants.XSD_UNSIGNEDBYTE),
-                false);
+        myRegister(Constants.XSD_UNSIGNEDBYTE,
org.apache.axis.types.UnsignedByte.class,
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.UnsignedByte.class,
+                                             Constants.XSD_UNSIGNEDBYTE),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.UnsignedByte.class,
+                                             Constants.XSD_UNSIGNEDBYTE),
+                   true);
+
+        // a xsd:Name
+        myRegister(Constants.XSD_NAME, org.apache.axis.types.Name.class,
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.Name.class,
+                                             Constants.XSD_NAME),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.Name.class,
+                                             Constants.XSD_NAME),
+                   true);
+
+        // a xsd:NCName
+        myRegister(Constants.XSD_NCNAME,
org.apache.axis.types.NCName.class,
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.NCName.class,
+                                             Constants.XSD_NCNAME),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.NCName.class,
+                                             Constants.XSD_NCNAME),
+                   true);
+
+        // a xsd:NmToken
+        myRegister(Constants.XSD_NMTOKEN,
org.apache.axis.types.NMToken.class,
+                   new
SimplePrimitiveSerializerFactory(org.apache.axis.types.NMToken.class,
+                                             Constants.XSD_NMTOKEN),
+                   new
SimpleDeserializerFactory(org.apache.axis.types.NMToken.class,
+                                             Constants.XSD_NMTOKEN),
+                   true);

         // All array objects automatically get associated with the
SOAP_ARRAY.
         // There is no way to do this with a hash table,
Index: src/org/apache/axis/types/UnsignedByte.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedByte.java,v
retrieving revision 1.1
diff -u -r1.1 UnsignedByte.java
--- src/org/apache/axis/types/UnsignedByte.java	7 Aug 2002 21:02:09 -0000
1.1
+++ src/org/apache/axis/types/UnsignedByte.java	13 Aug 2002 05:52:41 -0000
@@ -76,7 +76,11 @@
      * @exception Exception will be thrown if validation fails
      */
     public UnsignedByte(long sValue) throws Exception {
-            setValue(sValue);
+      setValue(sValue);
+    }
+
+    public UnsignedByte(String sValue) throws Exception {
+      setValue(Long.parseLong(sValue));
     }

     /**
Index: src/org/apache/axis/types/UnsignedInt.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedInt.java,v
retrieving revision 1.2
diff -u -r1.2 UnsignedInt.java
--- src/org/apache/axis/types/UnsignedInt.java	8 Aug 2002 16:44:15 -0000
1.2
+++ src/org/apache/axis/types/UnsignedInt.java	13 Aug 2002 05:52:41 -0000
@@ -78,11 +78,11 @@
      * @exception Exception will be thrown if validation fails
      */
     public UnsignedInt(long iValue) throws Exception {
-            setValue(iValue);
+      setValue(iValue);
     }

     public UnsignedInt(String stValue) throws Exception {
-            setValue(Long.parseLong(stValue));
+      setValue(Long.parseLong(stValue));
     }


Index: src/org/apache/axis/types/UnsignedLong.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedLong.java,v
retrieving revision 1.2
diff -u -r1.2 UnsignedLong.java
--- src/org/apache/axis/types/UnsignedLong.java	8 Aug 2002 16:44:15 -0000
1.2
+++ src/org/apache/axis/types/UnsignedLong.java	13 Aug 2002 05:52:42 -0000
@@ -77,7 +77,11 @@
      * @exception Exception will be thrown if validation fails
      */
     public UnsignedLong(double lValue) throws Exception {
-            setValue(lValue);
+      setValue(lValue);
+    }
+
+    public UnsignedLong(String stValue) throws Exception {
+      setValue(Double.parseDouble(stValue));
     }

     /**
Index: src/org/apache/axis/types/UnsignedShort.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedShort.java,v
retrieving revision 1.1
diff -u -r1.1 UnsignedShort.java
--- src/org/apache/axis/types/UnsignedShort.java	7 Aug 2002
21:02:09 -0000	1.1
+++ src/org/apache/axis/types/UnsignedShort.java	13 Aug 2002
05:52:42 -0000
@@ -75,7 +75,11 @@
      * @exception Exception will be thrown if validation fails
      */
     public UnsignedShort(long sValue) throws Exception {
-            setValue(sValue);
+      setValue(sValue);
+    }
+
+    public UnsignedShort(String sValue) throws Exception {
+      setValue(Long.parseLong(sValue));
     }

     /**
Index: src/org/apache/axis/utils/axisNLS.properties
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
retrieving revision 1.38
diff -u -r1.38 axisNLS.properties
--- src/org/apache/axis/utils/axisNLS.properties	9 Aug 2002
19:40:12 -0000	1.38
+++ src/org/apache/axis/utils/axisNLS.properties	13 Aug 2002
05:52:48 -0000
@@ -51,6 +51,10 @@

 badNameAttr00=No ''name'' attribute was specified in an undeployment
element  badNamespace00=Bad envelope namespace:  {0}
+badNameType00=Invalid Name
+badNCNameType00=Invalid NCName
+badNmtoken00=Invalid Nmtoken
+badNmtokens00=Invalid Nmtokens
 badOffset00=Malformed offset attribute ''{0}''.
 badpackage00=Error: --NStoPKG and --package switch can't be used together
# NOTE:  in badParmMode00, do not translate "Parameter".
Index: test/encoding/PackageTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/PackageTests.java,v
retrieving revision 1.21
diff -u -r1.21 PackageTests.java
--- test/encoding/PackageTests.java	9 Aug 2002 15:18:30 -0000
1.21
+++ test/encoding/PackageTests.java	13 Aug 2002 05:52:48 -0000
@@ -48,6 +48,9 @@
         suite.addTestSuite(TestMonth.class);
         suite.addTestSuite(TestMonthDay.class);
         suite.addTestSuite(TestDay.class);
+        suite.addTestSuite(TestName.class);
+        suite.addTestSuite(TestNCName.class);
+        suite.addTestSuite(TestNMToken.class);
         return suite;
     }
 }
Index: test/encoding/TestDeser2001.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser2001.java,v
retrieving revision 1.19
diff -u -r1.19 TestDeser2001.java
--- test/encoding/TestDeser2001.java	9 Aug 2002 15:18:30 -0000
1.19
+++ test/encoding/TestDeser2001.java	13 Aug 2002 05:52:49 -0000
@@ -15,6 +15,9 @@
 import org.apache.axis.types.Month;
 import org.apache.axis.types.Day;
 import org.apache.axis.types.MonthDay;
+import org.apache.axis.types.Name;
+import org.apache.axis.types.NCName;
+import org.apache.axis.types.NMToken;

 import java.util.ArrayList;
 import java.util.Calendar;
@@ -94,7 +97,7 @@

     /**
      * Test the xsd:Time deserialization
-     */
+     */
     public void testTimeZ() throws Exception {
         Calendar date = Calendar.getInstance();
         date.set(Calendar.HOUR_OF_DAY, 12);
@@ -121,7 +124,7 @@
                      "</result>",
                      time);
     }
-
+
     private final int msecsInMinute = 60000;
     private final int msecsInHour = 60 * msecsInMinute;

@@ -190,6 +193,21 @@
     public void testUnsignedByte() throws Exception {
         deserialize("<result xsi:type=\"xsd:unsignedByte\">103</result>",
                     new UnsignedByte(103),true);
+    }
+
+    public void testName() throws Exception {
+        deserialize("<result xsi:type=\"xsd:Name\">:Braves</result>",
+                    new Name(":Braves"),true);
+    }
+
+    public void testNCName() throws Exception {
+        deserialize("<result
xsi:type=\"xsd:NCName\">_Atlanta.Braves</result>",
+                    new NCName("_Atlanta.Braves"),true);
+    }
+
+    public void testNMToken() throws Exception {
+        deserialize("<result
xsi:type=\"xsd:NMTOKEN\">_A.B.C.1-2-3</result>",
+                    new NMToken("_A.B.C.1-2-3"),true);
     }

     public void testQName() throws Exception {



Mime
View raw message