axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/encoding TestNormalizedString.java TestToken.java PackageTests.java TestDeser2001.java
Date Tue, 09 Jul 2002 15:17:32 GMT
butek       2002/07/09 08:17:32

  Modified:    java/samples/echo InteropTest.wsdl
                        InteropTestSoapBindingImpl.java TestClient.java
               java/src/org/apache/axis Constants.java
               java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java
               java/src/org/apache/axis/utils axisNLS.properties
               java/test/encoding PackageTests.java TestDeser2001.java
  Added:       java/src/org/apache/axis/encoding NormalizedString.java
                        Token.java
               java/src/org/apache/axis/encoding/ser
                        NormalizedStringDeserializer.java
                        NormalizedStringDeserializerFactory.java
                        NormalizedStringSerializer.java
                        NormalizedStringSerializerFactory.java
                        TokenDeserializer.java
                        TokenDeserializerFactory.java TokenSerializer.java
                        TokenSerializerFactory.java
               java/test/encoding TestNormalizedString.java TestToken.java
  Log:
  From Chris Haddad, http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10493
  
  Added mappings for xsd:token and xsd:normalizedString.
  
  Revision  Changes    Path
  1.2       +44 -0     xml-axis/java/samples/echo/InteropTest.wsdl
  
  Index: InteropTest.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/InteropTest.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InteropTest.wsdl	9 Apr 2002 18:50:51 -0000	1.1
  +++ InteropTest.wsdl	9 Jul 2002 15:17:30 -0000	1.2
  @@ -211,6 +211,20 @@
   		<part name="return" type="s:ArrayOfMap"/>
   	</message>
   
  +	<message name="echoTokenRequest">
  +		<part name="inputToken" type="xsd:token"/>
  +	</message>
  +	<message name="echoTokenResponse">
  +		<part name="return" type="xsd:token"/>
  +	</message>
  +
  +	<message name="echoNormalizedStringRequest">
  +		<part name="inputNormalizedString" type="xsd:normalizedString"/>
  +	</message>
  +	<message name="echoNormalizedStringResponse">
  +		<part name="return" type="xsd:normalizedString"/>
  +	</message>
  +
   	<portType name="InteropTestPortType">
   		<operation name="echoString" parameterOrder="inputString">
   			<input message="tns:echoStringRequest"/>
  @@ -300,6 +314,16 @@
   			<input message="tns:echoMapArrayRequest"/>
   			<output message="tns:echoMapArrayResponse"/>
   		</operation>
  +
  +		<operation name="echoToken">
  +			<input message="tns:echoTokenRequest"/>
  +			<output message="tns:echoTokenResponse"/>
  +		</operation>
  +
  +		<operation name="echoNormalizedString">
  +			<input message="tns:echoNormalizedStringRequest"/>
  +			<output message="tns:echoNormalizedStringResponse"/>
  +		</operation>
   	</portType>
   
   	<binding name="InteropTestSoapBinding" type="tns:InteropTestPortType">
  @@ -494,6 +518,26 @@
   			</input>
   			<output>
   				<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +			</output>
  +		</operation>
  +
  +		<operation name="echoToken">
  +			<soap:operation soapAction="http://soapinterop.org/"/>
  +			<input>
  +				<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +			</input>
  +			<output>
  +				<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +			</output>
  +		</operation>
  +
  +		<operation name="echoNormalizedString">
  +			<soap:operation soapAction="http://soapinterop.org/"/>
  +			<input>
  +				<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +			</input>
  +			<output>
  +			<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   			</output>
   		</operation>
   	</binding>
  
  
  
  1.2       +15 -0     xml-axis/java/samples/echo/InteropTestSoapBindingImpl.java
  
  Index: InteropTestSoapBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/InteropTestSoapBindingImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InteropTestSoapBindingImpl.java	9 Apr 2002 18:50:51 -0000	1.1
  +++ InteropTestSoapBindingImpl.java	9 Jul 2002 15:17:30 -0000	1.2
  @@ -105,4 +105,19 @@
       public java.util.HashMap [] echoMapArray(java.util.HashMap[] input) {
           return input;
       }
  +
  +    /**
  +     * This method accepts a Token (xsd:token) and echoes it back to the client.
  +     */
  +    public org.apache.axis.encoding.Token echoToken(org.apache.axis.encoding.Token input) throws java.rmi.RemoteException {
  +        return input;
  +    }
  +
  +    /**
  +     * This method accepts a NormalizedString (xsd:normalizedString) and echoes
  +     * it back to the client.
  +     */
  +    public org.apache.axis.encoding.NormalizedString echoNormalizedString(org.apache.axis.encoding.NormalizedString input) throws java.rmi.RemoteException {
  +        return input;
  +    }
   }
  
  
  
  1.64      +40 -1     xml-axis/java/samples/echo/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/TestClient.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- TestClient.java	19 Jun 2002 22:27:45 -0000	1.63
  +++ TestClient.java	9 Jul 2002 15:17:30 -0000	1.64
  @@ -56,7 +56,11 @@
   package samples.echo ;
   
   import org.apache.axis.AxisFault;
  +
   import org.apache.axis.encoding.Hex;
  +import org.apache.axis.encoding.NormalizedString;
  +import org.apache.axis.encoding.Token;
  +
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Options;
   
  @@ -187,11 +191,46 @@
       }
   
       /**
  -     * Execute both the 2A and 2B tests
  +     * Execute all tests.
        */
       public void executeAll() throws Exception {
           execute2A();
           execute2B();
  +        executeAxisXSD();
  +    }
  +
  +    /**
  +     * Test custom mapping of xsd types not standardized:  xsd:token and
  +     * xsd:normalizedString.
  +     */
  +    public void executeAxisXSD() throws Exception {
  +        Object output = null;
  +
  +        // Test xsd:token
  +        Token tInput = new Token("abccdefg");
  +        try {
  +            output = binding.echoToken(tInput);
  +            verify("echoToken", tInput, output);
  +        } catch (Exception e) {
  +            if (!testMode) {
  +                verify("echoToken", tInput, e);
  +            } else {
  +                throw e;
  +            }
  +        }
  +
  +        // Test xsd:normalizedString
  +        NormalizedString nsInput = new NormalizedString("abccdefg");
  +        try {
  +            output = binding.echoNormalizedString(nsInput);
  +            verify("echoNormalizedString", nsInput, output);
  +        } catch (Exception e) {
  +            if (!testMode) {
  +                verify("echoNormalizedString", nsInput, e);
  +            } else {
  +                throw e;
  +            }
  +        }
       }
   
       /**
  
  
  
  1.67      +5 -2      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- Constants.java	30 Jun 2002 18:15:46 -0000	1.66
  +++ Constants.java	9 Jul 2002 15:17:30 -0000	1.67
  @@ -426,8 +426,11 @@
       public static final QName XSD_QNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "QName");
       public static final QName XSD_DATE = new QName(URI_DEFAULT_SCHEMA_XSD, "dateTime");
       public static final QName XSD_DATE1 = new QName(URI_DEFAULT_SCHEMA_XSD, "date");
  -    public static final QName XSD_DATE2= new QName(URI_1999_SCHEMA_XSD,    "timeInstant");
  -    public static final QName XSD_DATE3= new QName(URI_2000_SCHEMA_XSD,    "timeInstant");
  +    public static final QName XSD_DATE2 = new QName(URI_1999_SCHEMA_XSD,    "timeInstant");
  +    public static final QName XSD_DATE3 = new QName(URI_2000_SCHEMA_XSD,    "timeInstant");
  +
  +    public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD,    "normalizedString");
  +    public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD,    "token");
       
       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");
  
  
  
  1.35      +20 -0     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.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- DefaultTypeMappingImpl.java	28 Jun 2002 06:17:54 -0000	1.34
  +++ DefaultTypeMappingImpl.java	9 Jul 2002 15:17:30 -0000	1.35
  @@ -323,6 +323,26 @@
                                                    Constants.SOAP_VECTOR),
                      false);
   
  +        // xsd:token
  +        myRegister(Constants.XSD_TOKEN, org.apache.axis.encoding.Token.class,
  +                new TokenSerializerFactory(org.apache.axis.encoding.Token.class,
  +                    Constants.XSD_TOKEN),
  +                new TokenDeserializerFactory(
  +                    org.apache.axis.encoding.Token.class,
  +                    Constants.XSD_TOKEN),
  +                false);
  +
  +        // a xsd:normalizedString
  +        myRegister(Constants.XSD_NORMALIZEDSTRING,
  +                org.apache.axis.encoding.NormalizedString.class,
  +                new NormalizedStringSerializerFactory(
  +                    org.apache.axis.encoding.NormalizedString.class,
  +                    Constants.XSD_NORMALIZEDSTRING),
  +                new NormalizedStringDeserializerFactory(
  +                    org.apache.axis.encoding.NormalizedString.class,
  +                    Constants.XSD_NORMALIZEDSTRING),
  +                false);
  +
           // All array objects automatically get associated with the SOAP_ARRAY.
           // There is no way to do this with a hash table,
           // so it is done directly in getTypeQName.
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/NormalizedString.java
  
  Index: NormalizedString.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.encoding;
  
  import org.apache.axis.utils.JavaUtils;
  
  /**
   * Custom class for supporting XSD data type NormalizedString.
   * normalizedString represents white space normalized strings.
   * The base type of normalizedString is string.
   *
   * @author Chris Haddad <chaddad@cobia.net>
   * @see <a href="http://www.w3.org/TR/xmlschema-2/#normalizedString">XML Schema Part 2: Datatypes 3.3.1</a>
   */
  public class NormalizedString extends Object {
  
      java.lang.String m_value = null;   // JAX-RPC maps xsd:string to java.lang.String
  
      public NormalizedString() {
          super();
      }
  
      /**
       *
       * ctor for NormalizedString
       * NOTE: null will be returned if validation fails
       */
      public NormalizedString(java.lang.String stValue) throws Exception {
          setValue(stValue);
      }
  
      /**
       *
       * validates the data and sets the value for the object.
       *
       * @param normalizedString value
       */
      public void setValue(java.lang.String stValue) throws Exception {
          if (isValid(stValue) == false)
              throw new Exception(JavaUtils.getMessage("badNormalizedString00") +
                      " data=[" + stValue + "]");
          m_value = stValue;
      }
  
      public java.lang.String toString(){
          return m_value;
      }
  
      public int hashCode(){
          //TODO: How do we hash this?
          return m_value.hashCode();
      }
  
      /**
       *
       * validate the value against the xsd definition for the object
       *
       * The value space of normalizedString is the set of strings that
       * do not contain the carriage return (#xD), line feed (#xA) nor
       * tab (#x9) characters. The lexical space of normalizedString is
       * the set of strings that do not contain the carriage return (#xD)
       * nor tab (#x9) characters.
       *
       * @param the String to test
       * @returns true if valid normalizedString
       */
      public boolean isValid(java.lang.String stValue)  {
          int scan;
  
          for (scan = 0; scan < stValue.length(); scan++) {
              char cDigit = stValue.charAt(scan);
              switch (cDigit) {
                  case 0x09:
                  case 0x0A:
                  case 0x0D:
                      return false;
                  default:
                      break;
              }
          }
          return true;
      }
  
      public boolean equals(java.lang.Object object)  {
          java.lang.String s1 = object.toString();
          return s1.equals(m_value);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/Token.java
  
  Index: Token.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.encoding;
  
  import java.util.ArrayList;
  
  import org.apache.axis.utils.JavaUtils;
  
  /**
   * Custom class for supporting primitive XSD data type Token.
   * token represents tokenized strings.
   * The base type of token is normalizedString.
   *
   * @author Chris Haddad <chaddad@cobia.net>
   * @see <a href="http://www.w3.org/TR/xmlschema-2/#token">XML Schema 3.3.2</a>
   */
  public class Token extends NormalizedString {
  
      public Token() {
          super();
      }
  
      /**
       * ctor for Token
       * @exception Exception will be thrown if validation fails
       */
      public Token(String stValue) throws Exception {
          try {
              setValue(stValue);
          }
          catch (Exception e) {
              // recast normalizedString exception as token exception
              throw new Exception(JavaUtils.getMessage("badToken00") + "data=[" +
                      stValue + "]");
          }
      }
  
      /**
       *
       * validate the value against the xsd definition
       *
       * The value space of token is the set of strings that do not
       * contain the line feed (#xA) nor tab (#x9) characters, that
       * have no leading or trailing spaces (#x20) and that have no
       * internal sequences of two or more spaces. The lexical space
       * of token is the set of strings that do not contain the line
       * feed (#xA) nor tab (#x9) characters, that have no leading or
       * trailing spaces (#x20) and that have no internal sequences of two
       * or more spaces.
       */
      public boolean isValid(java.lang.String stValue) {
          int scan;
  
          // no leading space
          if (stValue.charAt(0) == 0x20)
              return false;
  
          // no trail space
          if (stValue.charAt(stValue.length() - 1) == 0x20)
              return false;
  
          for (scan=0; scan < stValue.length(); scan++) {
              char cDigit = stValue.charAt(scan);
              switch (cDigit) {
                  case 0x09:
                  case 0x0A:
                      return false;
                  case 0x20:
                     // no doublspace
                      if (scan+1 < stValue.length())
                          if (stValue.charAt(scan + 1) == 0x20) {
                              return false;
                          }
                  default:
                      break;
              }
          }
          return true;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/NormalizedStringDeserializer.java
  
  Index: NormalizedStringDeserializer.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.encoding.ser;
  
  import org.apache.axis.encoding.NormalizedString;
  import org.apache.axis.encoding.ser.SimpleDeserializer;
  
  import javax.xml.namespace.QName;
  
  /**
   * Deserializer for xsd:normalizedString elements
   *
   * @author Chris Haddad (chaddad@cobia.net)
   * @see <a href="http://www.w3.org/TR/xmlschema-2/#normalizedString">XML Schema Part 2: Datatypes 3.3.1 </a>
   */
  public class NormalizedStringDeserializer extends SimpleDeserializer
  {
      public NormalizedStringDeserializer(Class javaType, QName xmlType) {
          super(javaType, xmlType);
      }
  
      public Object makeValue(String source) throws Exception {
          return new NormalizedString(source);
      } // makeValue
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/NormalizedStringDeserializerFactory.java
  
  Index: NormalizedStringDeserializerFactory.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.encoding.ser;
  import javax.xml.namespace.QName;
  
  
  /**
   * DeserializerFactory for an xsd:normalizedString.
   *
   * @author Chris Haddad <chaddad@cobia.net>
   */
  public class NormalizedStringDeserializerFactory extends BaseDeserializerFactory {
      public NormalizedStringDeserializerFactory(Class javaType, QName xmlType) {
          super(NormalizedStringDeserializer.class, xmlType, javaType);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/NormalizedStringSerializer.java
  
  Index: NormalizedStringSerializer.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.encoding.ser;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.namespace.QName;
  
  import java.io.IOException;
  
  import org.apache.axis.Constants;
  import org.apache.axis.wsdl.fromJava.Types;
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.NormalizedString;
  import org.apache.axis.utils.JavaUtils;
  /**
   * Serializer for xsd:normalizedString
   *
   * @author Chris Haddad <chaddad@cobia.net>
   * @see <a href="http://www.w3.org/TR/xmlschema-2/#NormalizedString">XML Schema 3.3.1 </a>
   */
  public class NormalizedStringSerializer implements Serializer {
  
      public QName xmlType;
      public Class javaType;
      public NormalizedStringSerializer(Class javaType, QName xmlType) {
          this.xmlType = xmlType;
          this.javaType = javaType;
      }
  
      /**
       * Serialize a NormalizedString object.
       */
      public void serialize(QName name, Attributes attributes,
                            Object value, SerializationContext context)
          throws IOException
      {
          context.startElement(name, attributes);
  
          value = JavaUtils.convert(value, javaType);
          if (javaType == NormalizedString.class) {
              context.writeString(value.toString());
          }
          context.endElement();
      }
  
      public String getMechanismType() { return Constants.AXIS_SAX; }
  
      /**
       * Return XML schema for the specified type, suitable for insertion into
       * the <types> element of a WSDL document.
       *
       * @param types the Java2WSDL Types object which holds the context
       *              for the WSDL being generated.
       * @return true if we wrote a schema, false if we didn't.
       * @see org.apache.axis.wsdl.fromJava.Types
       */
      public boolean writeSchema(Types types) throws Exception {
          return false;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/NormalizedStringSerializerFactory.java
  
  Index: NormalizedStringSerializerFactory.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.encoding.ser;
  
  import javax.xml.namespace.QName;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  
  /**
   * SerializerFactory for xsd:normalizedString
   *
   * @author Chris Haddad <chaddad@cobia.net>
   */
  public class NormalizedStringSerializerFactory extends BaseSerializerFactory {
    public NormalizedStringSerializerFactory(Class javaType, QName xmlType) {
          super(NormalizedStringSerializer.class, true, xmlType, javaType);   // true indicates shared class
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/TokenDeserializer.java
  
  Index: TokenDeserializer.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.encoding.ser;
  
  import org.apache.axis.encoding.Token;
  import org.apache.axis.encoding.ser.SimpleDeserializer;
  import javax.xml.namespace.QName;
  
  /**
   * Deserializer for xsd:token elements
   *
   * @author Chris Haddad (chaddad@cobia.net)
   */
  public class TokenDeserializer extends SimpleDeserializer
  {
      public Object makeValue(String source) throws Exception {
          return new Token(source);
      } // makeValue
  
      public TokenDeserializer(Class javaType, QName xmlType) {
          super(javaType, xmlType);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/TokenDeserializerFactory.java
  
  Index: TokenDeserializerFactory.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.encoding.ser;
  
  import javax.xml.namespace.QName;
  
  /**
   * DeserializerFactory for xsd:token
   *
   * @author Chris Haddad <chaddad@cobia.net>
   */
  public class TokenDeserializerFactory extends BaseDeserializerFactory {
      public TokenDeserializerFactory(Class javaType, QName xmlType) {
          super(TokenDeserializer.class, xmlType, javaType);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/TokenSerializer.java
  
  Index: TokenSerializer.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.encoding.ser;
  
  import org.apache.axis.Constants;
  import org.apache.axis.wsdl.fromJava.Types;
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.Token;
  import org.apache.axis.utils.JavaUtils;
  import org.xml.sax.Attributes;
  
  import java.io.IOException;
  import javax.xml.namespace.QName;
  
  /**
   * Serializer for xsd:token.
   *
   * @author Chris Haddad <chaddad@cobia.net>
   * @see <a href="http://www.w3.org/TR/xmlschema-2/#token">XML Schema 3.3.2</a>
   */
  public class TokenSerializer implements Serializer {
  
      public QName xmlType;
      public Class javaType;
      public TokenSerializer(Class javaType, QName xmlType) {
          this.xmlType = xmlType;
          this.javaType = javaType;
      }
  
      /**
       * Serialize a Token quantity.
       */
      public void serialize(QName name, Attributes attributes,
                            Object value, SerializationContext context)
          throws IOException
      {
          context.startElement(name, attributes);
  
          value = JavaUtils.convert(value, javaType);
          if (javaType == Token.class) {
              context.writeString(value.toString());
          }
          context.endElement();
      }
  
      public String getMechanismType() { return Constants.AXIS_SAX; }
  
      /**
       * Return XML schema for the specified type, suitable for insertion into
       * the <types> element of a WSDL document.
       *
       * @param types the Java2WSDL Types object which holds the context
       *              for the WSDL being generated.
       * @return true if we wrote a schema, false if we didn't.
       * @see org.apache.axis.wsdl.fromJava.Types
       */
      public boolean writeSchema(Types types) throws Exception {
          return false;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/ser/TokenSerializerFactory.java
  
  Index: TokenSerializerFactory.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.encoding.ser;
  
  import javax.xml.namespace.QName;
  
  import java.io.IOException;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  /**
   * SerializerFactory for xsd:token
   *
   * @author Chris Haddad <chaddad@cobia.net>
   */
  public class TokenSerializerFactory extends BaseSerializerFactory {
      public TokenSerializerFactory(Class javaType, QName xmlType) {
          super(TokenSerializer.class, true, xmlType, javaType);   // true indicates shared class
      }
  
    }
  
  
  
  1.24      +2 -1      xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
  
  Index: axisNLS.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- axisNLS.properties	8 Jul 2002 15:56:36 -0000	1.23
  +++ axisNLS.properties	9 Jul 2002 15:17:31 -0000	1.24
  @@ -939,4 +939,5 @@
   
   badOutParameter00=A holder could not be found or constructed for the OUT parameter {0} of method {1}.
   setJavaTypeErr00=Illegal argument passed to ParameterDesc.setJavaType.  The java type {0} does not match the mode {1}
  -
  +badNormalizedString00=Invalid normalizedString value
  +badToken00=Invalid token value
  
  
  
  1.19      +2 -0      xml-axis/java/test/encoding/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/PackageTests.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PackageTests.java	3 Jul 2002 22:28:13 -0000	1.18
  +++ PackageTests.java	9 Jul 2002 15:17:31 -0000	1.19
  @@ -37,6 +37,8 @@
           suite.addTestSuite(TestRoundTrip.class);
           suite.addTestSuite(TestOmittedValues.class);
           suite.addTestSuite(TestMultiRefIdentity.class);
  +        suite.addTestSuite(TestNormalizedString.class);
  +        suite.addTestSuite(TestToken.class);
           return suite;
       }
   }
  
  
  
  1.16      +13 -0     xml-axis/java/test/encoding/TestDeser2001.java
  
  Index: TestDeser2001.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser2001.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestDeser2001.java	27 Jun 2002 23:10:36 -0000	1.15
  +++ TestDeser2001.java	9 Jul 2002 15:17:31 -0000	1.16
  @@ -1,7 +1,10 @@
   package test.encoding;
   
   import org.apache.axis.Constants;
  +
   import org.apache.axis.encoding.Hex;
  +import org.apache.axis.encoding.NormalizedString;
  +import org.apache.axis.encoding.Token;
   
   import java.util.ArrayList;
   import java.util.Calendar;
  @@ -119,6 +122,16 @@
       public void testHexNull() throws Exception {
           deserialize("<result xsi:type=\"xsd:hexBinary\"></result>",
                       new Hex(""),true);
  +    }
  +
  +    public void testToken() throws Exception {
  +        deserialize("<result xsi:type=\"xsd:token\">abcdefg</result>",
  +                    new Token("abcdefg"),true);
  +    }
  +
  +    public void testNormalizedString() throws Exception {
  +        deserialize("<result xsi:type=\"xsd:normalizedString\">abcdefg</result>",
  +                    new NormalizedString("abcdefg"),true);
       }
   
       public void testQName() throws Exception {
  
  
  
  1.1                  xml-axis/java/test/encoding/TestNormalizedString.java
  
  Index: TestNormalizedString.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 test.encoding;
  
  import junit.framework.TestCase;
  
  import org.apache.axis.encoding.NormalizedString;
  
  /**
   * Test validation of encoding.NormalizedString
   */
  public class TestNormalizedString extends TestCase {
  
      public TestNormalizedString(String name) {
          super(name);
      }
  
      /**
       * Run a failure test.  value should be invalid.
       */
      private void runFailTest(String value) throws Exception {
          NormalizedString oNormalizedString = null;
          try {
              oNormalizedString = new NormalizedString(value);
          }
          catch (Exception e) { // catch the validation exception
          }
          // object is not iNstantiated on bad data value
          assertNull("validation restriction failed [" +
                  value + "]. did not restrict bad value.", oNormalizedString);
      }
  
      /**
       * Run a successful test.  value should be valid.
       */
      private void runPassTest(String value) throws Exception {
          NormalizedString oNormalizedString = null;
          try {
              oNormalizedString = new NormalizedString(value);
          }
          catch (Exception e) { // catch the validation exception
          }
          assertEquals("normalized string not equal" +
                  value, oNormalizedString.toString(), value);
      }
  
      /**
       * Test that "a simple string" succeeds.
       */
      public void testNsSimpleString() throws Exception {
          runPassTest("a simple string");
      }
  
      /**
       * Test that "this has \r carriage return" fails.
       */
      public void testNsCarriageReturn() throws Exception {
          runFailTest("this has \r carriage return");
      }
  
      /**
       * Test that "this has \n line feed" fails.
       */
      public void testNsLineFeed() throws Exception {
          runFailTest("this has \n line feed");
      }
  
      /**
       * Test that "this has \t a tab" fails.
       */
      public void testNsStringWithTabs() throws Exception {
          runFailTest("this has \t a tab");
      }
  
      /**
       * differentiate from xsd:token
       */
      public void testNsStringWithLeadingSpaces() throws Exception {
          runPassTest("  a failure case");
      }
  
      /*
       * differentiate from xsd:token
       */
      public void testNsStringWithTrailingSpaces() throws Exception {
          runPassTest("this is a  ");
      }
  
      /*
       * differentiate from xsd:token
       */
      public void testNsStringWithLeadingAndTrailingSpaces() throws Exception {
          runPassTest("          centered          ");
      }
  
      /*
       * differentiate from xsd:token
       */
      public void testNsDoubleSpace() throws Exception {
          runPassTest("a   B"); // note: \r fails
      }
  }
  
  
  
  1.1                  xml-axis/java/test/encoding/TestToken.java
  
  Index: TestToken.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 test.encoding;
  
  import junit.framework.TestCase;
  import org.apache.axis.encoding.Token;
  
  /**
   * Test validation of encoding.Token
   */
  public class TestToken extends TestCase {
  
  
      public TestToken(String name) {
          super(name);
      }
  
      /**
       * Run a failure test.  value should be invalid.
       */
      private void runFailTest(String value) throws Exception {
          Token oToken = null;
          try {
              oToken = new Token(value);
          }
          catch (Exception e) { // catch the validation exception
          }
          assertNull(
                  "Token validation restriction failed. did not restrict bad value [" +
                     value + "] did not restrict bad value", oToken);
      }
  
      /**
       * Run a successful test.  value should be valid.
       */
      private void runPassTest(String value) throws Exception {
          Token oToken = null;
          try {
              oToken = new Token(value);
          }
          catch (Exception e) { // catch the validation exception
          }
          assertEquals("Token strings not equal. orig value:" + value, oToken.toString(), value);
      }
  
      /**
       * Test a simple string.
       */
      public void testSimpleString() throws Exception {
          runPassTest("a simple string");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept a CR
       */
      public void testCarriageString() throws Exception {
          runPassTest("a carriage return\r string\r");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept a \n
       */
      public void testLineFeed() throws Exception {
          runFailTest("line one\n line two");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept a \t
       */
      public void testStringWithTabs() throws Exception {
          runFailTest("this has \t a tab");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept leading spaces.
       */
      public void testStringWithLeadingSpaces() throws Exception {
          runFailTest("  a failure case");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept trailing spaces.
       */
      public void testStringWithTrailingSpaces() throws Exception {
          runFailTest("this is a  ");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept
       * leading and trailing spaces.
       */
      public void testStringWithLeadingAndTrailingSpaces() throws Exception {
          runFailTest("          centered          ");
      }
  
      /**
       * this is to differentiate from normalized string which cannot accept double spaces.
       */
      public void testDoubleSpace() throws Exception {
          runFailTest("a   B"); // note: \r fails
      }
  }
  
  
  

Mime
View raw message