You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2001/07/08 02:02:12 UTC

cvs commit: xml-axis/java/src/org/apache/axis/encoding BooleanDeserializerFactory.java SOAPTypeMappingRegistry.java

rubys       01/07/07 17:02:12

  Modified:    java/samples/echo EchoService.java TestClient.java
               java/src/org/apache/axis/encoding
                        SOAPTypeMappingRegistry.java
  Added:       java/src/org/apache/axis/encoding
                        BooleanDeserializerFactory.java
  Log:
  Add Decimal and Boolean tests
  
  Revision  Changes    Path
  1.3       +15 -0     xml-axis/java/samples/echo/EchoService.java
  
  Index: EchoService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/EchoService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EchoService.java	2001/07/04 02:09:49	1.2
  +++ EchoService.java	2001/07/08 00:02:11	1.3
  @@ -56,6 +56,7 @@
   package samples.echo ;
   
   import java.util.*;
  +import java.math.BigDecimal;
   
   /**
    * Test implementation of the echo interop service.  Original description of
  @@ -145,6 +146,20 @@
        * This method accepts a Date/Time and echoes it back to the client.
        */
       public Date echoDate(Date input) {
  +        return input;
  +    }
  +
  +    /**
  +     * This method accepts a boolean and echoes it back to the client.
  +     */
  +    public BigDecimal echoDecimal(BigDecimal input) {
  +        return input;
  +    }
  +
  +    /**
  +     * This method accepts a boolean and echoes it back to the client.
  +     */
  +    public boolean echoBoolean(boolean input) {
           return input;
       }
   }
  
  
  
  1.10      +3 -0      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestClient.java	2001/07/03 20:21:54	1.9
  +++ TestClient.java	2001/07/08 00:02:11	1.10
  @@ -57,6 +57,7 @@
   
   import java.lang.reflect.Array;
   import java.util.Date;
  +import java.math.BigDecimal;
   
   import org.apache.axis.AxisFault ;
   import org.apache.axis.client.ServiceClient ;
  @@ -171,6 +172,8 @@
             new SOAPStruct(3, "three", 3.3F)});
           test("Void", null);
           test("Date", new Date());
  +        test("Decimal", new BigDecimal("3.14159"));
  +        test("Boolean", Boolean.TRUE);
       }
   
       /**
  
  
  
  1.18      +0 -6      xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SOAPTypeMappingRegistry.java	2001/07/01 03:41:28	1.17
  +++ SOAPTypeMappingRegistry.java	2001/07/08 00:02:12	1.18
  @@ -134,12 +134,6 @@
       class StringDeserializerFactory implements DeserializerFactory {
           public DeserializerBase getDeserializer() { return new StringDeser(); }
       }
  -    class BooleanDeser extends BasicDeser {
  -        Object makeValue(String source) { return new Boolean(source); }
  -    }
  -    class BooleanDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer() { return new BooleanDeser(); }
  -    }
       class DoubleDeser extends BasicDeser {
           Object makeValue(String source) { return new Double(source); }
       }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/BooleanDeserializerFactory.java
  
  Index: BooleanDeserializerFactory.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.io.IOException;
  import java.text.SimpleDateFormat;
  import java.util.TimeZone;
  import java.util.Date;
  import java.util.Calendar;
  import java.text.DateFormat;
  
  import org.apache.axis.encoding.*;
  import org.apache.axis.utils.QName;
  
  import org.xml.sax.*;
  
  /**
   * General purpose serializer/deserializerFactory for an arbitrary java bean.
   *
   * @author Sam Ruby <ru...@us.ibm.com>
   * @see <a href="http://www.w3.org/TR/2001/PR-xmlschema-2-20010330/#boolean">XML Schema 3.2.7</a>
   */
  public class BooleanDeserializerFactory implements DeserializerFactory {
  
      static class BooleanDeser extends DeserializerBase {
          public void characters(char [] chars, int start, int end)
              throws SAXException
          {
              switch (chars[start]) {
                  case '0': case 'f': case 'F':
                     value = Boolean.FALSE;
                     break;
  
                  case '1': case 't': case 'T': 
                     value = Boolean.TRUE; 
                     break;
  
                  default:
                     throw new NumberFormatException("invalid boolean");
              }
          }
      }
  
      public DeserializerBase getDeserializer() { return new BooleanDeser(); }
  
  }