axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r478028 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/databinding/ codegen/src/org/apache/axis2/wsdl/template/java/ kernel/src/org/apache/axis2/util/
Date Wed, 22 Nov 2006 04:29:35 GMT
Author: amilas
Date: Tue Nov 21 20:29:34 2006
New Revision: 478028

URL: http://svn.apache.org/viewvc?view=rev&rev=478028
Log:
converted the operation names to valild java identifier names before generating the method
names of the code. Used 
the javaUtils class for conversion.

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=478028&r1=478027&r2=478028
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Tue Nov 21 20:29:34 2006
@@ -1697,7 +1697,7 @@
         methodElement = doc.createElement("method");
         String localPart = axisOperation.getName().getLocalPart();
 
-        addAttribute(doc, "name", localPart, methodElement);
+        addAttribute(doc, "name", JavaUtils.xmlNameToJava(localPart), methodElement);
         addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement);
         addAttribute(doc, "style", axisOperation.getStyle(), methodElement);
         addAttribute(doc, "dbsupportname", portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java?view=diff&rev=478028&r1=478027&r2=478028
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
Tue Nov 21 20:29:34 2006
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
@@ -96,11 +97,8 @@
             counter = 0;
         }
         if ((qname != null) && (qname.getLocalPart().length() != 0)) {
-            String paramName = qname.getLocalPart();
-            //make the first letter lower case - java coding convention
-            if (paramName.length() > 1){
-                paramName = paramName.substring(0,1).toLowerCase() + paramName.substring(1);
-            }
+            String paramName = JavaUtils.xmlNameToJavaIdentifier(qname.getLocalPart());
+
             if (parameterNameList.contains(paramName)){
                 paramName = paramName + counter++;
             }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?view=diff&rev=478028&r1=478027&r2=478028
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
Tue Nov 21 20:29:34 2006
@@ -176,6 +176,7 @@
           
             <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"/></xsl:variable>
             <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param/@complextype"/></xsl:variable>
+            <xsl:variable name="outputopname"><xsl:value-of select="output/param/@opname"/></xsl:variable>
             <xsl:variable name="style"><xsl:value-of select="@style"></xsl:value-of></xsl:variable>
             <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
             <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
@@ -382,7 +383,7 @@
                            _messageContext.getTransportOut().getSender().cleanup(_messageContext);
                           <xsl:choose>
                               <xsl:when test="($isbackcompatible='true') and (string-length(normalize-space($outputcomplextype))
> 0)">
-                                   return get<xsl:value-of select="@name"/>((<xsl:value-of
select="$outputtype"/>)object);
+                                   return get<xsl:value-of select="$outputopname"/>((<xsl:value-of
select="$outputtype"/>)object);
                               </xsl:when>
                               <xsl:otherwise>
                                    return (<xsl:value-of select="$outputtype"/>)object;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?view=diff&rev=478028&r1=478027&r2=478028
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
Tue Nov 21 20:29:34 2006
@@ -48,7 +48,7 @@
         }
 
         java.lang.String methodName;
-        if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
+        if(op.getName() != null &amp; (methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart()))
!= null){
 
         <xsl:for-each select="method">
 
@@ -284,7 +284,7 @@
         }
 
         java.lang.String methodName;
-        if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
+        if(op.getName() != null &amp; (methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart()))
!= null){
 
         <xsl:for-each select="method">
 
@@ -405,7 +405,7 @@
         }
 
         java.lang.String methodName;
-        if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
+        if(op.getName() != null &amp; (methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart()))
!= null){
 
         <xsl:for-each select="method">
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?view=diff&rev=478028&r1=478027&r2=478028
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java Tue
Nov 21 20:29:34 2006
@@ -182,6 +182,22 @@
     }    // capitalizeFirstChar
 
     /**
+     * converts an xml name to a java identifier
+     * @param name
+     * @return java identifier
+     */
+
+    public static String xmlNameToJavaIdentifier(String name){
+        String javaName = xmlNameToJava(name);
+        // convert the first letter to lowercase
+        if ((javaName != null) && (javaName.length() > 0)){
+            javaName = javaName.substring(0,1).toLowerCase() + javaName.substring(1);
+        }
+
+        return javaName;
+    }
+
+    /**
      * Tests the String 'value':
      *   return 'false' if its 'false', '0', or 'no' - else 'true'
      * 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message