You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/01/20 10:23:37 UTC

svn commit: r370765 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/schema/template/ codegen/src/org/apache/axis2/wsdl/codegen/extension/ codegen/src/org/apache/axis2/wsdl/template/java/ core/src/org/apache/axis2/client/ integr...

Author: ajith
Date: Fri Jan 20 01:23:11 2006
New Revision: 370765

URL: http://svn.apache.org/viewcvs?rev=370765&view=rev
Log:
Changed the stubs to make the externally visible Stub API more streamlined.
1. Changed the Stub to only have public getters and setters for the ServiceClient. All uses of options now need to call _getServiceClient().getOptions.

Changed the ADBpullparser to fix issue https://issues.apache.org/jira/browse/AXIS2-405

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
    webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeTest.java
    webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeTest.java
    webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Fri Jan 20 01:23:11 2006
@@ -257,7 +257,7 @@
                             }
                             //step one event
                             event = reader.next();
-                            if (reader.isEndElement()){
+                            if (reader.isEndElement() &amp;&amp;  !"<xsl:value-of select="$propertyName"/>".equals(reader.getLocalName())){
                             //two continuous end elements means we are exiting the xml structure
                             <xsl:value-of select="$loopBoolName"/> = true;
                             }else if (reader.isStartElement()){
@@ -290,7 +290,7 @@
                             }
                             //step one event
                             event = reader.next();
-                            if (reader.isEndElement()){
+                            if (reader.isEndElement() &amp;&amp;  !"<xsl:value-of select="$propertyName"/>".equals(reader.getLocalName())){
                             //two continuous end elements means we are exiting the xml structure
                             <xsl:value-of select="$loopBoolName"/> = true;
                             }else if (reader.isStartElement()){

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java Fri Jan 20 01:23:11 2006
@@ -96,7 +96,7 @@
             setDefaultOptions(options);
 
             //set the user parameters. the user parameters get the preference over
-            //the default once. But the user better know what he's doing if he
+            //the default ones. But the user better know what he's doing if he
             //used module specific parameters
             setUserparameters(options);
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- 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 Fri Jan 20 01:23:11 2006
@@ -63,7 +63,7 @@
                 targetEndpoint));
         <xsl:if test="$soapVersion='1.2'">
             //Set the soap version
-            _options.setSoapVersionURI(org.apache.axis2.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            _serviceClient.getOptions().setSoapVersionURI(org.apache.axis2.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
         </xsl:if>
 
     }
@@ -136,14 +136,14 @@
                             <xsl:choose>
                                 <xsl:when test="$style='rpc'">
                                     // Style is RPC
-                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
                                     new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
                                     new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
                                 </xsl:when>
                                 <xsl:when test="$style='doc'">
                                     //Style is Doc.
                                     <xsl:for-each select="input/param[@location='body']">
-                                        env = toEnvelope(getFactory(_options.getSoapVersionURI()), <xsl:value-of select="@name"/>);
+                                        env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), <xsl:value-of select="@name"/>);
                                     </xsl:for-each>
                                     <xsl:for-each select="input/param[@location='header']">
                                         // add the children only if the parameter is not null
@@ -163,7 +163,7 @@
                             <xsl:choose>
                                 <xsl:when test="$style='rpc'">
                                     //Style is RPC. No input parameters
-                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
                                 </xsl:when>
                                 <xsl:when test="$style='doc'">
                                     //Style is Doc. No input parameters
@@ -183,9 +183,6 @@
 
         // add the message contxt to the operation client
         _operationClient.addMessageContext(_messageContext);
-        //set the options hierarchy
-        _options.setParent (_operationClient.getOptions());
-        _operationClient.setOptions (_options);
 
         //execute the operation client
         _operationClient.execute(true);
@@ -237,14 +234,14 @@
                             <xsl:choose>
                                 <xsl:when test="$style='rpc'">
                                     // Style is RPC
-                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
                                     new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
                                     new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
                                 </xsl:when>
                                 <xsl:when test="$style='doc'">
                                     //Style is Doc.
                                     <xsl:for-each select="input/param[@location='body']">
-                                        env = toEnvelope(getFactory(_options.getSoapVersionURI()), <xsl:value-of select="@name"/>);
+                                        env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), <xsl:value-of select="@name"/>);
                                     </xsl:for-each>
                                     <xsl:for-each select="input/param[@location='header']">
                                          // add the headers only if they are not null
@@ -264,7 +261,7 @@
                             <xsl:choose>
                                 <xsl:when test="$style='rpc'">
                                     //Style is RPC. No input parameters
-                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
                                 </xsl:when>
                                 <xsl:when test="$style='doc'">
                                     //Style is Doc. No input parameters
@@ -284,9 +281,7 @@
 
         // add the message contxt to the operation client
         _operationClient.addMessageContext(_messageContext);
-        //set the options hierarchy
-        _options.setParent (_operationClient.getOptions());
-        _operationClient.setOptions (_options);
+
 
                     <xsl:choose>
                         <xsl:when test="$outputtype=''">
@@ -327,7 +322,7 @@
                 _operationClient.getOptions().setSoapAction("<xsl:value-of select="$soapAction"/>");
                 _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
 
-                <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+                <xsl:for-each select="input/param[@Action!='']">_operationClient.getOptions().setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
                 org.apache.axis2.soap.SOAPEnvelope env;
 
                 <xsl:choose>
@@ -338,14 +333,14 @@
                             <xsl:when test="$style='rpc'">
                                 // Style is RPC
                                 env = createEnvelope();
-                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
                                 new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
                                 new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
                             </xsl:when>
                             <xsl:when test="$style='doc'">
                                 <!-- for the doc lit case there can be only one element. So take the first element -->
                                 //Style is Doc.
-                                env = toEnvelope(getFactory(_options.getSoapVersionURI()), <xsl:value-of select="input/param[1]/@name"/>);
+                                env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), <xsl:value-of select="input/param[1]/@name"/>);
                             </xsl:when>
                             <xsl:otherwise>
                                 //Unknown style!! No code is generated
@@ -358,7 +353,7 @@
                         <xsl:choose>
                             <xsl:when test="$style='rpc'">
                                 //Style is RPC. No input parameters
-                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_operationClient.getOptions().getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
                             </xsl:when>
                             <xsl:when test="$style='doc'">
                                 //Style is Doc. No input parameters
@@ -378,9 +373,6 @@
 
             // add the message contxt to the operation client
             _operationClient.addMessageContext(_messageContext);
-            //set the options hierarchy
-            _options.setParent (_operationClient.getOptions());
-            _operationClient.setOptions (_options);
 
              _operationClient.execute(true);
              return;

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java Fri Jan 20 01:23:11 2006
@@ -17,7 +17,6 @@
 
 package org.apache.axis2.client;
 
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
@@ -31,7 +30,6 @@
 import org.apache.axis2.soap.SOAPProcessingException;
 import org.apache.wsdl.WSDLService;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 
@@ -39,32 +37,21 @@
     protected static AxisService _service;
     protected ArrayList modules = new ArrayList();
 
-    /**
-     * If _maintainSession is set to true, all the calls can use the same
-     * ServiceContext. The user can share information through this
-     * ServiceContext across operations.
-     */
-    protected Options _options = new Options();
-    protected ServiceClient _serviceClient;
 
-    public Options _getOptions() {
-        return _options;
-    }
+    protected ServiceClient _serviceClient;
 
-    public void _setOptions(Options _clientOptions) {
-        this._options = _clientOptions;
+    public ServiceClient _getServiceClient() {
+        return _serviceClient;
     }
 
-    protected SOAPEnvelope createEnvelope() throws SOAPProcessingException {
-        return getFactory(this._options.getSoapVersionURI()).getDefaultEnvelope();
+    public void _setServiceClient(ServiceClient _serviceClient) {
+        this._serviceClient = _serviceClient;
     }
 
-    public void engageModule(QName moduleName) throws AxisFault {
-        _serviceClient.engageModule(moduleName);
+    protected SOAPEnvelope createEnvelope(Options options) throws SOAPProcessingException {
+        return getFactory(options.getSoapVersionURI()).getDefaultEnvelope();
     }
 
-
-
     /**
      * A util method that extracts the correct element.
      *
@@ -92,9 +79,8 @@
         return builder.getDocumentElement();
     }
 
-    protected SOAPFactory getFactory(String soapNamespaceURI) {
-        String soapVersionURI = _options.getSoapVersionURI();
-
+    protected SOAPFactory getFactory(String soapVersionURI) {
+        
         if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
             return OMAbstractFactory.getSOAP11Factory();
         } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {

Modified: webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeTest.java?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeTest.java Fri Jan 20 01:23:11 2006
@@ -64,7 +64,7 @@
    public void testhandleStringArray() throws java.lang.Exception {
         PerfPortTypeStub stub = new PerfPortTypeStub(null, targetEpr);
         //create a new databinder
-        stub._getOptions().setSoapAction("handleStringArray");
+        stub._getServiceClient().getOptions().setSoapAction("handleStringArray");
         log.info(">>>> Warming up...");
         pump(stub, 1);
         log.info(">>>> Running volume tests...");

Modified: webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeTest.java?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeTest.java Fri Jan 20 01:23:11 2006
@@ -64,7 +64,7 @@
    public void testhandleStringArray() throws java.lang.Exception {
         PerfPortTypeStub stub = new PerfPortTypeStub(null, targetEpr);
         //create a new databinder
-        stub._getOptions().setSoapAction("handleStringArray");
+        stub._getServiceClient().getOptions().setSoapAction("handleStringArray");
         log.info(">>>> Warming up...");
         pump(stub, 1);
         log.info(">>>> Running volume tests...");

Modified: webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java?rev=370765&r1=370764&r2=370765&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java (original)
+++ webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java Fri Jan 20 01:23:11 2006
@@ -57,8 +57,8 @@
 
         //Enable MTOM to those scenarios where they are configured using:
         //<optimizeParts>xpathExpression</optimizeParts>
-        stub._getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
-        stub._getOptions().setSoapVersionURI(soapNsURI);
+        stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+        stub._getServiceClient().getOptions().setSoapVersionURI(soapNsURI);
 
         PingResponseDocument pingResDoc = stub.Ping(pingDoc);
 
@@ -85,17 +85,17 @@
 
         //Enable MTOM to those scenarios where they are configured using:
         //<optimizeParts>xpathExpression</optimizeParts>
-        stub._getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+        stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
 
         //Engage the security module
 
-        stub.engageModule(new javax.xml.namespace.QName("security"));
+        stub._getServiceClient().engageModule(new javax.xml.namespace.QName("security"));
 
         if (outflowConfig != null) {
-            stub._getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
+            stub._getServiceClient().getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
         }
         if (inflowConfig != null) {
-            stub._getOptions().setProperty(WSSHandlerConstants.INFLOW_SECURITY, inflowConfig.getProperty());
+            stub._getServiceClient().getOptions().setProperty(WSSHandlerConstants.INFLOW_SECURITY, inflowConfig.getProperty());
         }
         PingResponseDocument pingResDoc = stub.Ping(pingDoc);