You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2008/12/17 16:26:18 UTC

svn commit: r727413 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl: ./ codegen/ codegen/emitter/ i18n/ template/java/ util/

Author: amilas
Date: Wed Dec 17 07:26:18 2008
New Revision: 727413

URL: http://svn.apache.org/viewvc?rev=727413&view=rev
Log:
Added an new option to make generated method names start with lower case

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
    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/i18n/resource.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Wed Dec 17 07:26:18 2008
@@ -42,7 +42,7 @@
 
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg"));
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg1"));
-        for (int i = 2; i <= 48; i++) {
+        for (int i = 2; i <= 49; i++) {
             System.out.println("  " + CodegenMessages.getMessage("wsdl2code.arg" + i));
         }
     }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Wed Dec 17 07:26:18 2008
@@ -631,4 +631,14 @@
         this.exceptionBaseClassName = exceptionBaseClassName;
     }
 
+    private boolean isLowerCaseMethodName;
+
+    public boolean isLowerCaseMethodName() {
+        return isLowerCaseMethodName;
+    }
+
+    public void setLowerCaseMethodName(boolean lowerCaseMethodName) {
+        isLowerCaseMethodName = lowerCaseMethodName;
+    }
+
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Wed Dec 17 07:26:18 2008
@@ -309,6 +309,9 @@
                                       WSDL2JavaConstants.OVERRIDE_ABSOLUTE_ADDRESS_OPTION_LONG,
                                       optionMap) != null);
 
+        config.setLowerCaseMethodName(loadOption(WSDL2JavaConstants.LOWER_CASE_METHOD_NAME,
+                                      WSDL2JavaConstants.LOWER_CASE_METHOD_NAME_LONG, optionMap) != null);
+
         // loop through the map and find parameters having the extra prefix.
         //put them in the property map
         Iterator keyIterator = optionMap.keySet().iterator();

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?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- 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 Wed Dec 17 07:26:18 2008
@@ -1562,6 +1562,10 @@
         String localPart = makeJavaClassName(axisService.getName());
 
         addAttribute(doc, "name", localPart + mepToSuffixMap.get(mep), rootElement);
+
+        if (this.codeGenConfiguration.isLowerCaseMethodName()){
+           addAttribute(doc, "isLowerCaseMethodName", "true", rootElement); 
+        }
         //add backwordcompatibility attribute
         addAttribute(doc, "isbackcompatible",
                 String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
@@ -2230,8 +2234,11 @@
         List soapHeaderOutputParameterList = new ArrayList();
         methodElement = doc.createElement("method");
         String localPart = axisOperation.getName().getLocalPart();
-
-        addAttribute(doc, "name", JavaUtils.xmlNameToJavaIdentifier(localPart), methodElement);
+        if (this.codeGenConfiguration.isLowerCaseMethodName()){
+            addAttribute(doc, "name", JavaUtils.xmlNameToJavaIdentifier(localPart), methodElement);
+        } else {
+            addAttribute(doc, "name", localPart, methodElement);
+        }
         addAttribute(doc, "originalName", localPart, methodElement);
         addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement);
         addAttribute(doc, "style", (String) getBindingPropertyFromOperation(

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Wed Dec 17 07:26:18 2008
@@ -83,6 +83,7 @@
 wsdl2code.arg46=                           \t\t\t   -EbindingFileName <path>               (for jaxbri) - specify the file path for the episode file
 wsdl2code.arg47=  -oaa <override-absolute-address>  -change the absolute http addresses to local file addresses generated by wsdl2java tool
 wsdl2code.arg48=  -ebc <exception-base-class>  -generated Exceptions are inherited from this exception rather than the java.lang.Exception class
+wsdl2code.arg49=  -lcmn <lower-case-method-name>  -normally generated method names for operation is same as operation name. This option make first letter lower case 
 
 ################## prop file loader #################################
 propfileload.frameworkMismatch=Number of frameworks and extension names do not match!

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?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- 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 Wed Dec 17 07:26:18 2008
@@ -67,7 +67,7 @@
         }
 
         java.lang.String methodName;
-        if((op.getName() != null) &amp;&amp; ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(op.getName().getLocalPart())) != null)){
+        if((op.getName() != null) &amp;&amp; ((methodName = <xsl:if test="@isLowerCaseMethodName">org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(</xsl:if>op.getName().getLocalPart()<xsl:if test="@isLowerCaseMethodName">)</xsl:if>) != null)){
 
         <xsl:for-each select="method">
             <xsl:if test="position() > 1">} else </xsl:if>
@@ -358,7 +358,7 @@
         }
 
         java.lang.String methodName;
-        if((op.getName() != null) &amp;&amp; ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(op.getName().getLocalPart())) != null)){
+        if((op.getName() != null) &amp;&amp; ((methodName = <xsl:if test="@isLowerCaseMethodName">org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(</xsl:if>op.getName().getLocalPart()<xsl:if test="@isLowerCaseMethodName">)</xsl:if>) != null)){
 
         <xsl:for-each select="method">
 
@@ -496,7 +496,7 @@
         }
 
         java.lang.String methodName;
-        if((op.getName() != null) &amp;&amp; ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(op.getName().getLocalPart())) != null)){
+        if((op.getName() != null) &amp;&amp; ((methodName = <xsl:if test="@isLowerCaseMethodName">org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(</xsl:if>op.getName().getLocalPart()<xsl:if test="@isLowerCaseMethodName">)</xsl:if>) != null)){
 
         <xsl:for-each select="method">
             <xsl:if test="position() > 1">} else </xsl:if>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=727413&r1=727412&r2=727413&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Wed Dec 17 07:26:18 2008
@@ -102,6 +102,8 @@
                     WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION_LONG.equalsIgnoreCase(optionType) ||
                     WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION.equalsIgnoreCase(optionType) ||
                     WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                    WSDL2JavaConstants.LOWER_CASE_METHOD_NAME.equalsIgnoreCase(optionType) ||
+                    WSDL2JavaConstants.LOWER_CASE_METHOD_NAME_LONG.equalsIgnoreCase(optionType) ||
                     XMLBeansExtension.XSDCONFIG_OPTION.equalsIgnoreCase(optionType) ||
                     XMLBeansExtension.XSDCONFIG_OPTION_LONG.equalsIgnoreCase(optionType)
             );