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 sa...@apache.org on 2006/07/22 08:20:07 UTC

svn commit: r424527 - in /webservices/sandesha/trunk/c: include/ include/sandesha2/ src/ src/handlers/ src/msgprocessors/ src/util/ src/workers/

Author: sahan
Date: Fri Jul 21 23:20:06 2006
New Revision: 424527

URL: http://svn.apache.org/viewvc?rev=424527&view=rev
Log:
Fixing some bugs
Adding msg validator
adding msg_retrans_adjuster

Added:
    webservices/sandesha/trunk/c/include/sandesha2_msg_retrans_adjuster.h
    webservices/sandesha/trunk/c/include/sandesha2_msg_validator.h
    webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c
    webservices/sandesha/trunk/c/src/msg_validator.c
    webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
Modified:
    webservices/sandesha/trunk/c/include/sandesha2/sandesha2_app_msg_processor.h
    webservices/sandesha/trunk/c/include/sandesha2/sandesha2_utils.h
    webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h
    webservices/sandesha/trunk/c/include/sandesha2_seq_mgr.h
    webservices/sandesha/trunk/c/src/Makefile.am
    webservices/sandesha/trunk/c/src/handlers/Makefile.am
    webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
    webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/util/Makefile.am
    webservices/sandesha/trunk/c/src/util/msg_creator.c
    webservices/sandesha/trunk/c/src/util/utils.c
    webservices/sandesha/trunk/c/src/workers/in_order_invoker.c

Modified: webservices/sandesha/trunk/c/include/sandesha2/sandesha2_app_msg_processor.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2/sandesha2_app_msg_processor.h?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2/sandesha2_app_msg_processor.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2/sandesha2_app_msg_processor.h Fri Jul 21 23:20:06 2006
@@ -25,6 +25,7 @@
 #include <axis2_utils_defines.h>
 #include <axis2_env.h>
 #include <sandesha2/sandesha2_msg_processor.h>
+#include <sandesha2_storage_mgr.h>
 
 
 #ifdef __cplusplus
@@ -40,6 +41,14 @@
 AXIS2_EXTERN sandesha2_msg_processor_t* AXIS2_CALL
 sandesha2_app_msg_processor_create(
 						const axis2_env_t *env);
+                        
+axis2_status_t AXIS2_CALL 
+sandesha2_app_msg_processor_send_ack_if_reqd(
+                        sandesha2_msg_processor_t *msg_processor,
+                    	const axis2_env_t *env,
+                        sandesha2_msg_ctx_t *msg_ctx,
+                        axis2_char_t *msg_str,
+                        sandesha2_storage_mgr_t *mgr);
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/sandesha/trunk/c/include/sandesha2/sandesha2_utils.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2/sandesha2_utils.h?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2/sandesha2_utils.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2/sandesha2_utils.h Fri Jul 21 23:20:06 2006
@@ -147,8 +147,18 @@
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 sandesha2_utils_trim_string(const axis2_env_t *env, 
                         axis2_char_t *orig_string);
-                        
 
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL                        
+sandesha2_utils_is_retriable_on_faults(const axis2_env_t *env,
+                        axis2_msg_ctx_t *msg_ctx);
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+sandesha2_utils_is_rm_global_msg(const axis2_env_t *env,
+                        axis2_msg_ctx_t *msg_ctx);
+                        
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+sandesha2_utils_get_seq_id_from_rm_msg_ctx(const axis2_env_t *env, 
+                        sandesha2_msg_ctx_t *rm_msg_ctx);
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h Fri Jul 21 23:20:06 2006
@@ -67,7 +67,7 @@
  * @return
  */
 sandesha2_msg_ctx_t *
-sandesha2_msg_creator_create_create_seq_response_msg(
+sandesha2_msg_creator_create_create_seq_res_msg(
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *create_seq_msg,
         axis2_msg_ctx_t *out_msg,
@@ -82,13 +82,28 @@
  * @return
  */
 sandesha2_msg_ctx_t *
-sandesha2_msg_creator_create_close_seq_response_msg(
+sandesha2_msg_creator_create_close_seq_res_msg(
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *close_seq_msg,
         axis2_msg_ctx_t *out_msg,
         sandesha2_storage_mgr_t *storage_mgr);
 
 
+sandesha2_msg_ctx_t *AXIS2_CALL
+sandesha2_msg_creator_create_terminate_seq_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *ref_rm_msg,
+        axis2_char_t *seq_id,
+        axis2_char_t *internal_seq_id,
+        sandesha2_storage_mgr_t *storage_mgr);
+
+
+sandesha2_msg_ctx_t *AXIS2_CALL
+sandesha2_msg_creator_create_terminate_seq_res_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *ref_rm_msg,
+        axis2_msg_ctx_t *out_msg,
+        sandesha2_storage_mgr_t *storage_mgr);
 /** @} */
 #ifdef __cplusplus
 }

Added: webservices/sandesha/trunk/c/include/sandesha2_msg_retrans_adjuster.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_msg_retrans_adjuster.h?rev=424527&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_msg_retrans_adjuster.h (added)
+++ webservices/sandesha/trunk/c/include/sandesha2_msg_retrans_adjuster.h Fri Jul 21 23:20:06 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_MSG_RETRANS_ADJUSTER_H
+#define SANDESHA2_MSG_RETRANS_ADJUSTER_H
+
+/**
+ * @file sandesha2_msg_retrans_adjuster.h
+ * @brief Sandesha Message Retransmission Adjuster
+ */
+
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_sender_bean.h>
+#include <axis2_conf_ctx.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup sandesha2_msg_retrans_adjuster 
+  * @ingroup sandesha2_utils
+  * @{
+  */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+sandesha2_msg_retrans_adjuster_adjust_retrans(
+        const axis2_env_t *env,
+        sandesha2_sender_bean_t *retrans_bean,
+        axis2_conf_ctx_t *conf_ctx, 
+        sandesha2_storage_mgr_t *storage_mgr);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* SANDESHA2_MSG_RETRANS_ADJUSTER_H */

Added: webservices/sandesha/trunk/c/include/sandesha2_msg_validator.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_msg_validator.h?rev=424527&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_msg_validator.h (added)
+++ webservices/sandesha/trunk/c/include/sandesha2_msg_validator.h Fri Jul 21 23:20:06 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_MSG_VALIDATOR_H
+#define SANDESHA2_MSG_VALIDATOR_H
+
+/**
+ * @file sandesha2_msg_validator.h
+ * @brief Sandesha Message Validator
+ */
+
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2/sandesha2_msg_ctx.h>
+#include <axis2_msg_ctx.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup sandesha2_msg_validator 
+  * @ingroup sandesha2
+  * @{
+  */
+
+axis2_status_t AXIS2_CALL
+sandesha2_msg_validator_validate_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *rm_msg_ctx, 
+        sandesha2_storage_mgr_t *storage_mgr);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* SANDESHA2_MSG_VALIDATOR_H */

Modified: webservices/sandesha/trunk/c/include/sandesha2_seq_mgr.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_seq_mgr.h?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_seq_mgr.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_seq_mgr.h Fri Jul 21 23:20:06 2006
@@ -24,6 +24,7 @@
 
 #include <axis2_allocator.h>
 #include <axis2_env.h>
+#include <axis2_utils_defines.h>
 #include <axis2_error.h>
 #include <axis2_string.h>
 #include <axis2_utils.h>
@@ -43,11 +44,11 @@
   * @{
   */
 
-AXIS_EXTERN axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 sandesha2_seq_mgr_set_up_new_seq(
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *create_seq_msg, 
-        sandehsa2_storage_mgr_t *storage_mgr);
+        sandesha2_storage_mgr_t *storage_mgr);
        
 /**
  * Takes the internal_seq_id as the param. Not the seq_id
@@ -58,7 +59,7 @@
 sandesha2_seq_mgr_update_last_activated_time(
         const axis2_env_t *env,
         axis2_char_t *property_key,
-        axis2_storage_mgr_t *storage_mgr);
+        sandesha2_storage_mgr_t *storage_mgr);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/trunk/c/src/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/Makefile.am?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/Makefile.am (original)
+++ webservices/sandesha/trunk/c/src/Makefile.am Fri Jul 21 23:20:06 2006
@@ -1,8 +1,9 @@
-SUBDIRS = wsrm storage util transport workers client handlers
+SUBDIRS = wsrm storage util transport workers client handlers msgprocessors
 noinst_LTLIBRARIES = libsandesha2.la
 
 libsandesha2_la_SOURCES = msg_ctx.c\
-                          mod_sandesha2.c
+                          mod_sandesha2.c\
+                          msg_validator.c
 
 INCLUDES = -I$(top_builddir)/include \
             @AXIS2INC@

Modified: webservices/sandesha/trunk/c/src/handlers/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/Makefile.am?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/Makefile.am (original)
+++ webservices/sandesha/trunk/c/src/handlers/Makefile.am Fri Jul 21 23:20:06 2006
@@ -2,6 +2,7 @@
 
 libsandesha_handlers_la_SOURCES = \
 							sandesha2_in_handler.c \
+							sandesha2_global_in_handler.c \
 							sandesha2_out_handler.c
 
 INCLUDES = -I$(top_builddir)/include \

Added: webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c?rev=424527&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c (added)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c Fri Jul 21 23:20:06 2006
@@ -0,0 +1,425 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_handler_desc.h>
+#include <axis2_array_list.h>
+#include <axis2_svc.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_property.h>
+#include <axis2_conf_ctx.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_msg_ctx.h>
+#include <sandesha2_transaction.h>
+#include <sandesha2_msg_processor.h>
+#include <sandesha2_msg_init.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_utils.h>
+#include <axiom_soap_fault.h>
+#include <axiom_soap_body.h>
+#include <axis2_relates_to.h>
+#include <sandesha2/sandesha2_seq.h>
+#include <sandesha2/sandesha2_msg_number.h>
+#include <sandesha2/sandesha2_identifier.h>
+#include <sandesha2/sandesha2_app_msg_processor.h>
+
+axis2_qname_t *AXIS2_CALL
+sandesha2_global_in_handler_get_qname(
+        struct axis2_handler *handler, 
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+sandesha2_global_in_handler_invoke(
+        struct axis2_handler *handler, 
+        const axis2_env_t *env,
+        struct axis2_msg_ctx *msg_ctx);
+                                             
+/******************************************************************************/                         
+
+AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
+sandesha2_global_in_handler_create(
+        const axis2_env_t *env, 
+        axis2_qname_t *qname) 
+{
+    axis2_handler_t *handler = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    handler = axis2_handler_create(env);
+    if (!handler)
+    {
+        return NULL;
+    }
+   
+    /* handler init is handled by conf loading, so no need to do it here */
+    
+    /* set the base struct's invoke op */
+    if (handler->ops) 
+        handler->ops->invoke = sandesha2_global_in_handler_invoke;
+
+    return handler;
+}
+
+
+axis2_status_t AXIS2_CALL
+sandesha2_global_in_handler_invoke(
+        struct axis2_handler *handler, 
+        const axis2_env_t *env,
+        struct axis2_msg_ctx *msg_ctx)
+{
+    
+    axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_conf_t *conf = NULL;
+    axis2_ctx_t *ctx = NULL;
+    axiom_soap_envelope_t *soap_envelope = NULL;
+    axis2_bool_t within_transaction = AXIS2_FALSE;
+    axis2_char_t *within_transaction_str = NULL;
+    axiom_soap_fault_t *fault_part = NULL;
+    axis2_char_t *reinjected_msg = AXIS2_FALSE;
+    axis2_bool_t is_rm_global_msg = AXIS2_FALSE;
+    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
+    axis2_bool_t dropped = AXIS2_FALSE;
+    sandesha2_storage_mgr_t *storage_mgr = NULL;
+    sandesha2_transaction_t *transaction = NULL;
+    axis2_property_t *property = NULL;
+    
+    
+    AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
+    
+    AXIS2_LOG_INFO(env->log, "[sandesha2]Starting sandesha2 in handler ......");
+
+    conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+    if(conf_ctx == NULL)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Configuration"
+                        " Context is NULL");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
+    conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+    
+    soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
+    if(NULL == soap_envelope)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]SOAP envelope "
+                        "is NULL");
+        return AXIS2_FAILURE;
+    }
+    property = AXIS2_CTX_GET_PROPERTY(ctx, env, SANDESHA2_REINJECTED_MESSAGE, 
+            AXIS2_FALSE);
+    reinjected_msg = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(property, env); 
+    if(reinjected_msg && 0 == AXIS2_STRCMP(SANDESHA2_VALUE_TRUE, reinjected_msg))
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Detected"
+                        " reinjected_msg");
+        return AXIS2_SUCCESS; /* Reinjected Messages are not processed by 
+                                 sandesha2 inflow handlers */
+    }
+    storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, conf);
+    if(NULL == storage_mgr)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot get the "
+                        "storage manager");
+        return AXIS2_FAILURE;
+    }
+    property = AXIS2_CTX_GET_PROPERTY(ctx, env, 
+                        SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE);
+    within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
+                        property, env);
+    if(within_transaction_str && 0 == AXIS2_STRCMP(SANDESHA2_VALUE_TRUE, 
+                within_transaction_str))
+    {
+        within_transaction = AXIS2_TRUE;
+    }
+    if(AXIS2_TRUE != within_transaction)
+    {
+        axis2_property_t *prop = NULL;
+        
+        transaction = SANDESHA2_STORAGE_MGR_GET_TRANSACTION(storage_mgr, env);
+        prop = axis2_property_create(env);
+        AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+        AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_TRUE);
+        AXIS2_CTX_SET_PROPERTY(ctx, env, SANDESHA2_WITHIN_TRANSACTION, prop, 
+                AXIS2_FALSE);
+    }
+    fault_part = AXIOM_SOAP_BODY_GET_FAULT(AXIOM_SOAP_ENVELOPE_GET_BODY(
+                        soap_envelope, env), env);
+    if(NULL != fault_part)
+    {
+        axis2_relates_to_t *relates_to = NULL;
+        
+        relates_to = AXIS2_MSG_CTX_GET_RELATES_TO(msg_ctx, env);
+        if(NULL != relates_to)
+        {
+            axis2_char_t *relates_to_val = NULL;
+            axis2_op_ctx_t *op_ctx = NULL;
+            
+            relates_to_val = AXIS2_RELATES_TO_GET_VALUE(relates_to, env);
+            op_ctx = AXIS2_CONF_CTX_GET_OP_CTX(conf_ctx, env, relates_to_val);
+            if(NULL != op_ctx)
+            {
+                axis2_msg_ctx_t *req_msg_ctx = NULL;
+                req_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(op_ctx, env, 
+                        AXIS2_WSDL_MESSAGE_LABEL_OUT_VALUE);
+                if(NULL != req_msg_ctx)
+                {
+                    if(AXIS2_TRUE == sandesha2_utils_is_retriable_on_faults(env,
+                        req_msg_ctx))
+                    {
+                        /* TODO we need to notify the listners */
+                        AXIS2_MSG_CTX_PAUSE(msg_ctx, env);
+                        return AXIS2_SUCCESS;
+                    }
+                }
+            }
+        }
+    }
+    is_rm_global_msg = sandesha2_utils_is_rm_global_msg(env, msg_ctx);
+    if(AXIS2_FALSE == is_rm_global_msg)
+        return AXIS2_SUCCESS;
+    rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
+    dropped = sandesha2_global_in_handler_drop_if_duplicate(handler, env, 
+                        rm_msg_ctx, storage_mgr);
+    if(AXIS2_TRUE == dropped)
+    {
+        sandesha2_global_in_handler_process_dropped_msg(handler, env, rm_msg_ctx,
+                        storage_mgr);
+        return AXIS2_SUCCESS;
+    }
+    /*Process if global processing possible. - Currently none*/
+    if(AXIS2_TRUE == within_transaction)
+    {
+        SANDESHA2_TRANSACTION_COMMIT(transaction, env);
+        property = axis2_property_create(env);
+        AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+        AXIS2_PROPERTY_SET_VALUE(property, env, AXIS2_STRDUP(
+                        SANDESHA2_VALUE_FALSE, env));
+        AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, SANDESHA2_WITHIN_TRANSACTION,
+                        property, AXIS2_FALSE);
+    }
+       
+    return AXIS2_SUCCESS;
+}
+
+axis2_qname_t *AXIS2_CALL
+sandesha2_global_in_handler_get_qname(
+        struct axis2_handler *handler, 
+        const axis2_env_t *env)
+{
+    return axis2_qname_create(env, SANDESHA2_GLOBAL_IN_HANDLER_NAME, NULL, NULL);
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_global_in_handler_drop_if_duplicate(
+                        struct axis2_handler *handler, 
+                        const axis2_env_t *env,
+                        sandesha2_msg_ctx_t *rm_msg_ctx,
+                        sandesha2_storage_mgr_t *storage_mgr)
+{
+    axis2_bool_t drop = AXIS2_FALSE;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FALSE);
+    
+    if(SANDESHA2_MSG_TYPE_APPLICATION == SANDESHA2_MSG_CTX_GET_MSG_TYPE(
+                        rm_msg_ctx, env))
+    {
+        sandesha2_seq_t *sequence = NULL;
+        long msg_no = -1;
+        axis2_char_t *seq_id = NULL;
+        
+        sequence = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, 
+                        env, SANDESHA2_MSG_PART_SEQ);
+        if(NULL != sequence)
+        {
+            seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_SEQ_GET_IDENTIFIER(sequence, env), env);
+            msg_no = SANDESHA2_MSG_NUMBER_GET_MSG_NUM(SANDESHA2_SEQ_GET_MSG_NUM(
+                        sequence, env), env);
+        }
+        if(NULL != seq_id && 0 < msg_no)
+        {
+            sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
+            sandesha2_seq_property_bean_t *rcvd_msgs_bean = NULL;
+            
+            seq_prop_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_MGR(
+                        storage_mgr, env);
+            rcvd_msgs_bean = SANDESHA2_SEQ_PROPERTY_MGR_RETRIEVE(seq_prop_mgr,
+                        env, seq_id, 
+                        SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
+            if(NULL != rcvd_msgs_bean)
+            {
+                axis2_char_t *rcvd_msgs_str = NULL;
+                axis2_array_list_t *msg_no_list = NULL;
+                int i = 0;
+                
+                rcvd_msgs_str = SANDESHA2_SEQ_PROPERTY_BEAN_GET_VALUE(
+                        rcvd_msgs_bean, env);
+                msg_no_list = sandesha2_utils_get_array_list_from_string(env,
+                        rcvd_msgs_str);
+                for(i = 0; i < AXIS2_ARRAY_LIST_SIZE(msg_no_list, env); i++)
+                {
+                    axis2_char_t *temp = NULL;
+                    
+                    temp = AXIS2_ARRAY_LIST_GET(msg_no_list, env, i);
+                    if(atol(temp) == msg_no)
+                        drop = AXIS2_TRUE;
+                }
+            }
+            if(AXIS2_FALSE == drop)
+            {
+                axiom_soap_body_t *soap_body = NULL;
+                axiom_node_t *body_node = NULL;
+                axiom_element_t *body_element = NULL;
+                axiom_children_iterator_t *children_iterator = NULL;
+                axis2_bool_t empty_body = AXIS2_FALSE;
+            
+            
+                soap_body = AXIOM_SOAP_ENVELOPE_GET_BODY(
+                        SANDESHA2_MSG_CTX_GET_SOAP_ENVELOPE(rm_msg_ctx, env), 
+                        env);
+                body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+                body_element = AXIOM_NODE_GET_DATA_ELEMENT(body_node, env);
+                children_iterator = AXIOM_ELEMENT_GET_CHILDREN(body_element, env, 
+                        body_node);
+                if(AXIS2_FALSE == AXIOM_CHILDREN_ITERATOR_HAS_NEXT(
+                        children_iterator, env))
+                    empty_body = AXIS2_TRUE;
+                if(AXIS2_TRUE == empty_body)
+                {
+                    axis2_char_t *rcvd_msgs_str1 = NULL;
+                    axis2_char_t *bean_value = NULL;
+                    axis2_char_t msg_no_str[32];
+                    sandesha2_msg_processor_t *app_msg_processor = NULL;
+                    
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Empty "
+                        "body last msg recieved");
+                    drop = AXIS2_TRUE;
+                    if(NULL == rcvd_msgs_bean)
+                    {
+                        rcvd_msgs_bean = sandesha2_seq_property_bean_create_with_data
+                            (env, seq_id, 
+                            SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+                        SANDESHA2_SEQ_PROPERTY_MGR_INSERT(seq_prop_mgr, env,
+                            rcvd_msgs_bean);
+                    }
+                    rcvd_msgs_str1 = SANDESHA2_SEQ_PROPERTY_BEAN_GET_VALUE(
+                            rcvd_msgs_bean, env);
+                    sprintf(msg_no_str, "%ld", msg_no);
+                    if(NULL!= rcvd_msgs_str1 && 0 < AXIS2_STRLEN(rcvd_msgs_str1))
+                        bean_value = axis2_strcat(env, rcvd_msgs_str1, ",",
+                            msg_no_str, NULL);
+                    else
+                        bean_value = AXIS2_STRDUP(msg_no_str, env);
+                    
+                    SANDESHA2_SEQ_PROPERTY_BEAN_SET_VALUE(rcvd_msgs_bean, env,
+                        bean_value);
+                    SANDEASHA2_SEQ_PROPERTY_MGR_UPDATE(seq_prop_mgr, env, 
+                        rcvd_msgs_bean);
+                    app_msg_processor = sandesha2_app_msg_processor_create(env);
+                    sandesha2_app_msg_processor_send_ack_if_reqd(
+                        app_msg_processor, env, rm_msg_ctx, bean_value, 
+                        storage_mgr);
+                }
+            }
+        }        
+    } else if(SANDESHA2_MSG_TYPE_UNKNOWN == SANDESHA2_MSG_CTX_GET_MSG_TYPE(
+                        rm_msg_ctx, env))
+    {
+        axis2_relates_to_t *relates_to = NULL;
+        axis2_conf_ctx_t *conf_ctx = NULL;
+        
+        
+        relates_to = SANDESHA2_MSG_CTX_GET_RELATES_TO(rm_msg_ctx, env);
+        if(NULL != relates_to)
+        {
+            axis2_char_t *relates_to_val = NULL;
+            axis2_op_ctx_t *op_ctx = NULL;
+            axis2_op_ctx_t *op_ctx1 = NULL;
+            
+            relates_to_val = AXIS2_RELATES_TO_GET_VALUE(relates_to, env);
+            conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(SANDESHA2_MSG_CTX_GET_MSG_CTX(
+                        rm_msg_ctx, env), env);
+            op_ctx = AXIS2_CONF_CTX_GET_OP_CTX(conf_ctx, env, relates_to_val);
+            op_ctx1 = AXIS2_MSG_CTX_GET_OP_CTX(SANDESHA2_MSG_CTX_GET_MSG_CTX(
+                        rm_msg_ctx, env), env);
+            if(NULL == op_ctx && NULL == op_ctx1)
+            {
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Dropping"
+                        " duplicate RM message");
+                drop = AXIS2_TRUE;
+            }
+        }
+    }
+    if(AXIS2_TRUE == drop)
+    {
+        SANDESHA2_MSG_CTX_PAUSE(rm_msg_ctx, env);
+        return AXIS2_TRUE;
+    }
+    return AXIS2_FALSE;
+}
+
+
+axis2_status_t AXIS2_CALL
+sandesha2_global_in_handler_process_dropped_msg(
+                        struct axis2_handler *handler, 
+                        const axis2_env_t *env,
+                        sandesha2_msg_ctx_t *rm_msg_ctx,
+                        sandesha2_storage_mgr_t *storage_mgr)
+{
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FALSE);
+    
+    if(SANDESHA2_MSG_TYPE_APPLICATION == SANDESHA2_MSG_CTX_GET_MSG_TYPE(
+                        rm_msg_ctx, env))
+    {
+        sandesha2_seq_t *sequence = NULL;
+        axis2_char_t *seq_id = NULL;
+        
+        sequence = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, 
+                        env, SANDESHA2_MSG_PART_SEQ);
+        if(NULL != sequence)
+            seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_SEQ_GET_IDENTIFIER(sequence, env), env);
+            
+        if(NULL != seq_id)
+        {
+            sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
+            sandesha2_seq_property_bean_t *rcvd_msgs_bean = NULL;
+            axis2_char_t *rcvd_msgs_str = NULL;
+            sandesha2_msg_processor_t *app_msg_processor = NULL;
+            
+            seq_prop_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_MGR(
+                        storage_mgr, env);
+            rcvd_msgs_bean = SANDESHA2_SEQ_PROPERTY_MGR_RETRIEVE(seq_prop_mgr,
+                        env, seq_id, 
+                        SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
+            rcvd_msgs_str = SANDESHA2_SEQ_PROPERTY_BEAN_GET_VALUE(
+                        rcvd_msgs_bean, env);
+            app_msg_processor = sandesha2_app_msg_processor_create(env);
+            sandesha2_app_msg_processor_send_ack_if_reqd(
+                        app_msg_processor, env, rm_msg_ctx, rcvd_msgs_str, 
+                        storage_mgr);
+            
+        }
+    }
+    return AXIS2_SUCCESS;
+}
+

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Fri Jul 21 23:20:06 2006
@@ -29,12 +29,12 @@
 #include <sandesha2_utils.h>
 
 axis2_qname_t *AXIS2_CALL
-axis2_sandesha2_in_handler_get_qname(
+sandesha2_in_handler_get_qname(
         struct axis2_handler *handler, 
         const axis2_env_t *env);
 
 axis2_status_t AXIS2_CALL
-axis2_sandesha2_in_handler_invoke(
+sandesha2_in_handler_invoke(
         struct axis2_handler *handler, 
         const axis2_env_t *env,
         struct axis2_msg_ctx *msg_ctx);
@@ -42,7 +42,7 @@
 /******************************************************************************/                         
 
 AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
-axis2_sandesha2_in_handler_create(
+sandesha2_in_handler_create(
         const axis2_env_t *env, 
         axis2_qname_t *qname) 
 {
@@ -60,14 +60,14 @@
     
     /* set the base struct's invoke op */
     if (handler->ops) 
-        handler->ops->invoke = axis2_sandesha2_in_handler_invoke;
+        handler->ops->invoke = sandesha2_in_handler_invoke;
 
     return handler;
 }
 
 
 axis2_status_t AXIS2_CALL
-axis2_sandesha2_in_handler_invoke(
+sandesha2_in_handler_invoke(
         struct axis2_handler *handler, 
         const axis2_env_t *env,
         struct axis2_msg_ctx *msg_ctx)
@@ -233,7 +233,7 @@
 }
 
 axis2_qname_t *AXIS2_CALL
-axis2_sandesha2_in_handler_get_qname(
+sandesha2_in_handler_get_qname(
         struct axis2_handler *handler, 
         const axis2_env_t *env)
 {

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Fri Jul 21 23:20:06 2006
@@ -32,12 +32,12 @@
 #include "../client/sandesha2_client_constants.h"
 
 axis2_qname_t *AXIS2_CALL
-axis2_sandesha2_out_handler_get_qname(
+sandesha2_out_handler_get_qname(
         struct axis2_handler *handler, 
         const axis2_env_t *env);
 
 axis2_status_t AXIS2_CALL
-axis2_sandesha2_out_handler_invoke(
+sandesha2_out_handler_invoke(
         struct axis2_handler *handler, 
         const axis2_env_t *env,
         struct axis2_msg_ctx *msg_ctx);
@@ -45,7 +45,7 @@
 /******************************************************************************/                         
 
 AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
-axis2_sandesha2_out_handler_create(
+sandesha2_out_handler_create(
         const axis2_env_t *env, 
         axis2_qname_t *qname) 
 {
@@ -63,14 +63,14 @@
     
     /* set the base struct's invoke op */
     if (handler->ops) 
-        handler->ops->invoke = axis2_sandesha2_out_handler_invoke;
+        handler->ops->invoke = sandesha2_out_handler_invoke;
 
     return handler;
 }
 
 
 axis2_status_t AXIS2_CALL
-axis2_sandesha2_out_handler_invoke(
+sandesha2_out_handler_invoke(
         struct axis2_handler *handler, 
         const axis2_env_t *env,
         struct axis2_msg_ctx *msg_ctx)
@@ -232,7 +232,7 @@
 }
 
 axis2_qname_t *AXIS2_CALL
-axis2_sandesha2_out_handler_get_qname(
+sandesha2_out_handler_get_qname(
         struct axis2_handler *handler, 
         const axis2_env_t *env)
 {

Added: webservices/sandesha/trunk/c/src/msg_validator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msg_validator.c?rev=424527&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/msg_validator.c (added)
+++ webservices/sandesha/trunk/c/src/msg_validator.c Fri Jul 21 23:20:06 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <sandesha2_msg_validator.h>
+#include <sandesha2/sandesha2_utils.h>
+#include <sandesha2/sandesha2_constants.h>
+#include <sandesha2/sandesha2_spec_specific_consts.h>
+
+
+
+axis2_status_t AXIS2_CALL
+sandesha2_msg_validator_validate_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *rm_msg_ctx, 
+        sandesha2_storage_mgr_t *storage_mgr)
+{
+    int msg_type = -1;
+    axis2_char_t *seq_id = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FAILURE);
+    
+    msg_type = SANDESHA2_MSG_CTX_GET_MSG_TYPE(rm_msg_ctx, env);
+    if(SANDESHA2_MSG_TYPE_CREATE_SEQ != msg_type && 
+                        SANDESHA2_MSG_TYPE_UNKNOWN != msg_type)
+    {
+        seq_id = sandesha2_utils_get_seq_id_from_rm_msg_ctx(env, rm_msg_ctx);
+        if(NULL != seq_id)
+        {
+            axis2_char_t *rm_ver_seq = NULL;
+            axis2_char_t *addr_ns_seq = NULL;
+            axis2_char_t *rm_ns_msg = NULL;
+            axis2_char_t *addr_ns_msg = NULL;
+            axis2_char_t *rm_ns_seq = NULL;
+            
+            rm_ver_seq = sandesha2_utils_get_seq_property(env, seq_id, 
+                        SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, storage_mgr);
+            addr_ns_seq = sandesha2_utils_get_seq_property(env, seq_id, 
+                        SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, 
+                        storage_mgr);
+            rm_ns_msg = SANDESHA2_MSG_CTX_GET_RM_NS_VAL(rm_msg_ctx, env);
+            addr_ns_msg = SANDESHA2_MSG_CTX_GET_ADDR_NS_VAL(rm_msg_ctx, env);
+            
+            if(NULL != rm_ver_seq)
+                rm_ns_seq = sandesha2_spec_specific_consts_get_rm_ns_val(env,
+                        rm_ver_seq);
+            
+            if(NULL != rm_ns_seq && 0 != AXIS2_STRCMP(rm_ns_seq, rm_ns_msg))
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Validation"
+                        " failed. The RM namespace of the message does not"
+                        " match with the sequence");
+                return AXIS2_FAILURE;
+            } 
+            if(NULL != addr_ns_seq && 0 != AXIS2_STRCMP(addr_ns_seq, addr_ns_msg))
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Validation"
+                        " failed. The Addressing namespace of the message does"
+                        " not match with the sequence");
+                return AXIS2_FAILURE;
+            }            
+            
+        }   
+    }
+    return AXIS2_SUCCESS;
+}
+  

Modified: webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -40,6 +40,7 @@
 #include <sandesha2/sandesha2_spec_specific_consts.h>
 #include <sandesha2/sandesha2_ack_requested.h>
 #include <axis2_addr.h>
+#include <sandesha2_msg_init.h>
 
 /** 
  * @brief Ack Requested Message Processor struct impl
@@ -210,7 +211,7 @@
     AXIS2_MSG_CTX_SET_PROPERTY(ack_msg_ctx, env, 
                         SANDESHA2_APPLICATION_PROCESSING_DONE, property, 
                         AXIS2_FALSE);
-    ack_rm_msg = sandesha2_msg_initilizer_init_msg(env, ack_msg_ctx);
+    ack_rm_msg = sandesha2_msg_init_init_msg(env, ack_msg_ctx);
     SANDESHA2_MSG_CTX_SET_RM_NS_VAL(ack_rm_msg, env, 
                         SANDESHA2_MSG_CTX_GET_RM_NS_VAL(rm_msg_ctx, env));
     AXIS2_MSG_CTX_SET_MSG_ID(ack_msg_ctx, env, axis2_uuid_gen(env));

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?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -15,6 +15,7 @@
  */
  
 #include <sandesha2/sandesha2_app_msg_processor.h>
+#include <sandesha2/sandesha2_ack_msg_processor.h>
 #include <sandesha2/sandesha2_seq_ack.h>
 #include <sandesha2/sandesha2_seq.h>
 #include <sandesha2/sandesha2_ack_requested.h>
@@ -38,6 +39,10 @@
 #include <axiom_soap_const.h>
 #include "../client/sandesha2_client_constants.h"
 #include <stdio.h>
+#include <sandesha2_msg_init.h>
+#include <sandesha2_ack_mgr.h>
+#include <sandesha2_msg_creator.h>
+
 /** 
  * @brief Application Message Processor struct impl
  *	Sandesha2 App Msg Processor
@@ -214,7 +219,7 @@
     if(NULL != seq_ack)
     {
         sandesha2_msg_processor_t *ack_proc = NULL;
-        ack_proc = sandesha2_ack_processor_create(env);
+        ack_proc = sandesha2_ack_msg_processor_create(env);
         SANDESHA2_MSG_PROCESSOR_PROCESS_IN_MSG(ack_proc, env, msg_ctx);
     }
     
@@ -551,7 +556,7 @@
         
         req_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(AXIS2_MSG_CTX_GET_OP_CTX(
                         msg_ctx1, env), env, AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE);
-        req_rm_msg_ctx = sandesha2_msg_initilizer_init_msg(env, req_msg_ctx);
+        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(NULL == req_seq)
@@ -705,7 +710,7 @@
                         AXIS2_FAILURE);
             return AXIS2_FAILURE;
         }
-        req_rm_msg_ctx = sandesha2_msg_initilizer_init_msg(env, req_msg_ctx);
+        req_rm_msg_ctx = sandesha2_msg_init_init_msg(env, req_msg_ctx);
         seq = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(req_rm_msg_ctx, 
                         env, SANDESHA2_MSG_PART_SEQ);
         req_seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
@@ -1193,7 +1198,7 @@
     
     if(AXIS2_TRUE == AXIS2_MSG_CTX_IS_SERVER_SIDE(msg, env))
     {
-        req_rm_msg = sandesha2_msg_initilizer_init_msg(env, req_msg);
+        req_rm_msg = sandesha2_msg_init_init_msg(env, req_msg);
         req_seq = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(req_rm_msg, 
                         env, SANDESHA2_MSG_PART_SEQ);
         if(NULL == seq)

Modified: webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -38,6 +38,8 @@
 #include <axis2_op_ctx.h>
 #include <sandesha2/sandesha2_spec_specific_consts.h>
 #include <axis2_core_utils.h>
+#include <sandesha2_ack_mgr.h>
+#include <sandesha2_msg_creator.h>
 
 /** 
  * @brief Close Sequence Message Processor struct impl
@@ -201,7 +203,7 @@
     close_seq_res_msg = axis2_core_utils_create_out_msg_ctx(env, msg_ctx);
     
     close_seq_res_rm_msg = sandesha2_msg_creator_create_close_seq_res_msg(env, 
-                        close_seq_res_msg);
+                        rm_msg_ctx, close_seq_res_msg, storage_mgr);
     
     SANDESHA2_MSG_CTX_SET_MSG_PART(close_seq_res_rm_msg, env, 
                         SANDESHA2_MSG_PART_SEQ_ACKNOWLEDGEMENT,

Modified: webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -43,6 +43,8 @@
 #include <axis2_endpoint_ref.h>
 #include <axis2_op_ctx.h>
 #include <sandesha2/sandesha2_spec_specific_consts.h>
+#include <sandesha2_msg_creator.h>
+#include <sandesha2_seq_mgr.h>
 
 /** 
  * @brief Create Sequence Message Processor struct impl
@@ -198,9 +200,9 @@
         return AXIS2_SUCCESS;
     }
     out_msg_ctx = axis2_core_utils_create_out_msg_ctx(env, msg_ctx);
-    seq_prop_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_BEAN_MGR(storage_mgr, 
+    seq_prop_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_MGR(storage_mgr, 
                         env);
-    new_seq_id = sadesha2_seq_manager_setup_new_seq(env, rm_msg_ctx, 
+    new_seq_id = sandesha2_seq_mgr_set_up_new_seq(env, rm_msg_ctx, 
                         storage_mgr);
     create_seq_res_msg = sandesha2_msg_creator_create_create_seq_res_msg(env,
                         rm_msg_ctx, out_msg_ctx, new_seq_id, storage_mgr);

Modified: webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -47,6 +47,7 @@
 #include <sandesha2/sandesha2_ack_requested.h>
 #include <axis2_relates_to.h>
 #include <sandesha2_next_msg_mgr.h>
+#include <sandesha2_msg_init.h>
 
 
 /** 
@@ -374,7 +375,7 @@
         }
         assumed_rm_ns = sandesha2_spec_specific_consts_get_rm_ns_val(env,
                         rm_ver);
-        app_rm_msg = sandesha2_msg_initilizer_init_msg(env, app_msg_ctx);
+        app_rm_msg = sandesha2_msg_init_init_msg(env, app_msg_ctx);
         seq_part = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(
                         app_rm_msg, env, SANDESHA2_MSG_PART_SEQ);
         if(NULL == seq_part)

Modified: webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c Fri Jul 21 23:20:06 2006
@@ -42,6 +42,9 @@
 #include <sandesha2/sandesha2_ack_msg_processor.h>
 #include <sandesha2/sandesha2_seq.h>
 #include "../client/sandesha2_client_constants.h"
+#include <sandesha2_msg_init.h>
+#include <sandesha2_msg_creator.h>
+#include <sandesha2_ack_mgr.h>
 
 /** 
  * @brief Terminate Sequence Message Processor struct impl
@@ -305,7 +308,7 @@
         {
             sandesha2_msg_ctx_t *highest_out_rm_msg = NULL;
             sandesha2_seq_t *seq_of_out_msg = NULL;
-            highest_out_rm_msg = sandesha2_msg_initilizer_init_msg(env, 
+            highest_out_rm_msg = sandesha2_msg_init_init_msg(env, 
                         highest_out_msg);
             seq_of_out_msg = (sandesha2_seq_t*)
                         SANDESHA2_MSG_CTX_GET_MSG_PART(highest_out_rm_msg, env,

Modified: webservices/sandesha/trunk/c/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/Makefile.am?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/Makefile.am (original)
+++ webservices/sandesha/trunk/c/src/util/Makefile.am Fri Jul 21 23:20:06 2006
@@ -11,6 +11,7 @@
                             terminate_mgr.c \
 							msg_init.c \
 							msg_creator.c\
+                            msg_retrans_adjuster.c\
                             property_mgr.c
 
 INCLUDES = -I$(top_builddir)/include \

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?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_creator.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_creator.c Fri Jul 21 23:20:06 2006
@@ -31,6 +31,8 @@
 #include <sandesha2_seq_offer.h>
 #include <sandesha2_accept.h>
 #include <sandesha2_msg_init.h>
+#include <sandesha2/sandesha2_spec_specific_consts.h>
+#include <sandesha2/sandesha2_terminate_seq.h>
 #include "../client/sandesha2_client_constants.h"
 
 #include <axis2_conf_ctx.h>
@@ -44,6 +46,7 @@
 #include <axiom_soap_envelope.h>
 #include <axiom_soap_body.h>
 #include <axiom_node.h>
+#include <sandesha2/sandesha2_terminate_seq_res.h>
 
   
 static axis2_status_t
@@ -250,7 +253,7 @@
  * @return
  */
 sandesha2_msg_ctx_t *
-sandesha2_msg_creator_create_create_seq_response_msg(
+sandesha2_msg_creator_create_create_seq_res_msg(
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *create_seq_msg,
         axis2_msg_ctx_t *out_msg,
@@ -335,7 +338,7 @@
             env, rm_version);
     AXIS2_MSG_CTX_SET_WSA_ACTION(out_msg, env, temp_action);
     temp_action = 
-        sandesha2_spec_specific_consts_get_create_seq_response_soap_action(env, 
+        sandesha2_spec_specific_consts_get_create_seq_res_soap_action(env, 
                 rm_version);
     AXIS2_MSG_CTX_SET_SOAP_ACTION(out_msg, env, temp_action);
     ctx = AXIS2_MSG_CTX_GET_BASE(out_msg, env);
@@ -366,7 +369,7 @@
  * @return
  */
 sandesha2_msg_ctx_t *
-sandesha2_msg_creator_create_close_seq_response_msg(
+sandesha2_msg_creator_create_close_seq_res_msg(
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *close_seq_msg,
         axis2_msg_ctx_t *out_msg,
@@ -438,46 +441,31 @@
         sandesha2_msg_ctx_t *ref_rm_msg, 
         axis2_char_t *seq_id,
         axis2_char_t *internal_seq_id,
-        axis2_char_t *acks_to,
         sandesha2_storage_mgr_t *storage_mgr)
 {
     axis2_msg_ctx_t *ref_msg_ctx = NULL;
     axis2_msg_ctx_t *terminate_seq_msg_ctx = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
     axis2_op_t *terminate_seq_op = NULL;
-    axis2_op_t *app_msg_op_desc = NULL;
-    axis2_op_ctx_t *create_seq_op_ctx = NULL;
-    axis2_op_ctx_t *op_ctx = NULL;
+    axis2_op_t *ref_msg_op = NULL;
+    axis2_op_ctx_t *terminate_seq_op_ctx = NULL;
+    axis2_ctx_t *ctx = NULL;
     axis2_char_t *terminate_seq_msg_id = NULL;
     axis2_char_t *temp_msg_id = NULL;
     axis2_char_t *rm_version = NULL;
     axis2_char_t *rm_ns_value = NULL;
-    axis2_char_t *addressing_ns_value = NULL;
-    axis2_char_t *anonymous_uri = NULL;
-    axis2_char_t *temp_value = NULL;
-    axis2_char_t *temp_action = NULL;
-    axis2_char_t *temp_soap_action = NULL;
-    axis2_endpoint_ref_t *to_epr = NULL;
-    axis2_endpoint_ref_t *reply_to_epr = NULL;
-    axis2_endpoint_ref_t *acks_to_epr = NULL;
-    axis2_endpoint_ref_t *temp_to = NULL;
-    axis2_endpoint_ref_t *temp_reply_to = NULL;
-    axis2_qname_t *qname = NULL;
     axis2_bool_t is_seq_res_reqd = AXIS2_FALSE;
     axiom_soap_envelope_t *envelope = NULL;
     axiom_soap_envelope_t *temp_envelope = NULL;
-    sandesha2_create_seq_t *create_seq_part = NULL;
-    sandesha2_seq_property_bean_t *reply_to_bean = NULL;
-    sandesha2_seq_property_bean_t *to_bean = NULL;
-    sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
     sandesha2_msg_ctx_t *terminate_rm_msg = NULL;
-    sandesha2_address_t *temp_address = NULL;
-    sandesha2_acks_to_t *temp_acks_to = NULL;
+    sandesha2_terminate_seq_t *terminate_seq = NULL;
+    int soap_version = -1;
+    sandesha2_identifier_t *identifier = NULL;
 
     ref_msg_ctx = SANDESHA2_MSG_CTX_GET_MSG_CTX(ref_rm_msg, env);
     if(ref_msg_ctx == NULL)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_MSG_CTX,, 
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_MSG_CTX,
                 AXIS2_FAILURE);
         return NULL;
     }
@@ -499,22 +487,22 @@
     terminate_seq_msg_id = AXIS2_MSG_CTX_GET_MSG_ID(terminate_seq_msg_ctx, env);
     AXIS2_CONF_CTX_REGISTER_OP_CTX(conf_ctx, env, terminate_seq_msg_id, 
             terminate_seq_op_ctx);
-    ref_msg_op_desc = AXIS2_MSG_CTX_GET_OP(ref_msg_ctx, env);
+    ref_msg_op = AXIS2_MSG_CTX_GET_OP(ref_msg_ctx, env);
     terminate_seq_op = AXIS2_MSG_CTX_GET_OP(terminate_seq_msg_ctx, env);
-    if(ref_msg_op_desc)
+    if(ref_msg_op)
     {
         axis2_array_list_t *outflow = NULL;
         axis2_array_list_t *out_fault_flow = NULL;
         axis2_array_list_t *in_fault_flow = NULL;
         axis2_array_list_t *inflow = NULL;
 
-        outflow = AXIS2_OP_GET_PHASES_OUTFLOW(ref_msg_op_desc, env);
+        outflow = AXIS2_OP_GET_PHASES_OUTFLOW(ref_msg_op, env);
         AXIS2_OP_SET_PHASES_OUTFLOW(terminate_seq_op, env, outflow);
-        out_fault_flow = AXIS2_OP_GET_PHASES_OUT_FAULT_FLOW(ref_msg_op_desc, env);
+        out_fault_flow = AXIS2_OP_GET_PHASES_OUT_FAULT_FLOW(ref_msg_op, env);
         AXIS2_OP_SET_PHASES_OUT_FAULT_FLOW(terminate_seq_op, env, out_fault_flow);
-        in_fault_flow = AXIS2_OP_GET_PHASES_IN_FAULT_FLOW(ref_msg_op_desc, env);
+        in_fault_flow = AXIS2_OP_GET_PHASES_IN_FAULT_FLOW(ref_msg_op, env);
         AXIS2_OP_SET_PHASES_IN_FAULT_FLOW(terminate_seq_op, env, in_fault_flow);
-        inflow = AXIS2_OP_GET_REMAINING_PHASES_INFLOW(ref_msg_op_desc, env);
+        inflow = AXIS2_OP_GET_REMAINING_PHASES_INFLOW(ref_msg_op, env);
         AXIS2_OP_SET_REMAINING_PHASES_INFLOW(terminate_seq_op, env, inflow);
     }
     rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, storage_mgr);
@@ -532,15 +520,15 @@
     {
         AXIS2_CTX_SET_PROPERTY(ctx, env, AXIS2_TRANSPORT_IN, NULL, AXIS2_FALSE);
     }
-    terminate_rm_msg = sandesha2_msg_init_init_msg(env, terminate_msg);
+    terminate_rm_msg = sandesha2_msg_init_init_msg(env, terminate_seq_msg_ctx);
     if(terminate_rm_msg == NULL)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_MSG_CTX, AXIS2_FAILURE);
         return NULL;
     }
     temp_msg_id = axis2_uuid_gen(env);
-    AXIS2_MSG_SET_MSG_ID(terminate_msg, env, temp_msg_id);
-    ref_msg_op = AXIS2_MSG_CTX_GET_OP(ref_msg, env);
+    AXIS2_MSG_SET_MSG_ID(terminate_seq_msg_ctx, env, temp_msg_id);
+    ref_msg_op = AXIS2_MSG_CTX_GET_OP(ref_msg_ctx, env);
     if(ref_msg_op)
     {
         axis2_array_list_t *outphases = NULL;
@@ -548,18 +536,68 @@
         outphases = AXIS2_OP_GET_PHASES_OUTFLOW(ref_msg_op, env);
         if(outphases)
         {
-            AXIS2_OP_SET_PHASES_OUTFLOW(terminate_msg_op, env, outphases);
-            AXIS2_OP_SET_PHASES_OUT_FAULT_FLOW(terminate_msg_op, env, outphases);
+            AXIS2_OP_SET_PHASES_OUTFLOW(terminate_seq_op, env, outphases);
+            AXIS2_OP_SET_PHASES_OUT_FAULT_FLOW(terminate_seq_op, env, outphases);
         }
     }
-    temp_envelope = SANDESHA2_MSG_CTX_GET_SOAP_ENVELOPE(ref_msg, env);
+    temp_envelope = SANDESHA2_MSG_CTX_GET_SOAP_ENVELOPE(ref_msg_ctx, env);
     soap_version = sandesha2_utils_get_soap_version(env, temp_envelope);
     envelope = axiom_soap_envelope_create_default_soap_envelope(env, soap_version);
     SANDESHA2_MSG_CTX_SET_SOAP_ENVELOPE(terminate_rm_msg, env, envelope);
 
-
+    terminate_seq = sandesha2_terminate_seq_create(env, rm_ns_value);
+    identifier = sandesha2_identifier_create(env, rm_ns_value);
+    SANDESHA2_IDENTIFIER_SET_IDENTIFER(identifier, env, seq_id);
+    SANDESHA2_TERMINATE_SEQ_SET_IDENTIFIER(terminate_seq, env, identifier);
+    SANDESHA2_MSG_CTX_SET_MSG_PART(terminate_rm_msg, env, 
+                        SANDESHA2_MSG_PART_TERMINATE_SEQ, 
+                        (sandesha2_iom_rm_part_t*)terminate_seq);
+    sandesha2_msg_creator_finalize_creation(env, ref_msg_ctx, 
+                        terminate_seq_msg_ctx);
+    AXIS2_MSG_CTX_SET_PROPERTY(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN,
+                        NULL, AXIS2_FALSE);
+    return terminate_rm_msg;
 }
 
+sandesha2_msg_ctx_t *AXIS2_CALL
+sandesha2_msg_creator_create_terminate_seq_res_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *ref_rm_msg,
+        axis2_msg_ctx_t *out_msg,
+        sandesha2_storage_mgr_t *storage_mgr)
+{
+    sandesha2_msg_ctx_t *res_rm_msg = NULL;
+    sandesha2_terminate_seq_t *terminate_seq = NULL;
+    axis2_char_t *seq_id = NULL;
+    axis2_char_t *rm_ns_val = NULL;
+    sandesha2_terminate_seq_res_t *terminate_seq_res = NULL;
+    sandesha2_identifier_t *identifier = NULL;
+    axiom_soap_envelope_t *soap_envelope = NULL;
+    
+    res_rm_msg = sandesha2_msg_ctx_create(env, out_msg);
+    terminate_seq = (sandesha2_terminate_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(
+                        res_rm_msg, env, SANDESHA2_MSG_PART_TERMINATE_SEQ);
+    seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_TERMINATE_SEQ_GET_IDENTIFIER(terminate_seq,
+                        env), env);
+    rm_ns_val = SANDESHA2_MSG_CTX_GET_RM_NS_VAL(ref_rm_msg, env);
+    SANDESHA2_MSG_CTX_SET_RM_NS_VAL(res_rm_msg, env, rm_ns_val);
+    
+    terminate_seq_res = sandesha2_terminate_seq_res_create(env, rm_ns_val);
+    identifier = sandesha2_identifier_create(env, rm_ns_val);
+    SANDESHA2_IDENTIFIER_SET_IDENTIFER(identifier, env, seq_id);
+    SANDESHA2_TERMINATE_SEQ_RES_SET_IDENTIFIER(terminate_seq_res, env, 
+                        identifier);
+    soap_envelope = axiom_soap_envelope_create_default_soap_envelope(env,
+                        sandesha2_utils_get_soap_version(env,
+                        SANDESHA2_MSG_CTX_GET_SOAP_ENVELOPE(ref_rm_msg, env)));
+    SANDESHA2_MSG_CTX_SET_SOAP_ENVELOPE(res_rm_msg, env, soap_envelope);
+    SANDESHA2_MSG_CTX_SET_MSG_PART(res_rm_msg, env, 
+                        SANDESHA2_MSG_PART_TERMINATE_SEQ_RESPONSE,
+                        (sandesha2_iom_rm_part_t*)terminate_seq_res);
+    /*AXIS2_MSG_CTX_SET_WSA_ACTION(out_msg, env, */
+    return res_rm_msg;
+}
 
 static axis2_status_t
 sandesha2_msg_creator_finalize_creation(
@@ -620,11 +658,11 @@
         if(old_op_ctx_props)
         {
             axis2_op_ctx_t *new_op_ctx = NULL;
-            axis2_hash_index_t *i = NULL;
+            axis2_hash_index_t *hi = NULL;
 
             new_op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(new_msg, env);
-            for (i = axis2_hash_first (old_op_ctx_props, env); i; i = 
-                    axis2_hash_next (env, i))
+            for (hi = axis2_hash_first (old_op_ctx_props, env); hi; hi = 
+                    axis2_hash_next (env, hi))
             {
                 void *v = NULL;
                 void *k = NULL;
@@ -632,7 +670,7 @@
                 axis2_property_t *prop = NULL;
                 axis2_ctx_t *ctx = NULL;
 
-                axis2_hash_this (i, &k, NULL, &v);
+                axis2_hash_this (hi, (const void **)&k, NULL, &v);
                 key = (axis2_char_t *) k;
                 prop = (axis2_property_t *) v;
                 ctx = AXIS2_OP_CTX_GET_BASE(new_op_ctx, env);
@@ -661,7 +699,7 @@
                 axis2_property_t *prop = NULL;
                 axis2_ctx_t *ctx = NULL;
 
-                axis2_hash_this (i, &k, NULL, &v);
+                axis2_hash_this (i, (const void **)&k, NULL, &v);
                 key = (axis2_char_t *) k;
                 prop = (axis2_property_t *) v;
                 ctx = AXIS2_MSG_CTX_GET_BASE(new_msg, env);
@@ -691,7 +729,7 @@
             axis2_char_t *key = NULL;
             axis2_property_t *prop = NULL;
 
-            axis2_hash_this (i, &k, NULL, &v);
+            axis2_hash_this (i, (const void **)&k, NULL, &v);
             key = (axis2_char_t *) k;
             prop = (axis2_property_t *) v;
             axis2_hash_set(new_msg_props, key, AXIS2_HASH_KEY_STRING, prop);
@@ -729,4 +767,3 @@
     }
     return AXIS2_SUCCESS;
 }
-

Added: webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c?rev=424527&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c (added)
+++ webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c Fri Jul 21 23:20:06 2006
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <sandesha2_msg_retrans_adjuster.h>
+#include <sandesha2/sandesha2_utils.h>
+#include <sandesha2/sandesha2_constants.h>
+#include <sandesha2/sandesha2_spec_specific_consts.h>
+#include <sandesha2_msg_init.h>
+
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+sandesha2_msg_retrans_adjuster_adjust_retrans(
+        const axis2_env_t *env,
+        sandesha2_sender_bean_t *retrans_bean,
+        axis2_conf_ctx_t *conf_ctx, 
+        sandesha2_storage_mgr_t *storage_mgr)
+{
+    axis2_char_t *stored_key = NULL;
+    axis2_msg_ctx_t *msg_ctx = NULL;
+    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
+    axis2_char_t *int_seq_id = NULL;
+    axis2_char_t *seq_id = NULL;
+    sandesha2_property_bean_t *property_bean = NULL;
+    int max_attempts = -1;
+    axis2_bool_t timeout_seq = AXIS2_FALSE;
+    axis2_bool_t seq_timed_out = AXIS2_FALSE;
+    axis2_bool_t continue_sending = AXIS2_TRUE;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, retrans_bean, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FALSE);
+    
+    stored_key = SANDESHA2_SENDER_BEAN_GET_MSG_CONTEXT_REF_KEY(retrans_bean, env);
+    if(NULL == stored_key)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Stored Key not"
+                        " present in the retransmittable message");
+        return AXIS2_FALSE;
+    }
+    msg_ctx = SANDESHA2_STORAGE_MGR_RETRIEVE_MSG_CTX(storage_mgr, env, 
+                        stored_key, conf_ctx);
+    rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
+    int_seq_id = SANDESHA2_SENDER_BEAN_GET_INTERNAL_SEQ_ID(retrans_bean, env);
+    seq_id = SANDESHA2_SENDER_BEAN_GET_SEQ_ID(retrans_bean, env);
+    
+    property_bean = sandesha2_utils_get_property_bean_from_op(env, 
+                        AXIS2_MSG_CTX_GET_OP(msg_ctx, env));
+    SANDESHA2_SENDER_BEAN_SET_SENT_COUNT(retrans_bean, env, 
+                        SANDESHA2_SENDER_BEAN_GET_SENT_COUNT(retrans_bean, 
+                        env) + 1);
+    sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(env, retrans_bean,
+                        property_bean);
+    max_attempts = SANDESHA2_PROPERTY_BEAN_GET_MAX_RETRANS_COUNT(property_bean, 
+                        env);
+    
+    if(max_attempts > 0 && SANDESHA2_SENDER_BEAN_GET_SENT_COUNT(retrans_bean, 
+                        env) > max_attempts)
+        timeout_seq = AXIS2_TRUE;
+    seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, int_seq_id, 
+                        rm_msg_ctx, storage_mgr);
+    
+    if(AXIS2_TRUE == seq_timed_out)
+        timeout_seq = AXIS2_TRUE;
+        
+    if(AXIS2_TRUE == timeout_seq)
+    {
+        SANDESHA2_SENDER_BEAN_SET_SEND(retrans_bean, env, AXIS2_FALSE);
+        sandesha2_msg_retrans_adjuster_finalize_timedout_seq(env, int_seq_id,
+                        seq_id, msg_ctx, storage_mgr);
+        continue_sending = AXIS2_FALSE;
+    }
+    return continue_sending;
+}
+

Modified: webservices/sandesha/trunk/c/src/util/utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/utils.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/utils.c Fri Jul 21 23:20:06 2006
@@ -34,6 +34,12 @@
 #include <axis2_qname.h>
 #include <axis2_http_transport.h>
 #include <axis2_addr.h>
+#include <axiom_soap_header.h>
+#include <sandesha2/sandesha2_seq.h>
+#include <sandesha2/sandesha2_seq_ack.h>
+#include <sandesha2/sandesha2_ack_requested.h>
+#include <sandesha2/sandesha2_close_seq.h>
+#include <sandesha2/sandesha2_close_seq_res.h>
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_utils_remove_soap_body_part(const axis2_env_t *env, 
@@ -681,4 +687,160 @@
         
     memcpy(ret, tmp, len);
     return ret;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL                        
+sandesha2_utils_is_retriable_on_faults(const axis2_env_t *env,
+                        axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_bool_t ret = AXIS2_FALSE;
+    axis2_char_t *action = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FALSE);
+    
+    action =  AXIS2_MSG_CTX_GET_WSA_ACTION(msg_ctx, env);
+    if(NULL == action)
+        return AXIS2_FALSE;
+        
+    if(0 == AXIS2_STRCMP(action, SANDESHA2_SPEC_2005_02_ACTION_CREATE_SEQ))
+        ret = AXIS2_TRUE;
+    else if(0 == AXIS2_STRCMP(action, SANDESHA2_SPEC_2005_10_ACTION_CREATE_SEQ))
+        ret = AXIS2_TRUE;
+        
+    return ret;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+sandesha2_utils_is_rm_global_msg(const axis2_env_t *env,
+                        axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_bool_t is_global_msg = AXIS2_FALSE;
+    axis2_char_t *action = NULL;
+    axiom_soap_envelope_t *soap_env = NULL;
+    axiom_soap_header_t *soap_header = NULL;
+    axiom_element_t *header_element = NULL;
+    axiom_node_t *header_node = NULL;
+    axiom_element_t *seq_element = NULL;
+    axiom_node_t *seq_node = NULL;
+    axis2_qname_t *qname = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FALSE);
+    
+    action =  AXIS2_MSG_CTX_GET_WSA_ACTION(msg_ctx, env);
+    soap_env = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
+    
+    if(NULL == soap_env)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] SOAP envelope is"
+                        " null");
+        return AXIS2_FALSE;
+    }
+    soap_header = AXIOM_SOAP_ENVELOPE_GET_HEADER(soap_env, env);
+    
+    if(NULL != soap_header)
+    {
+        header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
+        header_element = AXIOM_NODE_GET_DATA_ELEMENT(header_node, env);
+    
+        qname = axis2_qname_create(env, SANDESHA2_WSRM_COMMON_SEQ,
+                        SANDESHA2_SPEC_2005_02_NS_URI, NULL);
+        seq_element = AXIOM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(header_element, 
+                        env, qname, header_node, &seq_node);
+        if(NULL == seq_element)
+        {
+            qname = axis2_qname_create(env, SANDESHA2_WSRM_COMMON_SEQ,
+                        SANDESHA2_SPEC_2005_10_NS_URI, NULL);
+            seq_element = AXIOM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(
+                        header_element, env, qname, header_node, &seq_node);
+        }
+    }
+    if(NULL != seq_element)
+        is_global_msg = AXIS2_TRUE;
+        
+    if(0 == AXIS2_STRCMP(action, 
+                        SANDESHA2_SPEC_2005_02_ACTION_SEQ_ACKNOWLEDGEMENT))
+        is_global_msg = AXIS2_TRUE;
+        
+    if(0 == AXIS2_STRCMP(action, 
+                        SANDESHA2_SPEC_2005_02_ACTION_CREATE_SEQ_RESPONSE))
+        is_global_msg = AXIS2_TRUE;
+        
+    if(0 == AXIS2_STRCMP(action, SANDESHA2_SPEC_2005_02_ACTION_TERMINATE_SEQ))
+        is_global_msg = AXIS2_TRUE;    
+        
+    if(0 == AXIS2_STRCMP(action, 
+                        SANDESHA2_SPEC_2005_10_ACTION_SEQ_ACKNOWLEDGEMENT))
+        is_global_msg = AXIS2_TRUE;
+        
+    if(0 == AXIS2_STRCMP(action, 
+                        SANDESHA2_SPEC_2005_10_ACTION_CREATE_SEQ_RESPONSE))
+        is_global_msg = AXIS2_TRUE;
+        
+    if(0 == AXIS2_STRCMP(action, SANDESHA2_SPEC_2005_10_ACTION_TERMINATE_SEQ))
+        is_global_msg = AXIS2_TRUE;    
+    
+    return is_global_msg;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+sandesha2_utils_get_seq_id_from_rm_msg_ctx(const axis2_env_t *env, 
+                        sandesha2_msg_ctx_t *rm_msg_ctx)
+{
+    int msg_type = -1;
+    axis2_char_t *seq_id = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, NULL);
+    
+    msg_type = SANDESHA2_MSG_CTX_GET_MSG_TYPE(rm_msg_ctx, env);
+    
+    if(SANDESHA2_MSG_TYPE_APPLICATION == msg_type)
+    {
+        sandesha2_seq_t *seq = NULL;
+        seq = (sandesha2_seq_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, env,
+                        SANDESHA2_MSG_PART_SEQ);
+        seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_SEQ_GET_IDENTIFIER(seq, env), env);
+    }
+    else if(SANDESHA2_MSG_TYPE_ACK == msg_type)
+    {
+        sandesha2_seq_ack_t *seq_ack = NULL;
+        seq_ack = (sandesha2_seq_ack_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(
+                        rm_msg_ctx, env, SANDESHA2_MSG_PART_SEQ_ACKNOWLEDGEMENT);
+        seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_SEQ_ACK_GET_IDENTIFIER(seq_ack, env), env);
+    }
+    else if(SANDESHA2_MSG_TYPE_ACK_REQUEST == msg_type)
+    {
+        sandesha2_ack_requested_t *ack_requested = NULL;
+        ack_requested = (sandesha2_ack_requested_t*)
+                        SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, env, 
+                        SANDESHA2_MSG_PART_ACK_REQUEST);
+        seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_ACK_REQUESTED_GET_IDENTIFIER(ack_requested, 
+                        env), env);
+    }
+    else if(SANDESHA2_MSG_TYPE_CLOSE_SEQ == msg_type)
+    {
+        sandesha2_close_seq_t *close_seq = NULL;
+        close_seq = (sandesha2_close_seq_t*)
+                        SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, env, 
+                        SANDESHA2_MSG_PART_CLOSE_SEQ);
+        seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_CLOSE_SEQ_GET_IDENTIFIER(close_seq, 
+                        env), env);
+    }
+    else if(SANDESHA2_MSG_TYPE_CLOSE_SEQ_RESPONSE == msg_type)
+    {
+        sandesha2_close_seq_res_t *close_seq_res = NULL;
+        close_seq_res = (sandesha2_close_seq_res_t*)
+                        SANDESHA2_MSG_CTX_GET_MSG_PART(rm_msg_ctx, env, 
+                        SANDESHA2_MSG_PART_CLOSE_SEQ_RESPONSE);
+        seq_id = SANDESHA2_IDENTIFIER_GET_IDENTIFIER(
+                        SANDESHA2_CLOSE_SEQ_RES_GET_IDENTIFIER(close_seq_res, 
+                        env), env);
+    }
+    return seq_id;
 }

Modified: webservices/sandesha/trunk/c/src/workers/in_order_invoker.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/in_order_invoker.c?rev=424527&r1=424526&r2=424527&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/in_order_invoker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/in_order_invoker.c Fri Jul 21 23:20:06 2006
@@ -22,6 +22,7 @@
 #include <sandesha2_seq_property_mgr.h>
 #include <sandesha2/sandesha2_msg_ctx.h>
 #include <sandesha2/sandesha2_seq.h>
+#include <sandesha2_msg_init.h>
 #include <axis2_addr.h>
 #include <axis2_engine.h>
 #include <stdio.h>
@@ -424,7 +425,7 @@
                         env);
                 msg_to_invoke = SANDESHA2_STORAGE_MGR_RETRIEVE_MSG_CTX(
                         storage_mgr, env, key, invoker_impl->conf_ctx);
-                rm_msg_ctx = sandesha2_msg_initilizer_init_msg(env, 
+                rm_msg_ctx = sandesha2_msg_init_init_msg(env, 
                         msg_to_invoke);
                 /* have to commit the transaction before invoking. This may get 
                  * changed when WS-AT is available.



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