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 gd...@apache.org on 2005/02/24 22:59:56 UTC

cvs commit: ws-axis/java/tools/org/apache/axis/tools/ant/wsdl Java2WsdlAntTask.java

gdaniels    2005/02/24 13:59:56

  Modified:    java/src/org/apache/axis/client Service.java
               java/src/org/apache/axis/deployment/wsdd WSDDService.java
               java/src/org/apache/axis/description JavaServiceDesc.java
               java/src/org/apache/axis/encoding
                        DefaultJAXRPC11TypeMappingImpl.java
                        DefaultSOAPEncodingTypeMappingImpl.java
                        DefaultTypeMappingImpl.java TypeMapping.java
                        TypeMappingDelegate.java TypeMappingImpl.java
                        TypeMappingRegistryImpl.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/i18n resource.properties
               java/src/org/apache/axis/providers BasicProvider.java
               java/src/org/apache/axis/schema SchemaVersion.java
                        SchemaVersion1999.java SchemaVersion2000.java
                        SchemaVersion2001.java
               java/src/org/apache/axis/wsdl Java2WSDL.java
               java/src/org/apache/axis/wsdl/fromJava Emitter.java
                        Types.java
               java/src/org/apache/axis/wsdl/gen NoopFactory.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
               java/test/chains TestChainFault.java
               java/test/encoding TestAutoTypes.java
               java/test/functional TestJAXRPCSamples.java
               java/test/wsdl/addrNoImplSEI build.xml
               java/test/wsdl/roundtrip2 build.xml
               java/tools/org/apache/axis/tools/ant/wsdl
                        Java2WsdlAntTask.java
  Log:
  * Re-do delegation logic.  There were various problems as a result
    of TypeMappingImpls being both the repository for mappings and
    also the links on delegation chains themselves.  Now TypeMappingImpl
    is purely an internal functional class, and all accesses to
    TypeMappings from the outside use TypeMappingDelegates (which
    might now be better named TypeMappingProxy).  A TypeMappingDelegate
    is responsible for a) delegating all functionality to the
    TypeMappingImpl it points to, and b) maintaining the link to the
    next TypeMappingDelegate in a scoping chain.  This lets us be
    more flexible about connecting them together.  If I have
    SOAPENC and default mappings in TMR1 and delegate to TMR2, the
    order is TMR1[soapenc]->TMR2[soapenc]->TMR1[default]->tmr2[default]
  
  * Create TypeMappingDelegates not TypeMappingImpls wherever needed
  
  * Centralize all the type mapping version code in the TMR.
  
  * Rejigger the Emitters (from/to Java) - instead of having a separate
    default type mapping, just use a TypeMappingRegistry which
    will have its own defaults built in.  This means that the TM we
    use will be able to do defaulting itself.
  
  * Use consistent type mapping versions in addrImplNoSEI/build.xml
  
  * Use consistent type mapping versions in roundtrip2/build.xml
    (wsdl2java needs to be consistent with java2wsdl)
  
  * Various tweaks to tests to accommodate above changes
  
  * Don't block exceptions in JAXRPCSamples test
  
  * Still have some cleanup to do, and right now we're creating way
    too many instances of TypeMappingImpls.  Next step is to change
    it so that only the engine-level TMRs contain the SOAP encoding
    mappings, and subsidiary TMRs (for services) only contain default
    mappings if they specify a "typeMappingVersion" different from
    that of the engine.
  
  Revision  Changes    Path
  1.106     +2 -1      ws-axis/java/src/org/apache/axis/client/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/Service.java,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- Service.java	12 Feb 2005 04:41:20 -0000	1.105
  +++ Service.java	24 Feb 2005 21:59:54 -0000	1.106
  @@ -237,7 +237,8 @@
               initService(parser, serviceName);
           } catch (Exception exp) {
               throw new ServiceException(
  -                    Messages.getMessage("wsdlError00", "" + "", "\n" + exp));
  +                    Messages.getMessage("wsdlError00", "" + "", "\n" + exp),
  +                    exp);
           }
       }
   
  
  
  
  1.111     +8 -11     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- WSDDService.java	12 Feb 2005 04:41:20 -0000	1.110
  +++ WSDDService.java	24 Feb 2005 21:59:54 -0000	1.111
  @@ -25,11 +25,10 @@
   import org.apache.axis.MessageContext;
   import org.apache.axis.attachments.Attachments;
   import org.apache.axis.attachments.AttachmentsImpl;
  +import org.apache.axis.constants.Style;
  +import org.apache.axis.constants.Use;
   import org.apache.axis.description.JavaServiceDesc;
   import org.apache.axis.description.ServiceDesc;
  -import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
  -import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
   import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.SerializerFactory;
  @@ -38,8 +37,6 @@
   import org.apache.axis.encoding.TypeMappingRegistryImpl;
   import org.apache.axis.encoding.ser.BaseDeserializerFactory;
   import org.apache.axis.encoding.ser.BaseSerializerFactory;
  -import org.apache.axis.constants.Style;
  -import org.apache.axis.constants.Use;
   import org.apache.axis.handlers.HandlerInfoChainFactory;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.providers.java.JavaProvider;
  @@ -451,6 +448,8 @@
                                                 respHandler);
           service.setStyle(style);
           service.setUse(use);
  +        service.setServiceDescription(desc);
  +
           service.setHighFidelityRecording(!streaming);
           service.setSendType(sendType);
   
  @@ -469,15 +468,14 @@
               service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
           }
   
  -    // Set handlerInfoChain
  -	if (_wsddHIchain != null) {
  +        // Set handlerInfoChain
  +        if (_wsddHIchain != null) {
               HandlerInfoChainFactory hiChainFactory = _wsddHIchain.getHandlerChainFactory();
   
  -        service.setOption(Constants.ATTR_HANDLERINFOCHAIN, hiChainFactory);
  -    }
  +            service.setOption(Constants.ATTR_HANDLERINFOCHAIN, hiChainFactory);
  +        }
   
           AxisEngine.normaliseOptions(service);
  -        tmr.delegate(registry.getTypeMappingRegistry());
   
           WSDDFaultFlow [] faultFlows = getFaultFlows();
           if (faultFlows != null && faultFlows.length > 0) {
  @@ -490,7 +488,6 @@
               }
           }
   
  -        service.setServiceDescription(desc);
           try {
               service.getInitializedServiceDesc(MessageContext.getCurrentContext());
           } catch (AxisFault axisFault) {
  
  
  
  1.23      +1 -1      ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java
  
  Index: JavaServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JavaServiceDesc.java	8 Feb 2005 18:44:37 -0000	1.22
  +++ JavaServiceDesc.java	24 Feb 2005 21:59:54 -0000	1.23
  @@ -141,7 +141,7 @@
       private ArrayList completedNames = new ArrayList();
   
       /** Our typemapping for resolving Java<->XML type issues */
  -    private TypeMapping tm = null;
  +    private TypeMapping tm = DefaultTypeMappingImpl.getSingleton();
       private TypeMappingRegistry tmr = null;
   
       private boolean haveAllSkeletonMethods = false;
  
  
  
  1.11      +4 -7      ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java
  
  Index: DefaultJAXRPC11TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultJAXRPC11TypeMappingImpl.java	17 Feb 2005 20:05:05 -0000	1.10
  +++ DefaultJAXRPC11TypeMappingImpl.java	24 Feb 2005 21:59:54 -0000	1.11
  @@ -23,7 +23,6 @@
   import org.apache.axis.encoding.ser.DateSerializerFactory;
   import org.apache.axis.encoding.ser.TimeDeserializerFactory;
   import org.apache.axis.encoding.ser.TimeSerializerFactory;
  -import org.apache.axis.schema.SchemaVersion;
   
   /**
    * This is the implementation of the axis Default JAX-RPC SOAP Encoding TypeMapping
  @@ -36,17 +35,15 @@
       /**
        * Obtain the singleton default typemapping.
        */
  -    public static synchronized TypeMapping getSingleton() {
  +    public static synchronized TypeMappingDelegate getSingleton() {
           if (tm == null) {
               tm = new DefaultJAXRPC11TypeMappingImpl();
           }
  -        return tm;
  +        return new TypeMappingDelegate(tm);
       }
   
  -    public static TypeMapping create() {
  -        TypeMapping ret = new DefaultJAXRPC11TypeMappingImpl();
  -        ret.setDelegate(DefaultJAXRPC11TypeMappingImpl.getSingleton());
  -        return ret;
  +    public static TypeMappingImpl create() {
  +        return new DefaultJAXRPC11TypeMappingImpl();
       }
   
       protected DefaultJAXRPC11TypeMappingImpl() {
  
  
  
  1.10      +17 -9     ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java
  
  Index: DefaultSOAPEncodingTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultSOAPEncodingTypeMappingImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultSOAPEncodingTypeMappingImpl.java	12 Feb 2005 04:41:20 -0000	1.9
  +++ DefaultSOAPEncodingTypeMappingImpl.java	24 Feb 2005 21:59:54 -0000	1.10
  @@ -17,6 +17,7 @@
   package org.apache.axis.encoding;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.MessageContext;
   import org.apache.axis.encoding.ser.Base64SerializerFactory;
   import org.apache.axis.encoding.ser.Base64DeserializerFactory;
   import org.apache.axis.encoding.ser.ArraySerializerFactory;
  @@ -34,25 +35,32 @@
       /**
        * Construct TypeMapping
        */
  -    public static TypeMapping getSingleton() {
  +    public static TypeMappingDelegate getSingleton() {
           if (tm == null) {
               tm = new DefaultSOAPEncodingTypeMappingImpl();
           }
  -        return tm;
  +        return new TypeMappingDelegate(tm);
       }
       
  -    public static TypeMapping create() {
  -        TypeMapping ret = new DefaultSOAPEncodingTypeMappingImpl();
  -
  -        // Removed by gdaniels 2/11/2005 - we don't seem to need this
  -        // any more since delegation gets done by the TMR as necessary
  -        //
  -        // ret.setDelegate(DefaultTypeMappingImpl.getSingleton());
  +    public static TypeMappingImpl create() {
  +        return new DefaultSOAPEncodingTypeMappingImpl();
  +    }
   
  +    public static TypeMappingDelegate createWithDelegate() {
  +        TypeMappingDelegate ret = new TypeMappingDelegate(new DefaultSOAPEncodingTypeMappingImpl());
  +        MessageContext mc = MessageContext.getCurrentContext();
  +        TypeMappingDelegate tm = null;
  +        if (mc != null) {
  +            tm = (TypeMappingDelegate)mc.getTypeMappingRegistry().getDefaultTypeMapping();
  +        } else {
  +            tm = DefaultTypeMappingImpl.getSingleton();
  +        }
  +        ret.setNext(tm);
           return ret;
       }
   
       protected DefaultSOAPEncodingTypeMappingImpl() {
  +        super(true);
           registerSOAPTypes();
       }
   
  
  
  
  1.89      +11 -4     ws-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
  
  Index: DefaultTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- DefaultTypeMappingImpl.java	12 Feb 2005 18:04:59 -0000	1.88
  +++ DefaultTypeMappingImpl.java	24 Feb 2005 21:59:54 -0000	1.89
  @@ -79,17 +79,24 @@
       /**
        * Obtain the singleton default typemapping.
        */
  -    public static synchronized TypeMapping getSingleton() {
  +    public static synchronized TypeMappingDelegate getSingleton() {
           if (tm == null) {
               tm = new DefaultTypeMappingImpl();
           }
  -        return tm;
  +        return new TypeMappingDelegate(tm);
       }
   
       protected DefaultTypeMappingImpl() {
  -        super(null);
  -        delegate = null;
  +        initMappings();
  +    }
  +
  +    protected DefaultTypeMappingImpl(boolean noMappings) {
  +        if (!noMappings) {
  +            initMappings();
  +        }
  +    }
   
  +    protected void initMappings() {
           // Notes:
           // 1) The registration statements are order dependent.  The last one
           //    wins.  So if two javaTypes of String are registered, the
  
  
  
  1.16      +0 -30     ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java
  
  Index: TypeMapping.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMapping.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TypeMapping.java	12 Feb 2005 04:41:20 -0000	1.15
  +++ TypeMapping.java	24 Feb 2005 21:59:55 -0000	1.16
  @@ -31,16 +31,6 @@
       extends javax.xml.rpc.encoding.TypeMapping {
   
       /**
  -     * setDelegate sets the new Delegate TypeMapping
  -     */
  -    public void setDelegate(TypeMapping delegate);
  -
  -    /**
  -     * getDelegate gets the new Delegate TypeMapping
  -     */
  -    public TypeMapping getDelegate();
  -
  -    /**
        * Gets the SerializerFactory registered for the specified pair
        * of Java type and XML data type.
        *
  @@ -121,26 +111,6 @@
        */
       QName getXMLType(Class javaType, QName xmlType, boolean encoded)
           throws JAXRPCException;
  -
  -    /**
  -     * Gets the DeserializerFactory registered for the specified XML data type.
  -     * This version uses a particular "original" TypeMapping in order to do
  -     * secondary lookups for array component types, if necessary.
  -     *
  -     * @param javaType - the desired Java class
  -     * @param xmlType - Qualified name of the XML data type
  -     * @param orig - the TypeMapping from which to do secondary lookups
  -     *
  -     * @return Registered DeserializerFactory
  -     *
  -     * @throws JAXRPCException - If there is no registered DeserializerFactory
  -     * for this pair of Java type and  XML data type
  -     * java.lang.IllegalArgumentException -
  -     * If invalid or unsupported XML/Java type is specified
  -     */
  -    DeserializerFactory
  -        getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
  -        throws JAXRPCException;
   }
   
   
  
  
  
  1.18      +63 -78    ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java
  
  Index: TypeMappingDelegate.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TypeMappingDelegate.java	12 Feb 2005 04:41:20 -0000	1.17
  +++ TypeMappingDelegate.java	24 Feb 2005 21:59:55 -0000	1.18
  @@ -17,6 +17,7 @@
   package org.apache.axis.encoding;
   
   import org.apache.axis.utils.Messages;
  +import org.apache.axis.Constants;
   
   import javax.xml.namespace.QName;
   import javax.xml.rpc.JAXRPCException;
  @@ -28,13 +29,17 @@
    * 
    * @author Rich Scheuerle (scheu@us.ibm.com)
    */
  -class TypeMappingDelegate implements TypeMapping { 
  -    TypeMapping delegate;
  -    
  +public class TypeMappingDelegate implements TypeMapping {
  +    TypeMappingImpl delegate;
  +    TypeMappingDelegate next;
  +
       /**
        * Construct TypeMapping
        */
  -    TypeMappingDelegate(TypeMapping delegate) {
  +    TypeMappingDelegate(TypeMappingImpl delegate) {
  +        if (delegate == null) {
  +            throw new RuntimeException(Messages.getMessage("NullDelegate"));
  +        }
           this.delegate = delegate;
       }
   
  @@ -44,16 +49,11 @@
       // Delegate or throw an exception
       
       public String[] getSupportedEncodings() {
  -        if (delegate != null) {
  -            return delegate.getSupportedEncodings();
  -        }
  -        return null;
  +        return delegate.getSupportedEncodings();
       }
   
       public void setSupportedEncodings(String[] namespaceURIs) {
  -        if (delegate != null) {
  -            delegate.setSupportedEncodings(namespaceURIs);
  -        }
  +        delegate.setSupportedEncodings(namespaceURIs);
       }
   
       /**
  @@ -67,70 +67,57 @@
       public void register(Class javaType, QName xmlType,
                            javax.xml.rpc.encoding.SerializerFactory sf,
                            javax.xml.rpc.encoding.DeserializerFactory dsf)
  -        throws JAXRPCException {        
  -
  -        throw new JAXRPCException(
  -                Messages.getMessage("delegatedTypeMapping"));
  +        throws JAXRPCException {
  +        delegate.register(javaType, xmlType, sf, dsf);
       }
       
       public javax.xml.rpc.encoding.SerializerFactory 
           getSerializer(Class javaType, QName xmlType)
           throws JAXRPCException
       {
  -        if (delegate != null) {
  -            return delegate.getSerializer(javaType, xmlType);
  +        SerializerFactory sf = (SerializerFactory)delegate.getSerializer(javaType, xmlType);
  +
  +        if (sf == null && next != null) {
  +            sf = (SerializerFactory)next.getSerializer(javaType, xmlType);
  +        }
  +
  +        if (sf == null) {
  +            sf = delegate.finalGetSerializer(javaType);
           }
  -        return null;
  +
  +        return sf;
       }
       public javax.xml.rpc.encoding.SerializerFactory
           getSerializer(Class javaType) 
           throws JAXRPCException 
       {
  -        if (delegate != null) {
  -            return delegate.getSerializer(javaType);
  -        }
  -        return null;
  +        return getSerializer(javaType, null);
       }
   
       public javax.xml.rpc.encoding.DeserializerFactory
           getDeserializer(Class javaType, QName xmlType)
           throws JAXRPCException {
  -        if (delegate != null) {
  -            return delegate.getDeserializer(javaType, xmlType);
  -        }
  -        return null;
  +        return getDeserializer(javaType, xmlType, this);
       }
   
  -    /**
  -     * Gets the DeserializerFactory registered for the specified XML data type.
  -     * This version uses a particular "original" TypeMapping in order to do
  -     * secondary lookups for array component types, if necessary.
  -     *
  -     * @param javaType - the desired Java class
  -     * @param xmlType - Qualified name of the XML data type
  -     * @param orig - the TypeMapping from which to do secondary lookups
  -     *
  -     * @return Registered DeserializerFactory
  -     *
  -     * @throws JAXRPCException - If there is no registered DeserializerFactory
  -     * for this pair of Java type and  XML data type
  -     * java.lang.IllegalArgumentException -
  -     * If invalid or unsupported XML/Java type is specified
  -     */
  -    public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig) throws JAXRPCException {
  -        if (delegate != null) {
  -            return delegate.getDeserializer(javaType, xmlType, orig);
  +    public javax.xml.rpc.encoding.DeserializerFactory
  +            getDeserializer(Class javaType, QName xmlType, TypeMappingDelegate start)
  +            throws JAXRPCException {
  +        DeserializerFactory df =
  +                (DeserializerFactory)delegate.getDeserializer(javaType, xmlType, start);
  +        if (df == null && next != null) {
  +            df = (DeserializerFactory)next.getDeserializer(javaType, xmlType, start);
  +        }
  +        if (df == null) {
  +            df = delegate.finalGetDeserializer(javaType, xmlType, start);
           }
  -        return null;
  +        return df;
       }
   
       public javax.xml.rpc.encoding.DeserializerFactory
           getDeserializer(QName xmlType)
           throws JAXRPCException {
  -        if (delegate != null) {
  -            return delegate.getDeserializer(xmlType);
  -        }
  -        return null;
  +        return getDeserializer(null, xmlType);
       }
   
       /**
  @@ -158,10 +145,11 @@
       }
   
      public boolean isRegistered(Class javaType, QName xmlType) {
  -       if (delegate != null) {
  -           return delegate.isRegistered(javaType, xmlType);
  +       boolean result = delegate.isRegistered(javaType, xmlType);
  +       if (result == false && next != null) {
  +           return next.isRegistered(javaType, xmlType);
          }
  -       return false;
  +       return result;
      }
   
       /********* End JAX-RPC Compliant Method Definitions *****************/
  @@ -172,10 +160,7 @@
        * @return xmlType qname or null
        */
       public QName getTypeQName(Class javaType) {
  -        if (delegate != null) {
  -            return delegate.getTypeQName(javaType);
  -        }
  -        return null;
  +        return delegate.getTypeQName(javaType, next);
       }
       
       /**
  @@ -184,10 +169,7 @@
        * @return javaType class for type or null for no mappingor delegate
        */
       public Class getClassForQName(QName xmlType) {
  -        if (delegate != null) {
  -            return delegate.getClassForQName(xmlType);
  -        }
  -        return null;
  +        return getClassForQName(xmlType, null);
       }
   
       /**
  @@ -197,10 +179,7 @@
        * @return javaType class for type or null for no mappingor delegate
        */
       public Class getClassForQName(QName xmlType, Class javaType) {
  -        if (delegate != null) {
  -            return delegate.getClassForQName(xmlType, javaType);
  -        }
  -        return null;
  +        return delegate.getClassForQName(xmlType, javaType, next);
       }
   
       /**
  @@ -212,32 +191,33 @@
        * @return
        */
       public QName getTypeQNameExact(Class javaType) {
  -        if (delegate != null) {
  -            return delegate.getTypeQNameExact(javaType);
  -        }
  -        return null;
  +        QName result = delegate.getTypeQNameExact(javaType, next);
  +
  +        return result;
       }
   
       /**
        * setDelegate sets the new Delegate TypeMapping
        */
  -    public void setDelegate(TypeMapping delegate) {
  -        this.delegate = delegate;
  +    public void setNext(TypeMappingDelegate next) {
  +        if (next == this) {
  +            return; // Refuse to set up tight loops (throw exception?)
  +        }
  +        this.next = next;
       }
   
       /**
        * getDelegate gets the new Delegate TypeMapping
        */
  -    public TypeMapping getDelegate() {
  -        return delegate;
  +    public TypeMappingDelegate getNext() {
  +        return next;
       }
   
       /**
        * Returns an array of all the classes contained within this mapping
        */
       public Class[] getAllClasses() {
  -        if (delegate == null) return null;
  -        return delegate.getAllClasses();
  +        return delegate.getAllClasses(next);
       }
   
       /**
  @@ -259,9 +239,14 @@
        */
       public QName getXMLType(Class javaType, QName xmlType, boolean encoded)
               throws JAXRPCException {
  -        if (delegate != null) {
  -            return delegate.getXMLType(javaType, xmlType, encoded);
  +        QName result = delegate.getXMLType(javaType, xmlType, encoded);
  +        if (result == null && next != null) {
  +            return next.getXMLType(javaType, xmlType, encoded);
           }
  -        return null;
  +        return result;
  +    }
  +
  +    public void setDoAutoTypes(boolean doAutoTypes) {
  +        delegate.setDoAutoTypes(doAutoTypes);
       }
   }
  
  
  
  1.57      +66 -158   ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
  
  Index: TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- TypeMappingImpl.java	12 Feb 2005 04:41:20 -0000	1.56
  +++ TypeMappingImpl.java	24 Feb 2005 21:59:55 -0000	1.57
  @@ -67,7 +67,7 @@
    *
    * @author Rich Scheuerle (scheu@us.ibm.com)
    */
  -public class TypeMappingImpl implements TypeMapping
  +public class TypeMappingImpl
   {
       protected static Log log =
           LogFactory.getLog(TypeMappingImpl.class.getName());
  @@ -114,7 +114,6 @@
       private HashMap class2Pair;     // Class Name to Pair Mapping
       private HashMap pair2SF;        // Pair to Serialization Factory
       private HashMap pair2DF;        // Pair to Deserialization Factory
  -    protected TypeMapping delegate;   // Pointer to delegate or null
       private ArrayList namespaces;   // Supported namespaces
   
       protected Boolean doAutoTypes = null;
  @@ -122,12 +121,11 @@
       /**
        * Construct TypeMapping
        */
  -    public TypeMappingImpl(TypeMapping delegate) {
  +    public TypeMappingImpl() {
           qName2Pair  = new HashMap();
           class2Pair  = new HashMap();
           pair2SF     = new HashMap();
           pair2DF     = new HashMap();
  -        this.delegate = delegate;
           namespaces  = new ArrayList();
       }
   
  @@ -137,21 +135,6 @@
       }
   
   
  -    /**
  -     * setDelegate sets the new Delegate TypeMapping
  -     */
  -    public void setDelegate(TypeMapping delegate) {
  -        if (delegate != this)
  -            this.delegate = delegate;
  -    }
  -
  -    /**
  -     * getDelegate gets the new Delegate TypeMapping
  -     */
  -    public TypeMapping getDelegate() {
  -        return delegate;
  -    }
  -
       /********* JAX-RPC Compliant Method Definitions *****************/
   
       /**
  @@ -207,9 +190,6 @@
           if (pair2SF.keySet().contains(new Pair(javaType, xmlType))) {
               return true;
           }
  -        if (delegate != null) {
  -            return delegate.isRegistered(javaType, xmlType);
  -        }
           return false;
       }
   
  @@ -306,7 +286,7 @@
   
           // If the xmlType was not provided, get one
           if (xmlType == null) {
  -            xmlType = getTypeQName(javaType);
  +            xmlType = getTypeQName(javaType, null);
               // If we couldn't find one, we're hosed, since getTypeQName()
               // already asked all of our delegates.
               if (xmlType == null) {
  @@ -343,26 +323,22 @@
                   componentType = componentType.getSuperclass();
               }
           }
  -
  -        if (sf == null && delegate != null) {
  -            sf = delegate.getSerializer(javaType, xmlType);
  +        
  +        return sf;
  +    }
  +    
  +    public SerializerFactory finalGetSerializer(Class javaType) {
  +        Pair pair;
  +        if (isArray(javaType)) {
  +            pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
  +        } else {
  +            pair = (Pair) class2Pair.get(javaType);
           }
  -
  -        // If not successful, use the javaType to get another Pair unless
  -        // we've got an array, in which case make sure we get the
  -        // ArraySerializer.
  -        if (sf == null) {
  -            if (isArray(javaType)) {
  -                pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
  -            } else {
  -                pair = (Pair) class2Pair.get(pair.javaType);
  -            }
  -            if (pair != null) {
  -                sf = (javax.xml.rpc.encoding.SerializerFactory) pair2SF.get(pair);
  -            }
  +        if (pair != null) {
  +            return (SerializerFactory)pair2SF.get(pair);
           }
   
  -        return sf;
  +        return null;
       }
   
       /**
  @@ -423,10 +399,7 @@
   
           if (pair != null) {
               xmlType = pair.xmlType;
  -        } else if (delegate != null) {
  -            return delegate.getXMLType(javaType, xmlType, encoded);
           }
  -
           return xmlType;
       }
   
  @@ -445,34 +418,10 @@
        * If invalid or unsupported XML/Java type is specified
        */
       public javax.xml.rpc.encoding.DeserializerFactory
  -        getDeserializer(Class javaType, QName xmlType)
  -        throws JAXRPCException {
  -        return getDeserializer(javaType, xmlType, this);
  -    }
  -
  -    /**
  -     * Gets the DeserializerFactory registered for the specified XML data type.
  -     * This version uses a particular "original" TypeMapping in order to do
  -     * secondary lookups for array component types, if necessary.
  -     *
  -     * @param javaType - the desired Java class
  -     * @param xmlType - Qualified name of the XML data type
  -     * @param orig - the TypeMapping from which to do secondary lookups
  -     *
  -     * @return Registered DeserializerFactory
  -     *
  -     * @throws JAXRPCException - If there is no registered DeserializerFactory
  -     * for this pair of Java type and  XML data type
  -     * java.lang.IllegalArgumentException -
  -     * If invalid or unsupported XML/Java type is specified
  -     */
  -    public javax.xml.rpc.encoding.DeserializerFactory
  -        getDeserializer(Class javaType, QName xmlType, TypeMappingImpl orig)
  +        getDeserializer(Class javaType, QName xmlType, TypeMappingDelegate start)
           throws JAXRPCException {
  -        javax.xml.rpc.encoding.DeserializerFactory df = null;
  -
           if (javaType == null) {
  -            javaType = getClassForQName(xmlType);
  +            javaType = start.getClassForQName(xmlType);
               // If we don't have a mapping, we're hosed since getClassForQName()
               // has already asked all our delegates.
               if (javaType == null) {
  @@ -482,34 +431,33 @@
   
           Pair pair = new Pair(javaType, xmlType);
   
  -        df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
  -
  -        if (df == null && delegate != null) {
  -            df = delegate.getDeserializer(javaType, xmlType, orig);
  -        }
  +        return (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
  +    }
  +    
  +    public DeserializerFactory finalGetDeserializer(Class javaType,
  +                                                    QName xmlType,
  +                                                    TypeMappingDelegate start) {
  +        DeserializerFactory df = null;
  +        if (javaType != null && javaType.isArray()) {
  +            Class componentType = javaType.getComponentType();
   
  -        if (df == null) {
  -            if (javaType.isArray()) {
  -                Class componentType = javaType.getComponentType();
  -
  -                // HACK ALERT - Don't return the ArrayDeserializer IF
  -                // the xmlType matches the component type of the array,
  -                // because that means we're using maxOccurs and we'll
  -                // want the higher layers to get the component type
  -                // deserializer... (sigh)
  -                if (xmlType != null) {
  -                    Class actualClass = orig.getClassForQName(xmlType);
  -                    if (actualClass == componentType)
  -                        return null;
  -                }
  +            // HACK ALERT - Don't return the ArrayDeserializer IF
  +            // the xmlType matches the component type of the array,
  +            // because that means we're using maxOccurs and we'll
  +            // want the higher layers to get the component type
  +            // deserializer... (sigh)
  +            if (xmlType != null) {
  +                Class actualClass = start.getClassForQName(xmlType);
  +                if (actualClass == componentType)
  +                    return null;
  +            }
   
  -                pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
  -                df = (javax.xml.rpc.encoding.DeserializerFactory) pair2DF.get(pair);
  -                if (df instanceof ArrayDeserializerFactory && javaType.isArray()) {
  -                    QName componentXmlType = orig.getTypeQName(componentType);
  -                    if (componentXmlType != null) {
  -                        df = new ArrayDeserializerFactory(componentXmlType);
  -                    }
  +            Pair pair = (Pair) qName2Pair.get(Constants.SOAP_ARRAY);
  +            df = (DeserializerFactory) pair2DF.get(pair);
  +            if (df instanceof ArrayDeserializerFactory && javaType.isArray()) {
  +                QName componentXmlType = start.getTypeQName(componentType);
  +                if (componentXmlType != null) {
  +                    df = new ArrayDeserializerFactory(componentXmlType);
                   }
               }
           }
  @@ -570,7 +518,7 @@
       public QName getTypeQNameRecursive(Class javaType) {
           QName ret = null;
           while (javaType != null) {
  -            ret = getTypeQName(javaType);
  +            ret = getTypeQName(javaType, null);
               if (ret != null)
                   return ret;
   
  @@ -579,7 +527,7 @@
               if (interfaces != null) {
                   for (int i = 0; i < interfaces.length; i++) {
                       Class iface = interfaces[i];
  -                    ret = getTypeQName(iface);
  +                    ret = getTypeQName(iface, null);
                       if (ret != null)
                           return ret;
                   }
  @@ -598,13 +546,14 @@
        * @param javaType
        * @return
        */
  -    public QName getTypeQNameExact(Class javaType) {
  +    public QName getTypeQNameExact(Class javaType, TypeMappingDelegate next) {
           if (javaType == null)
               return null;
          
           QName xmlType = null;
           Pair pair = (Pair) class2Pair.get(javaType);
  -        if (dotnet_soapenc_bugfix && pair != null ) {
  +
  +        if (TypeMappingImpl.dotnet_soapenc_bugfix && pair != null ) {
               // Hack alert!
               // If we are in .NET bug compensation mode, skip over any
               // SOAP Encoded types we my find and prefer XML Schema types
  @@ -615,17 +564,21 @@
               }
           }
   
  -        if (pair == null && delegate != null) {
  -            xmlType = delegate.getTypeQNameExact(javaType);
  -        } else if (pair != null) {
  +        if (pair == null && next != null) {
  +            // Keep checking up the stack...
  +            xmlType = next.delegate.getTypeQNameExact(javaType,
  +                                                      next.next);
  +        }
  +
  +        if (pair != null) {
               xmlType = pair.xmlType;
           }
   
           return xmlType;
       }
   
  -    public QName getTypeQName(Class javaType) {
  -        QName xmlType = getTypeQNameExact(javaType);
  +    public QName getTypeQName(Class javaType, TypeMappingDelegate next) {
  +        QName xmlType = getTypeQNameExact(javaType, next);
   
           /* If auto-typing is on and the array has the default SOAP_ARRAY QName,
            * then generate a namespace for this array intelligently.   Also
  @@ -687,16 +640,8 @@
           return xmlType;
       }
   
  -    /**
  -     * Gets the Class mapped to QName.
  -     * @param xmlType qname or null
  -     * @return javaType class for type or null for no mapping
  -     */
  -    public Class getClassForQName(QName xmlType) {
  -        return getClassForQName(xmlType, null);
  -    }
  -
  -    public Class getClassForQName(QName xmlType, Class javaType) {
  +    public Class getClassForQName(QName xmlType, Class javaType,
  +                                  TypeMappingDelegate next) {
           if (xmlType == null) {
               return null;
           }
  @@ -707,8 +652,8 @@
               // Looking for an exact match first
               Pair pair = new Pair(javaType, xmlType);
               if (pair2DF.get(pair) == null) {
  -                if (delegate != null) {
  -                    javaType = delegate.getClassForQName(xmlType, javaType);
  +                if (next != null) {
  +                    javaType = next.getClassForQName(xmlType, javaType);
                   }
               }
           }
  @@ -716,9 +661,9 @@
           if (javaType == null) {
               //look for it in our map
               Pair pair = (Pair) qName2Pair.get(xmlType);
  -            if (pair == null && delegate != null) {
  +            if (pair == null && next != null) {
                   //on no match, delegate
  -                javaType = delegate.getClassForQName(xmlType);
  +                javaType = next.getClassForQName(xmlType);
               } else if (pair != null) {
                   javaType = pair.javaType;
               }
  @@ -745,43 +690,6 @@
           return javaType;
       }
   
  -    /**
  -     * Gets the SerializerFactory registered for the Java type.
  -     *
  -     * @param javaType - Class of the Java type
  -     *
  -     * @return Registered SerializerFactory
  -     *
  -     * @throws JAXRPCException - If there is no registered SerializerFactory
  -     * for this pair of Java type and XML data type
  -     * java.lang.IllegalArgumentException -
  -     * If invalid or unsupported XML/Java type is specified
  -     */
  -    public javax.xml.rpc.encoding.SerializerFactory
  -        getSerializer(Class javaType)
  -        throws JAXRPCException
  -    {
  -        return getSerializer(javaType, null);
  -    }
  -
  -    /**
  -     * Gets the DeserializerFactory registered for the xmlType.
  -     *
  -     * @param xmlType - Qualified name of the XML data type
  -     *
  -     * @return Registered DeserializerFactory
  -     *
  -     * @throws JAXRPCException - If there is no registered DeserializerFactory
  -     * for this pair of Java type and  XML data type
  -     * java.lang.IllegalArgumentException -
  -     * If invalid or unsupported XML/Java type is specified
  -     */
  -    public javax.xml.rpc.encoding.DeserializerFactory
  -        getDeserializer(QName xmlType)
  -        throws JAXRPCException {
  -        return getDeserializer(null, xmlType);
  -    }
  -
       public void setDoAutoTypes(boolean doAutoTypes) {
           this.doAutoTypes = doAutoTypes ? Boolean.TRUE : Boolean.FALSE;
       }
  @@ -809,12 +717,12 @@
       /**
        * Returns an array of all the classes contained within this mapping
        */
  -    public Class [] getAllClasses()
  +    public Class [] getAllClasses(TypeMappingDelegate next)
       {
           java.util.HashSet temp = new java.util.HashSet();
  -        if (delegate != null)
  +        if (next != null)
           {
  -            temp.addAll(java.util.Arrays.asList(delegate.getAllClasses()));
  +            temp.addAll(java.util.Arrays.asList(next.getAllClasses()));
           }
           temp.addAll(class2Pair.keySet());
           return (Class[])temp.toArray(new Class[temp.size()]);
  
  
  
  1.34      +73 -86    ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
  
  Index: TypeMappingRegistryImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- TypeMappingRegistryImpl.java	17 Feb 2005 20:05:05 -0000	1.33
  +++ TypeMappingRegistryImpl.java	24 Feb 2005 21:59:55 -0000	1.34
  @@ -128,16 +128,18 @@
   public class TypeMappingRegistryImpl implements TypeMappingRegistry { 
       
       private HashMap mapTM;          // Type Mappings keyed with Namespace URI
  -    private TypeMapping defaultDelTM;  // Delegate to default Type Mapping 
  +    private TypeMappingDelegate defaultDelTM;  // Delegate to default Type Mapping
  +    private boolean isDelegated = false;
   
       /**
        * Construct TypeMappingRegistry
        * @param tm
        */ 
  -    public TypeMappingRegistryImpl(TypeMapping tm) {
  +    public TypeMappingRegistryImpl(TypeMappingImpl tm) {
           mapTM = new HashMap();
           defaultDelTM = new TypeMappingDelegate(tm);
  -        register(Constants.URI_SOAP11_ENC, new DefaultSOAPEncodingTypeMappingImpl());
  +        TypeMappingDelegate del = new TypeMappingDelegate(new DefaultSOAPEncodingTypeMappingImpl());
  +        register(Constants.URI_SOAP11_ENC, del);
       }
   
       /**
  @@ -145,11 +147,14 @@
        */
       public TypeMappingRegistryImpl() {
           mapTM = new HashMap();
  -        defaultDelTM = 
  -                new TypeMappingDelegate(DefaultTypeMappingImpl.getSingleton());
  -        register(Constants.URI_SOAP11_ENC, new DefaultSOAPEncodingTypeMappingImpl());
  +        defaultDelTM = DefaultTypeMappingImpl.getSingleton();
  +        TypeMappingDelegate del = new TypeMappingDelegate(new DefaultSOAPEncodingTypeMappingImpl());
  +        register(Constants.URI_SOAP11_ENC, del);
       }
  -    
  +
  +    public TypeMappingRegistryImpl(boolean registerDefaults) {
  +    }
  +
       /**
        * delegate
        *
  @@ -158,30 +163,42 @@
        */
       public void delegate(TypeMappingRegistry secondaryTMR) {
   
  -        if (secondaryTMR == null || secondaryTMR == this) {
  +        if (isDelegated || secondaryTMR == null || secondaryTMR == this) {
               return;
           }
  +
  +        isDelegated = true;
           String[]  keys = secondaryTMR.getRegisteredEncodingStyleURIs();
  -//        String[]  keys = null;
  +        TypeMappingDelegate otherDefault =
  +                ((TypeMappingRegistryImpl)secondaryTMR).defaultDelTM;
           if (keys != null) {
  -            for(int i=0; i < keys.length; i++) {
  +            for (int i=0; i < keys.length; i++) {
                   try {
                       String nsURI = keys[i];
  -                    TypeMapping tm = (TypeMapping) getTypeMapping(nsURI);
  +                    TypeMappingDelegate tm = (TypeMappingDelegate) getTypeMapping(nsURI);
                       if (tm == null || tm == getDefaultTypeMapping() ) {
  -                        tm = (TypeMapping) createTypeMapping();
  +                        tm = (TypeMappingDelegate)createTypeMapping();
                           tm.setSupportedEncodings(new String[] { nsURI });
                           register(nsURI, tm);
                       }
  -                    
  +
                       if (tm != null) {
                           // Get the secondaryTMR's TM'
  -                        TypeMapping del = (TypeMapping)
  -                            ((TypeMappingRegistryImpl)
  -                             secondaryTMR).mapTM.get(nsURI);
  -                        tm.setDelegate(del);
  +                        TypeMappingDelegate del = (TypeMappingDelegate)
  +                            ((TypeMappingRegistryImpl)secondaryTMR).mapTM.get(nsURI);
  +                        TypeMappingDelegate nu = new TypeMappingDelegate(del.delegate);
  +                        tm.setNext(nu);
  +                        nu.setNext(defaultDelTM);
  +
  +                        while (del.next != null) {
  +                            if (del.next == otherDefault) {
  +                                del.setNext(defaultDelTM);
  +                                break;
  +                            }
  +                            del = del.next;
  +                        }
                       }
  -                    
  +
                   } catch (Exception e) {
                   }
               }
  @@ -189,8 +206,7 @@
           // Change our defaultDelTM to delegate to the one in 
           // the secondaryTMR
           if (defaultDelTM != null) {
  -            defaultDelTM.setDelegate(
  -            ((TypeMappingRegistryImpl)secondaryTMR).defaultDelTM);
  +            defaultDelTM.setNext(otherDefault);
           }
           
       }            
  @@ -214,7 +230,7 @@
                            javax.xml.rpc.encoding.TypeMapping mapping) {
   //        namespaceURI = "";
           if (mapping == null || 
  -            !(mapping instanceof TypeMapping)) {
  +            !(mapping instanceof TypeMappingDelegate)) {
               throw new IllegalArgumentException(
                       Messages.getMessage("badTypeMapping"));
           } 
  @@ -222,19 +238,16 @@
               throw new java.lang.IllegalArgumentException(
                       Messages.getMessage("nullNamespaceURI"));
           }
  -        // Get or create a TypeMappingDelegate and set it to 
  -        // delegate to the new mapping.
  -        TypeMappingDelegate del = (TypeMappingDelegate)
  -            mapTM.get(namespaceURI);
  -        if (del == null) {
  -            del = new TypeMappingDelegate((TypeMapping) mapping);
  -            mapTM.put(namespaceURI, del);
  -            ((TypeMapping)mapping).setDelegate(defaultDelTM.getDelegate());
  +
  +        TypeMappingDelegate del = (TypeMappingDelegate)mapping;
  +        TypeMappingDelegate old = (TypeMappingDelegate)mapTM.get(namespaceURI);
  +        if (old == null) {
  +            del.setNext(defaultDelTM);
           } else {
  -            ((TypeMapping)mapping).setDelegate(del.getDelegate());
  -            del.setDelegate((TypeMapping) mapping);
  +            del.setNext(old);
           }
  -        return null; // Needs works
  +        mapTM.put(namespaceURI, del);
  +        return old; // Needs works
       }
       
       /**
  @@ -248,7 +261,7 @@
        */
       public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
           if (mapping == null ||
  -            !(mapping instanceof TypeMapping)) {
  +            !(mapping instanceof TypeMappingDelegate)) {
               throw new IllegalArgumentException(
                       Messages.getMessage("badTypeMapping"));
           }
  @@ -257,12 +270,12 @@
            * the TMR's TypeMappings will be using the default type mapping
            * of the secondary TMR.
            */
  -        if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
  +        if (defaultDelTM.getNext() != null) {
               throw new IllegalArgumentException(
                       Messages.getMessage("defaultTypeMappingSet"));
           }
   
  -        defaultDelTM.setDelegate((TypeMapping) mapping);
  +        defaultDelTM = (TypeMappingDelegate)mapping;
       }
   
       /**
  @@ -273,39 +286,28 @@
        */
       public void doRegisterFromVersion(String version) {
           if (version == null || version.equals("1.0") || version.equals("1.2")) {
  +            TypeMappingImpl.dotnet_soapenc_bugfix = false;
               // Do nothing, just register SOAPENC mapping
           } else if (version.equals("1.1")) {
  +            TypeMappingImpl.dotnet_soapenc_bugfix = true;
               // Do nothing, no SOAPENC mapping
               return;
           } else if (version.equals("1.3")) {
               // Reset the default TM to the JAXRPC version, then register SOAPENC
  -            TypeMapping tm = DefaultJAXRPC11TypeMappingImpl.create();
  -            defaultDelTM = new TypeMappingDelegate(tm);
  +            defaultDelTM = new TypeMappingDelegate(DefaultJAXRPC11TypeMappingImpl.create());
           } else {
               throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
           }
  -        registerSOAPENCDefault(DefaultSOAPEncodingTypeMappingImpl.getSingleton());
  +        registerSOAPENCDefault(new TypeMappingDelegate(DefaultSOAPEncodingTypeMappingImpl.create()));
       }
       /**
        * Force registration of the given mapping as the SOAPENC default mapping
        * @param mapping
        */
  -    private void registerSOAPENCDefault(TypeMapping mapping) {
  -        registerForced(Constants.URI_SOAP11_ENC, mapping);
  -        registerForced(Constants.URI_SOAP12_ENC, mapping);
  -        mapping.setDelegate(defaultDelTM);
  -    }
  -
  -    /**
  -     * Force registration of a particular mapping for a given namespace,
  -     * which will delegate back to the default.
  -     *
  -     * @param namespaceURI
  -     * @param mapping
  -     */
  -    private void registerForced(String namespaceURI, TypeMapping mapping) {
  -        mapTM.put(namespaceURI, new TypeMappingDelegate((TypeMapping) mapping));
  -        ((TypeMapping)mapping).setDelegate(defaultDelTM.getDelegate());
  +    private void registerSOAPENCDefault(TypeMappingDelegate mapping) {
  +        mapTM.put(Constants.URI_SOAP11_ENC, mapping);
  +        mapTM.put(Constants.URI_SOAP12_ENC, mapping);
  +        mapping.setNext(defaultDelTM);
       }
   
       /**
  @@ -319,17 +321,13 @@
       public javax.xml.rpc.encoding.TypeMapping 
           getTypeMapping(String namespaceURI) {
   //        namespaceURI = "";
  -        TypeMapping del = (TypeMapping) mapTM.get(namespaceURI);
  -        TypeMapping tm = null;
  -        if (del != null) {
  -            tm = del.getDelegate();
  -        }
  -        if (tm == null) {
  -            tm = (TypeMapping)getDefaultTypeMapping();
  +        TypeMapping del = (TypeMappingDelegate) mapTM.get(namespaceURI);
  +        if (del == null) {
  +            del = (TypeMapping)getDefaultTypeMapping();
           }
  -        return tm;
  +        return del;
       }
  -    
  +
       /**
        * Obtain a type mapping for the given encodingStyle.  If no specific
        * mapping exists for this encodingStyle, we will create and register
  @@ -339,17 +337,13 @@
        * @return a registered TypeMapping for the given encodingStyle
        */ 
       public TypeMapping getOrMakeTypeMapping(String encodingStyle) {
  -        TypeMapping del = (TypeMapping) mapTM.get(encodingStyle);
  -        TypeMapping tm = null;
  -        if (del != null) {
  -            tm = del.getDelegate();
  -        }
  -        if (tm == null || tm instanceof DefaultTypeMappingImpl) {
  -            tm = (TypeMapping)createTypeMapping();
  -            tm.setSupportedEncodings(new String[] {encodingStyle});
  -            register(encodingStyle, tm);
  +        TypeMappingDelegate del = (TypeMappingDelegate) mapTM.get(encodingStyle);
  +        if (del == null || del == defaultDelTM) {
  +            del = (TypeMappingDelegate)createTypeMapping();
  +            del.setSupportedEncodings(new String[] {encodingStyle});
  +            register(encodingStyle, del);
           }
  -        return tm;
  +        return del;
       }
   
       /**
  @@ -360,13 +354,7 @@
        */
       public javax.xml.rpc.encoding.TypeMapping 
           unregisterTypeMapping(String namespaceURI) {
  -        TypeMapping del = (TypeMapping) mapTM.get(namespaceURI);
  -        TypeMapping tm = null;
  -        if (del != null) {
  -            tm = del.getDelegate();
  -            del.setDelegate(null);
  -        }
  -        return tm;
  +        return (TypeMappingDelegate)mapTM.remove(namespaceURI);
       }
   
       /**
  @@ -395,7 +383,10 @@
        * @return An empty generic TypeMapping object
        */
       public javax.xml.rpc.encoding.TypeMapping createTypeMapping() {
  -        return new TypeMappingImpl(defaultDelTM);
  +        TypeMappingImpl impl = new TypeMappingImpl();
  +        TypeMappingDelegate del = new TypeMappingDelegate(impl);
  +        del.setNext(defaultDelTM);
  +        return del;
       }
           
   
  @@ -431,11 +422,7 @@
        * @return TypeMapping or null
        **/
       public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping() {
  -        TypeMapping defaultTM = defaultDelTM;
  -        while(defaultTM != null && defaultTM instanceof TypeMappingDelegate) {
  -            defaultTM = defaultTM.getDelegate();
  -        }
  -        return defaultTM;
  +        return defaultDelTM;
       }
   
   }
  
  
  
  1.125     +1 -2      ws-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- SOAPService.java	8 Feb 2005 18:44:37 -0000	1.124
  +++ SOAPService.java	24 Feb 2005 21:59:55 -0000	1.125
  @@ -226,7 +226,6 @@
           this.engine = engine;
           ((LockableHashtable)options).setParent(engine.getOptions());
           TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  -        serviceDescription.setTypeMapping((TypeMapping)tmr.getDefaultTypeMapping());
           getTypeMappingRegistry().delegate(tmr);
       }
   
  @@ -297,7 +296,7 @@
               return;
           }
           this.serviceDescription = serviceDescription;
  -        serviceDescription.setTypeMapping((TypeMapping)this.getTypeMappingRegistry().getDefaultTypeMapping());
  +        //serviceDescription.setTypeMapping((TypeMapping)this.getTypeMappingRegistry().getDefaultTypeMapping());
       }
   
       public void setPropertyParent(Hashtable parent)
  
  
  
  1.112     +1 -0      ws-axis/java/src/org/apache/axis/i18n/resource.properties
  
  Index: resource.properties
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/i18n/resource.properties,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- resource.properties	5 Feb 2005 00:14:32 -0000	1.111
  +++ resource.properties	24 Feb 2005 21:59:55 -0000	1.112
  @@ -1268,4 +1268,5 @@
   invocationArgumentsModified00=Invocation arguments were modified
   cannotCreateTextNode00=Exception creating text node
   cannotFindObjectForClass00=No object was found for class type {0}
  +NullDelegate=Null delegate passed to TypeMappingDelegate constructor
   
  
  
  
  1.24      +1 -2      ws-axis/java/src/org/apache/axis/providers/BasicProvider.java
  
  Index: BasicProvider.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/providers/BasicProvider.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BasicProvider.java	4 Nov 2004 13:38:12 -0000	1.23
  +++ BasicProvider.java	24 Feb 2005 21:59:55 -0000	1.24
  @@ -206,8 +206,7 @@
   
               emitter.setLocationUrl(locationUrl);
               emitter.setServiceDesc(serviceDesc);
  -            emitter.setTypeMapping((TypeMapping) msgContext.getTypeMappingRegistry().getTypeMapping(serviceDesc.getUse().getEncoding()));
  -            emitter.setDefaultTypeMapping((TypeMapping) msgContext.getTypeMappingRegistry().getDefaultTypeMapping());
  +            emitter.setTypeMappingRegistry(msgContext.getTypeMappingRegistry());
   
               String wsdlPortType = (String) service.getOption(OPTION_WSDL_PORTTYPE);
               String wsdlServiceElement = (String) service.getOption(OPTION_WSDL_SERVICEELEMENT);
  
  
  
  1.7       +2 -2      ws-axis/java/src/org/apache/axis/schema/SchemaVersion.java
  
  Index: SchemaVersion.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/schema/SchemaVersion.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SchemaVersion.java	25 Feb 2004 14:02:44 -0000	1.6
  +++ SchemaVersion.java	24 Feb 2005 21:59:55 -0000	1.7
  @@ -16,7 +16,7 @@
   
   package org.apache.axis.schema;
   
  -import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingImpl;
   
   import javax.xml.namespace.QName;
   import java.io.Serializable;
  @@ -54,5 +54,5 @@
       /**
        * Register the schema specific type mappings
        */ 
  -    public void registerSchemaSpecificTypes(TypeMapping tm);
  +    public void registerSchemaSpecificTypes(TypeMappingImpl tm);
   }
  
  
  
  1.7       +2 -2      ws-axis/java/src/org/apache/axis/schema/SchemaVersion1999.java
  
  Index: SchemaVersion1999.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/schema/SchemaVersion1999.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SchemaVersion1999.java	25 Feb 2004 14:02:44 -0000	1.6
  +++ SchemaVersion1999.java	24 Feb 2005 21:59:55 -0000	1.7
  @@ -17,7 +17,7 @@
   package org.apache.axis.schema;
   
   import org.apache.axis.Constants;
  -import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingImpl;
   import org.apache.axis.encoding.ser.CalendarDeserializerFactory;
   import org.apache.axis.encoding.ser.CalendarSerializerFactory;
   
  @@ -67,7 +67,7 @@
       /**
        * Register the schema specific type mappings
        */
  -    public void registerSchemaSpecificTypes(TypeMapping tm) {
  +    public void registerSchemaSpecificTypes(TypeMappingImpl tm) {
           
           // Register the timeInstant type
           tm.register(java.util.Calendar.class, 
  
  
  
  1.7       +2 -2      ws-axis/java/src/org/apache/axis/schema/SchemaVersion2000.java
  
  Index: SchemaVersion2000.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/schema/SchemaVersion2000.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SchemaVersion2000.java	25 Feb 2004 14:02:44 -0000	1.6
  +++ SchemaVersion2000.java	24 Feb 2005 21:59:55 -0000	1.7
  @@ -17,7 +17,7 @@
   package org.apache.axis.schema;
   
   import org.apache.axis.Constants;
  -import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingImpl;
   import org.apache.axis.encoding.ser.CalendarDeserializerFactory;
   import org.apache.axis.encoding.ser.CalendarSerializerFactory;
   
  @@ -65,7 +65,7 @@
       /**
        * Register the schema specific type mappings
        */
  -    public void registerSchemaSpecificTypes(TypeMapping tm) {
  +    public void registerSchemaSpecificTypes(TypeMappingImpl tm) {
           
           // Register the timeInstant type
           tm.register(java.util.Calendar.class, 
  
  
  
  1.7       +2 -2      ws-axis/java/src/org/apache/axis/schema/SchemaVersion2001.java
  
  Index: SchemaVersion2001.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/schema/SchemaVersion2001.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SchemaVersion2001.java	25 Feb 2004 14:02:44 -0000	1.6
  +++ SchemaVersion2001.java	24 Feb 2005 21:59:55 -0000	1.7
  @@ -17,7 +17,7 @@
   package org.apache.axis.schema;
   
   import org.apache.axis.Constants;
  -import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingImpl;
   import org.apache.axis.encoding.ser.CalendarDeserializerFactory;
   import org.apache.axis.encoding.ser.CalendarSerializerFactory;
   
  @@ -67,7 +67,7 @@
       /**
        * Register the schema specific type mappings
        */
  -    public void registerSchemaSpecificTypes(TypeMapping tm) {
  +    public void registerSchemaSpecificTypes(TypeMappingImpl tm) {
           
           // This mapping will convert a Java 'Date' type to a dateTime
           tm.register(java.util.Date.class,
  
  
  
  1.51      +5 -2      ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
  
  Index: Java2WSDL.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- Java2WSDL.java	23 Feb 2005 13:22:01 -0000	1.50
  +++ Java2WSDL.java	24 Feb 2005 21:59:55 -0000	1.51
  @@ -22,6 +22,8 @@
   import org.apache.axis.utils.ClassUtils;
   import org.apache.axis.utils.Messages;
   import org.apache.axis.wsdl.fromJava.Emitter;
  +import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.TypeMappingImpl;
   
   import java.util.HashMap;
   import java.util.List;
  @@ -557,8 +559,9 @@
                   emitter.setNamespaceMap(namespaceMap);
               }
   
  -            // Set the TypeMappingVersion
  -            emitter.setTypeMappingVersion(typeMappingVersion);
  +            TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
  +            tmr.doRegisterFromVersion(typeMappingVersion);
  +            emitter.setTypeMappingRegistry(tmr);
   
               // Find the class using the name
               emitter.setCls(className);
  
  
  
  1.140     +22 -64    ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- Emitter.java	21 Feb 2005 21:37:08 -0000	1.139
  +++ Emitter.java	24 Feb 2005 21:59:55 -0000	1.140
  @@ -24,23 +24,21 @@
   import org.apache.axis.Constants;
   import org.apache.axis.InternalException;
   import org.apache.axis.Version;
  -import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.components.logger.LogFactory;
  +import org.apache.axis.constants.Style;
  +import org.apache.axis.constants.Use;
   import org.apache.axis.description.FaultDesc;
   import org.apache.axis.description.JavaServiceDesc;
   import org.apache.axis.description.OperationDesc;
   import org.apache.axis.description.ParameterDesc;
   import org.apache.axis.description.ServiceDesc;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
   import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
  -import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
  -import org.apache.axis.constants.Style;
  -import org.apache.axis.constants.Use;
  +import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.utils.ClassUtils;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Messages;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.commons.logging.Log;
   import org.w3c.dom.Comment;
   import org.w3c.dom.Document;
  @@ -59,13 +57,13 @@
   import javax.wsdl.Input;
   import javax.wsdl.Message;
   import javax.wsdl.Operation;
  +import javax.wsdl.OperationType;
   import javax.wsdl.Output;
   import javax.wsdl.Part;
   import javax.wsdl.Port;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
   import javax.wsdl.WSDLException;
  -import javax.wsdl.OperationType;
   import javax.wsdl.extensions.ExtensibilityElement;
   import javax.wsdl.extensions.soap.SOAPAddress;
   import javax.wsdl.extensions.soap.SOAPBinding;
  @@ -173,7 +171,7 @@
       private TypeMapping tm = null;              // Registered type mapping
   
       /** Field defaultTM */
  -    private TypeMapping defaultTM = null;       // Default TM
  +    private TypeMappingRegistry tmr;
   
       /** Field namespaces */
       private Namespaces namespaces;
  @@ -567,6 +565,15 @@
               }
           }
   
  +        if (tm == null) {
  +            String encodingStyle = "";
  +            if (use == Use.ENCODED) {
  +                encodingStyle = Constants.URI_SOAP11_ENC;
  +                /** TODO : Set this correctly if we do SOAP 1.2 support here */
  +            }
  +            tm = (TypeMapping)tmr.getTypeMapping(encodingStyle);
  +        }
  +
           // Set up a ServiceDesc to use to introspect the Service
           if (serviceDesc == null) {
               JavaServiceDesc javaServiceDesc = new JavaServiceDesc();
  @@ -575,13 +582,7 @@
               javaServiceDesc.setImplClass(cls);
   
               // Set the typeMapping to the one provided.
  -            // If not available use the default TM
  -            if (tm != null) {
  -                serviceDesc.setTypeMapping(tm);
  -            } else {
  -                tm = getDefaultTypeMapping();
  -                serviceDesc.setTypeMapping(tm);
  -            }
  +            serviceDesc.setTypeMapping(tm);
   
               javaServiceDesc.setStopClasses(stopClasses);
               serviceDesc.setAllowedMethods(allowedMethods);
  @@ -600,12 +601,7 @@
                   serviceDesc2.setImplClass(implCls);
   
                   // Set the typeMapping to the one provided.
  -                // If not available use the default TM
  -                if (tm != null) {
  -                    serviceDesc2.setTypeMapping(tm);
  -                } else {
  -                    serviceDesc2.setTypeMapping(getDefaultTypeMapping());
  -                }
  +                serviceDesc2.setTypeMapping(tm);
   
                   serviceDesc2.setStopClasses(stopClasses);
                   serviceDesc2.setAllowedMethods(allowedMethods);
  @@ -756,8 +752,8 @@
               throws IOException, WSDLException, SAXException,
               ParserConfigurationException {
   
  -        types = new Types(def, tm, getDefaultTypeMapping(), namespaces, intfNS, stopClasses,
  -                serviceDesc);
  +        types = new Types(def, tm, (TypeMapping)tmr.getDefaultTypeMapping(),
  +                          namespaces, intfNS, stopClasses, serviceDesc);
   
           if (inputWSDL != null) {
               types.loadInputTypes(inputWSDL);
  @@ -2517,48 +2513,10 @@
       }
   
       /**
  -     * Returns the default <code>TypeMapping</code> used by the service
  -     * 
  -     * @return the default <code>TypeMapping</code> used by the service
  -     */
  -    public TypeMapping getDefaultTypeMapping() {
  -        if (defaultTM == null) {
  -            throw new RuntimeException(Messages.getMessage("noDefaultTypeMapping00"));
  -        }
  -        return defaultTM;
  -    }
  -
  -    /**
  -     * Sets the default <code>TypeMapping</code> used by the service
  -     * 
  -     * @param defaultTM the default <code>TypeMapping</code> used by the service
  +     * Set the TypeMappingRegistry for this Emitter.
        */
  -    public void setDefaultTypeMapping(TypeMapping defaultTM) {
  -        this.defaultTM = defaultTM;
  -    }
  -
  -    /**
  -     * Method setTypeMappingVersion
  -     * 
  -     * @param typeMappingVersion 
  -     */
  -    public void setTypeMappingVersion(String typeMappingVersion) {
  -        if(defaultTM == null) {
  -            if (typeMappingVersion.equals("1.0")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
  -            } else if (typeMappingVersion.equals("1.1")) {
  -                // No SOAP encoding
  -                defaultTM=DefaultTypeMappingImpl.getSingleton();
  -            } else if (typeMappingVersion.equals("1.2")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
  -            } else if (typeMappingVersion.equals("1.3")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
  -                defaultTM.setDelegate(DefaultJAXRPC11TypeMappingImpl.create());
  -            } else {
  -                throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
  -            }
  -            setDefaultTypeMapping(defaultTM);
  -        }
  +    public void setTypeMappingRegistry(TypeMappingRegistry tmr) {
  +        this.tmr = tmr;
       }
       /**
        * getStyle
  
  
  
  1.110     +5 -15     ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Types.java	8 Feb 2005 18:44:36 -0000	1.109
  +++ Types.java	24 Feb 2005 21:59:55 -0000	1.110
  @@ -161,7 +161,7 @@
   
           this.tm = tm;
           this.defaultTM = defaultTM;
  -        
  +
           mappedTypes = tm.getAllClasses();
           
           this.namespaces = namespaces;
  @@ -334,7 +334,7 @@
   
                   QName qName = new QName(qNameIn.getNamespaceURI(),
                           qNameIn.getLocalPart());
  -                Class cls = defaultTM.getClassForQName(qName);
  +                Class cls = tm.getClassForQName(qName);
   
                   if (cls == null) {
                       return null;
  @@ -702,13 +702,7 @@
           QName qName = null;
   
           // Use the typeMapping information to lookup the qName.
  -        if (tm != null) {
  -            qName = tm.getTypeQName(javaType);
  -        }
  -
  -        if (qName == null) {
  -            qName = defaultTM.getTypeQName(javaType);
  -        }
  +        qName = tm.getTypeQName(javaType);
   
           // If the javaType is an array and the qName is
           // SOAP_ARRAY, construct the QName using the
  @@ -721,7 +715,7 @@
               // instead use "MyArrayOf" (gag) 
               String arrayTypePrefix = "ArrayOf";
   
  -            if(tm instanceof DefaultJAXRPC11TypeMappingImpl || 
  +            if (tm instanceof DefaultJAXRPC11TypeMappingImpl ||
                  defaultTM instanceof DefaultJAXRPC11TypeMappingImpl) {
                   arrayTypePrefix = "MyArrayOf";
               }
  @@ -1752,11 +1746,7 @@
   
           // look up the serializer in the TypeMappingRegistry
           SerializerFactory factory;
  -        if (tm != null) {
  -            factory = (SerializerFactory) tm.getSerializer(type, qName);
  -        } else {
  -            factory = (SerializerFactory) defaultTM.getSerializer(type, qName);
  -        }
  +        factory = (SerializerFactory) tm.getSerializer(type, qName);
   
           // If no factory is found, use the BeanSerializerFactory
           // if applicable, otherwise issue errors and treat as an anyType
  
  
  
  1.12      +1 -1      ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java
  
  Index: NoopFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- NoopFactory.java	12 Feb 2005 04:41:21 -0000	1.11
  +++ NoopFactory.java	24 Feb 2005 21:59:55 -0000	1.12
  @@ -134,7 +134,7 @@
               btm = new BaseTypeMapping() {
   
                   TypeMapping defaultTM =
  -                        DefaultSOAPEncodingTypeMappingImpl.create();
  +                        DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
   
                   public String getBaseName(QName qNameIn) {
   
  
  
  
  1.84      +9 -23     ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- Emitter.java	23 Feb 2005 13:22:01 -0000	1.83
  +++ Emitter.java	24 Feb 2005 21:59:55 -0000	1.84
  @@ -15,11 +15,10 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.apache.axis.encoding.DefaultJAXRPC11TypeMappingImpl;
  -import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
  -import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
   import org.apache.axis.constants.Scope;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.TypeMappingRegistryImpl;
   import org.apache.axis.i18n.Messages;
   import org.apache.axis.utils.ClassUtils;
   import org.apache.axis.utils.JavaUtils;
  @@ -139,7 +138,9 @@
   	
       /** Field defaultTM */
       private TypeMapping defaultTM = null;       // Default TM
  -    
  +
  +    private TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
  +
       /**
        * Default constructor.
        */
  @@ -408,7 +409,7 @@
       public TypeMapping getDefaultTypeMapping() {
           if (defaultTM == null) {
               defaultTM =
  -                    DefaultSOAPEncodingTypeMappingImpl.create();
  +                    (TypeMapping)tmr.getTypeMapping(Constants.URI_SOAP11_ENC);
           }
           return defaultTM;
       }
  @@ -760,23 +761,8 @@
        * @param typeMappingVersion 
        */
       public void setTypeMappingVersion(String typeMappingVersion) {
  -        if(defaultTM == null) {
  -            if (typeMappingVersion.equals("1.0")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
  -            } else if (typeMappingVersion.equals("1.1")) {
  -                // No SOAP encoding
  -                defaultTM=DefaultTypeMappingImpl.getSingleton();
  -            } else if (typeMappingVersion.equals("1.2")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.create();
  -            } else if (typeMappingVersion.equals("1.3")) {
  -                defaultTM=DefaultSOAPEncodingTypeMappingImpl.getSingleton();
  -                defaultTM.setDelegate(DefaultJAXRPC11TypeMappingImpl.create());
  -            } else {
  -                throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
  -            }
  -            this.typeMappingVersion = typeMappingVersion;
  -            setDefaultTypeMapping(defaultTM);
  -        }
  +        this.typeMappingVersion = typeMappingVersion;
  +        tmr.doRegisterFromVersion(typeMappingVersion);
           baseTypeMapping = new BaseTypeMapping() {
   
               final TypeMapping defaultTM = getDefaultTypeMapping();
  
  
  
  1.9       +3 -1      ws-axis/java/test/chains/TestChainFault.java
  
  Index: TestChainFault.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/chains/TestChainFault.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestChainFault.java	29 Jul 2004 21:40:28 -0000	1.8
  +++ TestChainFault.java	24 Feb 2005 21:59:55 -0000	1.9
  @@ -180,6 +180,7 @@
               }
   
           } catch (Exception ex) {
  +            ex.printStackTrace();
               assertTrue("Unexpected exception", false);
           }
       }
  @@ -216,7 +217,8 @@
               } catch (AxisFault f) {
                   // did we save off the fault string?
                 assertEquals("faultstring does not match constant",
  -                testHandler.getFaultCatch(),TestChainFault.FAULT_MESSAGE);
  +                           TestChainFault.FAULT_MESSAGE,
  +                           testHandler.getFaultCatch());
                   // does saved faultString match AxisFault?
                 assertEquals("Fault not caught by handler",
                   testHandler.getFaultCatch(),f.getFaultString());
  
  
  
  1.6       +2 -2      ws-axis/java/test/encoding/TestAutoTypes.java
  
  Index: TestAutoTypes.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/TestAutoTypes.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestAutoTypes.java	15 Dec 2004 22:44:38 -0000	1.5
  +++ TestAutoTypes.java	24 Feb 2005 21:59:56 -0000	1.6
  @@ -4,8 +4,8 @@
   
   import junit.framework.TestCase;
   
  -import org.apache.axis.encoding.TypeMappingImpl;
   import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMappingDelegate;
   import org.apache.axis.server.AxisServer;
   import org.apache.axis.wsdl.fromJava.Namespaces;
   import org.apache.axis.wsdl.fromJava.Types;
  @@ -24,7 +24,7 @@
       public void testAutoTypes() throws Exception
       {
           TypeMappingRegistry tmr = server.getTypeMappingRegistry();
  -        TypeMappingImpl tm = (TypeMappingImpl) tmr.getDefaultTypeMapping();
  +        TypeMappingDelegate tm = (TypeMappingDelegate)tmr.getDefaultTypeMapping();
           tm.setDoAutoTypes(true);
           
           QName qname = tm.getTypeQName( AttributeBean.class );
  
  
  
  1.15      +19 -37    ws-axis/java/test/functional/TestJAXRPCSamples.java
  
  Index: TestJAXRPCSamples.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/functional/TestJAXRPCSamples.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestJAXRPCSamples.java	25 Feb 2004 14:02:55 -0000	1.14
  +++ TestJAXRPCSamples.java	24 Feb 2005 21:59:56 -0000	1.15
  @@ -75,49 +75,31 @@
   //    } // testGetQuote
   
       public void testGetInfo() throws Exception {
  -        try {
  -            log.info("Testing JAX-RPC GetInfo sample.");
  -            log.info("Testing deployment...");
  -            doTestDeploy();
  -            log.info("Testing service...");
  -            String[] args = {"-uuser3", "-wpass3", "IBM", "symbol"};
  -            GetInfo.main(args);
  -            args = new String[] {"-uuser3", "-wpass3", "MACR", "name"};
  -            GetInfo.main(args);
  -            args = new String[] {"-uuser3", "-wpass3", "CSCO", "address"};
  -            GetInfo.main(args);
  -            log.info("Testing undeployment...");
  -            doTestUndeploy();
  -            log.info("Test complete.");
  -        }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            throw new Exception("Fault returned from test: " + t);
  -        }
  +        log.info("Testing JAX-RPC GetInfo sample.");
  +        log.info("Testing deployment...");
  +        doTestDeploy();
  +        log.info("Testing service...");
  +        String[] args = {"-uuser3", "-wpass3", "IBM", "symbol"};
  +        GetInfo.main(args);
  +        args = new String[] {"-uuser3", "-wpass3", "MACR", "name"};
  +        GetInfo.main(args);
  +        args = new String[] {"-uuser3", "-wpass3", "CSCO", "address"};
  +        GetInfo.main(args);
  +        log.info("Testing undeployment...");
  +        doTestUndeploy();
  +        log.info("Test complete.");
       } // testGetInfo
   
       public void testHello() throws Exception {
  -        try {
  -            log.info("Testing JAX-RPC hello sample.");
  -            samples.jaxrpc.hello.HelloClient.main(new String[]{});
  -            log.info("Test complete.");
  -        }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            throw new Exception("Fault returned from test: " + t);
  -        }
  +        log.info("Testing JAX-RPC hello sample.");
  +        samples.jaxrpc.hello.HelloClient.main(new String[]{});
  +        log.info("Test complete.");
       }
   
       public void testAddress() throws Exception {
  -        try {
  -            log.info("Testing JAX-RPC Address sample.");
  -            samples.jaxrpc.address.AddressClient.main(new String[]{});
  -            log.info("Test complete.");
  -        }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            throw new Exception("Fault returned from test: " + t);
  -        }
  +        log.info("Testing JAX-RPC Address sample.");
  +        samples.jaxrpc.address.AddressClient.main(new String[]{});
  +        log.info("Test complete.");
       }
   
       public static void main(String args[]) throws Exception {
  
  
  
  1.12      +1 -0      ws-axis/java/test/wsdl/addrNoImplSEI/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/addrNoImplSEI/build.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build.xml	2 Jun 2004 17:05:17 -0000	1.11
  +++ build.xml	24 Feb 2005 21:59:56 -0000	1.12
  @@ -97,6 +97,7 @@
                  useInheritedMethods="false"
                  portTypeName="AddressBookNoImplSEI"
                  namespace="http://addrNoImplSEI.wsdl.test"
  +               typeMappingVersion="1.1"
                  location="http://localhost:8080/axis/services/AddressBookNoImplSEI">
           <mapping namespace="urn:AddrNoImplSEI" package="test.wsdl.addrNoImplSEI"/>
       </java2wsdl>
  
  
  
  1.3       +1 -0      ws-axis/java/test/wsdl/roundtrip2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/roundtrip2/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml	21 Feb 2005 21:37:09 -0000	1.2
  +++ build.xml	24 Feb 2005 21:59:56 -0000	1.3
  @@ -90,6 +90,7 @@
       <wsdl2java url="${axis.home}/build/work/test/wsdl/roundtrip2/roundtrip2.wsdl"
                  output="${axis.home}/build/work"
                  deployscope="session"
  +               typeMappingVersion="1.3"
                  serverSide="yes"
                  testcase="yes">
       </wsdl2java>
  
  
  
  1.27      +8 -3      ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java
  
  Index: Java2WsdlAntTask.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Java2WsdlAntTask.java	29 Jan 2005 03:00:54 -0000	1.26
  +++ Java2WsdlAntTask.java	24 Feb 2005 21:59:56 -0000	1.27
  @@ -16,6 +16,8 @@
   package org.apache.axis.tools.ant.wsdl;
   
   import org.apache.axis.encoding.TypeMappingImpl;
  +import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.TypeMappingDelegate;
   import org.apache.axis.utils.ClassUtils;
   import org.apache.axis.wsdl.fromJava.Emitter;
   import org.apache.tools.ant.AntClassLoader;
  @@ -163,6 +165,7 @@
           try {
               traceParams(Project.MSG_VERBOSE);
               validate();
  +
               // Instantiate the emitter
               Emitter emitter = new Emitter();
               //do the mappings, packages are the key for this map
  @@ -194,14 +197,16 @@
                   emitter.setExtraClasses(extraClasses);
               }
   
  -            emitter.setTypeMappingVersion(typeMappingVersion);
  +            TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
  +            tmr.doRegisterFromVersion(typeMappingVersion);
  +            emitter.setTypeMappingRegistry(tmr);
  +
               // Create TypeMapping and register complex types
  -            TypeMappingImpl tmi = new TypeMappingImpl(emitter.getDefaultTypeMapping());
  +            TypeMappingDelegate tmi = (TypeMappingDelegate)tmr.getDefaultTypeMapping();
               Iterator i = complexTypes.iterator();
               while (i.hasNext()) {
                   ((ComplexType) i.next()).register(tmi);
               }
  -            emitter.setTypeMapping(tmi);
               
               if (style != null) {
                   emitter.setStyle(style);