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 2007/03/29 08:25:38 UTC

svn commit: r523578 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java

Author: amilas
Date: Wed Mar 28 23:25:38 2007
New Revision: 523578

URL: http://svn.apache.org/viewvc?view=rev&rev=523578
Log:
set the short type of according to the databindig frame work

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.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=523578&r1=523577&r2=523578
==============================================================================
--- 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 Mar 28 23:25:38 2007
@@ -330,7 +330,7 @@
         if (this.axisService.getEndpoints().size() > 1){
            localPart = makeJavaClassName(axisService.getName() + axisService.getEndpointName());
         } else {
-           localPart = makeJavaClassName(axisService.getName()); 
+           localPart = makeJavaClassName(axisService.getName());
         }
         return packageName + "." + localPart + STUB_SUFFIX;
     }
@@ -1326,7 +1326,7 @@
         if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
                 equals(codeGenConfiguration.getWSDLVersion())) {
             // Woden cannot serialize the WSDL as yet, so lets serialize the axisService for now.
-            
+
             WSDL20Writer wsdl20Writer = new WSDL20Writer(
                     codeGenConfiguration.isFlattenFiles() ?
                             getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) :
@@ -1641,25 +1641,32 @@
     }
 
     /**
-     * Adds the short type name to the given parameter element
-     * if the type has no '.' characters in its name
-     * the type itself is taken as the shorttype
-     *
+     * set the short type as it is in the data binding
      * @param paramElement
+     * @param xmlName
      */
-    protected void addShortType(Element paramElement, String type) {
-        if (type != null && type.indexOf('.') != -1) {
+
+
+    protected void addShortType(Element paramElement, String xmlName) {
+
+        if (xmlName != null) {
+            String javaName;
+            if (JavaUtils.isJavaKeyword(xmlName)) {
+                javaName = JavaUtils.makeNonJavaKeyword(xmlName);
+            } else {
+                javaName = JavaUtils.capitalizeFirstChar(JavaUtils
+                        .xmlNameToJava(xmlName));
+            }
             addAttribute(paramElement.getOwnerDocument(),
                     "shorttype",
-                    type.substring(type.lastIndexOf('.') + 1),
+                    javaName,
                     paramElement);
         } else {
             addAttribute(paramElement.getOwnerDocument(),
                     "shorttype",
-                    type == null ? "" : type,
+                    "",
                     paramElement);
         }
-
     }
 
     /**
@@ -2657,7 +2664,7 @@
                         : typeMapping, paramElement);
 
                 //add the short name
-                addShortType(paramElement, typeMapping);
+                addShortType(paramElement, (msg.getElementQName() == null) ? null: msg.getElementQName().getLocalPart());
 
                 String attribValue = (String) instantiatableMessageClassNames.
                         get(msg.getElementQName());
@@ -2836,7 +2843,7 @@
                 paramElement);
 
         //adds the short type
-        addShortType(paramElement, paramType);
+        addShortType(paramElement, (paramQName == null)? null : paramQName.getLocalPart());
 
         // add an extra attribute to say whether the type mapping is the default
         if (mapper.getDefaultMappingName().equals(paramType)) {
@@ -2904,7 +2911,8 @@
         addAttribute(doc, "type", typeMappingStr, paramElement);
 
         //adds the short type
-        addShortType(paramElement, typeMappingStr);
+        addShortType(paramElement,
+                (outputMessage.getElementQName() == null)? null : outputMessage.getElementQName().getLocalPart());
 
         // add an extra attribute to say whether the type mapping is the default
         if (mapper.getDefaultMappingName().equals(typeMappingStr)) {



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