ws-wsif-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ow...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/util WSIFUtils.java
Date Wed, 26 Feb 2003 15:55:24 GMT
owenb       2003/02/26 07:55:24

  Modified:    java/src/org/apache/wsif/base WSIFDefaultOperation.java
                        WSIFClientProxy.java WSIFServiceImpl.java
                        WSIFServiceFactoryImpl.java
               java/src/org/apache/wsif/compiler/schema/tools
                        ClassFile.java SchemaType.java Conventions.java
                        SchemaAttributeGroup.java Schema2Java.java
                        ClassField.java SchemaAttribute.java
                        SchemaAnyAttribute.java SchemaAny.java
                        SchemaGroup.java SchemaElement.java
                        SchemaComplexType.java SchemaMGS.java
                        SchemaSimpleType.java
               java/src/org/apache/wsif/wsdl WSIFWSDLLocatorImpl.java
                        AuthenticatingProxyWSDLLocatorImpl.java
               java/test/docStyle NWBankTest.java ZipCodeAxisTest.java
               java/src/org/apache/wsif/compiler/util Utils.java
                        StreamFactory.java TypeMapping.java
               java/src/org/apache/wsif WSIFConstants.java
                        WSIFServiceFactory.java
               java/src/org/apache/wsif/compiler/schema
                        SchemaException.java
               java/test/util TestUtilities.java
               java/test/addressbook AddressBookTest.java
               java/src/org/apache/wsif/schema Parser.java
               java/src/org/apache/wsif/util WSIFUtils.java
  Added:       java/src/org/apache/wsif/mapping WSIFDefaultMapper.java
                        WSIFMappingConvention.java
                        WSIFDefaultMappingConvention.java WSIFMapper.java
                        WSIFMappingConventionFactory.java
                        WSIFMapperFactory.java
               java/src/org/apache/wsif/wsdl ClosableLocator.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSDL2JavaMappingConvention.java
  Log:
  Add support for new functionality which allows WSIF to automatically establish mappings between xml names and Java class names
  
  Revision  Changes    Path
  1.21      +3 -3      xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java
  
  Index: WSIFDefaultOperation.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSIFDefaultOperation.java	13 Jan 2003 20:40:21 -0000	1.20
  +++ WSIFDefaultOperation.java	26 Feb 2003 15:55:17 -0000	1.21
  @@ -360,8 +360,8 @@
                       throw new WSIFException(
                           "jms:propertyValue " + name + " did not have a value");
       
  -                TypeMapping tm = (TypeMapping) (simpleTypeReg.get(type));
  -                if (tm == null || tm.javaType == null)
  +                String cls = (String) (simpleTypeReg.get(type));
  +                if (cls == null)
                       throw new WSIFException(
                           "jms:propertyValue "
                               + name
  @@ -372,7 +372,7 @@
                   try {
                       javaClass =
                           Class.forName(
  -                            tm.javaType,
  +                            cls,
                               true,
                               Thread.currentThread().getContextClassLoader());
                   } catch (ClassNotFoundException cce) {
  
  
  
  1.17      +3 -4      xml-axis-wsif/java/src/org/apache/wsif/base/WSIFClientProxy.java
  
  Index: WSIFClientProxy.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFClientProxy.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- WSIFClientProxy.java	21 Jan 2003 17:34:08 -0000	1.16
  +++ WSIFClientProxy.java	26 Feb 2003 15:55:18 -0000	1.17
  @@ -523,11 +523,10 @@
                   }
   
                   // Look for a simple type that matches
  -                TypeMapping tm =
  -                    (TypeMapping) (simpleTypeReg.get(partTypeName));
  +                String simpleType =
  +                    (String) (simpleTypeReg.get(partTypeName));
                   if (!foundThisArg) {
  -                    if (tm != null) {
  -                        String simpleType = tm.javaType;
  +                    if (simpleType != null) {
                           if (types[argIndex].toString().equals(simpleType)) {
                               // this works for simple types (float, int)
                               foundThisArg = true;
  
  
  
  1.32      +207 -163  xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java
  
  Index: WSIFServiceImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- WSIFServiceImpl.java	13 Jan 2003 20:40:21 -0000	1.31
  +++ WSIFServiceImpl.java	26 Feb 2003 15:55:18 -0000	1.32
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -50,15 +50,15 @@
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
    * originally based on software copyright (c) 2001, 2002, International
  - * Business Machines, Inc., http://www.apache.org.  For more
  + * Business Machines, Inc., http://www.ibm.com.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
   
   package org.apache.wsif.base;
   
  +import java.io.IOException;
   import java.util.ArrayList;
  -import java.util.HashMap;
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.List;
  @@ -77,27 +77,27 @@
   import javax.wsdl.WSDLException;
   import javax.wsdl.extensions.ExtensibilityElement;
   import javax.wsdl.extensions.ExtensionRegistry;
  -import javax.wsdl.extensions.UnknownExtensibilityElement;
  +import javax.wsdl.xml.WSDLLocator;
   import javax.xml.namespace.QName;
   
  -import org.apache.wsif.WSIFConstants;
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFMessage;
   import org.apache.wsif.WSIFPort;
   import org.apache.wsif.WSIFService;
  -import org.apache.wsif.compiler.schema.tools.Schema2Java;
  -import org.apache.wsif.compiler.util.TypeMapping;
  -import org.apache.wsif.compiler.util.Utils;
   import org.apache.wsif.logging.MessageLogger;
   import org.apache.wsif.logging.Trc;
  +import org.apache.wsif.mapping.WSIFMapper;
  +import org.apache.wsif.mapping.WSIFMapperFactory;
  +import org.apache.wsif.mapping.WSIFMappingConvention;
  +import org.apache.wsif.mapping.WSIFMappingConventionFactory;
   import org.apache.wsif.providers.WSIFDynamicTypeMap;
  +import org.apache.wsif.schema.Parser;
  +import org.apache.wsif.schema.SchemaType;
   import org.apache.wsif.spi.WSIFProvider;
   import org.apache.wsif.util.WSIFPluggableProviders;
   import org.apache.wsif.util.WSIFUtils;
  -import org.w3c.dom.Element;
  -
  -import com.ibm.wsdl.util.xml.QNameUtils;
  -
  +import org.apache.wsif.wsdl.ClosableLocator;
  +import org.apache.wsif.wsdl.WSIFWSDLLocatorImpl;
   
   /**
    * An entry point to dynamic WSDL invocations.
  @@ -118,11 +118,21 @@
       private Port[] myPortsArr;
       private Map myPortsMap;
       private WSIFDynamicTypeMap typeMap = new WSIFDynamicTypeMap();
  -    private boolean typeMapInitialised = false;
       private String preferredPort = null;
       private Map typeReg = null;
       private Port chosenPort = null;
       private WSIFMessage context;
  +    
  +    protected ArrayList schemaTypes = new ArrayList();    
  +    protected WSIFMappingConvention mapCon = null;
  +    protected WSIFMapper mapper = null;
  +    // Flag to indicate that we have produced mappings based on the types in the schema
  +    private boolean typeMapInitialised = false;
  +    // Flag to indicate that we have parsed the schema to find the types
  +    private boolean schemaTypesInitialised = false;
  +    // If the WSDLLocator needed to parse the schema cannot be created by calling
  +    // new WSIFWSDLLocatorImpl((String) null, (String) null, null), store it
  +    private WSDLLocator specialistLocator = null;
   
       /**
        * Create a WSIF service instance from WSDL document URL.
  @@ -199,6 +209,10 @@
               throw new WSIFException("could not load " + wsdlLoc, ex);
           }
   
  +        // Store a locator with a reference to the classloader in case autoTypeMappings
  +        // is off but we use stub invocations later
  +		specialistLocator = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  +
           // select WSDL service if given name
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
   
  @@ -313,6 +327,11 @@
   		System.arraycopy(svc.myPortsArr, 0, this.myPortsArr, 0, svc.myPortsArr.length);
           this.myPortsMap = (Map) ((Hashtable) svc.myPortsMap).clone();
   		this.typeMap = svc.typeMap.copy();
  +		this.schemaTypesInitialised = svc.schemaTypesInitialised;
  +		this.typeMapInitialised = svc.typeMapInitialised;
  +		this.schemaTypes = (ArrayList) svc.schemaTypes.clone();
  +		this.mapCon = svc.mapCon;
  +		this.mapper = svc.mapper;
   	}
   
       /**
  @@ -457,48 +476,95 @@
           }
           // Store the chosen port so that we can query which was is being used
           chosenPort = port;
  +        
  +       	setupTypeMappings();       
   
           Trc.exit(portInstance);
           return portInstance;
       }
   
       /**
  +     * Add an association between XML and Java type.
  +     * @param xmlType The qualified xml name
  +     * @param javaType The Java class
  +     * @param force flag to indicate if mapping should override an existing one
  +     * for the same xmlType 
  +     */
  +    private void mapType(QName xmlType, Class javaType, boolean force)
  +        throws WSIFException {
  +        Trc.entry(this, xmlType, javaType, new Boolean(force));
  +        typeMap.mapType(xmlType, javaType, force);
  +        Trc.exit();
  +    }
  +
  +    /**
        * Add association between XML and Java type.
        * @param xmlType The qualified xml name
        * @param javaType The Java class 
        */
       public void mapType(QName xmlType, Class javaType) throws WSIFException {
           Trc.entry(this, xmlType, javaType);
  -        typeMap.mapType(xmlType, javaType);
  +        if (mapper != null) {
  +        	mapper.overrideTypeMapping(xmlType, javaType.getName());
  +        }
  +        if (!schemaTypesInitialised) {
  +            // Map it directly now!        	
  +            typeMap.mapType(xmlType, javaType, true);
  +        }
           Trc.exit();
       }
   
       /**
  -     * Add an association between XML and Java type.
  +     * Add association between XML and Java type.
        * @param xmlType The qualified xml name
  -     * @param javaType The Java class
  -     * @param force flag to indicate if mapping should override an existing one
  -     * for the same xmlType 
  +     * @param className The Java class name
        */
  -    private void mapType(QName xmlType, Class javaType, boolean force)
  -        throws WSIFException {
  -        Trc.entry(this, xmlType, javaType, new Boolean(force));
  -        typeMap.mapType(xmlType, javaType, force);
  +    public void mapType(QName xmlType, String className) throws WSIFException {
  +        Trc.entry(this, xmlType, className);
  +        if (mapper != null) {
  +        	mapper.overrideTypeMapping(xmlType, className);
  +        }
  +        if (!schemaTypesInitialised) {
  +            // Map it directly now!
  +            Class clazz = null;
  +            try {
  +                clazz =
  +                    Class.forName(
  +                        className,
  +                        true,
  +                        Thread.currentThread().getContextClassLoader());
  +            } catch (ClassNotFoundException e) {
  +                // Ignore error - mapping will not be added
  +                Trc.ignoredException(e);
  +            }
  +            if (clazz != null) {
  +                typeMap.mapType(xmlType, clazz, true);
  +            }
  +        }
           Trc.exit();
       }
   
       /**
  -     * Add an association between a namespace URI and and a Java package.
  +     * Add an association between a namespace URI and and a Java package. Calling
  +     * this method will trigger the automatic mapping of types, regardless of what 
  +     * was set at the WSIFServiceFactory level, since all the types in the schema(s)
  +     * need to be examined in order to use the information provided.
        * @param namespace The namespace URI
        * @param packageName The full package name
        */
       public void mapPackage(String namespace, String packageName)
           throws WSIFException {
           Trc.entry(namespace, packageName);
  -        typeMap.mapPackage(namespace, packageName);
  +        // In order to use package mapping information, we need a list
  +        // of types to apply the mapping to, so let's make sure we have one!
  +        populateSchemaTypes(specialistLocator);
  +        
  +        if (mapCon != null) {
  +        	mapCon.overridePackageMapping(namespace, packageName);
  +        }
           Trc.exit();
       }
  -
  +    
       /**
        * @deprecated this method is replaced by the getProvider
        * method in the org.apache.util.WSIFPluggableProviders class
  @@ -543,17 +609,10 @@
       public Object getStub(String portName, Class iface) throws WSIFException {
           Trc.entry(this, portName, iface);
   
  -        // Initialise the type mappings here (not in the constructor) so that
  -        // other products which use non-standard WSDL in their complexTypes
  -        // that WSIF wouldn't understand, can use the DynamicInvoker 
  -        // successfully. Using the DynamicInvoker means we would never come
  -        // through this code and so never try to parse the complexTypes.
  -        // Obviously if the user wants to use dynamic proxies then we have to 
  -        // parse the complex types.
  -        if (!typeMapInitialised) {
  -            initialiseTypeMappings();
  -            typeMapInitialised = true;
  -        }
  +		// Stub support has always included automatically mapping
  +		// types, albeit badly! So we need to make sure that we
  +		// do it now, regardless of what flag is set on the WSIFServiceFactory		
  +		populateSchemaTypes(specialistLocator);
   
           // if the port is not available, force the expection now rather
           // rather than go through the rest of this method		
  @@ -590,17 +649,10 @@
       public Object getStub(Class iface) throws WSIFException {
           Trc.entry(this, iface);
   
  -        // Initialise the type mappings here (not in the constructor) so that
  -        // other products which use non-standard WSDL in their complexTypes
  -        // that WSIF wouldn't understand, can use the DynamicInvoker 
  -        // successfully. Using the DynamicInvoker means we would never come
  -        // through this code and so never try to parse the complexTypes.
  -        // Obviously if the user wants to use dynamic proxies then we have to 
  -        // parse the complex types.
  -        if (!typeMapInitialised) {
  -            initialiseTypeMappings();
  -            typeMapInitialised = true;
  -        }
  +		// Stub support has always included automatically mapping
  +		// types, albeit badly! So we need to make sure that we
  +		// do it now, regardless of what flag is set on the WSIFServiceFactory
  +		populateSchemaTypes(specialistLocator);
   
           // if the port is not available, force the expection now rather
           // rather than go through the rest of this method		
  @@ -769,124 +821,12 @@
               myPortsArr[count++] = port;
           }
   
  -        // Provide the WSIDDynamicTypeMap with a list of all of the custom
  -        // types in the wsdl
  -        typeMap.setAllTypes(getAllCustomTypes());
  -    }
  -
  -    /**
  -     * Get a list of all the custom complexTypes and simpleTypes in the wsdl
  -     */
  -    private ArrayList getAllCustomTypes() {
  -        ArrayList types = new ArrayList();
  -        Iterator typeMappingIterator = getDefaultTypeMappings();
  -        if (typeMappingIterator != null) {
  -            while (typeMappingIterator.hasNext()) {
  -                TypeMapping tm = (TypeMapping) typeMappingIterator.next();
  -                if (tm != null) {
  -                    String namespaceURI = tm.elementType.getNamespaceURI();
  -                    if (!namespaceURI.equals(WSIFConstants.NS_URI_1999_SCHEMA_XSD)
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_2000_SCHEMA_XSD)
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD)) {
  -                        QName element = tm.elementType;
  -                        if (element != null) {
  -                            types.add(element);
  -                        }
  -                    }
  -                }
  -            }
  -        }
  -        return types;
  -    }
  -
  -    /**
  -     * Get a list of all the default mappings for complexTypes and simpleTypes 
  -     * in the wsdl
  -     */
  -    private Iterator getDefaultTypeMappings() {
  -        if (typeReg != null) {
  -    		return typeReg.values().iterator();
  -    	}
  -        typeReg = new HashMap();
  -        List typesElList = Utils.getAllTypesElements(def);
  -        if (typesElList.size() > 0) {
  -            String schemaURI1999 = WSIFConstants.NS_URI_1999_SCHEMA_XSD;
  -            Schema2Java s2j1999 = new Schema2Java(schemaURI1999);
  -            QName qElemSchema1999 = new QName(schemaURI1999, "schema");
  -            String schemaURI2000 = WSIFConstants.NS_URI_2000_SCHEMA_XSD;
  -            Schema2Java s2j2000 = new Schema2Java(schemaURI2000);
  -            QName qElemSchema2000 = new QName(schemaURI2000, "schema");
  -            String schemaURI2001 = WSIFConstants.NS_URI_2001_SCHEMA_XSD;
  -            Schema2Java s2j2001 = new Schema2Java(schemaURI2001);
  -            QName qElemSchema2001 = new QName(schemaURI2001, "schema");
  -
  -            Iterator typesElIterator = typesElList.iterator();
  -            while (typesElIterator.hasNext()) {
  -                UnknownExtensibilityElement unknExEl =
  -                    (UnknownExtensibilityElement) typesElIterator.next();
  -                Element schemaEl = unknExEl.getElement();
  -                try {
  -                    if (QNameUtils.matches(qElemSchema1999, schemaEl)
  -                        || QNameUtils.matches(qElemSchema2000, schemaEl)
  -                        || QNameUtils.matches(qElemSchema2001, schemaEl)) {
  -                        //Hashtable typeReg = new Hashtable();
  -                        if (QNameUtils.matches(qElemSchema1999, schemaEl))
  -                            s2j1999.createJavaMapping(schemaEl, typeReg);
  -                        else if (QNameUtils.matches(qElemSchema2000, schemaEl))
  -                            s2j2000.createJavaMapping(schemaEl, typeReg);
  -                        else
  -                            s2j2001.createJavaMapping(schemaEl, typeReg);
  -                    }
  -                } catch (Exception e) {
  -		        	Trc.ignoredException(e);
  -                    //ignored
  -                }
  -            }
  -        }
  -        return typeReg.values().iterator();
  +		// Set up the WSIFMapper and WSIFMappingConvention for use by this service
  +        mapCon = WSIFMappingConventionFactory.newMappingConvention();
  +        mapper = WSIFMapperFactory.newMapper();
  +        mapper.setMappingConvention(mapCon);       
       }
   
  -    /**
  -     * Initialize default mappings between custom complex types and simple types and
  -     * Java classes.
  -     */
  -    private void initialiseTypeMappings() throws WSIFException {
  -        Iterator typeMappingIterator = getDefaultTypeMappings();
  -        if (typeMappingIterator != null) {
  -            while (typeMappingIterator.hasNext()) {
  -                TypeMapping tm = (TypeMapping) typeMappingIterator.next();
  -
  -                if (tm.elementType != null && tm.elementType.getNamespaceURI() != null) {
  -                    String namespaceURI = tm.elementType.getNamespaceURI();
  -                    if (namespaceURI != null
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_1999_SCHEMA_XSD)
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_2000_SCHEMA_XSD)
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD)
  -                        && !namespaceURI.equals(WSIFConstants.NS_URI_SOAP_ENC)
  -                        && tm.javaType != null) {
  -                        String packageName = Utils.getPackageName(tm.javaType);
  -                        if (packageName != null && !packageName.equals("")) {
  -                        	packageName += ".";
  -                        }
  -                        String className = packageName + Utils.getClassName(tm.javaType);
  -                        Class clazz = null;
  -
  -                        try {
  -                            clazz =
  -                                Class.forName(className, true, Thread.currentThread().getContextClassLoader());
  -                        } catch (ClassNotFoundException e) {
  -                            // Ignore error - mapping will not be added
  -                            Trc.ignoredException(e);
  -                        }
  -                        // Create a new mapping but don't override one that already exists for this element type
  -                        if (clazz != null) {
  -                        	mapType(tm.elementType, clazz, false);
  -                        }
  -                    }
  -                }
  -            } // end while
  -        }
  -    }
   
       /**
        * Check PortType information is consistent. This method can be updated when
  @@ -1023,6 +963,110 @@
           }
           this.context = context;
           Trc.exit();
  +    }
  +	
  +	/**
  +	 * Override the WSIFMapper used by this WSIFService
  +	 * @param mapperClassName The class name for the WSIFMapper implementation to be used by this WSIFService
  +	 * @throws A WSIFException if the WSIFMapper cannot be found or set
  +	 */
  +	protected void overrideMapper(String mapperClassName) throws WSIFException {
  +		mapper = WSIFMapperFactory.newMapper(mapperClassName);
  +	}
  +
  +	/**
  +	 * Override the WSIFMappingConvention used by this WSIFService
  +	 * @param mappingConvClassName The class name for the WSIFMappingConvention implementation 
  +	 * to be used by this WSIFService
  +	 * @throws A WSIFException if the WSIFMappingConvention cannot be found or set
  +	 */
  +	protected void overrideMappingConvention(String mappingConvClassName) throws WSIFException {
  +		mapCon = WSIFMappingConventionFactory.newMappingConvention(mappingConvClassName);
  +		mapper.setMappingConvention(mapCon);
  +	}
  +
  +	/**
  +	 * Parse the schema(s) associated with the wsdl and find all the types/elements that are defined.
  +	 * @param loc A WSDLLocator to use in finding imported xsd files
  +	 * @throws A WSIFException if the parsing fails
  +	 */    
  +    protected void populateSchemaTypes(WSDLLocator loc)
  +        throws WSIFException {
  +        // Get a lock on the list of type. Nobody else should be able to alter it
  +    	// while we are working in this method.	
  +        synchronized (schemaTypes) {
  +        	// Don't parse the schema if we've already done it!!
  +        	if (schemaTypesInitialised) return;
  +        	if (loc == null) {
  +        		loc = new WSIFWSDLLocatorImpl((String) null, (String) null, (ClassLoader) null);
  +        	}
  +            Parser.getAllSchemaTypes(def, schemaTypes, loc);
  +            
  +            // if we can, close the WSDLLocator
  +            if (loc instanceof ClosableLocator) {
  +            	try {
  +            		((ClosableLocator) loc).close();
  +            	} catch (IOException ioe) {
  +            		// Ignore. Is this the correct thing to do??
  +            		Trc.ignoredException(ioe);
  +            	}
  +            }
  +            
  +            schemaTypesInitialised = true;
  +        }
  +    }
  +
  +	/**
  +	 * Create and set all mappings from xml types to Java classes
  +	 * @throws A WSIFException if the mapping process fails
  +	 */    
  +    protected void setupTypeMappings() throws WSIFException {
  +    	// Get a lock on the list of type. Nobody else should be able to alter it
  +    	// while we are working in this method.
  +        synchronized (schemaTypes) {
  +        	// Don't calculate the mappings if we've already done it!!
  +        	// This is a one off method. Perhaps in the future a way of updating
  +        	// existing mappings could be added.
  +        	if (typeMapInitialised) return;
  +        	
  +        	// Without a mapper we can't do any mapping!!     	
  +            if (mapper == null) {
  +                Trc.event(this, "Automatic mapping of types did not take place "+
  +                "because mapper was null");
  +                return;
  +            }
  +            SchemaType[] types = new SchemaType[schemaTypes.size()];
  +            schemaTypes.toArray(types);
  +            Map mappings = mapper.getMappings(types);
  +            if (mappings != null) {
  +                Iterator it = mappings.keySet().iterator();
  +                while (it.hasNext()) {
  +                    QName xmlType = (QName) it.next();
  +                    String clsName = (String) mappings.get(xmlType);
  +                    if (clsName != null) {
  +                        Class clazz = null;
  +                        try {
  +                            clazz =
  +                                Class.forName(
  +                                    clsName,
  +                                    true,
  +                                    Thread
  +                                        .currentThread()
  +                                        .getContextClassLoader());
  +                        } catch (ClassNotFoundException e) {
  +                            // Ignore error - mapping will not be added
  +                            Trc.ignoredException(e);
  +                        }
  +                        // Create a new mapping but don't override an existing 
  +                        // one for the same type
  +                        if (clazz != null) {
  +                            mapType(xmlType, clazz, false);
  +                        }
  +                    }
  +                }
  +            }
  +            typeMapInitialised = true;
  +        }
       }
   
       public String deep() {
  
  
  
  1.10      +72 -2     xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceFactoryImpl.java
  
  Index: WSIFServiceFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceFactoryImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WSIFServiceFactoryImpl.java	7 Dec 2002 12:34:00 -0000	1.9
  +++ WSIFServiceFactoryImpl.java	26 Feb 2003 15:55:18 -0000	1.10
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -50,7 +50,7 @@
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
    * originally based on software copyright (c) 2001, 2002, International
  - * Business Machines, Inc., http://www.apache.org.  For more
  + * Business Machines, Inc., http://www.ibm.com.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  @@ -63,12 +63,14 @@
   import javax.wsdl.Definition;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
  +import javax.wsdl.xml.WSDLLocator;
   import javax.xml.namespace.QName;
   
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFService;
   import org.apache.wsif.WSIFServiceFactory;
   import org.apache.wsif.logging.Trc;
  +import org.apache.wsif.wsdl.WSIFWSDLLocatorImpl;
   
   /**
    * Factory class used to create instances of WSIFService
  @@ -79,6 +81,9 @@
   public class WSIFServiceFactoryImpl extends WSIFServiceFactory {
   
       private boolean useCache = false;
  +    private boolean autoMapTypes = false;
  +    private String mapperClassName = null;
  +    private String mappingConventionClassName = null;
       private Map cache = new Hashtable();
   
       /**
  @@ -137,6 +142,11 @@
                   portTypeNS,
                   portTypeName);
   
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, wsdlLoc, null);
  +			configureServiceImplMappingInfo(wsi, loc);			
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -206,6 +216,11 @@
                   portTypeNS,
                   portTypeName);
   
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  +			configureServiceImplMappingInfo(wsi, loc);			
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -234,6 +249,12 @@
           }
   
           WSIFServiceImpl wsi = new WSIFServiceImpl(def);
  +
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, def.getDocumentBaseURI(), null);
  +			configureServiceImplMappingInfo(wsi, loc);			
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -264,6 +285,12 @@
           }
   
           WSIFServiceImpl wsi = new WSIFServiceImpl(def, service);
  +
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, def.getDocumentBaseURI(), null);
  +			configureServiceImplMappingInfo(wsi, loc);			
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -297,6 +324,12 @@
           }
   
           WSIFServiceImpl wsi = new WSIFServiceImpl(def, service, portType);
  +
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, def.getDocumentBaseURI(), null);
  +			configureServiceImplMappingInfo(wsi, loc);			
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -355,6 +388,12 @@
                   serviceName,
                   portTypeNS,
                   portTypeName);
  +
  +		if (autoMapTypes) {
  +			WSDLLocator loc = new WSIFWSDLLocatorImpl(null, def.getDocumentBaseURI(), null);
  +			configureServiceImplMappingInfo(wsi, loc);		
  +		}
  +
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
           }
  @@ -376,6 +415,27 @@
           Trc.exit();
       }
   
  +
  +    /**
  +     * @see WSIFServiceFactory#automaticallyMapTypes(boolean on)
  +     */
  +    public void automaticallyMapTypes(boolean on) {
  +    	Trc.entry(this,on);
  +        autoMapTypes = on;
  +        Trc.exit();
  +    }
  +
  +    /**
  +     * @see WSIFServiceFactory#automaticallyMapTypes(boolean on, String mapperClassName, String conventionClassName)
  +     */
  +    public void automaticallyMapTypes(boolean on, String mapperClassName, String conventionClassName) {
  +    	Trc.entry(this, new Boolean(on), mapperClassName, conventionClassName);
  +        autoMapTypes = on;    	
  +    	this.mapperClassName = mapperClassName;
  +    	this.mappingConventionClassName = conventionClassName;
  +    	Trc.exit();
  +    }
  +
       private String genCacheKey(
           Definition def,
           Service service,
  @@ -488,5 +548,15 @@
               ret = "";
           Trc.exit(ret);
           return ret;
  +    }
  +    
  +    private void configureServiceImplMappingInfo(WSIFServiceImpl ser, WSDLLocator loc) throws WSIFException {
  +        ser.populateSchemaTypes(loc);
  +        if (mapperClassName != null) {
  +            ser.overrideMapper(mapperClassName);
  +        }
  +        if (mappingConventionClassName != null) {
  +            ser.overrideMappingConvention(mappingConventionClassName);
  +        }
       }
   }
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/ClassFile.java
  
  Index: ClassFile.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/ClassFile.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassFile.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ ClassFile.java	26 Feb 2003 15:55:18 -0000	1.3
  @@ -63,6 +63,7 @@
    * ClassFile
    * Creation date: (5/30/00 2:04:09 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class ClassFile {
   
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaType.java
  
  Index: SchemaType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaType.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ SchemaType.java	26 Feb 2003 15:55:18 -0000	1.3
  @@ -61,6 +61,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 5:21:48 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public interface SchemaType {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/Conventions.java
  
  Index: Conventions.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/Conventions.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Conventions.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ Conventions.java	26 Feb 2003 15:55:18 -0000	1.4
  @@ -72,6 +72,7 @@
    * @author:Tian Zhao (tzhao@cs.purdue.edu)
    * @author:Sanjiva Weerawarana (sanjiva@us.ibm.com)
    * @author:Matthew J. Duftler (duftler@us.ibm.com)
  + * @deprecated
    */
   public class Conventions {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAttributeGroup.java
  
  Index: SchemaAttributeGroup.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAttributeGroup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaAttributeGroup.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaAttributeGroup.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -65,6 +65,7 @@
    * Processed information of a XML Schema attribute group
    * Creation date: (5/29/00 1:55:51 AM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaAttributeGroup implements SchemaType {
   
  
  
  
  1.12      +2 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/Schema2Java.java
  
  Index: Schema2Java.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/Schema2Java.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Schema2Java.java	7 Dec 2002 12:33:55 -0000	1.11
  +++ Schema2Java.java	26 Feb 2003 15:55:19 -0000	1.12
  @@ -85,6 +85,8 @@
    * Convert XML schema file into Java class files.
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
    * @author Owen Burroughs <owenb@apache.org>
  + * 
  + * @deprecated
    */
   public class Schema2Java {
   
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/ClassField.java
  
  Index: ClassField.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/ClassField.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassField.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ ClassField.java	26 Feb 2003 15:55:19 -0000	1.3
  @@ -61,6 +61,7 @@
    * Data structure to hold class fields for schema to Java output files.
    * Creation date: (5/29/00 1:55:51 AM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class ClassField {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAttribute.java
  
  Index: SchemaAttribute.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAttribute.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaAttribute.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaAttribute.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -63,6 +63,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 5:32:11 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaAttribute implements SchemaType {
   
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAnyAttribute.java
  
  Index: SchemaAnyAttribute.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAnyAttribute.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaAnyAttribute.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ SchemaAnyAttribute.java	26 Feb 2003 15:55:19 -0000	1.3
  @@ -61,6 +61,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 6:42:07 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaAnyAttribute implements SchemaType {
   
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAny.java
  
  Index: SchemaAny.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaAny.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaAny.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ SchemaAny.java	26 Feb 2003 15:55:19 -0000	1.3
  @@ -61,6 +61,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 6:42:07 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaAny implements SchemaType {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaGroup.java
  
  Index: SchemaGroup.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaGroup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaGroup.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaGroup.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -65,6 +65,7 @@
    * Processed information of a XML Schema group
    * Creation date: (5/29/00 1:55:51 AM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaGroup implements SchemaType {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaElement.java
  
  Index: SchemaElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaElement.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaElement.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaElement.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -63,6 +63,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 5:32:11 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaElement implements SchemaType {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaComplexType.java
  
  Index: SchemaComplexType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaComplexType.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaComplexType.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaComplexType.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -65,6 +65,7 @@
    * Processed information of a XML Schema complexType
    * Creation date: (5/29/00 1:55:51 AM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaComplexType implements SchemaType {
   
  
  
  
  1.3       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaMGS.java
  
  Index: SchemaMGS.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaMGS.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaMGS.java	7 Dec 2002 12:33:55 -0000	1.2
  +++ SchemaMGS.java	26 Feb 2003 15:55:19 -0000	1.3
  @@ -63,6 +63,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 6:35:05 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaMGS implements SchemaType {
   
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaSimpleType.java
  
  Index: SchemaSimpleType.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/tools/SchemaSimpleType.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaSimpleType.java	7 Dec 2002 12:33:55 -0000	1.3
  +++ SchemaSimpleType.java	26 Feb 2003 15:55:19 -0000	1.4
  @@ -63,6 +63,7 @@
    * Insert the type's description here.
    * Creation date: (6/21/00 5:32:11 PM)
    * @author: Tian Zhao (tzhao@cs.purdue.edu)
  + * @deprecated
    */
   public class SchemaSimpleType implements SchemaType {
   
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFDefaultMapper.java
  
  Index: WSIFDefaultMapper.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.mapping;
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  
  import javax.xml.namespace.QName;
  
  import org.apache.wsif.WSIFConstants;
  import org.apache.wsif.logging.Trc;
  import org.apache.wsif.schema.ComplexType;
  import org.apache.wsif.schema.ElementType;
  import org.apache.wsif.schema.SchemaType;
  import org.apache.wsif.schema.SimpleType;
  
  /**
   * The default implementation of {@link org.apache.wsif.mapping.WSIFMapper}.
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public class WSIFDefaultMapper implements WSIFMapper {
  	
  	private boolean includeStandardMappings = false;
  	private WSIFMappingConvention convention = new WSIFDefaultMappingConvention();
  
  	// Table of type mappings: xml name -> Java class name
      private Hashtable typeMappings = new Hashtable();
  	
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#getIncludeStandardMappings()
       */
  	public boolean getIncludeStandardMappings() {
  		return includeStandardMappings;
  	}
  
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#setIncludeStandardMappings(boolean)
       */
  	public void setIncludeStandardMappings(boolean b) {
  		includeStandardMappings = b;
  	}
  
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#getMappingConvention()
       */
  	public WSIFMappingConvention getMappingConvention() {
  		return convention;
  	}
  
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#setMappingConvention(WSIFMappingConvention)
       */
  	public void setMappingConvention(WSIFMappingConvention con) {
  		convention = con;
  	}
  
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#overrideTypeMapping(String, QName)
       */
      public void overrideTypeMapping(QName xmlName, String className) {
      	if (className != null && xmlName != null) {
      		// Store the xml name as the key and the Java class name as the value
      	    typeMappings.put(xmlName, className);
      	}
      }
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMapper#getMappings(SchemaType[])
       */
      public Map getMappings(SchemaType[] types) {
  
  		Trc.entry(this, types);
  		
  		HashMap table = new HashMap();
  		if (types == null) {
  			Trc.exit(table);
  			return table;
  		}
  				
          HashMap standards = null;
  
          if (includeStandardMappings) {
              // set up all standard mappings
              populateWithStandardMappings(
                  table,
                  WSIFConstants.NS_URI_1999_SCHEMA_XSD,
                  true);
              populateWithStandardMappings(
                  table,
                  WSIFConstants.NS_URI_2000_SCHEMA_XSD,
                  false);
              populateWithStandardMappings(
                  table,
                  WSIFConstants.NS_URI_2001_SCHEMA_XSD,
                  false);
          } else {
              // set up all standard mappings in a seperate map for use when resolving arrays			
              standards = new HashMap();
              populateWithStandardMappings(
                  standards,
                  WSIFConstants.NS_URI_1999_SCHEMA_XSD,
                  true);
              populateWithStandardMappings(
                  standards,
                  WSIFConstants.NS_URI_2000_SCHEMA_XSD,
                  false);
              populateWithStandardMappings(
                  standards,
                  WSIFConstants.NS_URI_2001_SCHEMA_XSD,
                  false);
          }
  
          // Create temporary list to hold types which are arrays. We can then resolve them
          // after resolving all other types
          List arrays = new ArrayList();
  
          // Create temporary list to hold types which are elements. We can then resolve them
          // after resolving all other types
          List elements = new ArrayList();
  
          // Go through the array of SchemaType objects
          for (int i = 0; i < types.length; i++) {
  
              SchemaType st = types[i];
              // Ignore null types
              if (st == null)
                  continue;
              QName typeName = st.getTypeName();
              if (typeName == null)
                  continue;
  
              if (st.isArray()) {
                  arrays.add(st);
              } else {
                  // Deal with elements
                  if (st instanceof ElementType) {
                      QName baseType = ((ElementType) st).getElementType();
  
                      if (baseType != null) {
                          if (((ElementType) st).isNillable()) {
                              String wrapperClass = getWrapperClassName(baseType);
                              if (wrapperClass != null) {
                                  table.put(typeName, wrapperClass);
                                  continue;
                              }
                          }
                          String baseClassName = (String) typeMappings.get(baseType);
                          if (baseClassName == null) {                        
                              baseClassName = (String) table.get(baseType);
                          }
                          if (baseClassName == null
                              && !includeStandardMappings) {
                              baseClassName = (String) standards.get(baseType);
                          }
                          if (baseClassName != null) {
                              table.put(typeName, baseClassName);
                          } else {
                              elements.add(st);
                          }
                      } else {
                          String className = convention.getClassNameForElementType(typeName);
                          if (className != null) {
                              table.put(typeName, className);
                          }
                      }
                  } else {
                  	String className = null;
                  	
                      // Deal with complexTypes and simpleTypes
                      if (st instanceof ComplexType) {
                      	className = convention.getClassNameForComplexType(typeName);
                      } else if (st instanceof SimpleType) {
                      	className = convention.getClassNameForSimpleType(typeName);
                      }
                      if (className != null) {
                          table.put(typeName, className);
                      }
                  }
              }
          }
  
          // Create a temporary list for arrays of arrays so we can resolve them last
          ArrayList multiArrays = new ArrayList();
  
          // Now we'll resolve any array types that were found
          Iterator ai = arrays.iterator();
          while (ai.hasNext()) {
              SchemaType st = (SchemaType) ai.next();
              // We've already checked that its an array so cut to the chase!
              QName theType = st.getTypeName();
              if (theType == null) continue;
              
              QName arrayType = st.getArrayType();
              if (arrayType != null && theType != null) {
              	// Check overriden mappings first
              	String baseClass = (String) typeMappings.get(arrayType);
              	if (baseClass == null) {
              		// Check current mappings
                      baseClass = (String) table.get(arrayType);
              	}
                  if (baseClass == null && standards != null) {
                      // Check for base class in the standard mappings
                      baseClass = (String) standards.get(arrayType);
                  }
                  if (baseClass == null) {
                      String lp = arrayType.getLocalPart();
                      if (lp != null && lp.startsWith("ArrayOf")) {
                          // This is an array of an array. Perhaps we've
                          // not mapped the base array yet so re-try this
                          // at the end
                          multiArrays.add(st);
                      }
                      continue;
                  }
                  // Deal with multidimentional array classes
                  String extraDims = "";
                  for (int x = 1; x < st.getArrayDimension(); x++) {
                      extraDims += "[";
                  }
                  if (baseClass != null) {
                      // Check for primitive types
                      if (baseClass.equals("int")) {
                          table.put(theType, extraDims + "[I");
                      } else if (baseClass.equals("float")) {
                          table.put(theType, extraDims + "[F");
                      } else if (baseClass.equals("long")) {
                          table.put(theType, extraDims + "[J");
                      } else if (baseClass.equals("double")) {
                          table.put(theType, extraDims + "[D");
                      } else if (baseClass.equals("boolean")) {
                          table.put(theType, extraDims + "[Z");
                      } else if (baseClass.equals("byte")) {
                          table.put(theType, extraDims + "[B");
                      } else if (baseClass.equals("short")) {
                          table.put(theType, extraDims + "[S");
                      } else if (baseClass.startsWith("[")) {
                          // The base for this array is another array!!						
                          String arrayOfBase = "[" + baseClass;
                          table.put(theType, arrayOfBase);
                      } else {
                          String arrayOfBase = extraDims + "[L" + baseClass + ";";
                          table.put(theType, arrayOfBase);
                      }
                  }
              }
          }
  
          // Now we'll resolve any arrays of arrays that are outstanding
          Iterator mi = multiArrays.iterator();
          while (mi.hasNext()) {
              SchemaType st = (SchemaType) mi.next();
              QName theType = st.getTypeName();
              if (theType == null) continue;
              
              QName arrayType = st.getArrayType();
              if (arrayType != null && theType != null) {
                  String extraDims = "";
                  for (int x = 1; x < st.getArrayDimension(); x++) {
                      extraDims += "[";
                  }
                  String baseClass = (String) typeMappings.get(arrayType);
                  if (baseClass == null) {
                  	baseClass = (String) table.get(arrayType);
                  }
                  if (baseClass != null) {
                      // Base class should be an array
                      if (baseClass.startsWith("[")) {
                          String arrayOfBase = "[" + baseClass;
                          table.put(theType, arrayOfBase);
                      }
                  }
              }
          }
          
          // Finally we'll resolve any elements that are outstanding
          Iterator ei = elements.iterator();
          while (ei.hasNext()) {
              SchemaType st = (SchemaType) ei.next();
              QName theType = st.getTypeName();
              if (theType == null)
                  continue;
  
              QName baseType = null;
              if (st instanceof ElementType) {
                  baseType = ((ElementType) st).getElementType();
              }
              if (baseType != null) {
                  String baseClassName = (String) typeMappings.get(baseType);
                  if (baseClassName == null) {
                  	baseClassName = (String) table.get(baseType);
                  }            	
                  if (baseClassName != null) {
                      table.put(theType, baseClassName);
                  }
              }
          }
          
          // Copy all of the user defined mappings into the table
     		table.putAll(typeMappings);
                         
          Trc.exit(table);
          return table;
      }
  
  
      /**
       * Populate a map with the standard xml type -> Java class name mappings
       */
      public static void populateWithStandardMappings(
          Map t,
          String schemaURI,
          boolean oneTimeAdds) {
  
          t.put(new QName(schemaURI, "string"), "java.lang.String");
          t.put(new QName(schemaURI, "integer"), "java.math.BigInteger");
          t.put(new QName(schemaURI, "boolean"), "boolean");
          t.put(new QName(schemaURI, "float"), "float");
          t.put(new QName(schemaURI, "double"), "double");
          t.put(new QName(schemaURI, "base64Binary"), "[B");
          t.put(new QName(schemaURI, "hexBinary"), "[B");
          t.put(new QName(schemaURI, "long"), "long");
          t.put(new QName(schemaURI, "int"), "int");
          t.put(new QName(schemaURI, "short"), "short");
          t.put(new QName(schemaURI, "decimal"), "java.math.BigDecimal");
          t.put(new QName(schemaURI, "byte"), "byte");
          t.put(new QName(schemaURI, "QName"), "javax.xml.namespace.QName");
  
          // Register dateTime or timeInstant depending on schema
          if (schemaURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD)) {
              t.put(new QName(schemaURI, "dateTime"), "java.util.Calendar");
          } else {
              t.put(new QName(schemaURI, "timeInstant"), "java.util.Calendar");
          }
  
          // Only add the SOAP-ENC simple types and soap collection class mappings once
          if (oneTimeAdds) {
              // SOAP encoding simple types
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "string"),
                  "java.lang.String");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "boolean"),
                  "java.lang.Boolean");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "float"),
                  "java.lang.Float");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "double"),
                  "java.lang.Double");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "decimal"),
                  "java.math.BigDecimal");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "int"),
                  "java.lang.Integer");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "short"),
                  "java.lang.Short");
              t.put(
                  new QName(WSIFConstants.NS_URI_SOAP_ENC, "byte"),
                  "java.lang.Byte");
              t.put(new QName(WSIFConstants.NS_URI_SOAP_ENC, "base64"), "[B");
  
              // soap Java collection mappings
              t.put(
                  new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Map"),
                  "java.util.Map");
              t.put(
                  new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Vector"),
                  "java.util.Vector");
              t.put(
                  new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Hashtable"),
                  "java.util.Hashtable");
          }
      }
    
      /**
       * Elements which are nillable and are based on xsd simple types should map to
       * the object wrapper version of the corresponding primitive type. This method
       * will return the wrapper class name for a given QName.
       */
      protected String getWrapperClassName(QName qn) {
          if (qn == null) return null;
          String ns = qn.getNamespaceURI();
          if (WSIFConstants.NS_URI_1999_SCHEMA_XSD.equals(ns)
              || WSIFConstants.NS_URI_2000_SCHEMA_XSD.equals(ns)
              || WSIFConstants.NS_URI_2001_SCHEMA_XSD.equals(ns)) {
              String lp = qn.getLocalPart();
              if (lp == null) return null;
              if (lp.equals("int")) {
              	return "java.lang.Integer";
              } else if (lp.equals("long")) {
              	return "java.lang.Long";            	
              } else if (lp.equals("float")) {
              	return "java.lang.Float";            	
              } else if (lp.equals("short")) {
              	return "java.lang.Short";
              } else if (lp.equals("double")) {
              	return "java.lang.Double";
              } else if (lp.equals("boolean")) {
              	return "java.lang.Boolean";
              } else if (lp.equals("byte")) {
              	return "java.lang.Byte";            	
              }           
          }
          return null;
      }   
  }
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFMappingConvention.java
  
  Index: WSIFMappingConvention.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.mapping;
  
  import javax.xml.namespace.QName;
  
  /**
   * A WSIFMappingConvention defines a convention for converting an xml name
   * to a Java class name. Different techniques can be applied to complexTypes
   * simpleTypes and elements
   * 
   * @author Owen Burroughs <owenb@uk.ibm.com>
   */
  public interface WSIFMappingConvention {
  	
  	/**
  	 * Get a class name for a complexType
  	 * @param qn The name of the complexType
  	 * @return The Java class name
  	 */
  	public String getClassNameForComplexType(QName qn);
  
  	/**
  	 * Get a class name for a simpleType
  	 * @param qn The name of the simpleType
  	 * @return The Java class name
  	 */	
  	public String getClassNameForSimpleType(QName qn);
  
  	/**
  	 * Get a class name for a global element
  	 * @param qn The name of the simpleType
  	 * @return The Java class name
  	 */	
  	public String getClassNameForElementType(QName qn);
  
  	/**
  	 * Override the mapping from a namespace to a package name for a specific 
  	 * namespace
  	 * @param namespace The namespace to map
  	 * @param packageName The package name to map the namespace to
  	 */
  	public void overridePackageMapping(String namespace, String packageName);		
  }
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFDefaultMappingConvention.java
  
  Index: WSIFDefaultMappingConvention.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   
  package org.apache.wsif.mapping;
  
  import java.util.Hashtable;
  import javax.xml.namespace.QName;
  
  import org.apache.wsif.util.WSIFUtils;
  
  /**
   * Default implementation of {@link org.apache.wsif.mapping.WSIFMappingConvention}
   * This convention works as follows:<br>
   * <ul>
   * <li>For all types, the package for the class is determined by in the following way:<br>
   * Take the "hostname" part of the namespace uri. Reverse the components. Take the remainder 
   * of the uri. Split it by the / character and rebuild with . between each component. At 
   * all times strings are checked to make sure that they are valid Java names.<br>
   * </li>
   * <li>Local parts of the xml name are converted to valid Java class names and appended to
   * the generated package name</li>
   * <li>Class names for elements are appended with the string "Element"</li>
   * </ul>
   * So for example, the xml name 
   * <br>&nbsp;&nbsp;&nbsp;<tt>http://www.wsif.com/test/types:address</tt>
   * <br>would map to
   * <br>&nbsp;&nbsp;<tt>com.wsif.www.test.types.Address</tt>
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public class WSIFDefaultMappingConvention implements WSIFMappingConvention {
  
      // Table of package mappings: namespace -> packageName
  	private Hashtable packageMappings = new Hashtable();
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForComplexType(QName)
       */
      public String getClassNameForComplexType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = WSIFUtils.getPackageNameFromNamespaceURI(namespace);
          }
          String className = WSIFUtils.getJavaClassNameFromXMLName(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className;
          }
          return null;
      }
  
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForSimpleType(QName)
       */
      public String getClassNameForSimpleType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = WSIFUtils.getPackageNameFromNamespaceURI(namespace);
          }
          String className = WSIFUtils.getJavaClassNameFromXMLName(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className;
          }
          return null;
      }
  
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForElementType(QName)
       */
      public String getClassNameForElementType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = WSIFUtils.getPackageNameFromNamespaceURI(namespace);
          }
          String className = WSIFUtils.getJavaClassNameFromXMLName(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className + "Element";
          }
          return null;
      }
  
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#overridePackageMapping(String, String)
       */
      public void overridePackageMapping(String namespace, String packageName) {
      	if (packageName != null && namespace != null) {
      		// Store the namespace as the key and the package name as the value
      	    packageMappings.put(namespace, packageName);
      	}
      }
  }
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFMapper.java
  
  Index: WSIFMapper.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   
  package org.apache.wsif.mapping;
  
  import java.util.Map;
  
  import javax.xml.namespace.QName;
  
  import org.apache.wsif.schema.SchemaType;
  
  /**
   * A WSIFMapper defines a way of producing a list of QName
   * to Java class name mappings. It defines the logic for determining
   * what type of mapping is required for a particular 
   * {@link org.apache.wsif.schema.SchemaType} The mapping is then produced
   * by an associated {@link org.apache.wsif.mapping.WSIFMappingConvention}
   * 
   * @author Owen Burroughs <owenb@uk.ibm.com>
   */
  public interface WSIFMapper {
  
  	/**
  	 * Set a flag to indicate whether or not the list of mappings returned
  	 * by the getMappings method includes the standard JAX-RPC mappings for
  	 * simple types.
  	 * @param b The flag
  	 */
  	public void setIncludeStandardMappings(boolean b);
  
  	/**
  	 * Get the flag indicating whether or not the list of mappings returned
  	 * by the getMappings method includes the standard JAX-RPC mappings for
  	 * simple types.
  	 * @return The flag
  	 */
  	public boolean getIncludeStandardMappings();
  
  	/**
  	 * Set the {@link WSIFMappingConvention} used by the WSIFMapper
  	 * @param con The {@link WSIFMappingConvention} to use
  	 */
      public void setMappingConvention(WSIFMappingConvention con);
  
  	/**
  	 * Get the {@link WSIFMappingConvention} used by the WSIFMapper
  	 * @return The {@link WSIFMappingConvention}
  	 */
  	public WSIFMappingConvention getMappingConvention();	
  	
  	/**
  	 * Get a map of xml name to Java class name (QName to String) mappings
  	 * from a array of {@link SchemaType} objects
  	 * @param types An array of {@link SchemaType} objects to create the
  	 * mappings for
  	 * @return A map of xml name to Java class name mappings
  	 */
      public Map getMappings(SchemaType[] types);
      
      /**
       * Override a generated mapping for a particular xml name with this information
       * @param xmlName The xml name of the mapping
       * @param className The class name for the mapping
       */
      public void overrideTypeMapping(QName xmlName, String className);		
  }
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFMappingConventionFactory.java
  
  Index: WSIFMappingConventionFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.mapping;
  
  import org.apache.wsif.WSIFConstants;
  import org.apache.wsif.WSIFException;
  import org.apache.wsif.logging.Trc;
  import org.apache.wsif.util.WSIFProperties;
  
  /**
   * A factory to produce instances of WSIFMappingConvention
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public class WSIFMappingConventionFactory {
  
  	private static final String DEFAULT_MAPPINGCONVENTION_CLASS = "org.apache.wsif.mapping.WSIFDefaultMappingConvention";
  	
  	// Store the name of the mapping convention class used so that we don't have to repeatedly look it up.
  	// Store as a StringBuffer so that we can synchronize on it
  	private static StringBuffer mappingConvClassNameBuffer = new StringBuffer();
  	
  	/**
  	 * Get a new MappingConvention. This method is equivalent to calling newMappingConvention(false)
  	 * @return A new instance of WSIFMappingConvention
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMappingConvention
  	 */
  	public static WSIFMappingConvention newMappingConvention() throws WSIFException {
  		return newMappingConvention(false);
  	}
  	
  	/**
  	 * Get a new WSIFMappingConvention. This method allows the user to refresh the class name of the
  	 * WSIFMappingConvention to return. If the flag is true or a class name has not yet to be established
  	 * the class name will be looked up in the following order:<br>
  	 * <ol>
  	 * <li>Look for a system property named <tt>org.apache.wsif.mappingconvention</tt></li>
  	 * <li>Look for a property in wsif.properties called <tt>org.apache.wsif.mappingconvention</tt></li>
  	 * <li>Use the default class name - <tt>org.apache.wsif.mapping.WSIFDefaultMappingConvention</tt></li>
  	 * </ol>
  	 * If the flag is false and a class name has already been establshed, that class name will be used.
  	 * @param refresh A flag to indicate whether or not to reuse the class name for the
  	 * WSIFMappingConvention implementation if it has already been established rather than determine it
  	 * again.
  	 * @return A new instance of WSIFMappingConvention
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMappingConvention
  	 */
      public static WSIFMappingConvention newMappingConvention(boolean refresh) throws WSIFException {
          synchronized (mappingConvClassNameBuffer) {
              if (mappingConvClassNameBuffer.length() == 0 || refresh) {
                  String mappingConvClassName = null;
                  // First try getting the mapping convention class name from the system properties
                  // Don't use doPrivileged since we are loading a class that is user specified		
                  try {
                      mappingConvClassName = System.getProperty(WSIFConstants.WSIF_MAPPINGCONVENTION_PROPERTY);
                  } catch (SecurityException s) {
                      Trc.ignoredException(s);
                  }
  
                  // If no system property set, try the wsif.properties file
                  if (mappingConvClassName == null) {
                      mappingConvClassName = WSIFProperties.getProperty(WSIFConstants.WSIF_MAPPINGCONVENTION_PROPERTY);
                  }
  
                  // Finally use the default class
                  if (mappingConvClassName == null) {
                      mappingConvClassName = DEFAULT_MAPPINGCONVENTION_CLASS;
                  }
                  
                  if (refresh) {
                  	mappingConvClassNameBuffer.delete(0, mappingConvClassNameBuffer.length());
                  }
                 	mappingConvClassNameBuffer.insert(0, mappingConvClassName);
              }
              try {
                  Class c =
                      Class.forName(
                          mappingConvClassNameBuffer.toString(),
                          true,
                          Thread.currentThread().getContextClassLoader());
                  return (WSIFMappingConvention) c.newInstance();
              } catch (ClassNotFoundException cnf) {
              	throw new WSIFException("Unable to create new mapping convention", cnf);
              } catch (Exception e) {
              	throw new WSIFException("Unable to create new mapping convention", e);
              }
          }
      }
      
      /**
       * Create a new instance of an implementation WSIFMappingConvention. This method will 
       * attempt to use the class name given. If the class is not an instance of WSIFMappingConvention 
       * an exception will be thrown. Calling this method will not override the class name stored
       * by this instance of WSIFMappingConventionFactory. The class is looked up in isolation.
       * @param mappingConvClassName The class name of the implementation of WSIFMappingConvention to
       * use
       * @return An instance of WSIFMappingConvention
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMappingConvention
       */
      public static WSIFMappingConvention newMappingConvention(String mappingConvClassName)
          throws WSIFException {
          try {
              Class c =
                  Class.forName(
                      mappingConvClassName,
                      true,
                      Thread.currentThread().getContextClassLoader());
              return (WSIFMappingConvention) c.newInstance();
          } catch (ClassNotFoundException cnf) {
              throw new WSIFException(
                  "Unable to create new mapping convention",
                  cnf);
          } catch (Exception e) {
              throw new WSIFException(
                  "Unable to create new mapping convention",
                  e);
          }
      }  
  }
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/mapping/WSIFMapperFactory.java
  
  Index: WSIFMapperFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.mapping;
  
  import org.apache.wsif.WSIFConstants;
  import org.apache.wsif.WSIFException;
  import org.apache.wsif.logging.Trc;
  import org.apache.wsif.util.WSIFProperties;
  
  /**
   * A factory to produce instances of WSIFMapper
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public class WSIFMapperFactory {
  	
  	private static final String DEFAULT_MAPPER_CLASS = "org.apache.wsif.mapping.WSIFDefaultMapper";
  	
  	// Store the name of the mapper class used so that we don't have to repeatedly look it up.
  	// Store as a StringBuffer so that we can synchronize on it
  	private static StringBuffer mapperClassNameBuffer = new StringBuffer();
  
  	/**
  	 * Get a new WSIFMapper. This method is equivalent to calling newMapper(false)
  	 * @return A new instance of WSIFMapper
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMapper
  	 */	
  	public static WSIFMapper newMapper() throws WSIFException {
  		return newMapper(false);
  	}
  
  	/**
  	 * Get a new WSIFMapper. This method allows the user to refresh the class name of the
  	 * WSIFMapper to return. If the flag is true or a class name has not yet to be established
  	 * the class name will be looked up in the following order:<br>
  	 * <ol>
  	 * <li>Look for a system property named <tt>org.apache.wsif.mapper</tt></li>
  	 * <li>Look for a property in wsif.properties called <tt>org.apache.wsif.mapper</tt></li>
  	 * <li>Use the default class name - <tt>org.apache.wsif.mapping.WSIFDefaultMapper</tt></li>
  	 * </ol>
  	 * If the flag is false and a class name has already been establshed, that class name will be used.
  	 * @param refresh A flag to indicate whether or not to reuse the class name for the
  	 * WSIFMapper implementation if it has already been established rather than determine it
  	 * again.
  	 * @return A new instance of WSIFMapper
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMapper
  	 */
      public static WSIFMapper newMapper(boolean refresh) throws WSIFException {
          synchronized (mapperClassNameBuffer) {
              if (mapperClassNameBuffer.length() == 0 || refresh) {
                  String mapperClassName = null;
                  // First try getting the mapper class name from the system properties
                  // Don't use doPrivileged since we are loading a class that is user specified		
                  try {
                      mapperClassName = System.getProperty(WSIFConstants.WSIF_MAPPER_PROPERTY);
                  } catch (SecurityException s) {
                      Trc.ignoredException(s);
                  }
  
                  // If no system property set, try the wsif.properties file
                  if (mapperClassName == null) {
                      mapperClassName = WSIFProperties.getProperty(WSIFConstants.WSIF_MAPPER_PROPERTY);
                  }
  
                  // Finally use the default class
                  if (mapperClassName == null) {
                      mapperClassName = DEFAULT_MAPPER_CLASS;
                  }
                  
                  if (refresh) {
                  	mapperClassNameBuffer.delete(0, mapperClassNameBuffer.length());
                  }
                 	mapperClassNameBuffer.insert(0, mapperClassName);
              }
              try {
                  Class c =
                      Class.forName(
                          mapperClassNameBuffer.toString(),
                          true,
                          Thread.currentThread().getContextClassLoader());
                  return (WSIFMapper) c.newInstance();
              } catch (ClassNotFoundException cnf) {
              	throw new WSIFException("Unable to create new mapper", cnf);
              } catch (Exception e) {
              	throw new WSIFException("Unable to create new mapper", e);
              }
          }
      }
  
      /**
       * Create a new instance of an implementation WSIFMapper. This method will 
       * attempt to use the class name given. If the class is not an instance of WSIFMapper 
       * an exception will be thrown. Calling this method will not override the class name stored
       * by this instance of WSIFMapperFactory. The class is looked up in isolation.
       * @param mapperClassName The class name of the implementation of WSIFMapper to
       * use
       * @return An instance of WSIFMapper
       * @throws An exception if the class cannot be found or is not an implemenation of
       * WSIFMapper
       */
      public static WSIFMapper newMapper(String mapperClassName)
          throws WSIFException {
          try {
              Class c =
                  Class.forName(
                      mapperClassName,
                      true,
                      Thread.currentThread().getContextClassLoader());
              return (WSIFMapper) c.newInstance();
          } catch (ClassNotFoundException cnf) {
              throw new WSIFException("Unable to create new mapper", cnf);
          } catch (Exception e) {
              throw new WSIFException("Unable to create new mapper", e);
          }
      }    
  }
  
  
  
  1.15      +1 -1      xml-axis-wsif/java/src/org/apache/wsif/wsdl/WSIFWSDLLocatorImpl.java
  
  Index: WSIFWSDLLocatorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/wsdl/WSIFWSDLLocatorImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WSIFWSDLLocatorImpl.java	10 Feb 2003 12:27:59 -0000	1.14
  +++ WSIFWSDLLocatorImpl.java	26 Feb 2003 15:55:21 -0000	1.15
  @@ -75,7 +75,7 @@
    * 
    * @author Owen Burroughs <owenb@apache.org>
    */ 
  -public class WSIFWSDLLocatorImpl implements javax.wsdl.xml.WSDLLocator { 
  +public class WSIFWSDLLocatorImpl implements javax.wsdl.xml.WSDLLocator, ClosableLocator { 
    
       Reader baseReader = null; 
       InputStream baseInputStream = null;
  
  
  
  1.7       +1 -1      xml-axis-wsif/java/src/org/apache/wsif/wsdl/AuthenticatingProxyWSDLLocatorImpl.java
  
  Index: AuthenticatingProxyWSDLLocatorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/wsdl/AuthenticatingProxyWSDLLocatorImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AuthenticatingProxyWSDLLocatorImpl.java	10 Feb 2003 12:27:59 -0000	1.6
  +++ AuthenticatingProxyWSDLLocatorImpl.java	26 Feb 2003 15:55:21 -0000	1.7
  @@ -76,7 +76,7 @@
    * 
    * @author Owen Burroughs <owenb@apache.org>
    */ 
  -public class AuthenticatingProxyWSDLLocatorImpl implements javax.wsdl.xml.WSDLLocator { 
  +public class AuthenticatingProxyWSDLLocatorImpl implements javax.wsdl.xml.WSDLLocator, ClosableLocator { 
    
   	private static final String PROXY_AUTH="Proxy-Authorization";
       private static final char[] BASE64_CHARS = {
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/wsdl/ClosableLocator.java
  
  Index: ClosableLocator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.wsdl;
  
  import java.io.IOException;
  
  /**
   * Simple interface supported by the WSIF WSDLLocator implementations. It declares
   * one method, close(), that closes resources used by the locator.
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public interface ClosableLocator {
  	public void close() throws IOException;
  }
  
  
  
  1.8       +3 -0      xml-axis-wsif/java/test/docStyle/NWBankTest.java
  
  Index: NWBankTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/NWBankTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NWBankTest.java	22 Jan 2003 16:39:08 -0000	1.7
  +++ NWBankTest.java	26 Feb 2003 15:55:21 -0000	1.8
  @@ -217,6 +217,9 @@
   					"http/www.pointwsp.net/ws/finance",
   					"pwspNoCentrbankCurRatesSoap");
   
  +			// Need to call mapPackage since the namespace in the wsdl is an invalid URI!!!
  +			service.mapPackage("http/www.pointwsp.net/ws/finance", "http.net.pointwsp.www.ws.finance");
  +			
               // force to use a 'wrapped' type operation
               WSIFMessage context = service.getContext();
               context.setObjectPart(WSIFConstants.CONTEXT_OPERATION_STYLE, WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED);
  
  
  
  1.7       +5 -5      xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java
  
  Index: ZipCodeAxisTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ZipCodeAxisTest.java	2 Jan 2003 10:40:40 -0000	1.6
  +++ ZipCodeAxisTest.java	26 Feb 2003 15:55:21 -0000	1.7
  @@ -176,7 +176,7 @@
   		} catch (Exception ex) {
   			ex.printStackTrace();
   			assertTrue(
  -				"AddressBookTest("
  +				"ZipCodeAxisTest("
   					+ portName
   					+ ") caught exception "
   					+ ex.getLocalizedMessage(),
  @@ -245,7 +245,7 @@
   		} catch (Exception ex) {
   			ex.printStackTrace();
   			assertTrue(
  -				"AddressBookTest("
  +				"ZipCodeAxisTest("
   					+ portName
   					+ ") caught exception "
   					+ ex.getLocalizedMessage(),
  @@ -278,7 +278,7 @@
   		} catch (Exception ex) {
   			ex.printStackTrace();
   			assertTrue(
  -				"AddressBookTest("
  +				"ZipCodeAxisTest("
   					+ portName
   					+ ") caught exception "
   					+ ex.getLocalizedMessage(),
  @@ -331,7 +331,7 @@
   		} catch (Exception ex) {
   			ex.printStackTrace();
   			assertTrue(
  -				"AddressBookTest("
  +				"ZipCodeAxisTest("
   					+ portName
   					+ ") caught exception "
   					+ ex.getLocalizedMessage(),
  @@ -403,7 +403,7 @@
   		} catch (Exception ex) {
   			ex.printStackTrace();
   			assertTrue(
  -				"AddressBookTest("
  +				"ZipCodeAxisTest("
   					+ portName
   					+ ") caught exception "
   					+ ex.getLocalizedMessage(),
  
  
  
  1.5       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/util/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/util/Utils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Utils.java	7 Dec 2002 12:33:50 -0000	1.4
  +++ Utils.java	26 Feb 2003 15:55:21 -0000	1.5
  @@ -80,6 +80,7 @@
   
   /**
    * @author Matthew J. Duftler
  + * @deprecated
    */
   public class Utils {
   	
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/util/StreamFactory.java
  
  Index: StreamFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/util/StreamFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StreamFactory.java	7 Dec 2002 12:33:50 -0000	1.3
  +++ StreamFactory.java	26 Feb 2003 15:55:21 -0000	1.4
  @@ -71,6 +71,7 @@
   
   /**
    * @author Matthew J. Duftler
  + * @deprecated
    */
   public class StreamFactory {
   	
  
  
  
  1.5       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/util/TypeMapping.java
  
  Index: TypeMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/util/TypeMapping.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeMapping.java	7 Dec 2002 12:33:50 -0000	1.4
  +++ TypeMapping.java	26 Feb 2003 15:55:21 -0000	1.5
  @@ -67,6 +67,7 @@
    * of the Java classes that implement the mapping between XML and Java.
    *
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
  + * @deprecated
    */
   public class TypeMapping implements Serializable {
   	
  
  
  
  1.18      +11 -1     xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java
  
  Index: WSIFConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WSIFConstants.java	21 Jan 2003 17:34:09 -0000	1.17
  +++ WSIFConstants.java	26 Feb 2003 15:55:22 -0000	1.18
  @@ -245,5 +245,15 @@
           "http://schemas.xmlsoap.org/wsdl/";
   
   	public static final String NS_URI_APACHE_SOAP = 
  -        "http://xml.apache.org/xml-soap";                
  +        "http://xml.apache.org/xml-soap";
  +        
  +    /**
  +     * Property name that specifies a WSIFMapper implementation class
  +     */
  +	public static final String WSIF_MAPPER_PROPERTY = "org.apache.wsif.mapper";
  +
  +    /**
  +     * Property name that specifies a WSIFMappingConvention implementation class
  +     */	
  +	public static final String WSIF_MAPPINGCONVENTION_PROPERTY = "org.apache.wsif.mappingconvention";	                        
   }
  
  
  
  1.11      +25 -3     xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java
  
  Index: WSIFServiceFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSIFServiceFactory.java	19 Dec 2002 20:13:22 -0000	1.10
  +++ WSIFServiceFactory.java	26 Feb 2003 15:55:23 -0000	1.11
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -50,7 +50,7 @@
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
    * originally based on software copyright (c) 2001, 2002, International
  - * Business Machines, Inc., http://www.apache.org.  For more
  + * Business Machines, Inc., http://www.ibm.com.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  @@ -163,5 +163,27 @@
        * @param on Flag to indicate whether or not caching of services should be used
        */    
       public void cachingOn(boolean on) {
  -    }        
  +    }       
  +
  +	/**
  +	 * Set a flag to indicate whether or not instances of WSIFService created by this factory, will
  +	 * attempt to automatically calculate mappings between xml names and Java class names for the
  +	 * types in the wsdl.
  +	 * @param on Whether automcatic mapping of types is on or off. The default is off
  +	 */    
  +    public void automaticallyMapTypes(boolean on) {
  +    }
  +
  +	/**
  +	 * Set a flag to indicate whether or not instances of WSIFService created by this factory, will
  +	 * attempt to automatically calculate mappings between xml names and Java class names for the
  +	 * types in the wsdl. This method also allows the user to programatically specify the names of the
  +	 * WSIFMapper and WSIFMappingConvention classes to be used by WSIFServices created by this factory.
  +	 * A null value for a class name will be ignored i.e. no overriding will take place.
  +	 * @param on Whether automcatic mapping of types is on or off. The default is off
  +	 * @param mapperClassName The WSIFMapper implementation class name
  +	 * @param conventionClassName The WSIFMappingConvention implementation class name
  +	 */
  +    public void automaticallyMapTypes(boolean on, String mapperClassName, String conventionClassName) {
  +    }           
   }
  
  
  
  1.4       +1 -0      xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/SchemaException.java
  
  Index: SchemaException.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/compiler/schema/SchemaException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaException.java	7 Dec 2002 12:34:00 -0000	1.3
  +++ SchemaException.java	26 Feb 2003 15:55:23 -0000	1.4
  @@ -59,6 +59,7 @@
   
   /**
    * @author Matthew J. Duftler
  + * @deprecated
    */
   public class SchemaException extends Exception {
   	private static final long serialVersionUID = 1L;
  
  
  
  1.1                  xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSDL2JavaMappingConvention.java
  
  Index: WSDL2JavaMappingConvention.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 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 "WSIF" 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 and was
   * originally based on software copyright (c) 2001, 2002, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.wsif.providers.soap.apacheaxis;
  
  import java.util.Hashtable;
  import javax.xml.namespace.QName;
  
  import org.apache.axis.wsdl.toJava.Utils;
  import org.apache.wsif.mapping.WSIFMappingConvention;
  
  /**
   * An implementation of {@link org.apache.wsif.mapping.WSIFMappingConvention} that uses
   * the same methods from Apache Axis, that are used by the WSDL2Java tool.
   * 
   * @author Owen Burroughs <owenb@apache.org>
   */
  public class WSDL2JavaMappingConvention implements WSIFMappingConvention {
  
      // Table of package mappings: namespace -> packageName
  	private Hashtable packageMappings = new Hashtable();
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForComplexType(QName)
       */
      public String getClassNameForComplexType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = Utils.makePackageName(namespace);
          }
          String className = Utils.xmlNameToJavaClass(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className;
          }
          return null;
      }
  
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForSimpleType(QName)
       */
      public String getClassNameForSimpleType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = Utils.makePackageName(namespace);
          }
          String className = Utils.xmlNameToJavaClass(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className;
          }
          return null;
      }
  
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#getClassNameForElementType(QName)
       */
      public String getClassNameForElementType(QName qn) {
          String namespace = qn.getNamespaceURI();
          String localPart = qn.getLocalPart();
          String packageName = (String) packageMappings.get(namespace);
          if (packageName == null) {
          	packageName = Utils.makePackageName(namespace);
          }
          String className = Utils.xmlNameToJavaClass(localPart);
          if (packageName != null
              && !packageName.equals("")
              && className != null
              && !className.equals("")) {
              return packageName + "." + className;
          }
          return null;
      }
  
  	
      /**
       * @see org.apache.wsif.mapping.WSIFMappingConvention#overridePackageMapping(String, String)
       */
      public void overridePackageMapping(String namespace, String packageName) {
      	if (packageName != null && namespace != null) {
      		// Store the namespace as the key and the package name as the value
      	    packageMappings.put(namespace, packageName);
      	}
      }
  }
  
  
  
  1.21      +2 -0      xml-axis-wsif/java/test/util/TestUtilities.java
  
  Index: TestUtilities.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/util/TestUtilities.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TestUtilities.java	12 Feb 2003 14:01:07 -0000	1.20
  +++ TestUtilities.java	26 Feb 2003 15:55:23 -0000	1.21
  @@ -75,6 +75,7 @@
   import javax.jms.QueueSession;
   import javax.jms.Session;
   
  +import org.apache.wsif.WSIFConstants;
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.base.WSIFDefaultCorrelationService;
   import org.apache.wsif.providers.soap.apacheaxis.WSIFDynamicProvider_ApacheAxis;
  @@ -239,6 +240,7 @@
           //WSIFServiceImpl.addExtensionRegistry(new JmsExtensionRegistry()) ;
           //WSIFServiceImpl.addExtensionRegistry(new EJBExtensionRegistry());
           resetDefaultProviders();
  +        System.setProperty(WSIFConstants.WSIF_MAPPINGCONVENTION_PROPERTY, "org.apache.wsif.providers.soap.apacheaxis.WSDL2JavaMappingConvention");
       }
       /**
        * This starts what listeners are required to run the testcases.
  
  
  
  1.21      +30 -19    xml-axis-wsif/java/test/addressbook/AddressBookTest.java
  
  Index: AddressBookTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/addressbook/AddressBookTest.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AddressBookTest.java	14 Jan 2003 16:43:19 -0000	1.20
  +++ AddressBookTest.java	26 Feb 2003 15:55:23 -0000	1.21
  @@ -151,22 +151,28 @@
           doit("NativeJmsPort", "" ); 
       }
       public void testDynamicSOAP() {
  -        doitDyn(server+"Port", "soap");
  +        doitDyn(server+"Port", "soap", false);
       }
       public void testDynamicAxis() {
  -        doitDyn(server+"Port", "axis");
  +        doitDyn(server+"Port", "axis", false);
       }
       public void testDynamicJava() {
  -        doitDyn("JavaPort", "java");
  +        doitDyn("JavaPort", "java", false);
       }
       public void testDynamicSoapJms() {
  -        doitDyn("SOAPJMSPort", "soap");
  +        doitDyn("SOAPJMSPort", "soap", false);
       }
       public void testDynamicAxisJms() {
  -        doitDyn("SOAPJMSPort", "axis");
  +        doitDyn("SOAPJMSPort", "axis", false);
       }
       public void testDynamicNativeJms() {
  -        doitDyn("NativeJmsPort", "" ); 
  +        doitDyn("NativeJmsPort", "", false); 
  +    }
  +    public void testDynamicAxisAuto() {
  +        doitDyn(server+"Port", "axis", true);
  +    }
  +    public void testDynamicAxisJmsAuto() {
  +        doitDyn("SOAPJMSPort", "axis", true);
       }
   
       private void doit(String portName, String protocol) {
  @@ -208,7 +214,7 @@
           }
       }
   
  -    private void doitDyn(String portName, String protocol) {
  +    private void doitDyn(String portName, String protocol, boolean autoMapTypes) {
           if (portName.toUpperCase().indexOf("JMS") != -1 && !TestUtilities.areWeTesting("jms"))
               return;
   
  @@ -216,22 +222,27 @@
   
           try {
               WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
  -                WSIFService service = factory.getService(wsdlLocation, null, // serviceNS 
  +            
  +            if (autoMapTypes) factory.automaticallyMapTypes(true);
  +            
  +            WSIFService service = factory.getService(wsdlLocation, null, // serviceNS 
                   null, // serviceName 
                   "http://wsifservice.addressbook/", // portTypeNS 
                   "AddressBook"); // portTypeName 
   
  -            service.mapType(
  -                new javax.xml.namespace.QName(
  -                    "http://wsiftypes.addressbook/",
  -                    "address"),
  -                Class.forName("addressbook.wsiftypes.Address"));
  -
  -            service.mapType(
  -                new javax.xml.namespace.QName(
  -                    "http://wsiftypes.addressbook/",
  -                    "phone"),
  -                Class.forName("addressbook.wsiftypes.Phone"));
  +			if (!autoMapTypes) {
  +	            service.mapType(
  +	                new javax.xml.namespace.QName(
  +	                    "http://wsiftypes.addressbook/",
  +	                    "address"),
  +	                Class.forName("addressbook.wsiftypes.Address"));
  +	
  +	            service.mapType(
  +	                new javax.xml.namespace.QName(
  +	                    "http://wsiftypes.addressbook/",
  +	                    "phone"),
  +	                Class.forName("addressbook.wsiftypes.Phone"));
  +			}
   
               WSIFPort port = null;
   
  
  
  
  1.8       +39 -19    xml-axis-wsif/java/src/org/apache/wsif/schema/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/schema/Parser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Parser.java	9 Feb 2003 16:10:24 -0000	1.7
  +++ Parser.java	26 Feb 2003 15:55:23 -0000	1.8
  @@ -105,6 +105,8 @@
        * their corresponding Java class names.
        * @param def The Definition object representing the wsdl
        * @param table The Map to proulate with xml type -> Java class name (QName -> String) mappings
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(Definition def, Map table) throws WSIFException {
           getTypeMappings(def, table, true, null);
  @@ -116,6 +118,8 @@
        * @param def The Definition object representing the wsdl
        * @param table The Map to proulate with xml type -> Java class name (QName -> String) mappings
        * @param loader A ClassLoader to use in resolving xsd locations
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(Definition def, Map table, ClassLoader loader) throws WSIFException {
   		WSDLLocator	locator = new WSIFWSDLLocatorImpl((String) null, (String) null, loader);
  @@ -130,6 +134,8 @@
        * @param loader A ClassLoader to use in resolving xsd locations
        * @param includeStandardMappings Flag to indicate whether or not standard xsd, soapenc and Apache SOAP mappings
        * should be included in the table
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(
       	Definition def,
  @@ -146,6 +152,8 @@
        * @param def The Definition object representing the wsdl
        * @param table The Map to proulate with xml type -> Java class name (QName -> String) mappings
        * @param loc WSDLLocator equal or equivalent to that used to locate the original wsdl document
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(Definition def, Map table, WSDLLocator loc) throws WSIFException {
           getTypeMappings(def, table, true, loc);
  @@ -158,6 +166,8 @@
        * @param table The Map to proulate with xml type -> Java class name (QName -> String) mappings
        * @param includeStandardMappings Flag to indicate whether or not standard xsd, soapenc and Apache SOAP mappings
        * should be included in the table
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(
           Definition def,
  @@ -175,6 +185,8 @@
        * @param includeStandardMappings Flag to indicate whether or not standard xsd, soapenc and Apache SOAP mappings
        * should be included in the table
        * @param loc WSDLLocator equal or equivalent to that used to locate the original wsdl document
  +     * @deprecated Use getAllSchemaTypes in combination with a {@link org.apache.wsif.mapping.WSIFMapper} rather 
  +     * than this method
        */
       public static void getTypeMappings(
           Definition def,
  @@ -413,29 +425,37 @@
        * to resolve imported schemas.
        * @exception A WSIFException is thrown if a problem occurs when parsing the schemas
        */
  -	public static void getAllSchemaTypes(Definition def, List schemaTypes, WSDLLocator loc) throws WSIFException {
  -		try {
  +    public static void getAllSchemaTypes(
  +        Definition def,
  +        List schemaTypes,
  +        WSDLLocator loc)
  +            throws WSIFException {
  +        try {
               ArrayList schemas = new ArrayList();
  +            if (loc == null) {
  +                loc =
  +                    new WSIFWSDLLocatorImpl((String) null, (String) null, null);
  +            }
               Parser.getTypesSchemas(def, schemas, loc);
  -	        Iterator si = schemas.iterator();
  -	        while (si.hasNext()) {
  -	            Schema ts = (Schema) si.next();
  -	            if (ts != null) {
  -	                // Get all the types defined in this schema
  -	                List types = ts.getTypes();
  -	                Iterator ti = types.iterator();
  -	                while (ti.hasNext()) {
  -	                    SchemaType st = (SchemaType) ti.next();
  -	                    // Ignore null types
  -	                    if (st == null)
  -	                        continue;
  -	                    schemaTypes.add(st);
  -	                }
  -	            }
  -	        }			            
  +            Iterator si = schemas.iterator();
  +            while (si.hasNext()) {
  +                Schema ts = (Schema) si.next();
  +                if (ts != null) {
  +                    // Get all the types defined in this schema
  +                    List types = ts.getTypes();
  +                    Iterator ti = types.iterator();
  +                    while (ti.hasNext()) {
  +                        SchemaType st = (SchemaType) ti.next();
  +                        // Ignore null types
  +                        if (st == null)
  +                            continue;
  +                        schemaTypes.add(st);
  +                    }
  +                }
  +            }
           } catch (WSIFException e) {
           }
  -	}
  +    }
   
       /**
        * Populate a map with the standard xml type -> Java class name mappings
  
  
  
  1.29      +9 -14     xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java
  
  Index: WSIFUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- WSIFUtils.java	21 Jan 2003 08:46:22 -0000	1.28
  +++ WSIFUtils.java	26 Feb 2003 15:55:24 -0000	1.29
  @@ -99,6 +99,7 @@
   import org.apache.wsif.format.WSIFFormatHandler;
   import org.apache.wsif.logging.MessageLogger;
   import org.apache.wsif.logging.Trc;
  +import org.apache.wsif.mapping.WSIFDefaultMapper;
   import org.apache.wsif.schema.ComplexType;
   import org.apache.wsif.schema.ElementType;
   import org.apache.wsif.schema.Parser;
  @@ -142,7 +143,7 @@
       private static final String emptyString = "";
       
       private static Boolean providersInitialized = new Boolean(false);
  -    private static Boolean simpleTypesMapCreated = new Boolean(false);
  +    private static boolean simpleTypesMapCreated = false;
       private static HashMap simpleTypesMap = new HashMap();
   	private static HashMap keywordMap = null;
       
  @@ -697,18 +698,12 @@
        * Create a map of all schema simple types and there Java equivalents.
        */
       public static void createSimpleTypesMap() {
  -        synchronized (simpleTypesMapCreated) {
  -            if (!simpleTypesMapCreated.booleanValue()) {
  -                new Schema2Java(
  -                    WSIFConstants.NS_URI_1999_SCHEMA_XSD).getRegistry(
  -                    simpleTypesMap);
  -                new Schema2Java(
  -                    WSIFConstants.NS_URI_2000_SCHEMA_XSD).getRegistry(
  -                    simpleTypesMap);
  -                new Schema2Java(
  -                    WSIFConstants.NS_URI_2001_SCHEMA_XSD).getRegistry(
  -                    simpleTypesMap);
  -                simpleTypesMapCreated = new Boolean(true);
  +        synchronized (simpleTypesMap) {
  +            if (!simpleTypesMapCreated) {
  +            	WSIFDefaultMapper.populateWithStandardMappings(simpleTypesMap, WSIFConstants.NS_URI_1999_SCHEMA_XSD, true);
  +            	WSIFDefaultMapper.populateWithStandardMappings(simpleTypesMap, WSIFConstants.NS_URI_2000_SCHEMA_XSD, false);
  +            	WSIFDefaultMapper.populateWithStandardMappings(simpleTypesMap, WSIFConstants.NS_URI_2001_SCHEMA_XSD, false);
  +                simpleTypesMapCreated = true;
               }
           }
       }
  @@ -718,7 +713,7 @@
        * @return The map of simple types
        */
       public static Map getSimpleTypesMap() {
  -        if (!simpleTypesMapCreated.booleanValue()) {
  +        if (!simpleTypesMapCreated) {
               createSimpleTypesMap();
           }
           return simpleTypesMap;
  
  
  

Mime
View raw message