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 da...@apache.org on 2006/08/10 07:01:42 UTC

svn commit: r430243 - in /webservices/axis2/trunk/c: include/axis2_msg_ctx.h include/axis2_phase.h modules/core/context/msg_ctx.c modules/core/engine/engine.c modules/core/engine/phase.c samples/user_guide/clients/echo_non_blocking_dual.c

Author: damitha
Date: Wed Aug  9 22:01:41 2006
New Revision: 430243

URL: http://svn.apache.org/viewvc?rev=430243&view=rev
Log:
In process of getting sandesha2 work. Now addressing headers
are sent from client side

Modified:
    webservices/axis2/trunk/c/include/axis2_msg_ctx.h
    webservices/axis2/trunk/c/include/axis2_phase.h
    webservices/axis2/trunk/c/modules/core/context/msg_ctx.c
    webservices/axis2/trunk/c/modules/core/engine/engine.c
    webservices/axis2/trunk/c/modules/core/engine/phase.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c

Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Wed Aug  9 22:01:41 2006
@@ -1099,6 +1099,16 @@
                     const axis2_msg_ctx_t *msg_ctx,
                     const axis2_env_t *env);
 
+       /**
+        * @param msg_ctx message context
+        * @param env pointer to environment struct
+        */
+            int (AXIS2_CALL *
+                    get_paused_handler_index)(
+                        const axis2_msg_ctx_t *msg_ctx,
+                        const axis2_env_t *env);
+
+
         /**
          * @param msg_ctx message context
          * @param env pointer to environment struct
@@ -1119,6 +1129,15 @@
                 get_current_phase_index)(
                     const axis2_msg_ctx_t *msg_ctx,
                     const axis2_env_t *env);
+
+   /**
+    * @param msg_ctx message context
+    * @param env pointer to environment struct
+    */
+        int (AXIS2_CALL *
+                get_paused_phase_index)(
+                    const axis2_msg_ctx_t *msg_ctx,
+                    const axis2_env_t *env);
     };
 
     /**
@@ -1592,6 +1611,11 @@
 #define AXIS2_MSG_CTX_GET_CURRENT_HANDLER_INDEX(msg_ctx, env) \
       ((msg_ctx)->ops->get_current_handler_index(msg_ctx, env))
 
+/** Gets the paused handler index.
+    @sa axis2_msg_ctx_ops#get_paused_handler_index */
+#define AXIS2_MSG_CTX_GET_PAUSED_HANDLER_INDEX(msg_ctx, env) \
+      ((msg_ctx)->ops->get_paused_handler_index(msg_ctx, env))
+
 /** Sets the current phase index.
     @sa axis2_msg_ctx_ops#set_current_phase_index */
 #define AXIS2_MSG_CTX_SET_CURRENT_PHASE_INDEX(msg_ctx, env, index) \
@@ -1601,6 +1625,11 @@
     @sa axis2_msg_ctx_ops#get_current_phase_index */
 #define AXIS2_MSG_CTX_GET_CURRENT_PHASE_INDEX(msg_ctx, env) \
       ((msg_ctx)->ops->get_current_phase_index(msg_ctx, env))
+
+/** Gets the paused phase index.
+    @sa axis2_msg_ctx_ops#get_paused_phase_index */
+#define AXIS2_MSG_CTX_GET_PAUSED_PHASE_INDEX(msg_ctx, env) \
+      ((msg_ctx)->ops->get_paused_phase_index(msg_ctx, env))
 
 /************************** End of function macros ****************************/
 

Modified: webservices/axis2/trunk/c/include/axis2_phase.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_phase.h?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_phase.h (original)
+++ webservices/axis2/trunk/c/include/axis2_phase.h Wed Aug  9 22:01:41 2006
@@ -214,7 +214,7 @@
                 invoke_start_from_handler)(
                     struct axis2_phase *phase,
                     const axis2_env_t *env,
-                    axis2_qname_t *qname,
+                    int paused_handler_index,
                     struct axis2_msg_ctx *msg_ctx);
 
 
@@ -316,8 +316,10 @@
 
 /** Invoke start from handler.
     @sa axis2_phase_ops#invoke_start_from_handler */
-#define AXIS2_PHASE_INVOKE_START_FROM_HANDLER(phase, env, qname, msg_ctx) \
-      ((phase)->ops->invoke_start_from_handler(phase, env, qname, msg_ctx))
+#define AXIS2_PHASE_INVOKE_START_FROM_HANDLER(phase, env, paused_handler_index, \
+        msg_ctx) \
+      ((phase)->ops->invoke_start_from_handler(phase, env, paused_handler_index, \
+        msg_ctx))
 
 /** Frees the phase.
     @sa axis2_phase_ops#free */

Modified: webservices/axis2/trunk/c/modules/core/context/msg_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/context/msg_ctx.c?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/msg_ctx.c Wed Aug  9 22:01:41 2006
@@ -117,6 +117,10 @@
     axis2_array_list_t *execution_chain;
     /** Index into the execution chain of the currently executing handler */
     int current_handler_index;
+    /** Index of the paused  handler */
+    int paused_handler_index;
+    /** Index of the paused  phase */
+    int paused_phase_index;
     /** Index into the current Phase of the currently executing handler (if any)*/
     int current_phase_index;
 };
@@ -626,6 +630,11 @@
     const axis2_msg_ctx_t *msg_ctx,
     const axis2_env_t *env);
 
+int AXIS2_CALL
+axis2_msg_ctx_get_paused_handler_index(
+        const axis2_msg_ctx_t *msg_ctx,
+        const axis2_env_t *env);
+
 axis2_status_t AXIS2_CALL
 axis2_msg_ctx_set_current_phase_index(
     axis2_msg_ctx_t *msg_ctx,
@@ -637,6 +646,11 @@
     const axis2_msg_ctx_t *msg_ctx,
     const axis2_env_t *env);
 
+int AXIS2_CALL
+axis2_msg_ctx_get_paused_phase_index(
+    const axis2_msg_ctx_t *msg_ctx,
+    const axis2_env_t *env);
+
 /************************* End of function headers ****************************/   
 
 AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL
@@ -695,8 +709,10 @@
     msg_ctx_impl->op_qname = NULL;
     msg_ctx_impl->flow = AXIS2_IN_FLOW;
     msg_ctx_impl->execution_chain = NULL;
-    msg_ctx_impl->current_handler_index = 0;
+    msg_ctx_impl->current_handler_index = -1;
+    msg_ctx_impl->paused_handler_index = -1;
     msg_ctx_impl->current_phase_index = 0;
+    msg_ctx_impl->paused_phase_index = 0;
     
     msg_ctx_impl->base = axis2_ctx_create(env);
     if (!(msg_ctx_impl->base))
@@ -827,10 +843,14 @@
         axis2_msg_ctx_get_current_handler_index;
     msg_ctx_impl->msg_ctx.ops->set_current_handler_index = 
         axis2_msg_ctx_set_current_handler_index;
+    msg_ctx_impl->msg_ctx.ops->get_paused_handler_index = 
+        axis2_msg_ctx_get_paused_handler_index;
     msg_ctx_impl->msg_ctx.ops->get_current_phase_index = 
         axis2_msg_ctx_get_current_phase_index;
     msg_ctx_impl->msg_ctx.ops->set_current_phase_index = 
         axis2_msg_ctx_set_current_phase_index;
+    msg_ctx_impl->msg_ctx.ops->get_paused_phase_index = 
+        axis2_msg_ctx_get_paused_phase_index;
     return &(msg_ctx_impl->msg_ctx);
 }
 
@@ -1524,8 +1544,12 @@
     const axis2_env_t *env, 
     axis2_bool_t paused) 
 {
+    axis2_msg_ctx_impl_t *msg_ctx_impl = NULL;
+
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(msg_ctx)->paused = paused;
+    msg_ctx_impl = AXIS2_INTF_TO_IMPL(msg_ctx);
+    msg_ctx_impl->paused = paused;
+    msg_ctx_impl->paused_phase_index = msg_ctx_impl->current_phase_index;
     return AXIS2_SUCCESS;
 }
 
@@ -2444,6 +2468,7 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);    
     AXIS2_INTF_TO_IMPL(msg_ctx)->execution_chain = execution_chain;
     AXIS2_INTF_TO_IMPL(msg_ctx)->current_handler_index = -1;
+    AXIS2_INTF_TO_IMPL(msg_ctx)->paused_handler_index = -1;
     AXIS2_INTF_TO_IMPL(msg_ctx)->current_phase_index = 0;
     return AXIS2_SUCCESS;
 }
@@ -2484,10 +2509,22 @@
     const axis2_msg_ctx_t *msg_ctx,
     const axis2_env_t *env)
 {
+    axis2_msg_ctx_impl_t *msg_ctx_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    msg_ctx_impl = AXIS2_INTF_TO_IMPL(msg_ctx);
+    return msg_ctx_impl->current_handler_index;
+}
+
+int AXIS2_CALL
+axis2_msg_ctx_get_paused_handler_index(const axis2_msg_ctx_t *msg_ctx,
+    const axis2_env_t *env)
+{
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return AXIS2_INTF_TO_IMPL(msg_ctx)->current_handler_index;
+    return AXIS2_INTF_TO_IMPL(msg_ctx)->paused_handler_index;
 }
 
+
 axis2_status_t AXIS2_CALL
 axis2_msg_ctx_set_current_phase_index(
     axis2_msg_ctx_t *msg_ctx,
@@ -2507,4 +2544,13 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     return AXIS2_INTF_TO_IMPL(msg_ctx)->current_phase_index;
+}
+
+int AXIS2_CALL
+axis2_msg_ctx_get_paused_phase_index(
+    const axis2_msg_ctx_t *msg_ctx,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    return AXIS2_INTF_TO_IMPL(msg_ctx)->paused_phase_index;
 }

Modified: webservices/axis2/trunk/c/modules/core/engine/engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/engine/engine.c?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Wed Aug  9 22:01:41 2006
@@ -920,28 +920,35 @@
     AXIS2_MSG_CTX_SET_PAUSED(msg_ctx, env, AXIS2_FALSE);
     
     count = AXIS2_ARRAY_LIST_SIZE(phases, env);
-    
+
     for (i = 0; i < count && !(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env)); i++) 
     {
-        axis2_phase_t *phase = (axis2_phase_t *) AXIS2_ARRAY_LIST_GET(phases, env, i);
+        axis2_phase_t *phase = (axis2_phase_t *) AXIS2_ARRAY_LIST_GET(phases, 
+            env, i);
         axis2_char_t* phase_name = AXIS2_PHASE_GET_NAME(phase, env);
-        axis2_char_t* paused_phase_name = AXIS2_MSG_CTX_GET_PAUSED_PHASE_NAME(msg_ctx, env);
-        if (phase_name && paused_phase_name)
+        axis2_char_t* paused_phase_name = AXIS2_MSG_CTX_GET_PAUSED_PHASE_NAME(
+            msg_ctx, env);
+        /* Skip invoking hanlders until we find the paused phase */
+        if (phase_name && paused_phase_name && 0 == AXIS2_STRCMP(phase_name, 
+            paused_phase_name))
         {
-            if (AXIS2_STRCMP(phase_name, paused_phase_name) == 0)
-            {
-                found_match = AXIS2_TRUE;
-                AXIS2_PHASE_INVOKE_START_FROM_HANDLER(phase, env, 
-                    AXIS2_MSG_CTX_GET_PAUSED_HANDLER_NAME(msg_ctx, env), msg_ctx);
-            }
+            int paused_handler_i = -1;
+            found_match = AXIS2_TRUE;
+
+            paused_handler_i = AXIS2_MSG_CTX_GET_CURRENT_HANDLER_INDEX(msg_ctx, 
+                env);
+            /* Invoke the paused handler and rest of the handlers of the puased 
+             * phase */
+            AXIS2_PHASE_INVOKE_START_FROM_HANDLER(phase, env, paused_handler_i, 
+                msg_ctx);
         }
-        else 
+        else /* Now we have found the paused phase and invoked the rest of the
+              * handlers of that phase.Invoke all the phases after that */ 
         {
             if (found_match) 
             {
                 AXIS2_PHASE_INVOKE(phase, env, msg_ctx);
             }
-
        }
     }
     

Modified: webservices/axis2/trunk/c/modules/core/engine/phase.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/engine/phase.c?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/phase.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/phase.c Wed Aug  9 22:01:41 2006
@@ -146,7 +146,7 @@
 axis2_phase_invoke_start_from_handler(
     axis2_phase_t *phase, 
     const axis2_env_t *env, 
-    axis2_qname_t *qname, 
+    int paused_handler_index, 
     axis2_msg_ctx_t *msg_ctx) ;
                                       
 axis2_status_t AXIS2_CALL 
@@ -311,8 +311,6 @@
     phase_impl = AXIS2_INTF_TO_IMPL(phase);
     
     AXIS2_MSG_CTX_SET_PAUSED_PHASE_NAME(msg_ctx, env, phase_impl->name);
-    /* If phase first handler is there then it should run first */
-    
     if (phase_impl->first_handler)
     {
         if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
@@ -351,13 +349,13 @@
                         "Invoke the handler %s within the phase %s",
                          AXIS2_QNAME_GET_LOCALPART(AXIS2_HANDLER_GET_NAME(handler, env), env), 
                          phase_impl->name);
-                         
                 status = AXIS2_HANDLER_INVOKE(handler, env, msg_ctx);
                 if (status != AXIS2_SUCCESS)
-                    return status;                
-                /* index increment should be after the invoke as if the invocation 
-                   failed this handler is taken care of and no need to revoke agien */
+                    return status;
+                /* index increment should be done after the invoke function. If the invocation 
+                   failed this handler is taken care of and no need to revoke again */
                 index++;
+                AXIS2_MSG_CTX_SET_CURRENT_HANDLER_INDEX(msg_ctx, env, index);
             }
         }
     }
@@ -1118,12 +1116,12 @@
 axis2_phase_invoke_start_from_handler(
     axis2_phase_t *phase, 
     const axis2_env_t *env, 
-    axis2_qname_t *qname, 
+    int paused_handler_index,
     axis2_msg_ctx_t *msg_ctx) 
 {
     axis2_phase_impl_t *phase_impl = NULL;
-    int size = 0, i = 0;
-    axis2_bool_t found = AXIS2_FALSE;
+    int i = 0, size = 0;
+    axis2_status_t status = AXIS2_SUCCESS;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     
@@ -1132,12 +1130,14 @@
     AXIS2_MSG_CTX_SET_PAUSED_PHASE_NAME(msg_ctx, env, phase_impl->name);    
     
     size = AXIS2_ARRAY_LIST_SIZE(phase_impl->handlers, env);
-    
-    for (i = 0; i < size; i++) 
-    {
-        axis2_handler_t *handler = (axis2_handler_t *) AXIS2_ARRAY_LIST_GET(phase_impl->handlers, env, i);
+    for(i = paused_handler_index; i < size; i++)
+    { 
+        axis2_handler_t *handler = (axis2_handler_t *) AXIS2_ARRAY_LIST_GET(
+            phase_impl->handlers, env, i);
         if (handler)
         {
+            int index = -1;
+            
             axis2_handler_desc_t *handler_desc = AXIS2_HANDLER_GET_HANDLER_DESC(handler, env);
             if (!handler_desc)
             {
@@ -1145,16 +1145,12 @@
                 return AXIS2_FAILURE;
             }
             
-            found = AXIS2_QNAME_EQUALS(AXIS2_HANDLER_DESC_GET_QNAME(handler_desc, env), env, qname);
-            
-            if (found)
-            {
-                return AXIS2_HANDLER_INVOKE(handler, env, msg_ctx);
-            }
+            AXIS2_HANDLER_INVOKE(handler, env, msg_ctx);
+            index = AXIS2_MSG_CTX_GET_CURRENT_HANDLER_INDEX(msg_ctx, env);
+            AXIS2_MSG_CTX_SET_CURRENT_HANDLER_INDEX(msg_ctx, env, (index+1));
         }
     }
-    
-    return AXIS2_FAILURE;
+    return status;
 }
 
 axis2_status_t AXIS2_CALL 

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c?rev=430243&r1=430242&r2=430243&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c Wed Aug  9 22:01:41 2006
@@ -202,7 +202,7 @@
                             int exception)
 {
    /** take necessary action on error */
-   printf("\necho client invike FAILED. Error code:%d ::%s", exception, 
+   printf("\nEcho client invoke FAILED. Error code:%d ::%s", exception, 
          AXIS2_ERROR_GET_MESSAGE(env->error));
    isComplete = 1;
    return AXIS2_SUCCESS;



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