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 na...@apache.org on 2010/01/08 08:44:49 UTC

svn commit: r897124 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl: codegen/emitter/CEmitter.java template/c/ServiceSkeleton.xsl template/c/SkelHeaderTemplate.xsl template/c/SkelSourceTemplate.xsl

Author: nandika
Date: Fri Jan  8 07:44:48 2010
New Revision: 897124

URL: http://svn.apache.org/viewvc?rev=897124&view=rev
Log:
msg_ctx added as a parameter to generated service methods

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java?rev=897124&r1=897123&r2=897124&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java Fri Jan  8 07:44:48 2010
@@ -69,6 +69,7 @@
 
     protected static final String C_OUR_TYPE_PREFIX = "axis2_";
     protected static final String C_OUR_TYPE_SUFFIX = "_t*";
+    protected static final String C_GEN_NO_MESSAGE_CONTEXT = "nmc";
 
 
     public CEmitter() {
@@ -181,6 +182,22 @@
 
         writeFile(interfaceImplModel, writerCStub);
     }
+
+    private void addGenerateMessageContextAttr(Document model)
+    {
+        Element rootEle = model.getDocumentElement();
+        Map<Object,Object> propertyMap = this.codeGenConfiguration.getProperties();
+        boolean generateMsgCtx = true;
+        if(propertyMap.containsKey(C_GEN_NO_MESSAGE_CONTEXT))
+        {
+             if(Boolean.valueOf(propertyMap.get(C_GEN_NO_MESSAGE_CONTEXT).toString()).booleanValue())
+             {
+                generateMsgCtx = false;
+             }
+        }
+        addAttribute(model, "generateMsgCtx",generateMsgCtx ? "1" : "0", rootEle);
+
+    }
     /**
      * Writes the Skel.
      *
@@ -188,9 +205,8 @@
      */
     protected void writeCSkel() throws Exception {
 
-        Document skeletonModel =
-                createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface());
-
+        Document skeletonModel =  createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface());
+        addGenerateMessageContextAttr(skeletonModel);
 
         CSkelHeaderWriter skeletonWriter = new CSkelHeaderWriter(
                 getOutputDirectory(this.codeGenConfiguration.getOutputLocation(),
@@ -213,15 +229,12 @@
     protected void writeCServiceSkeleton() throws Exception {
 
         Document skeletonModel = createDOMDocumentForServiceSkeletonXML();
+        addGenerateMessageContextAttr(skeletonModel);
         CSvcSkeletonWriter writer =
                 new CSvcSkeletonWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(),
                                                           codeGenConfiguration.getSourceLocation()),
                                        codeGenConfiguration.getOutputLanguage());
-
         writeFile(skeletonModel, writer);
-
-        //writeVCProjectFile();
-
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl?rev=897124&r1=897123&r2=897124&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl Fri Jan  8 07:44:48 2010
@@ -30,6 +30,7 @@
         <xsl:variable name="svcname"><xsl:value-of select="@svcname"/></xsl:variable>
         <xsl:variable name="servicename"><xsl:value-of select="@svcname"/></xsl:variable>
         <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+        <xsl:variable name="generateMsgCtx"><xsl:value-of select="@generateMsgCtx"/></xsl:variable>
 
         /**
          * <xsl:value-of select="@name"/>.c
@@ -558,6 +559,7 @@
                         <xsl:variable name="outputparam_types" select="output/param/param/@type"/>
                         {
                            <xsl:value-of select="$outputparam_types"/> ret_unwrapped = <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/><xsl:text>(env</xsl:text>
+                                                <xsl:if test="$generateMsgCtx='1'"><xsl:text>, msg_ctx</xsl:text></xsl:if>
                                                 <xsl:value-of select="$inputparam_values"/><xsl:for-each select="output/param[@location='soap_header']">,
                                                     <xsl:text>&amp;_</xsl:text><xsl:value-of select="@name"/><xsl:value-of select="$position"/>
                                                 </xsl:for-each><xsl:if test="count(fault/*)">,
@@ -591,6 +593,7 @@
                                                 </xsl:for-each>
                         </xsl:variable>
                         ret_val<xsl:value-of select="$position"/> =  <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/><xsl:text>(env</xsl:text>
+                                                <xsl:if test="$generateMsgCtx='1'"><xsl:text>, msg_ctx</xsl:text></xsl:if>
                                                 <xsl:value-of select="$inputparam_values"/><xsl:for-each select="output/param[@location='soap_header']">,
                                                     <xsl:text>&amp;_</xsl:text><xsl:value-of select="@name"/><xsl:value-of select="$position"/>
                                                 </xsl:for-each><xsl:if test="count(fault/*)">,

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl?rev=897124&r1=897123&r2=897124&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl Fri Jan  8 07:44:48 2010
@@ -23,6 +23,7 @@
     <xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
     <xsl:variable name="caps_svc_name"><xsl:value-of select="@caps-name"/></xsl:variable>
     <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+    <xsl:variable name="generateMsgCtx"><xsl:value-of select="@generateMsgCtx"/></xsl:variable>
     <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
 
     /**
@@ -96,7 +97,9 @@
         /**
          * auto generated function declaration
          * for "<xsl:value-of select="@qname"/>" operation.
-         * @param env environment ( mandatory)<xsl:if test="not($isUnwrapParameters)"><xsl:for-each select="input/param[@type!='']"><xsl:text>
+         * @param env environment ( mandatory)<xsl:if test="$generateMsgCtx='1'">
+         <xsl:text>* @param MessageContext the outmessage context</xsl:text></xsl:if>
+         <xsl:if test="not($isUnwrapParameters)"><xsl:for-each select="input/param[@type!='']"><xsl:text>
          </xsl:text>* @param _<xsl:value-of select="@name"/> of the <xsl:value-of select="@type"/></xsl:for-each></xsl:if>
          <xsl:if test="$isUnwrapParameters"><xsl:for-each select="input/param/param[@type!='']"><xsl:text>
          </xsl:text>* @param _<xsl:value-of select="@name"/> of the <xsl:value-of select="@type"/></xsl:for-each></xsl:if>
@@ -127,6 +130,7 @@
         </xsl:choose>
         <xsl:text> </xsl:text>
         <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/><xsl:text>(const axutil_env_t *env</xsl:text>
+                                          <xsl:if test="$generateMsgCtx='1'"><xsl:text>,axis2_msg_ctx_t *msg_ctx</xsl:text></xsl:if>
                                           <xsl:value-of select="$inputparams"/><xsl:for-each select="output/param[@location='soap_header']">,
                                             <xsl:variable name="outputtype"><xsl:value-of select="@type"/><xsl:if test="@ours">*</xsl:if></xsl:variable>
                                             <xsl:value-of select="$outputtype"/><xsl:text> dp_</xsl:text><xsl:value-of select="@name"/><xsl:text> /* output header double ptr*/</xsl:text>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl?rev=897124&r1=897123&r2=897124&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl Fri Jan  8 07:44:48 2010
@@ -23,6 +23,7 @@
     <xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
     <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
     <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+    <xsl:variable name="generateMsgCtx"><xsl:value-of select="@generateMsgCtx"/></xsl:variable>
 
     /**
      * <xsl:value-of select="@name"/>.c
@@ -53,7 +54,8 @@
         /**
          * auto generated function definition signature
          * for "<xsl:value-of select="@qname"/>" operation.
-         * @param env environment ( mandatory)<xsl:if test="not($isUnwrapParameters)"><xsl:for-each select="input/param[@type!='']"><xsl:text>
+         * @param env environment ( mandatory)<xsl:if test="$generateMsgCtx='1'">
+         <xsl:text>* @param MessageContext the outmessage context</xsl:text></xsl:if><xsl:if test="not($isUnwrapParameters)"><xsl:for-each select="input/param[@type!='']"><xsl:text>
          </xsl:text>* @param _<xsl:value-of select="@name"/> of the <xsl:value-of select="@type"/></xsl:for-each></xsl:if>
          <xsl:if test="$isUnwrapParameters"><xsl:for-each select="input/param/param[@type!='']"><xsl:text>
          </xsl:text>* @param _<xsl:value-of select="@name"/> of the <xsl:value-of select="@type"/></xsl:for-each></xsl:if>
@@ -83,7 +85,8 @@
         <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
         </xsl:choose>
         <xsl:text> </xsl:text>
-        <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/><xsl:text>(const axutil_env_t *env</xsl:text>
+        <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/><xsl:text>(const axutil_env_t *env </xsl:text>
+                                          <xsl:if test="$generateMsgCtx='1'"><xsl:text>, axis2_msg_ctx_t *msg_ctx</xsl:text></xsl:if>
                                           <xsl:value-of select="$inputparams"/><xsl:for-each select="output/param[@location='soap_header']">,
                                             <xsl:variable name="outputtype"><xsl:value-of select="@type"/><xsl:if test="@ours">*</xsl:if></xsl:variable>
                                             <xsl:value-of select="$outputtype"/><xsl:text> dp_</xsl:text><xsl:value-of select="@name"/><xsl:text> /* output header double ptr*/</xsl:text>