cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r832808 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/tools/common/ tools/common/src/main/java/org/apache/cxf/tools/common/ tools/common/src/main/java/org/apache/cxf/tools/util/ tools/wsdlto/core/src/main/java/org/apac...
Date Wed, 04 Nov 2009 17:35:44 GMT
Author: dkulp
Date: Wed Nov  4 17:35:43 2009
New Revision: 832808

URL: http://svn.apache.org/viewvc?rev=832808&view=rev
Log:
Merged revisions 832802 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r832802 | dkulp | 2009-11-04 12:20:13 -0500 (Wed, 04 Nov 2009) | 5 lines
  
  [CXF-1939] For services that don't differ after mapping, map to new nam
  Bunch of optimizations in wsdl2java to reduce reprocssing the same data
  over and over.
  Add a workaround for running codegen tests in eclipse if eclipse is
  using jdk 1.5, but commandline/apth is set to use jdk 1.6.
........

Added:
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1939/
      - copied from r832802, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1939/
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1939/hello_world.wsdl
      - copied unchanged from r832802, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1939/hello_world.wsdl
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java
    cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolException.java
    cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/FaultGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Wed Nov  4 17:35:43 2009
@@ -90,6 +90,7 @@
     public static final String CFG_ANT_PROP = "ant.prop";
     public static final String CFG_NO_ADDRESS_BINDING = "noAddressBinding";
     public static final String CFG_ALLOW_ELEMENT_REFS = "allowElementReferences";
+    public static final String CFG_RESERVE_NAME = "reserveClass";
 
 
 

Modified: cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java (original)
+++ cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java Wed Nov  4 17:35:43 2009
@@ -53,6 +53,11 @@
             argList.add("-verbose");
         }
 
+        if ("1.5".equals(System.getProperty("java.specification.version"))) {
+            argList.add("-target");
+            argList.add("1.5");
+        }
+        
         if (context.get(ToolConstants.CFG_CLASSDIR) != null) {
             argList.add("-d");
             String classDir = (String)context.get(ToolConstants.CFG_CLASSDIR);

Modified: cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolException.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolException.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolException.java (original)
+++ cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolException.java Wed Nov  4 17:35:43 2009
@@ -58,5 +58,8 @@
     public ToolException(String messageId, Logger logger) {
         this(new Message(messageId, logger));
     }
+    public ToolException(String messageId, Logger logger, Object ... args) {
+        this(new Message(messageId, logger, args));
+    }
 }
 

Modified: cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java (original)
+++ cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java Wed Nov  4 17:35:43 2009
@@ -35,9 +35,36 @@
     private final Map<String, String> implClassNames = new HashMap<String, String>();
     private final Map<String, String> clientClassNames = new HashMap<String, String>();
     private final Map<String, String> serverClassNames = new HashMap<String, String>();
+    private final Map<String, String> reservedClassNames = new HashMap<String, String>();
+    
 
     private final Set<String> typesPackages = new HashSet<String>();
-
+    
+    public ClassCollector() {
+        
+    }
+    public void reserveClass(String fullName) {
+        String cls = fullName;
+        int idx = cls.lastIndexOf('.');
+        String pkg = "";
+        if (idx != -1) {
+            pkg = cls.substring(0, idx);
+            cls = cls.substring(idx + 1);
+        }        
+        reservedClassNames.put(key(pkg, cls), fullName);
+
+        addSeiClassName(pkg, cls, fullName);
+        addTypesClassName(pkg, cls, fullName);
+        addServerClassName(pkg, cls, fullName);
+        addImplClassName(pkg, cls, fullName);
+        addClientClassName(pkg, cls, fullName);
+        addServiceClassName(pkg, cls, fullName);
+        addExceptionClassName(pkg, cls, fullName);
+    }
+    
+    public boolean isReserved(String packagename, String type) {
+        return reservedClassNames.containsKey(key(packagename, type));
+    }
     public boolean containSeiClass(String packagename, String type) {
         return seiClassNames.containsKey(key(packagename, type));
     }
@@ -49,6 +76,18 @@
     public boolean containExceptionClass(String packagename, String type) {
         return exceptionClassNames.containsKey(key(packagename, type));
     }
+    public boolean containServiceClass(String packagename, String type) {
+        return this.serviceClassNames.containsKey(key(packagename, type));
+    }
+    public boolean containClientClass(String packagename, String type) {
+        return this.clientClassNames.containsKey(key(packagename, type));
+    }
+    public boolean containServerClass(String packagename, String type) {
+        return this.serverClassNames.containsKey(key(packagename, type));
+    }
+    public boolean containImplClass(String packagename, String type) {
+        return this.implClassNames.containsKey(key(packagename, type));
+    }
 
     public void addSeiClassName(String packagename, String type, String fullClassName) {
         seiClassNames.put(key(packagename, type), fullClassName);

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Wed Nov  4 17:35:43 2009
@@ -204,7 +204,15 @@
         context.put(ToolConstants.XML_SCHEMA_COLLECTION, schemaCollection);
         
         context.put(ToolConstants.PORTTYPE_MAP, interfaces);
-        context.put(ClassCollector.class, new ClassCollector());
+        
+        ClassCollector collector = new ClassCollector();
+        String reserved[] = (String[])context.get(ToolConstants.CFG_RESERVE_NAME);
+        if (reserved != null) {
+            for (String r : reserved) {
+                collector.reserveClass(r);
+            }
+        }
+        context.put(ClassCollector.class, collector);
         Processor processor = frontend.getProcessor();
         if (processor instanceof ClassNameProcessor) {
             processor.setEnvironment(context);
@@ -228,12 +236,11 @@
             // Build the JavaModel from the ServiceModel
             processor.setEnvironment(context);
             processor.process();
-
-            if (!isSuppressCodeGen()) {
-                // Generate artifacts
-                for (FrontEndGenerator generator : frontend.getGenerators()) {
-                    generator.generate(context);
-                }
+        }
+        if (!isSuppressCodeGen()) {
+            // Generate artifacts
+            for (FrontEndGenerator generator : frontend.getGenerators()) {
+                generator.generate(context);
             }
         }
         context.remove(ToolConstants.SERVICE_LIST);

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java Wed Nov  4 17:35:43 2009
@@ -41,6 +41,7 @@
     public Set<String> getArrayKeys() {
         Set<String> set = super.getArrayKeys();
         set.add(ToolConstants.CFG_BINDING);
+        set.add(ToolConstants.CFG_RESERVE_NAME);
         return set;
     }
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/AntGenerator.java Wed Nov  4 17:35:43 2009
@@ -23,7 +23,10 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -33,6 +36,7 @@
 import org.apache.cxf.tools.common.model.JavaPort;
 import org.apache.cxf.tools.common.model.JavaServiceClass;
 import org.apache.cxf.tools.util.NameUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class AntGenerator extends AbstractJAXWSGenerator {
 
@@ -53,72 +57,74 @@
 
     public void generate(ToolContext penv) throws ToolException {       
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
-        
         if (passthrough()) {
             return;
         }
         
-        if (javaModel.getServiceClasses().size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_ANT", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
-            }
-            return;
-        }
-        
-        Map<String, String> clientClassNamesMap = new HashMap<String, String>();
-        Map<String, String> serverClassNamesMap = new HashMap<String, String>();
-        
-        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
-        int index = 1;
-        Iterator it = javaModel.getServiceClasses().values().iterator();
-        while (it.hasNext()) {
-            JavaServiceClass js = (JavaServiceClass)it.next();
-            Iterator i = js.getPorts().iterator();
-            while (i.hasNext()) {
-                JavaPort jp = (JavaPort)i.next();
-                String interfaceName = jp.getInterfaceClass();
-                JavaInterface intf = interfaces.get(interfaceName);
-                if (intf == null) {
-                    interfaceName = jp.getPortType();
-                    intf = interfaces.get(interfaceName);
-                }
-                
-                String clientClassName = intf.getPackageName() + "." + interfaceName + "_"
-                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
-
-                String serverClassName = intf.getPackageName() + "." + interfaceName + "_"
-                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
-                String clientTargetName = interfaceName + "Client";
-                boolean collison = false;
-                if (clientClassNamesMap.keySet().contains(clientTargetName)) {
-                    clientTargetName = clientTargetName + index;
-                    collison = true;
-                }
-                String serverTargetName = interfaceName + "Server";
-                if (serverClassNamesMap.keySet().contains(serverTargetName)) {
-                    serverTargetName = serverTargetName + index;
-                    collison = true;
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
+
+            if (javaModel.getServiceClasses().size() == 0) {
+                ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+                String wsdl = serviceInfo.getDescription().getBaseURI();
+                Message msg = new Message("CAN_NOT_GEN_ANT", LOG, wsdl);
+                if (penv.isVerbose()) {
+                    System.out.println(msg.toString());
                 }
-                
-                if (collison) {
-                    index++;
+                return;
+            }
+            
+            Map<String, String> clientClassNamesMap = new HashMap<String, String>();
+            Map<String, String> serverClassNamesMap = new HashMap<String, String>();
+            
+            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+            int index = 1;
+            Iterator it = javaModel.getServiceClasses().values().iterator();
+            while (it.hasNext()) {
+                JavaServiceClass js = (JavaServiceClass)it.next();
+                Iterator i = js.getPorts().iterator();
+                while (i.hasNext()) {
+                    JavaPort jp = (JavaPort)i.next();
+                    String interfaceName = jp.getInterfaceClass();
+                    JavaInterface intf = interfaces.get(interfaceName);
+                    if (intf == null) {
+                        interfaceName = jp.getPortType();
+                        intf = interfaces.get(interfaceName);
+                    }
+                    
+                    String clientClassName = intf.getPackageName() + "." + interfaceName + "_"
+                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
+    
+                    String serverClassName = intf.getPackageName() + "." + interfaceName + "_"
+                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
+                    String clientTargetName = interfaceName + "Client";
+                    boolean collison = false;
+                    if (clientClassNamesMap.keySet().contains(clientTargetName)) {
+                        clientTargetName = clientTargetName + index;
+                        collison = true;
+                    }
+                    String serverTargetName = interfaceName + "Server";
+                    if (serverClassNamesMap.keySet().contains(serverTargetName)) {
+                        serverTargetName = serverTargetName + index;
+                        collison = true;
+                    }
+                    
+                    if (collison) {
+                        index++;
+                    }
+                    clientClassNamesMap.put(clientTargetName, clientClassName);
+                    serverClassNamesMap.put(serverTargetName, serverClassName);
+                    
                 }
-                clientClassNamesMap.put(clientTargetName, clientClassName);
-                serverClassNamesMap.put(serverTargetName, serverClassName);
-                
             }
+    
+            clearAttributes();
+            setAttributes("clientClassNamesMap", clientClassNamesMap);
+            setAttributes("serverClassNamesMap", serverClassNamesMap);
+            setAttributes("wsdlLocation", javaModel.getLocation());
+            setCommonAttributes();
+    
+            doWrite(ANT_TEMPLATE, parseOutputName(null, "build", ".xml"));
         }
-
-        clearAttributes();
-        setAttributes("clientClassNamesMap", clientClassNamesMap);
-        setAttributes("serverClassNamesMap", serverClassNamesMap);
-        setAttributes("wsdlLocation", javaModel.getLocation());
-        setCommonAttributes();
-
-        doWrite(ANT_TEMPLATE, parseOutputName(null, "build", ".xml"));
     }
 }

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ClientGenerator.java Wed Nov  4 17:35:43 2009
@@ -22,7 +22,10 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -33,6 +36,7 @@
 import org.apache.cxf.tools.common.model.JavaServiceClass;
 import org.apache.cxf.tools.util.ClassCollector;
 import org.apache.cxf.tools.util.NameUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class ClientGenerator extends AbstractJAXWSGenerator {
 
@@ -60,50 +64,66 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
         if (passthrough()) {
             return;
         }
-        if (javaModel.getServiceClasses().size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_CLIENT", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
+        
+            if (javaModel.getServiceClasses().size() == 0) {
+                ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+                String wsdl = serviceInfo.getDescription().getBaseURI();
+                Message msg = new Message("CAN_NOT_GEN_CLIENT", LOG, wsdl);
+                if (penv.isVerbose()) {
+                    System.out.println(msg.toString());
+                }
+                return;
             }
-            return;
-        }
-
-        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
-        Iterator it = javaModel.getServiceClasses().values().iterator();
-        while (it.hasNext()) {
-            JavaServiceClass js = (JavaServiceClass)it.next();
-            Iterator i = js.getPorts().iterator();
-            while (i.hasNext()) {
-                JavaPort jp = (JavaPort)i.next();
-                String interfaceName = jp.getInterfaceClass();
-                JavaInterface intf = interfaces.get(interfaceName);
-                if (intf == null) {
-                    interfaceName = jp.getPortType();
-                    intf = interfaces.get(interfaceName);
+    
+            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+            Iterator it = javaModel.getServiceClasses().values().iterator();
+            while (it.hasNext()) {
+                JavaServiceClass js = (JavaServiceClass)it.next();
+                Iterator i = js.getPorts().iterator();
+                while (i.hasNext()) {
+                    JavaPort jp = (JavaPort)i.next();
+                    String interfaceName = jp.getInterfaceClass();
+                    JavaInterface intf = interfaces.get(interfaceName);
+                    if (intf == null) {
+                        interfaceName = jp.getPortType();
+                        intf = interfaces.get(interfaceName);
+                    }
+                    
+                    String clientClassName = interfaceName + "_"
+                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
+    
+                    clientClassName = mapClassName(intf.getPackageName(), clientClassName, penv);
+                    clearAttributes();
+                    setAttributes("clientClassName", clientClassName);
+                    setAttributes("intf", intf);
+                    setAttributes("service", js);
+                    setAttributes("port", jp);
+    
+                    setCommonAttributes();
+    
+                    doWrite(CLT_TEMPLATE, parseOutputName(intf.getPackageName(), clientClassName));
                 }
-                
-                String clientClassName = interfaceName + "_"
-                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
-
-                clearAttributes();
-                setAttributes("clientClassName", clientClassName);
-                setAttributes("intf", intf);
-                setAttributes("service", js);
-                setAttributes("port", jp);
-
-                setCommonAttributes();
-
-                doWrite(CLT_TEMPLATE, parseOutputName(intf.getPackageName(), clientClassName));
             }
         }
     }
 
+    private String mapClassName(String packageName, String name, ToolContext context) {
+        ClassCollector collector = context.get(ClassCollector.class);
+        int count = 0;
+        String checkName = name;
+        while (collector.containClientClass(packageName, checkName)) {
+            checkName = name + (++count);
+        }
+        collector.addClientClassName(packageName, checkName,
+                                     packageName + "." + checkName);
+        return checkName;
+    }
+
     public void register(final ClassCollector collector, String packageName, String fileName) {
         collector.addClientClassName(packageName , fileName , packageName + "." + fileName);
     }

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/FaultGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/FaultGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/FaultGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/FaultGenerator.java Wed Nov  4 17:35:43 2009
@@ -24,6 +24,9 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -31,6 +34,7 @@
 import org.apache.cxf.tools.common.model.JavaField;
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
 
 public class FaultGenerator extends AbstractJAXWSGenerator {
@@ -62,29 +66,30 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
-
         if (passthrough()) {
             return;
         }
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
 
-        Map<String, JavaExceptionClass> exceptionClasses = javaModel
-                .getExceptionClasses();
-        for (Iterator iter = exceptionClasses.keySet().iterator(); iter
-                .hasNext();) {
-            String expClassName = (String)iter.next();
-            JavaExceptionClass expClz =
-                exceptionClasses.get(expClassName);
-
-            clearAttributes();
-            setAttributes("suid", getSUID());
-            setAttributes("expClass", expClz);
-            for (JavaField jf : expClz.getFields()) {
-                setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
+            Map<String, JavaExceptionClass> exceptionClasses = javaModel
+                    .getExceptionClasses();
+            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
+                    .hasNext();) {
+                String expClassName = (String)iter.next();
+                JavaExceptionClass expClz =
+                    exceptionClasses.get(expClassName);
+    
+                clearAttributes();
+                setAttributes("suid", getSUID());
+                setAttributes("expClass", expClz);
+                for (JavaField jf : expClz.getFields()) {
+                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
+                }
+                setCommonAttributes();
+                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
+                        expClz.getName()));
             }
-            setCommonAttributes();
-            doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
-                    expClz.getName()));
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java Wed Nov  4 17:35:43 2009
@@ -22,6 +22,9 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -29,6 +32,8 @@
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.common.model.JavaPort;
 import org.apache.cxf.tools.common.model.JavaServiceClass;
+import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class ImplGenerator extends AbstractJAXWSGenerator {
 
@@ -62,47 +67,62 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
-
         if (passthrough()) {
             return;
         }
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
 
-        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
-            
-        Map<String, JavaServiceClass> services = javaModel.getServiceClasses();
-
-        JavaServiceClass service = null;
-        String port = "";
-        Iterator portIterator = null;
-        if (!services.values().isEmpty()) {
-            JavaServiceClass javaservice = services.values().iterator().next();
-            service = javaservice;
-      
-            if (javaservice.getPorts().size() != 0) {
-                portIterator = javaservice.getPorts().iterator();
+    
+            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+                
+            Map<String, JavaServiceClass> services = javaModel.getServiceClasses();
+    
+            JavaServiceClass service = null;
+            if (!services.values().isEmpty()) {
+                for (JavaServiceClass javaservice : services.values()) {
+                    service = javaservice;
+                    for (JavaPort jport : javaservice.getPorts()) {
+                        JavaInterface intf = interfaces.get(jport.getInterfaceClass());
+                        outputImpl(intf, service, jport.getPortName(), penv);
+                        
+                    }
+                }
+            } else {
+                for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
+                    String interfaceName = (String)iter.next();
+                    JavaInterface intf = interfaces.get(interfaceName);
+                    outputImpl(intf, service, "", penv);
+                }
             }
         }
-        for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
-            String interfaceName = (String)iter.next();
-            JavaInterface intf = interfaces.get(interfaceName);
-            
-            if (portIterator != null) {
-                JavaPort jport = (JavaPort)portIterator.next();
-                port = jport.getPortName();
-            }
-
-            clearAttributes();
-            setAttributes("intf", intf);
+    }
+    private void outputImpl(JavaInterface intf, JavaServiceClass service,
+                            String port, ToolContext penv) {
+        clearAttributes();
+        setAttributes("intf", intf);
 
-            setAttributes("service", service);
+        setAttributes("service", service);
   
-            setAttributes("port", port);
-            
-            setCommonAttributes();
-
-            doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
+        setAttributes("port", port);
+        
+        setCommonAttributes();
+        
+        String name = intf.getName() + "Impl";
+        name = mapClassName(intf.getPackageName(), name, penv);
+        setAttributes("implName", name);
+        penv.put(ToolConstants.CFG_IMPL_CLASS, name);
+        doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), name));
+    }
+    private String mapClassName(String packageName, String name, ToolContext context) {
+        ClassCollector collector = context.get(ClassCollector.class);
+        int count = 0;
+        String checkName = name;
+        while (collector.containImplClass(packageName, checkName)) {
+            checkName = name + (++count);
         }
+        collector.addImplClassName(packageName, checkName,
+                                   packageName + "." + checkName);
+        return checkName;
     }
-
 }

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java Wed Nov  4 17:35:43 2009
@@ -22,9 +22,11 @@
 import java.util.Map;
 
 import javax.jws.HandlerChain;
+import javax.xml.namespace.QName;
 
 import org.apache.cxf.annotations.DataBinding;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -34,6 +36,7 @@
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class SEIGenerator extends AbstractJAXWSGenerator {
 
@@ -66,61 +69,63 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
-
         if (passthrough()) {
             return;
         }
 
-        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
-
-        if (interfaces.size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_SEI", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
+        
+            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+    
+            if (interfaces.size() == 0) {
+                ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+                String wsdl = serviceInfo.getDescription().getBaseURI();
+                Message msg = new Message("CAN_NOT_GEN_SEI", LOG, wsdl);
+                if (penv.isVerbose()) {
+                    System.out.println(msg.toString());
+                }
+                return;
             }
-            return;
-        }
-        for (JavaInterface intf : interfaces.values()) {
-
-            if (hasHandlerConfig(intf)) {
-                HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
-                // REVISIT: find a better way to handle Handler gen, should not
-                // pass JavaInterface around.
-                handlerGen.setJavaInterface(intf);
-                handlerGen.generate(getEnvironment());
-
-                JAnnotation annot = handlerGen.getHandlerAnnotation();
-                if (handlerGen.getHandlerAnnotation() != null) {
-                    boolean existHandlerAnno = false;
-                    for (JAnnotation jann : intf.getAnnotations()) {
-                        if (jann.getType() == HandlerChain.class) {
-                            existHandlerAnno = true;
+            for (JavaInterface intf : interfaces.values()) {
+    
+                if (hasHandlerConfig(intf)) {
+                    HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
+                    // REVISIT: find a better way to handle Handler gen, should not
+                    // pass JavaInterface around.
+                    handlerGen.setJavaInterface(intf);
+                    handlerGen.generate(getEnvironment());
+    
+                    JAnnotation annot = handlerGen.getHandlerAnnotation();
+                    if (handlerGen.getHandlerAnnotation() != null) {
+                        boolean existHandlerAnno = false;
+                        for (JAnnotation jann : intf.getAnnotations()) {
+                            if (jann.getType() == HandlerChain.class) {
+                                existHandlerAnno = true;
+                            }
+                        }
+                        if (!existHandlerAnno) {
+                            intf.addAnnotation(annot);
+                            intf.addImport("javax.jws.HandlerChain");
                         }
-                    }
-                    if (!existHandlerAnno) {
-                        intf.addAnnotation(annot);
-                        intf.addImport("javax.jws.HandlerChain");
                     }
                 }
+                if (penv.containsKey(ToolConstants.RUNTIME_DATABINDING_CLASS)) {
+                    JAnnotation ann = new JAnnotation(DataBinding.class);
+                    JAnnotationElement el 
+                        = new JAnnotationElement(null,
+                                                 penv.get(ToolConstants.RUNTIME_DATABINDING_CLASS),
+                                                 true);
+                    ann.addElement(el);
+                    intf.addAnnotation(ann);
+                }
+                clearAttributes();
+                setAttributes("intf", intf);
+                setCommonAttributes();
+    
+                doWrite(SEI_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName()));
+    
             }
-            if (penv.containsKey(ToolConstants.RUNTIME_DATABINDING_CLASS)) {
-                JAnnotation ann = new JAnnotation(DataBinding.class);
-                JAnnotationElement el 
-                    = new JAnnotationElement(null,
-                                             penv.get(ToolConstants.RUNTIME_DATABINDING_CLASS),
-                                             true);
-                ann.addElement(el);
-                intf.addAnnotation(ann);
-            }
-            clearAttributes();
-            setAttributes("intf", intf);
-            setCommonAttributes();
-
-            doWrite(SEI_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName()));
-
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java Wed Nov  4 17:35:43 2009
@@ -22,8 +22,11 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -34,6 +37,7 @@
 import org.apache.cxf.tools.common.model.JavaServiceClass;
 import org.apache.cxf.tools.util.ClassCollector;
 import org.apache.cxf.tools.util.NameUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class ServerGenerator extends AbstractJAXWSGenerator {
 
@@ -59,54 +63,73 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
 
         if (passthrough()) {
             return;
         }
-        String address = "CHANGE_ME";
-        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
-
-        if (javaModel.getServiceClasses().size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_SRV", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
-            }
-            return;
-        }
-        Iterator it = javaModel.getServiceClasses().values().iterator();
-        while (it.hasNext()) {
-            JavaServiceClass js = (JavaServiceClass)it.next();
-            Iterator i = js.getPorts().iterator();
-            while (i.hasNext()) {
-                JavaPort jp = (JavaPort)i.next();
-                String interfaceName = jp.getInterfaceClass();
-                JavaInterface intf = interfaces.get(interfaceName);
-                if (intf == null) {
-                    interfaceName = jp.getPortType();
-                    intf = interfaces.get(interfaceName);
+        
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
+        
+            String address = "CHANGE_ME";
+            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
+    
+            if (javaModel.getServiceClasses().size() == 0) {
+                ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+                String wsdl = serviceInfo.getDescription().getBaseURI();
+                Message msg = new Message("CAN_NOT_GEN_SRV", LOG, wsdl);
+                if (penv.isVerbose()) {
+                    System.out.println(msg.toString());
                 }
-                address = StringUtils.isEmpty(jp.getBindingAdress()) ? address : jp.getBindingAdress();
-                String serverClassName = interfaceName + "_"
-                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
-
-                clearAttributes();
-                setAttributes("serverClassName", serverClassName);
-                setAttributes("intf", intf);
-                if (penv.optionSet(ToolConstants.CFG_IMPL_CLASS)) {
-                    setAttributes("impl", (String)penv.get(ToolConstants.CFG_IMPL_CLASS));
-                } else {
-                    setAttributes("impl", intf.getName() + "Impl");
+                return;
+            }
+            Iterator it = javaModel.getServiceClasses().values().iterator();
+            while (it.hasNext()) {
+                JavaServiceClass js = (JavaServiceClass)it.next();
+                Iterator i = js.getPorts().iterator();
+                while (i.hasNext()) {
+                    JavaPort jp = (JavaPort)i.next();
+                    String interfaceName = jp.getInterfaceClass();
+                    JavaInterface intf = interfaces.get(interfaceName);
+                    if (intf == null) {
+                        interfaceName = jp.getPortType();
+                        intf = interfaces.get(interfaceName);
+                    }
+                    address = StringUtils.isEmpty(jp.getBindingAdress()) ? address : jp.getBindingAdress();
+                    String serverClassName = interfaceName + "_"
+                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
+    
+                    serverClassName = mapClassName(intf.getPackageName(), serverClassName, penv);
+                    clearAttributes();
+                    setAttributes("serverClassName", serverClassName);
+                    setAttributes("intf", intf);
+                    if (penv.optionSet(ToolConstants.CFG_IMPL_CLASS)) {
+                        setAttributes("impl", (String)penv.get(ToolConstants.CFG_IMPL_CLASS));
+                        penv.remove(ToolConstants.CFG_IMPL_CLASS);
+                    } else {
+                        setAttributes("impl", intf.getName() + "Impl");
+                    }
+                    setAttributes("address", address);
+                    setCommonAttributes();
+    
+                    doWrite(SRV_TEMPLATE, parseOutputName(intf.getPackageName(), serverClassName));           
                 }
-                setAttributes("address", address);
-                setCommonAttributes();
-
-                doWrite(SRV_TEMPLATE, parseOutputName(intf.getPackageName(), serverClassName));           
             }
         }
     }
+    
+    private String mapClassName(String packageName, String name, ToolContext context) {
+        ClassCollector collector = context.get(ClassCollector.class);
+        int count = 0;
+        String checkName = name;
+        while (collector.containServerClass(packageName, checkName)) {
+            checkName = name + (++count);
+        }
+        collector.addServerClassName(packageName, checkName,
+                                     packageName + "." + checkName);
+        return checkName;
+    }
+
     public void register(final ClassCollector collector, String packageName, String fileName) {
         collector.addServerClassName(packageName , fileName , packageName + "." + fileName);
     }

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java Wed Nov  4 17:35:43 2009
@@ -22,8 +22,10 @@
 import java.util.Map;
 
 import javax.jws.HandlerChain;
+import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -33,6 +35,7 @@
 import org.apache.cxf.tools.common.model.JavaPort;
 import org.apache.cxf.tools.common.model.JavaServiceClass;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class ServiceGenerator extends AbstractJAXWSGenerator {
     private static final String SERVICE_TEMPLATE = TEMPLATE_BASE + "/service.vm";
@@ -60,79 +63,82 @@
 
     public void generate(ToolContext penv) throws ToolException {
         this.env = penv;
-        JavaModel javaModel = env.get(JavaModel.class);
-
         if (passthrough()) {
             return;
         }
-        ClassCollector collector = penv.get(ClassCollector.class);
-        
-        Map<String, JavaServiceClass> serviceClasses = javaModel.getServiceClasses();
         
-        if (serviceClasses.size() == 0) {
-            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
-            String wsdl = serviceInfo.getDescription().getBaseURI();
-            Message msg = new Message("CAN_NOT_GEN_SERVICE", LOG, wsdl);
-            if (penv.isVerbose()) {
-                System.out.println(msg.toString());
+        Map<QName, JavaModel> map = CastUtils.cast((Map)penv.get(WSDLToJavaProcessor.MODEL_MAP));
+        for (JavaModel javaModel : map.values()) {
+ 
+            ClassCollector collector = penv.get(ClassCollector.class);
+            
+            Map<String, JavaServiceClass> serviceClasses = javaModel.getServiceClasses();
+            
+            if (serviceClasses.size() == 0) {
+                ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+                String wsdl = serviceInfo.getDescription().getBaseURI();
+                Message msg = new Message("CAN_NOT_GEN_SERVICE", LOG, wsdl);
+                if (penv.isVerbose()) {
+                    System.out.println(msg.toString());
+                }
+                return;
             }
-            return;
-        }
-        
-        for (JavaServiceClass js : serviceClasses.values()) {
-            if (js.getHandlerChains() != null) {
-                HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
-                handlerGen.setJavaInterface(js);
-                handlerGen.generate(getEnvironment());
-
-                JAnnotation annot = handlerGen.getHandlerAnnotation();
-                               
-                if (handlerGen.getHandlerAnnotation() != null) {
-                    boolean existHandlerAnno = false;
-                    for (JAnnotation jann : js.getAnnotations()) {
-                        if (jann.getType() == HandlerChain.class) {
-                            existHandlerAnno = true;
+            
+            for (JavaServiceClass js : serviceClasses.values()) {
+                if (js.getHandlerChains() != null) {
+                    HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
+                    handlerGen.setJavaInterface(js);
+                    handlerGen.generate(getEnvironment());
+    
+                    JAnnotation annot = handlerGen.getHandlerAnnotation();
+                                   
+                    if (handlerGen.getHandlerAnnotation() != null) {
+                        boolean existHandlerAnno = false;
+                        for (JAnnotation jann : js.getAnnotations()) {
+                            if (jann.getType() == HandlerChain.class) {
+                                existHandlerAnno = true;
+                            }
+                        }
+                        if (!existHandlerAnno) {
+                            js.addAnnotation(annot);
+                            js.addImport("javax.jws.HandlerChain");
                         }
                     }
-                    if (!existHandlerAnno) {
-                        js.addAnnotation(annot);
-                        js.addImport("javax.jws.HandlerChain");
+                    
+                }
+    
+                for (JavaPort port : js.getPorts()) {
+                    if (!port.getPackageName().equals(js.getPackageName())) {
+                        js.addImport(port.getFullClassName());
                     }
                 }
+    
+                String url = (String)env.get(ToolConstants.CFG_WSDLURL);
+                String location = (String)env.get(ToolConstants.CFG_WSDLLOCATION);
+                if (location == null) {
+                    location = url;
+                }
                 
-            }
-
-            for (JavaPort port : js.getPorts()) {
-                if (!port.getPackageName().equals(js.getPackageName())) {
-                    js.addImport(port.getFullClassName());
+                String serviceSuperclass = "Service";
+                for (String s : collector.getGeneratedFileInfo()) {
+                    if (s.equals(js.getPackageName() + ".Service")) {
+                        serviceSuperclass = "javax.xml.ws.Service";
+                    }
                 }
-            }
-
-            String url = (String)env.get(ToolConstants.CFG_WSDLURL);
-            String location = (String)env.get(ToolConstants.CFG_WSDLLOCATION);
-            if (location == null) {
-                location = url;
-            }
-            
-            String serviceSuperclass = "Service";
-            for (String s : collector.getGeneratedFileInfo()) {
-                if (s.equals(js.getPackageName() + ".Service")) {
-                    serviceSuperclass = "javax.xml.ws.Service";
+                clearAttributes();
+                
+                setAttributes("service", js);
+                setAttributes("wsdlLocation", location);
+                setAttributes("serviceSuperclass", serviceSuperclass);
+                if ("Service".equals(serviceSuperclass)) {
+                    js.addImport("javax.xml.ws.Service");
                 }
+                setAttributes("wsdlUrl", url);
+                setCommonAttributes();
+    
+                doWrite(SERVICE_TEMPLATE, parseOutputName(js.getPackageName(), 
+                                                          js.getName()));
             }
-            clearAttributes();
-            
-            setAttributes("service", js);
-            setAttributes("wsdlLocation", location);
-            setAttributes("serviceSuperclass", serviceSuperclass);
-            if ("Service".equals(serviceSuperclass)) {
-                js.addImport("javax.xml.ws.Service");
-            }
-            setAttributes("wsdlUrl", url);
-            setCommonAttributes();
-
-            doWrite(SERVICE_TEMPLATE, parseOutputName(js.getPackageName(), 
-                                                      js.getName()));
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml Wed Nov  4 17:35:43 2009
@@ -99,7 +99,18 @@
                     <annotation>binding-file-name</annotation>
                 </associatedArgument>
             </option>
-
+            <option id="reserveClass" maxOccurs="unbounded">
+                <annotation>
+                    Reserve a class name to keep the code generator from generating
+                    a class of the given name.   In name cases, a binding file or 
+                    use of -autoNameResolution flag may be necessary for the 
+                    code generator to completely generate usable code.
+                </annotation>
+                <switch>reserveClass</switch>
+                <associatedArgument placement="afterSpace">
+                    <annotation>class-name</annotation>
+                </associatedArgument>
+            </option>
             <option id="catalog" maxOccurs="1">
                 <annotation>
                     Specify catalog file to map the imported wsdl/schema.

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties Wed Nov  4 17:35:43 2009
@@ -20,6 +20,8 @@
 #
 PARAMETER_ALREADY_EXIST = Parameter : {0} already exist in the wsdl model
 EXCEPTION_ALREADY_EXIST = Exception : {0} already exist in the wsdl model
+RESERVED_SEI_NAME = Reserved SEI interface name {0}. Use a binding file or -autoNameResolution to resolve.
+DUPLICATE_SERVICE_NAME = Duplicate Service class name {0}.  Use a binding file or -autoNameResolution to resolve.
 MIMEPART_CANNOT_MAP = MIME part: {0} could not be mapped to available parts in portType!"
 WRAPPER_STYLE_TWO_RETURN_TYPES = Wrapper style can not have two return types
 CANNOT_FIND_WSDL = Can not find the wsdl from : {0}

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessor.java Wed Nov  4 17:35:43 2009
@@ -47,44 +47,65 @@
         super(c);
     }
 
-    public void processClassNames(ServiceInfo serviceInfo) throws ToolException {
-        InterfaceInfo interfaceInfo = serviceInfo.getInterface();
-        if (interfaceInfo == null) {
-            return;
-        }
+    private JavaInterface getInterface(ServiceInfo serviceInfo,
+                                       InterfaceInfo interfaceInfo) throws ToolException {
+        JavaInterface intf = interfaceInfo.getProperty("JavaInterface", JavaInterface.class);
+        if (intf == null) {
+            intf = new InterfaceMapper(context).map(interfaceInfo);
+
+            JAXWSBinding jaxwsBinding = null;
+            if (serviceInfo.getDescription() != null) {
+                jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
+            }
+            JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
+            if (infBinding != null && infBinding.getPackage() != null) {
+                intf.setPackageName(infBinding.getPackage());
+            } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
+                intf.setPackageName(jaxwsBinding.getPackage());
+            }
+            
+            if (infBinding != null && !infBinding.getPackageJavaDoc().equals("")) {
+                intf.setPackageJavaDoc(infBinding.getPackageJavaDoc());
+            } else if (jaxwsBinding != null && !jaxwsBinding.getPackageJavaDoc().equals("")) {
+                intf.setPackageJavaDoc(jaxwsBinding.getPackageJavaDoc());
+            }
 
-        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
+            String name = intf.getName();
+            if (infBinding != null
+                && infBinding.getJaxwsClass() != null
+                && infBinding.getJaxwsClass().getClassName() != null) {
+                name = infBinding.getJaxwsClass().getClassName();
+                intf.setClassJavaDoc(infBinding.getJaxwsClass().getComments());
+            }
 
-        JAXWSBinding jaxwsBinding = null;
-        if (serviceInfo.getDescription() != null) {
-            jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
-        }
-        JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
-        if (infBinding != null && infBinding.getPackage() != null) {
-            intf.setPackageName(infBinding.getPackage());
-        } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
-            intf.setPackageName(jaxwsBinding.getPackage());
-        }
+            ClassCollector collector = context.get(ClassCollector.class);
+            if (context.optionSet(ToolConstants.CFG_AUTORESOLVE)) {
+                int count = 0;
+                String checkName = name;
+                while (collector.isReserved(intf.getPackageName(), checkName)) {
+                    checkName = name + "_" + (++count);
+                }
+                name = checkName;
+            } else if (collector.isReserved(intf.getPackageName(), name)) {
+                throw new ToolException("RESERVED_SEI_NAME", LOG, name);
+            }
+            interfaceInfo.setProperty("InterfaceName", name);
+            intf.setName(name);
+            collector.addSeiClassName(intf.getPackageName(),
+                                      intf.getName(),
+                                      intf.getPackageName() + "." + intf.getName());
         
-        if (infBinding != null && !infBinding.getPackageJavaDoc().equals("")) {
-            intf.setPackageJavaDoc(infBinding.getPackageJavaDoc());
-        } else if (jaxwsBinding != null && !jaxwsBinding.getPackageJavaDoc().equals("")) {
-            intf.setPackageJavaDoc(jaxwsBinding.getPackageJavaDoc());
+            interfaceInfo.setProperty("JavaInterface", intf);
         }
-
-        String name = intf.getName();
-        if (infBinding != null
-            && infBinding.getJaxwsClass() != null
-            && infBinding.getJaxwsClass().getClassName() != null) {
-            name = infBinding.getJaxwsClass().getClassName();
-            intf.setClassJavaDoc(infBinding.getJaxwsClass().getComments());
+        return intf;
+    }
+    
+    public void processClassNames(ServiceInfo serviceInfo) throws ToolException {
+        InterfaceInfo interfaceInfo = serviceInfo.getInterface();
+        if (interfaceInfo == null) {
+            return;
         }
-        intf.setName(name);
-
-        ClassCollector collector = context.get(ClassCollector.class);
-        collector.addSeiClassName(intf.getPackageName(),
-                                  intf.getName(),
-                                  intf.getPackageName() + "." + intf.getName());
+        getInterface(serviceInfo, interfaceInfo);
     }
 
     public void process(ServiceInfo serviceInfo) throws ToolException {
@@ -98,35 +119,8 @@
             return;
         }
 
-        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
+        JavaInterface intf = getInterface(serviceInfo, interfaceInfo);
         intf.setJavaModel(jmodel);
-        
-        JAXWSBinding jaxwsBinding = null;
-        if (serviceInfo.getDescription() != null) {
-            jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
-        }
-        JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
-        if (infBinding != null && infBinding.getPackage() != null) {
-            intf.setPackageName(infBinding.getPackage());
-        } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
-            intf.setPackageName(jaxwsBinding.getPackage());
-        }
-        
-        if (infBinding != null && !infBinding.getPackageJavaDoc().equals("")) {
-            intf.setPackageJavaDoc(infBinding.getPackageJavaDoc());
-        } else if (jaxwsBinding != null && !jaxwsBinding.getPackageJavaDoc().equals("")) {
-            intf.setPackageJavaDoc(jaxwsBinding.getPackageJavaDoc());
-        }
-
-
-        String name = intf.getName();
-        if (infBinding != null
-            && infBinding.getJaxwsClass() != null
-            && infBinding.getJaxwsClass().getClassName() != null) {
-            name = infBinding.getJaxwsClass().getClassName();
-            intf.setClassJavaDoc(infBinding.getJaxwsClass().getComments());
-        }
-        intf.setName(name);
 
         Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
         intf.setHandlerChains(handler);

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java Wed Nov  4 17:35:43 2009
@@ -101,6 +101,21 @@
         }
 
     }
+    private String mapName(String packageName, String name) {
+        while (isNameCollision(packageName, name)) {
+            name = name + "_Service";
+        }
+        ClassCollector collector = context.get(ClassCollector.class);
+        if (collector.isReserved(packageName, name)) {
+            int count = 0;
+            String checkName = name;
+            while (collector.isReserved(packageName, checkName)) {
+                checkName = name + (++count);
+            }
+            name = checkName;
+        }
+        return name;
+    }
 
     private boolean isNameCollision(String packageName, String className) {
         if (context.optionSet(ToolConstants.CFG_GEN_OVERWRITE)) {
@@ -113,89 +128,102 @@
     }
 
     private void processService(JavaModel model) throws ToolException {
-        JavaServiceClass sclz = new JavaServiceClass(model);
-        String name = NameUtil.mangleNameToClassName(service.getName().getLocalPart());
-        String namespace = service.getName().getNamespaceURI();
-        String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
-
-
-        //customizing
-        JAXWSBinding serviceBinding = null;
-        if (service.getDescription() != null) {
-            serviceBinding = service.getDescription().getExtensor(JAXWSBinding.class);
-        }
-        JAXWSBinding serviceBinding2 = service.getExtensor(JAXWSBinding.class);
-
-        //TODO : Handle service customized class
-        if (serviceBinding != null) {
-            if (serviceBinding.getPackage() != null) {
-                jaxwsBinding.setPackage(serviceBinding.getPackage());
-            }
-
-            if (serviceBinding.isEnableAsyncMapping()) {
-                jaxwsBinding.setEnableAsyncMapping(true);
-            }
-
-            if (serviceBinding.isEnableMime()) {
-                jaxwsBinding.setEnableMime(true);
-            }
-            jaxwsBinding.setEnableWrapperStyle(serviceBinding.isEnableWrapperStyle());
-
-            if (serviceBinding.getJaxwsClass() != null
-                && serviceBinding.getJaxwsClass().getClassName() != null) {
-                name = serviceBinding.getJaxwsClass().getClassName();  
-                sclz.setClassJavaDoc(serviceBinding.getJaxwsClass().getComments());          
-            }
-            sclz.setPackageJavaDoc(serviceBinding.getPackageJavaDoc());
-        }
-        if (serviceBinding2 != null) {
-            if (serviceBinding2.getPackage() != null) {
-                jaxwsBinding.setPackage(serviceBinding2.getPackage());
-            }
-
-            if (serviceBinding2.isEnableAsyncMapping()) {
-                jaxwsBinding.setEnableAsyncMapping(true);
-            }
-
-            if (serviceBinding2.isEnableMime()) {
-                jaxwsBinding.setEnableMime(true);
-            }
-
-            if (serviceBinding2.isEnableWrapperStyle()) {
-                jaxwsBinding.setEnableWrapperStyle(true);
-            }
-            if (serviceBinding2.getJaxwsClass() != null
-                && serviceBinding2.getJaxwsClass().getClassName() != null) {
-                name = serviceBinding2.getJaxwsClass().getClassName();                
-                sclz.setClassJavaDoc(serviceBinding2.getJaxwsClass().getComments());
-            }
-            if (!serviceBinding2.getPackageJavaDoc().equals("")) {
-                sclz.setPackageJavaDoc(serviceBinding2.getPackageJavaDoc());
-            }
+        JavaServiceClass sclz = (JavaServiceClass)service.getProperty("JavaServiceClass");
+        if (sclz != null) {
+            return;
         }
         
-        sclz.setServiceName(service.getName().getLocalPart());
-        sclz.setNamespace(namespace);
-
-        if (jaxwsBinding.getPackage() != null) {
-            packageName = jaxwsBinding.getPackage();
-        }
-        sclz.setPackageName(packageName);
-
-        while (isNameCollision(packageName, name)) {
-            name = name + "_Service";
-        }
-        sclz.setName(name);
-
-
-        if (model.getServiceClasses().containsKey(name)) {
-            sclz = model.getServiceClasses().get(name);
+        for (JavaServiceClass sc : model.getServiceClasses().values()) {
+            if (sc.getServiceName().equals(service.getName().getLocalPart())) {
+                sclz = sc;
+            }
+        }
+        if (sclz == null) {
+            sclz = new JavaServiceClass(model);
+            service.setProperty("JavaServiceClass", sclz);
+            String name = NameUtil.mangleNameToClassName(service.getName().getLocalPart());
+            String namespace = service.getName().getNamespaceURI();
+            String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
+    
+    
+            //customizing
+            JAXWSBinding serviceBinding = null;
+            if (service.getDescription() != null) {
+                serviceBinding = service.getDescription().getExtensor(JAXWSBinding.class);
+            }
+            JAXWSBinding serviceBinding2 = service.getExtensor(JAXWSBinding.class);
+    
+            //TODO : Handle service customized class
+            if (serviceBinding != null) {
+                if (serviceBinding.getPackage() != null) {
+                    jaxwsBinding.setPackage(serviceBinding.getPackage());
+                }
+    
+                if (serviceBinding.isEnableAsyncMapping()) {
+                    jaxwsBinding.setEnableAsyncMapping(true);
+                }
+    
+                if (serviceBinding.isEnableMime()) {
+                    jaxwsBinding.setEnableMime(true);
+                }
+                jaxwsBinding.setEnableWrapperStyle(serviceBinding.isEnableWrapperStyle());
+    
+                if (serviceBinding.getJaxwsClass() != null
+                    && serviceBinding.getJaxwsClass().getClassName() != null) {
+                    name = serviceBinding.getJaxwsClass().getClassName();  
+                    sclz.setClassJavaDoc(serviceBinding.getJaxwsClass().getComments());          
+                }
+                sclz.setPackageJavaDoc(serviceBinding.getPackageJavaDoc());
+            }
+            if (serviceBinding2 != null) {
+                if (serviceBinding2.getPackage() != null) {
+                    jaxwsBinding.setPackage(serviceBinding2.getPackage());
+                }
+    
+                if (serviceBinding2.isEnableAsyncMapping()) {
+                    jaxwsBinding.setEnableAsyncMapping(true);
+                }
+    
+                if (serviceBinding2.isEnableMime()) {
+                    jaxwsBinding.setEnableMime(true);
+                }
+    
+                if (serviceBinding2.isEnableWrapperStyle()) {
+                    jaxwsBinding.setEnableWrapperStyle(true);
+                }
+                if (serviceBinding2.getJaxwsClass() != null
+                    && serviceBinding2.getJaxwsClass().getClassName() != null) {
+                    name = serviceBinding2.getJaxwsClass().getClassName();                
+                    sclz.setClassJavaDoc(serviceBinding2.getJaxwsClass().getComments());
+                }
+                if (!serviceBinding2.getPackageJavaDoc().equals("")) {
+                    sclz.setPackageJavaDoc(serviceBinding2.getPackageJavaDoc());
+                }
+            }
+            
+            sclz.setServiceName(service.getName().getLocalPart());
+            sclz.setNamespace(namespace);
+    
+            if (jaxwsBinding.getPackage() != null) {
+                packageName = jaxwsBinding.getPackage();
+            }
+            sclz.setPackageName(packageName);
+            name = mapName(packageName, name);
+            sclz.setName(name);
+            ClassCollector collector = context.get(ClassCollector.class);
+            String checkName = name;
+            int count = 0;
+            while (collector.containServiceClass(packageName, checkName)) {
+                checkName = name + (++count);
+            }        
+            name = checkName;
+            sclz.setName(name);
+            collector.addServiceClassName(packageName, name, packageName + "." + name);
+    
+            Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
+            sclz.setHandlerChains(handler);
         }
 
-        Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
-        sclz.setHandlerChains(handler);
-
-
         Collection<EndpointInfo> ports = service.getEndpoints();
 
         for (EndpointInfo port : ports) {
@@ -204,7 +232,7 @@
         }
         
         sclz.setClassJavaDoc(jaxwsBinding.getClassJavaDoc());
-        model.addServiceClass(name, sclz);
+        model.addServiceClass(sclz.getName(), sclz);
     }
 
     private JavaPort processPort(JavaModel model, EndpointInfo port) throws ToolException {

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm Wed Nov  4 17:35:43 2009
@@ -49,7 +49,7 @@
 #end
                       endpointInterface = "$intf.PackageName.$intf.Name")
                       
-public class ${intf.Name}Impl implements $intf.Name {
+public class ${implName} implements $intf.Name {
 
     private static final Logger LOG = Logger.getLogger(${intf.Name}Impl.class.getName());
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Wed Nov  4 17:35:43 2009
@@ -24,6 +24,7 @@
 import java.io.FileInputStream;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.jws.WebService;
@@ -177,7 +178,7 @@
 
         File cxf = new File(org, "cxf");
         File[] files = cxf.listFiles();
-        assertEquals(23, files.length);
+        assertEquals(25, files.length);
 
         Class clz = classLoader.loadClass("org.cxf.Greeter");
         assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
@@ -576,7 +577,7 @@
         processor.execute();
 
         File file = new File(output, "org/apache/cxf/w2j/hello_world_soap_http");
-        assertEquals(4, file.list().length);
+        assertEquals(Arrays.asList(file.list()).toString(), 4, file.list().length);
         file = new File(output,
                         "org/apache/cxf/w2j/hello_world_soap_http/DocLitBare_DocLitBarePort_Client.java");
         assertTrue("DocLitBare_DocLitBarePort_Client is not found", file.exists());
@@ -935,7 +936,7 @@
         processor.setContext(env);
         processor.execute();
         File file = new File(output, "org/mypkg");
-        assertEquals(23, file.listFiles().length);
+        assertEquals(25, file.listFiles().length);
         Class<?> clz = classLoader.loadClass("org.mypkg.MyService");
         assertNotNull("Customized service class is not found", clz);
         clz = classLoader.loadClass("org.mypkg.MyGreeter");
@@ -1087,4 +1088,21 @@
         assertTrue(str.contains("@XmlLocation"));
         assertTrue(str.contains("synchronized"));
     }
+    
+    @Test
+    public void testCXF1939() throws Exception {
+        String[] args = new String[] {"-d", output.getCanonicalPath(),
+            "-impl", "-server", "-client", "-autoNameResolution",
+            getLocation("/wsdl2java_wsdl/cxf1939/hello_world.wsdl")};
+        WSDLToJava.main(args);
+                
+        assertNotNull(output);
+        assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/GreeterImpl.java").exists());
+        assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/GreeterImpl1.java").exists());
+        assertTrue(new File(output, 
+                            "org/apache/cxf/w2j/hello_world_soap_http/TestServiceName.java").exists());
+        assertTrue(new File(output, 
+                            "org/apache/cxf/w2j/hello_world_soap_http/TestServiceName1.java").exists());
+    }
+
 }

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Wed Nov  4 17:35:43 2009
@@ -487,7 +487,7 @@
         File types = new File(helloworldsoaphttp, "types");
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
-        assertEquals(7, files.length);
+        assertEquals(9, files.length);
         files = types.listFiles();
         assertEquals(17, files.length);
 
@@ -578,7 +578,7 @@
         File types = new File(helloworldsoaphttp, "types");
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
-        assertEquals(7, files.length);
+        assertEquals(9, files.length);
         files = types.listFiles();
         assertEquals(17, files.length);
 

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java?rev=832808&r1=832807&r2=832808&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java (original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java Wed Nov  4 17:35:43 2009
@@ -71,7 +71,8 @@
         assertNotNull(port);
 
         assertEquals(1, port.getExtensibilityElements().size());
-        assertTrue(port.getExtensibilityElements().get(0) instanceof HTTPAddress);
+        assertTrue(port.getExtensibilityElements().get(0).getClass().getName(), 
+                   port.getExtensibilityElements().get(0) instanceof HTTPAddress);
 
         Binding binding = port.getBinding();
         assertNotNull(binding);



Mime
View raw message