cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1550318 - in /cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws: generators/ImplGenerator.java generators/ServerGenerator.java template/impl.vm
Date Wed, 11 Dec 2013 23:45:48 GMT
Author: dkulp
Date: Wed Dec 11 23:45:47 2013
New Revision: 1550318

URL: http://svn.apache.org/r1550318
Log:
Merged revisions 1550274 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1550274 | dkulp | 2013-12-11 16:34:42 -0500 (Wed, 11 Dec 2013) | 2 lines

  [CXF-5455] Make sure we use the correct service/port impl when generating the server

........

Modified:
    cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
    cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
    cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm

Modified: cxf/branches/2.7.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.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java?rev=1550318&r1=1550317&r2=1550318&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
(original)
+++ cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
Wed Dec 11 23:45:47 2013
@@ -19,10 +19,12 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
 
+import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -105,13 +107,31 @@ public class ImplGenerator extends Abstr
         setAttributes("port", port);
         
         setCommonAttributes();
-        
-        String name = intf.getName() + "Impl";
-        name = mapClassName(intf.getPackageName(), name, penv);
+
+        if (StringUtils.isEmpty(port)) {
+            port = intf.getName();
+        }
+        String name = getImplName(port, service == null ? "" : service.getName(), intf, penv);
+
         setAttributes("implName", name);
-        penv.put(ToolConstants.CFG_IMPL_CLASS, name);
+        
         doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), name));
     }
+    
+    private String getImplName(String port, String service, JavaInterface intf, ToolContext
penv) {
+        Map<String, String> nm = CastUtils.cast((Map<?, ?>)penv.get(ToolConstants.CFG_IMPL_CLASS));
+        if (nm == null) {
+            nm = new HashMap<String, String>();
+            penv.put(ToolConstants.CFG_IMPL_CLASS, nm);
+        }
+        String name = nm.get(service + "/" + port);
+        if (name == null) {
+            name = intf.getName() + "Impl";
+            name = mapClassName(intf.getPackageName(), name, penv);
+            nm.put(service + "/" + port, name);
+        }
+        return name;
+    }
     private String mapClassName(String packageName, String name, ToolContext context) {
         ClassCollector collector = context.get(ClassCollector.class);
         int count = 0;

Modified: cxf/branches/2.7.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.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java?rev=1550318&r1=1550317&r2=1550318&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
(original)
+++ cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
Wed Dec 11 23:45:47 2013
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
 
+import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -98,12 +99,10 @@ public class ServerGenerator extends Abs
                     clearAttributes();
                     setAttributes("serverClassName", serverClassName);
                     setAttributes("intf", intf);
-                    if (penv.optionSet(ToolConstants.CFG_IMPL_CLASS)) {
-                        setAttributes("impl", penv.get(ToolConstants.CFG_IMPL_CLASS));
-                        penv.remove(ToolConstants.CFG_IMPL_CLASS);
-                    } else {
-                        setAttributes("impl", intf.getName() + "Impl");
-                    }
+                    
+                    String name = getImplName(jp.getPortName(), js.getServiceName(), intf,
penv);
+                    setAttributes("impl", name);
+                    
                     setAttributes("address", address);
                     setCommonAttributes();
     
@@ -112,6 +111,20 @@ public class ServerGenerator extends Abs
             }
         }
     }
+    private String getImplName(String port, String service, JavaInterface intf, ToolContext
penv) {
+        Map<String, String> nm = CastUtils.cast((Map<?, ?>)penv.get(ToolConstants.CFG_IMPL_CLASS));
+        if (nm == null) {
+            nm = new HashMap<String, String>();
+            penv.put(ToolConstants.CFG_IMPL_CLASS, nm);
+        }
+        String name = nm.get(service + "/" + port);
+        if (name == null) {
+            name = intf.getName() + "Impl";
+            name = mapClassName(intf.getPackageName(), name, penv);
+            nm.put(service + "/" + port, name);
+        }
+        return name;
+    }
     
     private String mapClassName(String packageName, String name, ToolContext context) {
         ClassCollector collector = context.get(ClassCollector.class);

Modified: cxf/branches/2.7.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.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm?rev=1550318&r1=1550317&r2=1550318&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
(original)
+++ cxf/branches/2.7.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
Wed Dec 11 23:45:47 2013
@@ -60,7 +60,7 @@ public class ${implName} implements $int
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
-    private static final Logger LOG = Logger.getLogger(${intf.Name}Impl.class.getName());
+    private static final Logger LOG = Logger.getLogger(${implName}.class.getName());
 
 #foreach ($method in $intf.Methods)
     /* (non-Javadoc)



Mime
View raw message