Author: amilas Date: Sun Feb 6 08:29:39 2011 New Revision: 1067612 URL: http://svn.apache.org/viewvc?rev=1067612&view=rev Log: apply the patch for AXIS2-4921
Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=1067612&r1=1067611&r2=1067612&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original) +++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Sun Feb 6 08:29:39 2011 @@ -3009,6 +3009,7 @@ public class AxisServiceBasedMultiLangua // This is the wrapped component - add the type mapping Element mainParameter = generateParamComponent(doc, + inputMessage.getDocumentation(), this.mapper.getParameterName( inputMessage.getElementQName()), this.mapper.getTypeMappingName( @@ -3052,9 +3053,11 @@ public class AxisServiceBasedMultiLangua wrapped_jaxws = true; //populate the parts list - this list is needed to generate multiple //parameters in the signatures + //todo documentation is kept empty(null) in this scenario for (int i = 0; i < partsList.size(); i++) { QName qName = (QName) partsList.get(i); mainParameter.appendChild(generateParamComponent(doc, + null, this.mapper.getParameterName( qName), this.mapper.getTypeMappingName( @@ -3091,11 +3094,12 @@ public class AxisServiceBasedMultiLangua * @return DOM Element */ protected Element generateParamComponent(Document doc, + String comment, String paramName, String paramType, QName operationName, QName paramQName) { - return generateParamComponent(doc, paramName, paramType, operationName, paramQName, null, + return generateParamComponent(doc, comment, paramName, paramType, operationName, paramQName, null, false, false); } @@ -3108,10 +3112,11 @@ public class AxisServiceBasedMultiLangua * @return DOM Element */ protected Element generateParamComponent(Document doc, + String comment, String paramName, String paramType, QName paramQName) { - return generateParamComponent(doc, paramName, paramType, null, paramQName, null, false, + return generateParamComponent(doc,comment, paramName, paramType, null, paramQName, null, false, false); } @@ -3141,6 +3146,7 @@ public class AxisServiceBasedMultiLangua * @param paramName */ protected Element generateParamComponent(Document doc, + String comment, String paramName, String paramType, QName opName, @@ -3152,6 +3158,10 @@ public class AxisServiceBasedMultiLangua addAttribute(doc, "name", paramName, paramElement); + addAttribute(doc, "comment", + (comment == null) ? "" : comment, + paramElement); + if (codeGenConfiguration.getOutputLanguage().equals("jax-ws") && useHolderClass_jaxws) { Class primitive = JavaUtils.getWrapperClass(paramType); if(primitive != null){ @@ -3225,12 +3235,15 @@ public class AxisServiceBasedMultiLangua } String parameterName; String typeMappingStr; + String comment = null; parameterName = this.mapper.getParameterName(outputMessage.getElementQName()); + comment = outputMessage.getDocumentation(); String typeMapping = this.mapper.getTypeMappingName(outputMessage.getElementQName()); typeMappingStr = (typeMapping == null) ? "" : typeMapping; addAttribute(doc, "name", parameterName, paramElement); + addAttribute(doc, "comment", (comment == null) ? "" : comment, paramElement); addAttribute(doc, "type", typeMappingStr, paramElement); //adds the short type @@ -3286,11 +3299,13 @@ public class AxisServiceBasedMultiLangua // in out put params we only intersted if there is only one parameter // otherwise we can not unwrap it. // this logic handles at the template level + //todo comment is empty(null) in this scenario QName qName; for (Iterator iter = partsList.iterator(); iter.hasNext();) { qName = (QName) iter.next(); paramElement. appendChild(generateParamComponent(doc, + null, this.mapper.getParameterName(qName), this.mapper.getTypeMappingName(qName), operation.getName(), Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl?rev=1067612&r1=1067611&r2=1067612&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl (original) +++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl Sun Feb 6 08:29:39 2011 @@ -54,10 +54,10 @@ <xsl:variable name="inputComplexType" select="input/param[@location='body' and @type!='']/@complextype"/> <xsl:choose> <xsl:when test="string-length(normalize-space($inputComplexType)) > 0"> - * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/> + * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/> : <xsl:value-of select="input/param[@location='body' and @type!='']/@comment"/> </xsl:when> <xsl:otherwise> - * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/> + * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/> : <xsl:value-of select="input/param[@location='body' and @type!='']/@comment"/> </xsl:otherwise> </xsl:choose> </xsl:when> @@ -73,19 +73,20 @@ <xsl:choose> <xsl:when test="$isUnwrapParameters"> <xsl:for-each select="input/param[@location='body' and @type!='']/param"> - * @param<xsl:text> </xsl:text><xsl:value-of select="@name"/> + * @param<xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text> </xsl:text><xsl:value-of select="@comment"/> </xsl:for-each> </xsl:when> <xsl:otherwise> - * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/> + * @param<xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@comment"/> </xsl:otherwise> </xsl:choose> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> + * @return <xsl:value-of select="output/param/@name"/><xsl:text> </xsl:text><xsl:value-of select="output/param/@comment"/> <xsl:for-each select="fault/param[@type!='']"> - * @throws <xsl:value-of select="@name"/> : <xsl:value-of select="@comment"/> + * @throws <xsl:value-of select="@name"/><xsl:text> </xsl:text><xsl:value-of select="@comment"/> </xsl:for-each> */ <xsl:choose> Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1067612&r1=1067611&r2=1067612&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Sun Feb 6 08:29:39 2011 @@ -596,6 +596,12 @@ public class WSDL11ToAxisServiceBuilder axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, portTypeWSDL); addDocumentation(axisOperation, wsdl4jOperation.getDocumentationElement()); + if (wsdl4jOperation.getInput() != null) { + addMessageDocumentation(axisOperation, wsdl4jOperation.getInput().getDocumentationElement(), WSDLConstants.MESSAGE_LABEL_IN_VALUE); + } + if (wsdl4jOperation.getOutput() != null) { + addMessageDocumentation(axisOperation, wsdl4jOperation.getOutput().getDocumentationElement(), WSDLConstants.MESSAGE_LABEL_OUT_VALUE); + } axisOperation.setParent(axisService); axisService.addChild(axisOperation); operationNames.add(axisOperation.getName()); @@ -608,6 +614,27 @@ public class WSDL11ToAxisServiceBuilder } + /** + * This method is used for adding documentation for the message types of the service operations + * eg: input message + * output message + * fault messages + * + * @param axisOperation + * @param documentationElement + * @param messageLabel + */ + private void addMessageDocumentation(AxisOperation axisOperation, Element documentationElement, String messageLabel) { + if ((documentationElement != null) && (documentationElement.getFirstChild() != null)) { + Node firstChild = documentationElement.getFirstChild(); + String documentation = DOM2Writer.nodeToString(firstChild); + + if (!"".equals(documentation)) { + (axisOperation.getMessage(messageLabel)).setDocumentation(documentation); + } + } + } + private void populateBinding(AxisBinding axisBinding, Binding wsdl4jBinding, Definition bindingWSDL,