You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2007/02/08 08:38:09 UTC

svn commit: r504812 - in /webservices/sandesha/trunk/c: include/ samples/ samples/rm_echo_single/ src/msgprocessors/ src/util/ src/workers/ src/wsrm/

Author: damitha
Date: Wed Feb  7 23:38:08 2007
New Revision: 504812

URL: http://svn.apache.org/viewvc?view=rev&rev=504812
Log:
fixed sandesha2c-19. Need more testing with current axis2c code

Modified:
    webservices/sandesha/trunk/c/include/sandesha2_utils.h
    webservices/sandesha/trunk/c/samples/configure.ac
    webservices/sandesha/trunk/c/samples/rm_echo_single/rm_echo_single.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/util/ack_mgr.c
    webservices/sandesha/trunk/c/src/util/msg_creator.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/workers/sender_worker.c
    webservices/sandesha/trunk/c/src/wsrm/seq_ack.c

Modified: webservices/sandesha/trunk/c/include/sandesha2_utils.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_utils.h?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_utils.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_utils.h Wed Feb  7 23:38:08 2007
@@ -229,7 +229,7 @@
 axis2_bool_t AXIS2_CALL
 sandesha2_utils_is_anon_uri(
     const axis2_env_t *env,
-    axis2_char_t *address);
+    const axis2_char_t *address);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_utils_stop_invoker(
@@ -251,6 +251,12 @@
     const axis2_env_t *env,
     axis2_char_t *str,
     axis2_char_t *pattern);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_utils_is_single_channel(
+    const axis2_env_t *env,
+    const axis2_char_t *rm_version,
+    const axis2_char_t *reply_to_addr);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/configure.ac?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/samples/configure.ac (original)
+++ webservices/sandesha/trunk/c/samples/configure.ac Wed Feb  7 23:38:08 2007
@@ -122,6 +122,7 @@
     rm_echo/Makefile \
     rm_echo_1_1/Makefile \
     rm_echo_single/Makefile \
+    rm_echo_single_1_1/Makefile \
     rm_ping_1_0/Makefile \
     rm_ping_1_1/Makefile \
     rm_mtom/Makefile \

Modified: webservices/sandesha/trunk/c/samples/rm_echo_single/rm_echo_single.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single/rm_echo_single.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single/rm_echo_single.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single/rm_echo_single.c Wed Feb  7 23:38:08 2007
@@ -168,7 +168,7 @@
     }
     /* RM Version 1.1 */
     property = axis2_property_create_with_args(env, 3, 0, 0, 
-        SANDESHA2_SPEC_VERSION_1_1);
+        SANDESHA2_SPEC_VERSION_1_0);
     if(property)
     {
         AXIS2_OPTIONS_SET_PROPERTY(options, env, 
@@ -195,6 +195,8 @@
     payload = NULL;
     AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
 
+    property = axis2_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
+    AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", property);
     payload = build_om_payload_for_echo_svc(env, "echo3", "sequence1");
     status = AXIS2_SVC_CLIENT_SEND_ROBUST(svc_client, env, payload);
     if(status)
@@ -202,10 +204,6 @@
     payload = NULL;
     AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
 
-    sandesha2_client_terminate_seq_with_svc_client_and_seq_key(env, svc_client, 
-        "sequence1");
-    /*sandesha2_client_terminate_seq_with_svc_client(env, svc_client, callback4, 
-        listener_manager);*/
     AXIS2_SLEEP(2 * SANDESHA2_MAX_COUNT);
     if (svc_client)
     {

Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Wed Feb  7 23:38:08 2007
@@ -203,7 +203,11 @@
     sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
     axis2_char_t *highest_in_msg_no_str = NULL;
     axis2_char_t *highest_in_msg_key_str = NULL;
-    axis2_bool_t msg_no_present_in_list = AXIS2_FALSE; 
+    axis2_bool_t msg_no_present_in_list = AXIS2_FALSE;
+    axis2_endpoint_ref_t *reply_to_epr = NULL;
+    axis2_char_t *reply_to_addr = NULL;
+    axis2_char_t *rm_version = NULL;
+    axis2_char_t *internal_seq_id = NULL;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
@@ -240,7 +244,7 @@
                 property, AXIS2_FALSE);
         }
     }
-    conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, 
         AXIS2_CONF_CTX_GET_CONF(conf_ctx, env));
     fault_ctx = sandesha2_fault_mgr_check_for_last_msg_num_exceeded(
@@ -468,13 +472,28 @@
         /* Start the invoker if stopped */
         sandesha2_utils_start_invoker_for_seq(env, conf_ctx, str_seq_id);
     }
-    sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str, 
-            storage_mgr);
-    /*if(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+
+    
+    
+    
+    
+    
+    internal_seq_id = sandesha2_utils_get_outgoing_internal_seq_id(env,
+        str_seq_id);
+    rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, storage_mgr);
+    if(!rm_version)
     {
-        AXIS2_MSG_CTX_SET_PAUSED(msg_ctx, env, AXIS2_FALSE);
-    }*/
-    /*AXIS2_MSG_CTX_SET_PAUSED(msg_ctx, env, AXIS2_TRUE);*/
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unable to fine RM spec version");
+        return AXIS2_FAILURE;
+    }
+    reply_to_epr = axis2_msg_ctx_get_reply_to(msg_ctx, env);
+    reply_to_addr = axis2_endpoint_ref_get_address(reply_to_epr, env);
+    if(!axis2_msg_ctx_get_server_side(msg_ctx, env) ||
+       !sandesha2_utils_is_single_channel(env, rm_version, reply_to_addr))
+    {
+        sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str, 
+            storage_mgr);
+    }
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2] Exit: sandesha2_app_msg_processor_process_in_msg");
     return AXIS2_SUCCESS;
@@ -520,7 +539,7 @@
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
   
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
-    conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     req_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(op_ctx, env, 
         AXIS2_WSDL_MESSAGE_LABEL_IN);
@@ -926,7 +945,7 @@
     sandesha2_msg_ctx_t *ack_rm_msg = NULL;
     axis2_engine_t *engine = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
-    
+
     AXIS2_LOG_INFO(env->log,  
         "[Sandesha2] sandesha2_app_msg_processor_send_ack_if_reqd");
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -937,7 +956,7 @@
         SANDESHA2_MSG_PART_SEQ);
     seq_id = sandesha2_identifier_get_identifier(
         sandesha2_seq_get_identifier(seq, env), env);
-    conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx,
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx,
         env), env);
     if(!conf_ctx)
     {
@@ -1098,7 +1117,7 @@
     axis2_msg_ctx_set_property(create_seq_msg, env, SANDESHA2_SET_SEND_TO_TRUE,
         property, AXIS2_FALSE);
     AXIS2_MSG_CTX_SET_TRANSPORT_OUT_DESC(create_seq_msg, env, trans_out);
-    engine = axis2_engine_create(env, AXIS2_MSG_CTX_GET_CONF_CTX(create_seq_msg, 
+    engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(create_seq_msg, 
         env));
     if(!AXIS2_ENGINE_RESUME_SEND(engine, env, create_seq_msg))
     {
@@ -1128,6 +1147,7 @@
     sandesha2_seq_property_bean_t *out_seq_bean = NULL;
     axis2_endpoint_ref_t *to_epr = NULL;
     axis2_endpoint_ref_t *reply_to_epr = NULL;
+    const axis2_char_t *to_addr = NULL;
     axis2_char_t *new_to_str = NULL;
     sandesha2_seq_t *seq = NULL;
     sandesha2_seq_t *req_seq = NULL;
@@ -1172,7 +1192,7 @@
     if(reply_to_bean)
         reply_to_epr = axis2_endpoint_ref_create(env, 
             sandesha2_seq_property_bean_get_value(reply_to_bean, env));
-
+    to_addr = axis2_endpoint_ref_get_address(to_epr, env);
     if(AXIS2_MSG_CTX_GET_SERVER_SIDE(app_msg_ctx, env))
     {
         axis2_endpoint_ref_t *reply_to = NULL;
@@ -1269,6 +1289,44 @@
     /* TODO add_ack_requested */
     sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
     app_msg_entry = sandesha2_sender_bean_create(env);
+    if(axis2_msg_ctx_get_server_side(app_msg_ctx, env) &&
+       sandesha2_utils_is_single_channel(env, rm_version, to_addr))
+    {
+
+        axis2_char_t *incoming_seq_id = NULL;
+        sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
+        axis2_msg_ctx_t *msg_ctx = NULL;
+        axis2_msg_ctx_t *req_msg_ctx = NULL;
+        axis2_op_ctx_t *op_ctx = NULL;
+        sandesha2_seq_t *req_seq = NULL;
+       
+        msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+        req_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(op_ctx, env, 
+        AXIS2_WSDL_MESSAGE_LABEL_IN);
+        req_rm_msg_ctx = sandesha2_msg_init_init_msg(env, req_msg_ctx);
+        req_seq = (sandesha2_seq_t *) sandesha2_msg_ctx_get_msg_part(
+            req_rm_msg_ctx, env, SANDESHA2_MSG_PART_SEQ);
+        if(!req_seq)
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Sequence is NULL");
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST, 
+                AXIS2_FAILURE);
+            return AXIS2_FAILURE;
+        }
+        incoming_seq_id = sandesha2_identifier_get_identifier(
+            sandesha2_seq_get_identifier(req_seq, env), env);
+        if(!incoming_seq_id)
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Sequence ID is NULL");
+            return AXIS2_FAILURE;
+        }
+        sandesha2_msg_creator_add_ack_msg(env, rm_msg_ctx, incoming_seq_id, 
+            storage_mgr);
+        engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(msg_ctx, 
+            env));
+        return AXIS2_ENGINE_RESUME_SEND(engine, env, msg_ctx);
+    }
     sandesha2_sender_bean_set_msg_ctx_ref_key(app_msg_entry, env, 
         storage_key);
     millisecs = sandesha2_utils_get_current_time_in_millis(env);
@@ -1318,7 +1376,7 @@
     }
     AXIS2_MSG_CTX_SET_CURRENT_HANDLER_INDEX(app_msg_ctx, env, 
         AXIS2_MSG_CTX_GET_CURRENT_HANDLER_INDEX(app_msg_ctx, env) + 1);
-    engine = axis2_engine_create(env, AXIS2_MSG_CTX_GET_CONF_CTX(app_msg_ctx, 
+    engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(app_msg_ctx, 
         env));
     AXIS2_LOG_INFO(env->log,  
         "[Sandesha2] Exit:sandesha2_app_msg_processor_process_response_msg");

Modified: webservices/sandesha/trunk/c/src/util/ack_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/ack_mgr.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/util/ack_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/ack_mgr.c Wed Feb  7 23:38:08 2007
@@ -427,7 +427,7 @@
     sandesha2_sender_bean_set_msg_type(find_bean, env, SANDESHA2_MSG_TYPE_ACK);
     sandesha2_sender_bean_set_send(find_bean, env, AXIS2_TRUE);
     sandesha2_sender_bean_set_resend(find_bean, env, AXIS2_FALSE);
-   
+
     to = sandesha2_msg_ctx_get_to(rm_msg_ctx, env);
     if(to)
         to_str = (axis2_char_t*)AXIS2_ENDPOINT_REF_GET_ADDRESS(to, env);
@@ -438,7 +438,6 @@
     {
         sandesha2_sender_bean_t *sender_bean = NULL;
         long timenow = 0;
-        
         
         timenow = sandesha2_utils_get_current_time_in_millis(env);
         sender_bean = AXIS2_ARRAY_LIST_GET(found_list, env, i);

Modified: webservices/sandesha/trunk/c/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_creator.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_creator.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_creator.c Wed Feb  7 23:38:08 2007
@@ -915,7 +915,8 @@
     seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(storage_mgr, env);
     seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, seq_id, 
             SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
-    msg_no_list = (axis2_char_t *) sandesha2_seq_property_bean_get_value(
+    if(seq_bean)
+        msg_no_list = (axis2_char_t *) sandesha2_seq_property_bean_get_value(
             seq_bean, env); 
     ack_range_list = sandesha2_utils_get_ack_range_list(env, msg_no_list, 
             rm_ns_value);
@@ -951,7 +952,6 @@
             SANDESHA2_MSG_PART_SEQ_ACKNOWLEDGEMENT, 
             (sandesha2_iom_rm_part_t *) seq_ack);
     soap_header = AXIOM_SOAP_ENVELOPE_GET_HEADER(envelope, env);
-
     sandesha2_iom_rm_element_to_om_node((sandesha2_iom_rm_element_t *)seq_ack, env, soap_header);
 
     rm_version = sandesha2_utils_get_rm_version(env, seq_id, storage_mgr);

Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Wed Feb  7 23:38:08 2007
@@ -1278,7 +1278,7 @@
 axis2_bool_t AXIS2_CALL
 sandesha2_utils_is_anon_uri(
     const axis2_env_t *env,
-    axis2_char_t *address)
+    const axis2_char_t *address)
 {
     axis2_char_t *address_l = NULL;
     if(!address)
@@ -1317,5 +1317,17 @@
     AXIS2_ARRAY_LIST_ADD(list, env, value);
 
     return list;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_utils_is_single_channel(
+    const axis2_env_t *env,
+    const axis2_char_t *rm_version,
+    const axis2_char_t *reply_to_addr)
+{
+    if(sandesha2_utils_is_anon_uri(env, reply_to_addr) &&
+        (0 == AXIS2_STRCMP(SANDESHA2_SPEC_VERSION_1_0, rm_version)))
+        return AXIS2_TRUE;
+    else return AXIS2_FALSE;
 }
 

Modified: webservices/sandesha/trunk/c/src/workers/sender_worker.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender_worker.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Wed Feb  7 23:38:08 2007
@@ -388,7 +388,7 @@
                     rm_msg_ctx))
     {
         sandesha2_ack_mgr_piggyback_acks_if_present(env, rm_msg_ctx, 
-                    storage_mgr);
+            storage_mgr);
     }
     
     if(!transport_out) 

Modified: webservices/sandesha/trunk/c/src/wsrm/seq_ack.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/wsrm/seq_ack.c?view=diff&rev=504812&r1=504811&r2=504812
==============================================================================
--- webservices/sandesha/trunk/c/src/wsrm/seq_ack.c (original)
+++ webservices/sandesha/trunk/c/src/wsrm/seq_ack.c Wed Feb  7 23:38:08 2007
@@ -392,7 +392,6 @@
                         seq_ack_impl->must_understand);
     sa_node = AXIOM_SOAP_HEADER_BLOCK_GET_BASE_NODE(sa_block, env);
     sandesha2_iom_rm_element_to_om_node((sandesha2_iom_rm_element_t *)seq_ack_impl->identifier, env, sa_node);
-
     for(i = 0; i < AXIS2_ARRAY_LIST_SIZE(seq_ack_impl->ack_range_list, env); i++)
     {
         sandesha2_ack_range_t *ack_range = NULL;



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