axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/test/encoding DataDeser.java DataDeserFactory.java DataSerFactory.java DataSer.java TestSer.java TestString.java TestXsiType.java
Date Sat, 26 Jan 2002 02:52:38 GMT
scheu       02/01/25 18:52:38

  Modified:    java/samples/attachments EchoAttachment.java
               java/samples/bidbuy TestClient.java v3.java
               java/samples/echo TestClient.java deploy.wsdd
               java/samples/encoding DataSer.java TestSer.java
               java/samples/userguide/example5 Client.java
               java/test/RPCDispatch TestSerializedRPC.java
               java/test/encoding DataSer.java TestSer.java TestString.java
                        TestXsiType.java
  Added:       java/samples/encoding DataDeser.java DataDeserFactory.java
                        DataSerFactory.java
               java/test/encoding DataDeser.java DataDeserFactory.java
                        DataSerFactory.java
  Log:
  (see prior commits)
  
  Revision  Changes    Path
  1.6       +11 -15    xml-axis/java/samples/attachments/EchoAttachment.java
  
  Index: EchoAttachment.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/attachments/EchoAttachment.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EchoAttachment.java	11 Jan 2002 21:42:10 -0000	1.5
  +++ EchoAttachment.java	26 Jan 2002 02:52:37 -0000	1.6
  @@ -61,8 +61,8 @@
   import org.apache.axis.client.Service;
   import org.apache.axis.client.Transport;
   import org.apache.axis.encoding.XMLType;
  -import org.apache.axis.encoding.JAFDataHandlerSerializer;
  -import org.apache.axis.encoding.JAFDataHandlerDeserializer;
  +import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;
  +import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
   import org.apache.axis.transport.http.HTTPConstants;
   import org.apache.axis.utils.Options;
   import javax.activation.DataHandler;
  @@ -120,13 +120,11 @@
   
           QName qnameAttachment = new QName("urn:EchoAttachmentsService", "DataHandler");
   
  -        call.addSerializer(dhSource.getClass(),//Add serializer for attachment. 
  -            qnameAttachment,
  -            new JAFDataHandlerSerializer());
  -
  -        call.addDeserializerFactory(qnameAttachment, dhSource.getClass(),
  -            JAFDataHandlerDeserializer.getFactory());
  -
  +        call.registerTypeMapping(dhSource.getClass(),//Add serializer for attachment. 
  +                                 qnameAttachment,
  +                                 JAFDataHandlerSerializerFactory.class,
  +                                 JAFDataHandlerDeserializerFactory.class);
  +                                 
           call.addParameter( "source", qnameAttachment,
                   ParameterMode.PARAM_MODE_IN ); //Add the file.
   
  @@ -210,12 +208,10 @@
   
           QName qnameAttachment = new QName("urn:EchoAttachmentsService", "DataHandler");
   
  -        call.addSerializer(attachments[0].getClass(),//Add serializer for attachment. 
  -            qnameAttachment,
  -            new JAFDataHandlerSerializer());
  -
  -        call.addDeserializerFactory(qnameAttachment, attachments[0].getClass(),
  -            JAFDataHandlerDeserializer.getFactory());
  +        call.registerTypeMapping(attachments[0].getClass(),//Add serializer for attachment. 
  +                                 qnameAttachment,
  +                                 JAFDataHandlerSerializerFactory.class,
  +                                 JAFDataHandlerDeserializerFactory.class);
   
           call.addParameter( "source",   XMLType.SOAP_ARRAY , // new XMLType(qnameAttachment),
               ParameterMode.PARAM_MODE_IN ); //Add the file.
  
  
  
  1.20      +5 -7      xml-axis/java/samples/bidbuy/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/TestClient.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TestClient.java	11 Jan 2002 21:42:10 -0000	1.19
  +++ TestClient.java	26 Jan 2002 02:52:38 -0000	1.20
  @@ -57,7 +57,8 @@
   
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
  -import org.apache.axis.encoding.BeanSerializer;
  +import org.apache.axis.encoding.ser.BeanSerializerFactory;
  +import org.apache.axis.encoding.ser.BeanDeserializerFactory;
   import org.apache.axis.encoding.XMLType;
   import org.apache.axis.transport.http.HTTPTransport;
   import org.apache.axis.utils.Options;
  @@ -109,20 +110,17 @@
           QName poqn = new QName("http://www.soapinterop.org/Bid",
                                  "PurchaseOrder");
           Class cls = PurchaseOrder.class;
  -        call.addSerializer(cls, poqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());
  +        call.registerTypeMapping(cls, poqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
           // register the Address class
           QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
           cls = Address.class;
  -        call.addSerializer(cls, aqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());
  +        call.registerTypeMapping(cls, aqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
           // register the LineItem class
           QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
           cls = LineItem.class;
  -        call.addSerializer(cls, liqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());
  +        call.registerTypeMapping(cls, liqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
           try {
               // Default return type based on what we expect
  
  
  
  1.17      +5 -7      xml-axis/java/samples/bidbuy/v3.java
  
  Index: v3.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/v3.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- v3.java	11 Jan 2002 21:42:10 -0000	1.16
  +++ v3.java	26 Jan 2002 02:52:38 -0000	1.17
  @@ -2,7 +2,8 @@
   
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
  -import org.apache.axis.encoding.BeanSerializer;
  +import org.apache.axis.encoding.ser.BeanSerializerFactory;
  +import org.apache.axis.encoding.ser.BeanDeserializerFactory;
   import org.apache.axis.encoding.XMLType;
   import org.apache.axis.transport.http.HTTPConstants;
   
  @@ -211,20 +212,17 @@
         // register the PurchaseOrder class
         QName poqn = new QName("http://www.soapinterop.org/Bid", "PurchaseOrder");
         Class cls = PurchaseOrder.class;
  -      call.addSerializer(cls, poqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());
  +      call.registerTypeMapping(cls, poqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
         // register the Address class
         QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
         cls = Address.class;
  -      call.addSerializer(cls, aqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());
  +      call.registerTypeMapping(cls, aqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
         // register the LineItem class
         QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
         cls = LineItem.class;
  -      call.addSerializer(cls, liqn, new BeanSerializer(cls));
  -      call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());
  +      call.registerTypeMapping(cls, liqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
         LineItem[]     lineItems = new LineItem[numItems];
         
  
  
  
  1.45      +10 -7     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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- TestClient.java	11 Jan 2002 21:42:10 -0000	1.44
  +++ TestClient.java	26 Jan 2002 02:52:38 -0000	1.45
  @@ -58,8 +58,11 @@
   import org.apache.axis.AxisFault;
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
  -import org.apache.axis.encoding.BeanSerializer;
  +import org.apache.axis.encoding.ser.BeanSerializerFactory;
  +import org.apache.axis.encoding.ser.BeanDeserializerFactory;
   import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
   import org.apache.axis.transport.http.HTTPTransport;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Options;
  @@ -88,7 +91,8 @@
       private static boolean addMethodToAction = false;
       private static String soapAction = "http://soapinterop.org/";
   
  -    private TypeMappingRegistry map;
  +    private TypeMappingRegistry tmr;
  +    private TypeMapping tm;
   
       /**
        * Determine if two objects are equal.  Handles nulls and recursively
  @@ -137,7 +141,6 @@
        * @param toSend object of the correct type to be sent
        */
       private void test(String type, Object toSend) {
  -
           String method = "echo" + type;
   
           type = type.trim();
  @@ -156,7 +159,7 @@
                   // args = new Object[] {new RPCParam(arg, toSend)};
   
                   // Default return type based on what we expect
  -                QName qn = map.getTypeQName(toSend.getClass());
  +                QName qn = tm.getTypeQName(toSend.getClass());
   
                   call.addParameter( arg, qn, ParameterMode.PARAM_MODE_IN);
                   call.setReturnType( qn );
  @@ -195,7 +198,8 @@
               service = new Service();
               call = (Call) service.createCall();
               call.setTargetEndpointAddress( new java.net.URL(url) );
  -            map = call.getMessageContext().getTypeMappingRegistry();
  +            tmr = call.getMessageContext().getTypeMappingRegistry();
  +            tm  = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
           }
           catch( Exception exp ) {
               throw AxisFault.makeFault(exp);
  @@ -209,8 +213,7 @@
           // register the SOAPStruct class
           QName ssqn = new QName("http://soapinterop.org/xsd", "SOAPStruct");
           Class cls = SOAPStruct.class;
  -        call.addSerializer(cls, ssqn, new BeanSerializer(cls));
  -        call.addDeserializerFactory(ssqn, cls, BeanSerializer.getFactory());
  +        call.registerTypeMapping(cls, ssqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
   
           // execute the tests
           test("String      ", "abcdefg");
  
  
  
  1.7       +1 -1      xml-axis/java/samples/echo/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/deploy.wsdd,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- deploy.wsdd	15 Jan 2002 17:57:02 -0000	1.6
  +++ deploy.wsdd	26 Jan 2002 02:52:38 -0000	1.7
  @@ -16,5 +16,5 @@
   
     <typeMapping xmlns:echo="http://soapinterop.org/xsd"
       qname="echo:SOAPStruct" languageSpecificType="java:samples.echo.SOAPStruct"
  -    serializer="org.apache.axis.encoding.BeanSerializer" deserializer="org.apache.axis.encoding.BeanSerializer$BeanDeserFactory"/>
  +    serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanSerializerFactory"/>
   </deployment>
  
  
  
  1.14      +15 -59    xml-axis/java/samples/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/DataSer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DataSer.java	23 Dec 2001 12:33:31 -0000	1.13
  +++ DataSer.java	26 Jan 2002 02:52:38 -0000	1.14
  @@ -1,79 +1,34 @@
   package samples.encoding;
   
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.Constants;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
  +import org.apache.axis.Constants;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
   import java.util.Hashtable;
   
  -public class DataSer extends Deserializer implements Serializer
  +public class DataSer implements Serializer
   {
       public static final String STRINGMEMBER = "stringMember";
       public static final String FLOATMEMBER = "floatMember";
       public static final String DATAMEMBER = "dataMember";
       public static final QName myTypeQName = new QName("typeNS", "Data");
       
  -    public static class DataSerFactory implements DeserializerFactory {
  -        public void setJavaClass(Class cls) {}
  -        public Deserializer getDeserializer() {
  -            return new DataSer();
  -        }
  -    }
  -    public static DeserializerFactory getFactory()
  -    {
  -        return new DataSerFactory();
  -    }
  -    
  -    private Hashtable typesByMemberName = new Hashtable();  
  -    
  -    public DataSer()
  -    {
  -        typesByMemberName.put(STRINGMEMBER, SOAPTypeMappingRegistry.XSD_STRING);
  -        typesByMemberName.put(FLOATMEMBER, SOAPTypeMappingRegistry.XSD_FLOAT);
  -        typesByMemberName.put(DATAMEMBER, myTypeQName);
  -        value = new Data();
  -    }
  -    
  -    /** DESERIALIZER STUFF - event handlers
  -     */
  -    
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        QName typeQName = (QName)typesByMemberName.get(localName);
  -        if (typeQName == null)
  -            throw new SAXException("Invalid element in Data struct - " + localName);
  -        
  -        // These can come in either order.
  -        Deserializer dSer = context.getTypeMappingRegistry().
  -                                                   getDeserializer(typeQName);
  -        try {
  -            dSer.registerValueTarget(value, localName);
  -        } catch (NoSuchFieldException e) {
  -            throw new SAXException(e);
  -        }
  -        
  -        if (dSer == null)
  -            throw new SAXException("No deserializer for a " + typeQName + "???");
  -        
  -        return dSer;
  -    }
  -    
       /** SERIALIZER STUFF
        */
  -    
  +    /**
  +     * Serialize an element named name, with the indicated attributes 
  +     * and value.  
  +     * @param name is the element name
  +     * @param attributes are the attributes...serialize is free to add more.
  +     * @param value is the value
  +     * @param context is the SerializationContext
  +     */
       public void serialize(QName name, Attributes attributes,
                             Object value, SerializationContext context)
           throws IOException
  @@ -83,9 +38,10 @@
           Data data = (Data)value;
           
           context.startElement(name, attributes);
  -        context.serialize(new QName("", STRINGMEMBER), null, data.stringMember);
  -        context.serialize(new QName("", FLOATMEMBER), null, data.floatMember);
  -        context.serialize(new QName("", DATAMEMBER), null, data.dataMember);
  +        context.serialize(new QName("", STRINGMEMBER), null, data.stringMember, String.class);
  +        context.serialize(new QName("", FLOATMEMBER), null, data.floatMember, float.class);
  +        context.serialize(new QName("", DATAMEMBER), null, data.dataMember, Data.class);
           context.endElement();
       }
  +    public String getMechanismType() { return Constants.AXIS_SAX; }
   }
  
  
  
  1.19      +12 -7     xml-axis/java/samples/encoding/TestSer.java
  
  Index: TestSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/TestSer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestSer.java	26 Oct 2001 18:18:57 -0000	1.18
  +++ TestSer.java	26 Jan 2002 02:52:38 -0000	1.19
  @@ -2,8 +2,12 @@
   
   import org.apache.axis.MessageContext;
   import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializationContextImpl;
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
   import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
   import org.apache.axis.message.SOAPEnvelope;
  @@ -48,11 +52,15 @@
               
               if (args.length == 0) {
                   Writer stringWriter = new StringWriter();
  -                SerializationContext context = new SerializationContext(stringWriter, msgContext);
  +                SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
                   
                   TypeMappingRegistry reg = context.getTypeMappingRegistry();
  -                
  -                reg.addSerializer(Data.class, dataQName, new DataSer());
  +                TypeMapping tm = (TypeMapping) reg.getTypeMapping(Constants.URI_SOAP_ENC);
  +                if (tm == null) {
  +                    tm = (TypeMapping) reg.createTypeMapping();
  +                    reg.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +                }
  +                tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
   
                   msg.output(context);
                   
  @@ -68,10 +76,7 @@
                   reader = new FileReader(args[0]);
               }
               
  -            TypeMappingRegistry reg = msgContext.getTypeMappingRegistry();
  -            reg.addDeserializerFactory(dataQName, Data.class, DataSer.getFactory());
  -            
  -            DeserializationContext dser = new DeserializationContext(
  +            DeserializationContext dser = new DeserializationContextImpl(
                   new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
               dser.parse();
               SOAPEnvelope env = dser.getEnvelope();
  
  
  
  1.1                  xml-axis/java/samples/encoding/DataDeser.java
  
  Index: DataDeser.java
  ===================================================================
  package samples.encoding;
  
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.encoding.FieldTarget;
  import org.apache.axis.Constants;
  import org.apache.axis.message.SOAPHandler;
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  import java.util.Hashtable;
  
  public class DataDeser extends DeserializerImpl
  {
      public static final String STRINGMEMBER = "stringMember";
      public static final String FLOATMEMBER = "floatMember";
      public static final String DATAMEMBER = "dataMember";
      public static final QName myTypeQName = new QName("typeNS", "Data");
      
      private Hashtable typesByMemberName = new Hashtable();  
      
      public DataDeser()
      {
          typesByMemberName.put(STRINGMEMBER, Constants.XSD_STRING);
          typesByMemberName.put(FLOATMEMBER, Constants.XSD_FLOAT);
          typesByMemberName.put(DATAMEMBER, myTypeQName);
          value = new Data();
      }
      
      /** DESERIALIZER STUFF - event handlers
       */
  
      /**
       * This method is invoked when an element start tag is encountered.
       * @param namespace is the namespace of the element
       * @param localName is the name of the element
       * @param qName is the prefixed qName of the element
       * @param attributes are the attributes on the element...used to get the type
       * @param context is the DeserializationContext
       */
      public SOAPHandler onStartChild(String namespace,
                                      String localName,
                                      String prefix,
                                      Attributes attributes,
                                      DeserializationContext context)
          throws SAXException
      {
          QName typeQName = (QName)typesByMemberName.get(localName);
          if (typeQName == null)
              throw new SAXException("Invalid element in Data struct - " + localName);
          
          // These can come in either order.
          Deserializer dSer = context.getDeserializerForType(typeQName);
          try {
              dSer.registerValueTarget(new FieldTarget(value, localName));
          } catch (NoSuchFieldException e) {
              throw new SAXException(e);
          }
          
          if (dSer == null)
              throw new SAXException("No deserializer for a " + typeQName + "???");
          
          return (SOAPHandler) dSer;
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/encoding/DataDeserFactory.java
  
  Index: DataDeserFactory.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 samples.encoding;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerFactory;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.Constants;
  
  import java.util.Iterator;
  import java.util.Vector;
  
  /**
   * DeserializerFactory for DataDeser
   *
   * @author Rich Scheuerle <scheu@us.ibm.com>
   */
  public class DataDeserFactory implements DeserializerFactory {
      private Vector mechanisms;
  
      public DataDeserFactory() {
      }
      public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
          return new DataDeser();
      }
      public Iterator getSupportedMechanismTypes() {
          if (mechanisms == null) {
              mechanisms = new Vector();
              mechanisms.add(Constants.AXIS_SAX);
          }
          return mechanisms.iterator();
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/encoding/DataSerFactory.java
  
  Index: DataSerFactory.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 samples.encoding;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerFactory;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.Constants;
  
  import java.util.Iterator;
  import java.util.Vector;
  
  /**
   * SerializerFactory for DataSer
   *
   * @author Rich Scheuerle <scheu@us.ibm.com>
   */
  public class DataSerFactory implements SerializerFactory {
      private Vector mechanisms;
  
      public DataSerFactory() {
      }
      public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
          return new DataSer();
      }
      public Iterator getSupportedMechanismTypes() {
          if (mechanisms == null) {
              mechanisms = new Vector();
              mechanisms.add(Constants.AXIS_SAX);
          }
          return mechanisms.iterator();
      }
  }
  
  
  
  1.13      +3 -3      xml-axis/java/samples/userguide/example5/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example5/Client.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Client.java	11 Jan 2002 21:42:11 -0000	1.12
  +++ Client.java	26 Jan 2002 02:52:38 -0000	1.13
  @@ -83,9 +83,9 @@
           Call     call    = (Call) service.createCall();
           QName    qn      = new QName( "urn:BeanService", "Order" );
   
  -        call.addSerializer(Order.class, qn,
  -                    new org.apache.axis.encoding.BeanSerializer(Order.class));
  -        
  +        call.registerTypeMapping(Order.class, qn,
  +                      new org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn),        
  +                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, qn));        
           String result;
           try {
               call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
  
  
  
  1.23      +40 -17    xml-axis/java/test/RPCDispatch/TestSerializedRPC.java
  
  Index: TestSerializedRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestSerializedRPC.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- TestSerializedRPC.java	15 Jan 2002 17:57:03 -0000	1.22
  +++ TestSerializedRPC.java	26 Jan 2002 02:52:38 -0000	1.23
  @@ -6,8 +6,10 @@
   import org.apache.axis.Handler;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.BeanSerializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.encoding.ser.BeanSerializerFactory;
  +import org.apache.axis.encoding.ser.BeanDeserializerFactory;
  +import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMapping;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
  @@ -132,11 +134,18 @@
        * Test a method that reverses a data structure
        */
       public void testSerReverseData() throws Exception {
  -        BeanSerializer ser = new BeanSerializer(Data.class);
  -        DeserializerFactory dSerFactory = BeanSerializer.getFactory();
  -        QName qName = new QName("urn:foo", "Data");
  -        engine.registerTypeMapping(qName, Data.class, dSerFactory,
  -                                   ser);
  +        Class javaType = Data.class;
  +        QName xmlType = new QName("urn:foo", "Data");
  +        BeanSerializerFactory   sf = new BeanSerializerFactory(javaType, xmlType);
  +        BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
  +
  +        TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  +        if (tm == null) {
  +            tm = (TypeMapping) tmr.createTypeMapping();
  +            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +        }
  +        tm.register(javaType, xmlType, sf, df);
           
           // invoke the service and verify the result
           String arg = "<arg0 xmlns:foo=\"urn:foo\" xsi:type=\"foo:Data\">";
  @@ -150,11 +159,18 @@
        * Test a method that reverses a data structure
        */
       public void testReverseDataWithUntypedParam() throws Exception {
  -        BeanSerializer ser = new BeanSerializer(Data.class);
  -        DeserializerFactory dSerFactory = BeanSerializer.getFactory();
  -        QName qName = new QName("urn:foo", "Data");
  -        engine.registerTypeMapping(qName, Data.class, dSerFactory,
  -                                   ser);
  +        Class javaType = Data.class;
  +        QName xmlType = new QName("urn:foo", "Data");
  +        BeanSerializerFactory   sf = new BeanSerializerFactory(javaType, xmlType);
  +        BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
  +
  +        TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  +        if (tm == null) {
  +            tm = (TypeMapping) tmr.createTypeMapping();
  +            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +        }
  +        tm.register(javaType, xmlType, sf, df);
           
           // invoke the service and verify the result
           String arg = "<arg0 xmlns:foo=\"urn:foo\">";
  @@ -168,11 +184,18 @@
        * Test DOM round tripping
        */
       public void testArgAsDOM() throws Exception {
  -        BeanSerializer ser = new BeanSerializer(Data.class);
  -        DeserializerFactory dSerFactory = BeanSerializer.getFactory();
  -        QName qName = new QName("urn:foo", "Data");
  -        engine.registerTypeMapping(qName, Data.class, dSerFactory,
  -                                   ser);
  +        Class javaType = Data.class;
  +        QName xmlType = new QName("urn:foo", "Data");
  +        BeanSerializerFactory   sf = new BeanSerializerFactory(javaType, xmlType);
  +        BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
  +
  +        TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  +        if (tm == null) {
  +            tm = (TypeMapping) tmr.createTypeMapping();
  +            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +        }
  +        tm.register(javaType, xmlType, sf, df);
           
           // invoke the service and verify the result
           String arg = "<arg0 xmlns:foo=\"urn:foo\">";
  
  
  
  1.11      +14 -72    xml-axis/java/test/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataSer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DataSer.java	23 Dec 2001 12:33:32 -0000	1.10
  +++ DataSer.java	26 Jan 2002 02:52:38 -0000	1.11
  @@ -1,91 +1,32 @@
   package test.encoding;
   
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.Constants;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
  +import org.apache.axis.Constants;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
   import java.util.Hashtable;
   
  -public class DataSer extends Deserializer implements Serializer
  +public class DataSer implements Serializer
   {
       public static final String STRINGMEMBER = "stringMember";
       public static final String FLOATMEMBER = "floatMember";
       
  -    public static class DataSerFactory implements DeserializerFactory {
  -        public void setJavaClass(Class cls) {};
  -        public Deserializer getDeserializer() {
  -            return new DataSer();
  -        }
  -    }
  -    public static DeserializerFactory getFactory()
  -    {
  -        return new DataSerFactory();
  -    }
  -    
  -    private Hashtable typesByMemberName = new Hashtable();  
  -    
  -    public DataSer()
  -    {
  -        typesByMemberName.put(STRINGMEMBER, SOAPTypeMappingRegistry.XSD_STRING);
  -        typesByMemberName.put(FLOATMEMBER, SOAPTypeMappingRegistry.XSD_FLOAT);
  -        value = new Data();
  -    }
  -    
  -    /** DESERIALIZER STUFF - event handlers
  -     */
  -    
  -    public SOAPHandler onStartChild(String namespace,
  -                                    String localName,
  -                                    String prefix,
  -                                    Attributes attributes,
  -                                    DeserializationContext context)
  -        throws SAXException
  -    {
  -        QName typeQName = (QName)typesByMemberName.get(localName);
  -        if (typeQName == null)
  -            throw new SAXException("Invalid element in Data struct - " +
  -                                   localName);
  -        
  -        // These can come in either order.
  -        Deserializer dSer = context.getTypeMappingRegistry().
  -                                                     getDeserializer(typeQName);
  -        
  -        if (dSer == null)
  -            throw new SAXException("No deserializer for a " + typeQName + "???");
  -        
  -        try {
  -            dSer.registerValueTarget(new Deserializer.FieldTarget(value,
  -                                                                  localName));
  -        } catch (NoSuchFieldException e) {
  -            throw new SAXException(e);
  -        }
  -        
  -        return dSer;
  -    }
  -    
  -    public void onEndChild(String localName, Deserializer deserializer)
  -        throws SAXException
  -    {
  -        if (STRINGMEMBER.equals(localName)) {
  -            ((Data)value).stringMember = (String)deserializer.getValue();
  -        } else if (FLOATMEMBER.equals(localName)) {
  -            ((Data)value).floatMember = (Float)deserializer.getValue();
  -        } else {
  -            throw new SAXException("No such child - " + localName);
  -        }
  -    }
  -        
       /** SERIALIZER STUFF
        */
  -    
  +    /**
  +     * Serialize an element named name, with the indicated attributes 
  +     * and value.  
  +     * @param name is the element name
  +     * @param attributes are the attributes...serialize is free to add more.
  +     * @param value is the value
  +     * @param context is the SerializationContext
  +     */
       public void serialize(QName name, Attributes attributes,
                             Object value, SerializationContext context)
           throws IOException
  @@ -95,8 +36,9 @@
           Data data = (Data)value;
           
           context.startElement(name, attributes);
  -        context.serialize(new QName("", STRINGMEMBER), null, data.stringMember);
  -        context.serialize(new QName("", FLOATMEMBER), null, data.floatMember);
  +        context.serialize(new QName("", STRINGMEMBER), null, data.stringMember, String.class);
  +        context.serialize(new QName("", FLOATMEMBER), null, data.floatMember, float.class);
           context.endElement();
       }
  +    public String getMechanismType() { return Constants.AXIS_SAX; }
   }
  
  
  
  1.18      +12 -6     xml-axis/java/test/encoding/TestSer.java
  
  Index: TestSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestSer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TestSer.java	2 Nov 2001 03:07:42 -0000	1.17
  +++ TestSer.java	26 Jan 2002 02:52:38 -0000	1.18
  @@ -3,8 +3,12 @@
   import junit.framework.TestCase;
   import org.apache.axis.MessageContext;
   import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializationContextImpl;
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
   import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
   import org.apache.axis.message.SOAPEnvelope;
  @@ -58,13 +62,17 @@
           msg.addBodyElement(body);
           
           Writer stringWriter = new StringWriter();
  -        SerializationContext context = new SerializationContext(stringWriter, msgContext);
  +        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
           context.setDoMultiRefs(multiref);
           
           TypeMappingRegistry reg = context.getTypeMappingRegistry();
  +        TypeMapping tm = (TypeMapping) reg.getTypeMapping(Constants.URI_SOAP_ENC);
  +        if (tm == null) {
  +            tm = (TypeMapping) reg.createTypeMapping();
  +            reg.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +        }
           QName dataQName = new QName("typeNS", "Data");
  -        
  -        reg.addSerializer(Data.class, dataQName, new DataSer());
  +        tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
   
           msg.output(context);
           
  @@ -76,10 +84,8 @@
           
           StringReader reader = new StringReader(msgString);
           
  -        DeserializationContext dser = new DeserializationContext(
  +        DeserializationContext dser = new DeserializationContextImpl(
               new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
  -        reg = dser.getTypeMappingRegistry();
  -        reg.addDeserializerFactory(dataQName, Data.class, DataSer.getFactory());
           dser.parse();
           
           SOAPEnvelope env = dser.getEnvelope();
  
  
  
  1.12      +4 -2      xml-axis/java/test/encoding/TestString.java
  
  Index: TestString.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestString.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestString.java	18 Oct 2001 13:28:38 -0000	1.11
  +++ TestString.java	26 Jan 2002 02:52:38 -0000	1.12
  @@ -3,7 +3,9 @@
   import junit.framework.TestCase;
   import org.apache.axis.MessageContext;
   import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.DeserializationContextImpl;
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
   import org.apache.axis.message.SOAPEnvelope;
  @@ -33,7 +35,7 @@
           msg.addBodyElement(body);
           
           Writer stringWriter = new StringWriter();
  -        SerializationContext context = new SerializationContext(stringWriter, msgContext);
  +        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
           
           msg.output(context);
           
  @@ -41,7 +43,7 @@
           
           StringReader reader = new StringReader(msgString);
           
  -        DeserializationContext dser = new DeserializationContext(
  +        DeserializationContext dser = new DeserializationContextImpl(
               new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
           dser.parse();
           
  
  
  
  1.10      +3 -2      xml-axis/java/test/encoding/TestXsiType.java
  
  Index: TestXsiType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestXsiType.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestXsiType.java	15 Jan 2002 17:57:03 -0000	1.9
  +++ TestXsiType.java	26 Jan 2002 02:52:38 -0000	1.10
  @@ -9,6 +9,7 @@
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SerializationContextImpl;
   import org.apache.axis.encoding.XMLType;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
  @@ -58,8 +59,8 @@
           msg.addBodyElement(body);
   
           Writer stringWriter = new StringWriter();
  -        SerializationContext context = new SerializationContext(stringWriter,
  -                                                                msgContext);
  +        SerializationContext context = new SerializationContextImpl(stringWriter,
  +                                                                    msgContext);
   
           msg.output(context);
   
  
  
  
  1.1                  xml-axis/java/test/encoding/DataDeser.java
  
  Index: DataDeser.java
  ===================================================================
  package test.encoding;
  
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.encoding.FieldTarget;
  import org.apache.axis.Constants;
  import org.apache.axis.message.SOAPHandler;
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  import java.util.Hashtable;
  
  public class DataDeser extends DeserializerImpl
  {
      public static final String STRINGMEMBER = "stringMember";
      public static final String FLOATMEMBER = "floatMember";
      
      private Hashtable typesByMemberName = new Hashtable();  
      
      public DataDeser()
      {
          typesByMemberName.put(STRINGMEMBER, Constants.XSD_STRING);
          typesByMemberName.put(FLOATMEMBER, Constants.XSD_FLOAT);
          value = new Data();
      }
      
      /** DESERIALIZER STUFF - event handlers
       */
  
      /**
       * This method is invoked when an element start tag is encountered.
       * @param namespace is the namespace of the element
       * @param localName is the name of the element
       * @param qName is the prefixed qName of the element
       * @param attributes are the attributes on the element...used to get the type
       * @param context is the DeserializationContext
       */
      public SOAPHandler onStartChild(String namespace,
                                      String localName,
                                      String prefix,
                                      Attributes attributes,
                                      DeserializationContext context)
          throws SAXException
      {
          QName typeQName = (QName)typesByMemberName.get(localName);
          if (typeQName == null)
              throw new SAXException("Invalid element in Data struct - " + localName);
          
          // These can come in either order.
          Deserializer dSer = context.getDeserializerForType(typeQName);
          try {
              dSer.registerValueTarget(new FieldTarget(value, localName));
          } catch (NoSuchFieldException e) {
              throw new SAXException(e);
          }
          
          if (dSer == null)
              throw new SAXException("No deserializer for a " + typeQName + "???");
          
          return (SOAPHandler) dSer;
      }
  }
  
  
  
  1.1                  xml-axis/java/test/encoding/DataDeserFactory.java
  
  Index: DataDeserFactory.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 org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerFactory;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.Constants;
  
  import java.util.Iterator;
  import java.util.Vector;
  
  /**
   * DeserializerFactory for DataDeser
   *
   * @author Rich Scheuerle <scheu@us.ibm.com>
   */
  public class DataDeserFactory implements DeserializerFactory {
      private Vector mechanisms;
  
      public DataDeserFactory() {
      }
      public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) {
          return new DataDeser();
      }
      public Iterator getSupportedMechanismTypes() {
          if (mechanisms == null) {
              mechanisms = new Vector();
              mechanisms.add(Constants.AXIS_SAX);
          }
          return mechanisms.iterator();
      }
  }
  
  
  
  1.1                  xml-axis/java/test/encoding/DataSerFactory.java
  
  Index: DataSerFactory.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 org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  
  import javax.xml.rpc.namespace.QName;
  import java.io.IOException;
  
  import org.apache.axis.encoding.Serializer;
  import org.apache.axis.encoding.SerializerFactory;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.DeserializerFactory;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.DeserializerImpl;
  import org.apache.axis.Constants;
  
  import java.util.Iterator;
  import java.util.Vector;
  
  /**
   * SerializerFactory for DataSer
   *
   * @author Rich Scheuerle <scheu@us.ibm.com>
   */
  public class DataSerFactory implements SerializerFactory {
      private Vector mechanisms;
  
      public DataSerFactory() {
      }
      public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
          return new DataSer();
      }
      public Iterator getSupportedMechanismTypes() {
          if (mechanisms == null) {
              mechanisms = new Vector();
              mechanisms.add(Constants.AXIS_SAX);
          }
          return mechanisms.iterator();
      }
  }
  
  
  

Mime
View raw message