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 de...@apache.org on 2006/01/06 14:00:57 UTC

svn commit: r366495 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/ServiceClient.java description/OutInAxisOperation.java description/OutOnlyAxisOperation.java

Author: deepal
Date: Fri Jan  6 05:00:49 2006
New Revision: 366495

URL: http://svn.apache.org/viewcvs?rev=366495&view=rev
Log:
fixing message ID setting problem in ServiceClient , and move it to Operation client

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=366495&r1=366494&r2=366495&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Fri Jan  6 05:00:49 2006
@@ -504,7 +504,7 @@
      *
      * @param mc the message context whose id is to be set
      */
-    private void setMessageID(MessageContext mc) {
+    public void setMessageID(MessageContext mc) {
         // now its the time to put the parameters set by the user in to the
         // correct places and to the
         // if there is no message id still, set a new one.

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=366495&r1=366494&r2=366495&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Fri Jan  6 05:00:49 2006
@@ -18,6 +18,7 @@
 import org.apache.axis2.soap.SOAPFault;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.util.CallbackReceiver;
+import org.apache.axis2.util.UUIDGenerator;
 import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
@@ -159,6 +160,31 @@
     }
 
     /**
+     * Create a message ID for the given message context if needed. If user gives an option with
+     * MessageID then just copy that into MessageContext , and with that there can be mutiple
+     * message with same MessageID unless user call setOption for each invocation.
+     * <p/>
+     * If user want to give message ID then the better way is to set the message ID in the option and
+     * call setOption for each invocation then the right thing will happen.
+     * <p/>
+     * If user does not give a message ID then the new one will be created and set that into Message
+     * Context.
+     *
+     * @param mc the message context whose id is to be set
+     */
+    public void setMessageID(MessageContext mc) {
+        // now its the time to put the parameters set by the user in to the
+        // correct places and to the
+        // if there is no message id still, set a new one.
+        String messageId = options.getMessageId();
+        if (messageId == null || "".equals(messageId)) {
+            messageId = UUIDGenerator.getUUID();
+        }
+        mc.setMessageID(messageId);
+    }
+
+
+    /**
      * Executes the MEP. What this does depends on the specific MEP client. The
      * basic idea is to have the MEP client execute and do something with the
      * messages that have been added to it so far. For example, if its an Out-In
@@ -190,6 +216,10 @@
         mc.setAxisOperation(axisOp);
         mc.setServiceContext(sc);
         mc.setOptions(options);
+        // setting messge ID if it null
+        if (mc.getMessageID() == null) {
+            setMessageID(mc);
+        }
 
         // if the transport to use for sending is not specified, try to find it
         // from the URL

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=366495&r1=366494&r2=366495&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java Fri Jan  6 05:00:49 2006
@@ -10,6 +10,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.util.UUIDGenerator;
 import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
@@ -44,7 +45,7 @@
     }
 
     public void addMessageContext(MessageContext msgContext,
-            OperationContext opContext) throws AxisFault {
+                                  OperationContext opContext) throws AxisFault {
         if (!opContext.isComplete()) {
             opContext.getMessageContexts().put(MESSAGE_LABEL_OUT_VALUE,
                     msgContext);
@@ -111,13 +112,11 @@
      * block parameter is ignored by this client and also the setMessageReceiver
      * method cannot be used.
      *
-     * @param sc
-     *            The service context for this client to live within. Cannot be
-     *            null.
-     * @param options
-     *            Options to use as defaults for this client. If any options are
-     *            set specifically on the client then those override options
-     *            here.
+     * @param sc      The service context for this client to live within. Cannot be
+     *                null.
+     * @param options Options to use as defaults for this client. If any options are
+     *                set specifically on the client then those override options
+     *                here.
      */
     public OperationClient createClient(ServiceContext sc, Options options) {
         return new OutOnlyAxisOperationClient(this, sc, options);
@@ -143,7 +142,7 @@
     boolean completed;
 
     OutOnlyAxisOperationClient(OutOnlyAxisOperation axisOp, ServiceContext sc,
-            Options options) {
+                               Options options) {
         this.axisOp = axisOp;
         this.sc = sc;
         this.options = new Options(options);
@@ -155,8 +154,7 @@
      * resets the entire set of options to use the new options - so you'd lose
      * any option cascading that may have been set up.
      *
-     * @param options
-     *            the options
+     * @param options the options
      */
     public void setOptions(Options options) {
         this.options = options;
@@ -178,10 +176,8 @@
      * process the message - it only records it in the MEP client. Processing
      * only occurs when execute() is called.
      *
-     * @param mc
-     *            the message context
-     * @throws AxisFault
-     *             if this is called inappropriately.
+     * @param mc the message context
+     * @throws AxisFault if this is called inappropriately.
      */
     public void addMessageContext(MessageContext mc) throws AxisFault {
         if (this.mc != null) {
@@ -196,11 +192,9 @@
      * Returns a message from the client - will return null if the requested
      * message is not available.
      *
-     * @param messageLabel
-     *            the message label of the desired message context
+     * @param messageLabel the message label of the desired message context
      * @return Returns the desired message context or null if its not available.
-     * @throws AxisFault
-     *             if the message label is invalid
+     * @throws AxisFault if the message label is invalid
      */
     public MessageContext getMessageContext(String messageLabel)
             throws AxisFault {
@@ -223,6 +217,31 @@
     }
 
     /**
+     * Create a message ID for the given message context if needed. If user gives an option with
+     * MessageID then just copy that into MessageContext , and with that there can be mutiple
+     * message with same MessageID unless user call setOption for each invocation.
+     * <p/>
+     * If user want to give message ID then the better way is to set the message ID in the option and
+     * call setOption for each invocation then the right thing will happen.
+     * <p/>
+     * If user does not give a message ID then the new one will be created and set that into Message
+     * Context.
+     *
+     * @param mc the message context whose id is to be set
+     */
+    public void setMessageID(MessageContext mc) {
+        // now its the time to put the parameters set by the user in to the
+        // correct places and to the
+        // if there is no message id still, set a new one.
+        String messageId = options.getMessageId();
+        if (messageId == null || "".equals(messageId)) {
+            messageId = UUIDGenerator.getUUID();
+        }
+        mc.setMessageID(messageId);
+    }
+
+
+    /**
      * Executes the MEP. What this does depends on the specific MEP client. The
      * basic idea is to have the MEP client execute and do something with the
      * messages that have been added to it so far. For example, if its an Out-In
@@ -230,12 +249,10 @@
      * it to send the message and get the In message, possibly using a different
      * thread.
      *
-     * @param block
-     *            Indicates whether execution should block or return ASAP. What
-     *            block means is of course a function of the specific MEP
-     *            client. IGNORED BY THIS MEP CLIENT.
-     * @throws AxisFault
-     *             if something goes wrong during the execution of the MEP.
+     * @param block Indicates whether execution should block or return ASAP. What
+     *              block means is of course a function of the specific MEP
+     *              client. IGNORED BY THIS MEP CLIENT.
+     * @throws AxisFault if something goes wrong during the execution of the MEP.
      */
     public void execute(boolean block) throws AxisFault {
         if (completed) {
@@ -246,6 +263,10 @@
 
         // set options on the message context
         mc.setOptions(options);
+        // setting messge ID if it null
+        if (mc.getMessageID() == null) {
+            setMessageID(mc);
+        }
 
         // if the transport to use for sending is not specified, try to find it
         // from the URL
@@ -276,9 +297,8 @@
      * is how you can reuse a MEP client. NOTE: this does not reset the options;
      * only the internal state so the client can be used again.
      *
-     * @throws AxisFault
-     *             if reset is called before the MEP client has completed an
-     *             interaction.
+     * @throws AxisFault if reset is called before the MEP client has completed an
+     *                   interaction.
      */
     public void reset() throws AxisFault {
         if (!completed) {



Re: svn commit: r366495 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/ServiceClient.java description/OutInAxisOperation.java description/OutOnlyAxisOperation.java

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Fri, 2006-01-06 at 13:00 +0000, deepal@apache.org wrote:
> Author: deepal
> Date: Fri Jan  6 05:00:49 2006
> New Revision: 366495
> 
> URL: http://svn.apache.org/viewcvs?rev=366495&view=rev
> Log:
> fixing message ID setting problem in ServiceClient , and move it to Operation client

I'm confused .. I see a public setMessageID() in ServiceClient yet.
Looking at the code for that function its a pure utility and hence shoud
be a utility somewhere at best and certainly not a publicly visible
method of the service client API.

In any case, why do we have a MessageID property in options at all?? Can
someone explain the need for that please? I remember something along the
lines of Sandesha needs it but I don't see why .. sorry if I'm
forgetting (again).

Deepal, you and I seem to have different IDE setting for formatting
comments. What's the configs that we've decided to use? Let's get it
sync'ed up so that we don't get spurious commits.

Sanjiva.



Re: svn commit: r366495 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/ServiceClient.java description/OutInAxisOperation.java description/OutOnlyAxisOperation.java

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Fri, 2006-01-06 at 13:00 +0000, deepal@apache.org wrote:
> Author: deepal
> Date: Fri Jan  6 05:00:49 2006
> New Revision: 366495
> 
> URL: http://svn.apache.org/viewcvs?rev=366495&view=rev
> Log:
> fixing message ID setting problem in ServiceClient , and move it to Operation client

I'm confused .. I see a public setMessageID() in ServiceClient yet.
Looking at the code for that function its a pure utility and hence shoud
be a utility somewhere at best and certainly not a publicly visible
method of the service client API.

In any case, why do we have a MessageID property in options at all?? Can
someone explain the need for that please? I remember something along the
lines of Sandesha needs it but I don't see why .. sorry if I'm
forgetting (again).

Deepal, you and I seem to have different IDE setting for formatting
comments. What's the configs that we've decided to use? Let's get it
sync'ed up so that we don't get spurious commits.

Sanjiva.