[jbossws-commits] JBossWS SVN: r8002 - in stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools: mapping and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Aug 4 08:32:15 EDT 2008


Author: darran.lofthouse at jboss.com
Date: 2008-08-04 08:32:15 -0400 (Mon, 04 Aug 2008)
New Revision: 8002

Modified:
   stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
   stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/mapping/MappingFileGenerator.java
Log:
Backport -r 5901

Modified: stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java	2008-08-04 12:30:45 UTC (rev 8001)
+++ stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java	2008-08-04 12:32:15 UTC (rev 8002)
@@ -23,6 +23,7 @@
 
 import java.beans.Introspector;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -99,7 +100,7 @@
    private String typeNamespace;
    private String serviceName = null;
    private String packageName = null;
-   private Map<String, String> namespacePackageMap = null;
+   private Map<String, String> namespacePackageMap = new HashMap<String,String>();
    private Set<String> registeredTypes = new HashSet<String>();
    private Set<String> registeredExceptions = new HashSet<String>();
 
@@ -480,6 +481,7 @@
          WsdlReturnValueMapping wrvm = new WsdlReturnValueMapping(semm);
          wrvm.setMethodReturnValue(getJavaTypeAsString(xmlName, xmlType, nameSpace, false, true));
          QName messageName = WSDLUtils.getWsdl11Output(wiop).getMessageName();
+
          wrvm.setWsdlMessage(new QName(messageName.getNamespaceURI(), messageName.getLocalPart(), WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS));
          wrvm.setWsdlMessagePartName(partName);
          semm.setWsdlReturnValueMapping(wrvm);
@@ -712,9 +714,17 @@
 
       if (xt instanceof XSComplexTypeDefinition)
       {
-
          XSModelGroup xm = null;
          XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xt;
+         XSTypeDefinition baseType = xc.getBaseType();
+         short der = xc.getDerivationMethod();
+
+         if ((baseType != null) && !utils.isBaseTypeIgnorable(baseType, xc))
+         {
+               addJavaXMLTypeMap(baseType, baseType.getName(), "", "", jwm, skipWrapperArray); //Recurse for base types
+         }
+
+         // handleContentTypeElementsWithDerivationNone
          if (xc.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
          {
             XSParticle xp = xc.getParticle();
@@ -798,12 +808,15 @@
       {
          XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
          if (xsterm instanceof XSModelGroup)
+         {
             addVariableMappingMap((XSModelGroup)xsterm, jxtm, javaType);
+         }
          else if (xsterm instanceof XSElementDeclaration)
          {
             XSElementDeclaration xe = (XSElementDeclaration)xsterm;
             VariableMapping vm = new VariableMapping(jxtm);
             String name = xe.getName();
+            
             // JBWS-1170 Convert characters which are illegal in Java identifiers
             vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name)));
             vm.setXmlElementName(name);

Modified: stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/mapping/MappingFileGenerator.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/mapping/MappingFileGenerator.java	2008-08-04 12:30:45 UTC (rev 8001)
+++ stack/native/branches/dlofthouse/JBPAPP-904/src/main/java/org/jboss/ws/tools/mapping/MappingFileGenerator.java	2008-08-04 12:32:15 UTC (rev 8002)
@@ -24,8 +24,11 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.rpc.encoding.TypeMapping;
 
@@ -72,7 +75,7 @@
    /**
     * Package Names to override
     */
-   protected Map<String, String> namespacePackageMap;
+   protected Map<String, String> namespacePackageMap = new HashMap<String,String>();
 
    /**
     * Service Name
@@ -205,6 +208,20 @@
          jwm.addPackageMapping(helper.constructPackageMapping(jwm, getPackageName(typeNamespace), typeNamespace));
       jwm.addPackageMapping(helper.constructPackageMapping(jwm, getPackageName(targetNS), targetNS));
 
+      if (namespacePackageMap != null)
+      {
+         Set<String> keys = namespacePackageMap.keySet();
+         Iterator<String> iter = keys.iterator();
+         while (iter != null && iter.hasNext())
+         {
+            String ns = iter.next();
+            if (jwm.getPackageNameForNamespaceURI(ns) == null)
+            {
+               jwm.addPackageMapping(helper.constructPackageMapping(jwm, namespacePackageMap.get(ns), ns));
+            }
+         }
+      }
+
       return jwm;
    }
 




More information about the jbossws-commits mailing list