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 ch...@apache.org on 2006/10/24 09:12:04 UTC

svn commit: r467261 - in /webservices/axis2/branches/java/1_1/modules: integration/test/org/apache/axis2/integration/ kernel/src/org/apache/axis2/client/ kernel/src/org/apache/axis2/deployment/

Author: chinthaka
Date: Tue Oct 24 00:12:04 2006
New Revision: 467261

URL: http://svn.apache.org/viewvc?view=rev&rev=467261
Log:
- Improving client api classes to have proper names for the variables. And adding more comments inside the code (with the little english I know :) ). 
- My IDE shows probable improvements in java classes with yellow marks. So I will be improving those classes whenever I see room for  improvements. This commit also has some of them. 

With this commit, I'd like to suggest people to use long and meaningful variable names as much as possible. Some variables were just named as sh or oc, which makes no sense when we go down a method.

Modified:
    webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/integration/UtilsJMSServer.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/OperationClient.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java

Modified: webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/integration/UtilsJMSServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/integration/UtilsJMSServer.java?view=diff&rev=467261&r1=467260&r2=467261
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/integration/UtilsJMSServer.java (original)
+++ webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/integration/UtilsJMSServer.java Tue Oct 24 00:12:04 2006
@@ -18,21 +18,17 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.transport.jms.JMSListener;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.transport.jms.JMSListener;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.activemq.broker.BrokerService;
 
 import javax.xml.namespace.QName;
 import java.io.File;
-import java.util.HashMap;
 
 public class UtilsJMSServer {
     private static JMSListener receiver;
@@ -50,8 +46,6 @@
 
         receiver.getConfigurationContext().getAxisConfiguration().addService(service);
 
-        ServiceGroupContext serviceGroupContext = new ServiceGroupContext(
-                receiver.getConfigurationContext(), (AxisServiceGroup) service.getParent());
     }
 
     public static synchronized void unDeployService(QName service)

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/OperationClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/OperationClient.java?view=diff&rev=467261&r1=467260&r2=467261
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/OperationClient.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/OperationClient.java Tue Oct 24 00:12:04 2006
@@ -55,10 +55,10 @@
      * process the message - it only records it in the operation client.
      * Processing only occurs when execute() is called.
      *
-     * @param mc the message context
+     * @param messageContext the message context
      * @throws AxisFault if this is called inappropriately.
      */
-    public void addMessageContext(MessageContext mc) throws AxisFault;
+    public void addMessageContext(MessageContext messageContext) throws AxisFault;
 
     /**
      * Return a message from the client - will return null if the requested

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?view=diff&rev=467261&r1=467260&r2=467261
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Tue Oct 24 00:12:04 2006
@@ -503,31 +503,33 @@
     }
 
     /**
-     * Directly invoke a named operation with an In-Out MEP. This method sends
+     * Directly invoke a named operationQName with an In-Out MEP. This method sends
      * your supplied XML and receives a response. For more control, you can
-     * instead create a client for the operation and use that client to execute
+     * instead create a client for the operationQName and use that client to execute
      * the exchange.
      *
-     * @param operation name of operation to be invoked (non-<code>null</code>)
-     * @param elem
+     * @param operationQName name of operationQName to be invoked (non-<code>null</code>)
+     * @param xmlPayload
      * @return response
      * @throws AxisFault
      */
-    public OMElement sendReceive(QName operation, OMElement elem)
+    public OMElement sendReceive(QName operationQName, OMElement xmlPayload)
             throws AxisFault {
         if (options.isUseSeparateListener()) {
 
-            // This mean doing a Request-Response invocation using two channel.
-            // If the
-            // transport is two way transport (e.g. http) Only one channel is
-            // used (e.g. in http cases
-            // 202 OK is sent to say no response available). Axis2 get blocked
-            // return when the response is available.
+            // Here we are trying to do a request-response invocation using two different channels for the request
+            // and the response.
+            // For example, if the IN and OUT transports are HTTP, then two different HTTP channels will be used. The first
+            // channel will be used to send the request, which the server respond sending HTTP 200, if accepted and uses
+            // a completely different channel to send the response. This flag, informs the Axis2 client engine to
+            // keep listeners ready to receive the response.
+
+            // even if the client is blocking we use a Callback, internally, to relate the response back to the client.
             SyncCallBack callback = new SyncCallBack();
 
             // this method call two channel non blocking method to do the work
             // and wait on the callback
-            sendReceiveNonBlocking(operation, elem, callback);
+            sendReceiveNonBlocking(operationQName, xmlPayload, callback);
 
             long timeout = options.getTimeOutInMilliSeconds();
             long waitTime = timeout;
@@ -564,12 +566,12 @@
                     throw new AxisFault(Messages.getMessage("callBackCompletedWithError"));
             }
         } else {
-            MessageContext mc = new MessageContext();
-            fillSOAPEnvelope(mc, elem);
-            OperationClient mepClient = createClient(operation);
-            mepClient.addMessageContext(mc);
-            mepClient.execute(true);
-            MessageContext response = mepClient
+            MessageContext messageContext = new MessageContext();
+            fillSOAPEnvelope(messageContext, xmlPayload);
+            OperationClient operationClient = createClient(operationQName);
+            operationClient.addMessageContext(messageContext);
+            operationClient.execute(true);
+            MessageContext response = operationClient
                     .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             return response.getEnvelope().getBody().getFirstElement();
         }
@@ -632,37 +634,37 @@
      * options. This method is used internally, and also by generated client
      * stub code.
      *
-     * @param operation qualified name of operation (local name is operation
+     * @param operationQName qualified name of operation (local name is operation
      *                  name, namespace URI is just the empty string)
      * @return client configured to talk to the given operation
      * @throws AxisFault if the operation is not found
      */
-    public OperationClient createClient(QName operation) throws AxisFault {
-        AxisOperation axisOp = axisService.getOperation(operation);
-        if (axisOp == null) {
+    public OperationClient createClient(QName operationQName) throws AxisFault {
+        AxisOperation axisOperation = axisService.getOperation(operationQName);
+        if (axisOperation == null) {
             throw new AxisFault(Messages
-                    .getMessage("operationnotfound", operation.getLocalPart()));
+                    .getMessage("operationnotfound", operationQName.getLocalPart()));
         }
 
-        OperationClient oc = axisOp.createClient(serviceContext, options);
+        OperationClient operationClient = axisOperation.createClient(serviceContext, options);
 
         // if overide options have been set, that means we need to make sure
         // those options override the options of even the operation client. So,
         // what we do is switch the parents around to make that work.
         if (overrideOptions != null) {
-            overrideOptions.setParent(oc.getOptions());
-            oc.setOptions(overrideOptions);
+            overrideOptions.setParent(operationClient.getOptions());
+            operationClient.setOptions(overrideOptions);
         }
-        return oc;
+        return operationClient;
     }
 
     /**
      * Return the SOAP factory to use depending on what options have been set.
-     * If the SOAP version has not be seen in the options, version 1.1 is the
+     * If the SOAP version can not be seen in the options, version 1.1 is the
      * default.
      *
      * @return the SOAP factory
-     * @see Options#setSoapVersionURI()
+     * @see Options#setSoapVersionURI(String)
      */
     private SOAPFactory getSOAPFactory() {
         String soapVersionURI = options.getSoapVersionURI();
@@ -677,20 +679,20 @@
     /**
      * Prepare a SOAP envelope with the stuff to be sent.
      *
-     * @param mc   the message context to be filled
-     * @param elem the payload content
+     * @param messageContext   the message context to be filled
+     * @param xmlPayload the payload content
      * @throws AxisFault if something goes wrong
      */
-    private void fillSOAPEnvelope(MessageContext mc, OMElement elem)
+    private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload)
             throws AxisFault {
-        mc.setServiceContext(serviceContext);
+        messageContext.setServiceContext(serviceContext);
         SOAPFactory soapFactory = getSOAPFactory();
         SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
-        if (elem != null) {
-            envelope.getBody().addChild(elem);
+        if (xmlPayload != null) {
+            envelope.getBody().addChild(xmlPayload);
         }
         addHeadersToEnvelope(envelope);
-        mc.setEnvelope(envelope);
+        messageContext.setEnvelope(envelope);
     }
 
 
@@ -701,9 +703,9 @@
      */
     public void addHeadersToEnvelope(SOAPEnvelope envelope) {
         if (headers != null) {
-            SOAPHeader sh = envelope.getHeader();
+            SOAPHeader soapHeader = envelope.getHeader();
             for (int i = 0; i < headers.size(); i++) {
-                sh.addChild((OMElement) headers.get(i));
+                soapHeader.addChild((OMElement) headers.get(i));
             }
         }
     }

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=467261&r1=467260&r2=467261
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Tue Oct 24 00:12:04 2006
@@ -22,6 +22,8 @@
 import org.apache.axis2.util.Loader;
 
 import java.io.File;
+import java.net.URLDecoder;
+
 
 public class RepositoryListener implements DeploymentConstants {
     private DeploymentEngine deploymentEngine;
@@ -129,7 +131,7 @@
                 location = url.toString();
             }
             if (location.startsWith("file")) {
-                java.io.File file = new java.io.File(java.net.URLDecoder.decode(url.getPath()).replace('/',
+                java.io.File file = new java.io.File(URLDecoder.decode(url.getPath()).replace('/',
                         File.separatorChar).replace('|', ':'));
                 return file.getAbsolutePath();
             } else {



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