Author: manjula
Date: Fri Sep 12 01:19:58 2008
New Revision: 694645

URL: http://svn.apache.org/viewvc?rev=694645&view=rev
Log:
Adding code for policy support.

Modified:
    webservices/sandesha/trunk/c/include/sandesha2_property_mgr.h
    webservices/sandesha/trunk/c/include/sandesha2_utils.h
    webservices/sandesha/trunk/c/src/core/mod_sandesha2.c
    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/util/msg_creator.c
    webservices/sandesha/trunk/c/src/util/property_mgr.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c

Modified: webservices/sandesha/trunk/c/include/sandesha2_property_mgr.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_property_mgr.h?rev=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_property_mgr.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_property_mgr.h Fri Sep 12 
01:19:58 2008
@@ -33,6 +33,7 @@
 #include <axis2_op.h>
 #include <sandesha2_property_bean.h>
 #include <sandesha2_msg_ctx.h>
+#include <axis2_rm_assertion.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -51,7 +52,12 @@
 sandesha2_property_mgr_load_properties_from_module_desc(
     const axutil_env_t *env,
     axis2_module_desc_t *module_desc);
-                        
+
+AXIS2_EXTERN sandesha2_property_bean_t* AXIS2_CALL
+sandesha2_property_mgr_load_properties_from_policy(
+    const axutil_env_t *env,
+    axis2_rm_assertion_t *rm_assertion);
+
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/trunk/c/include/sandesha2_utils.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_utils.h?rev=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_utils.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_utils.h Fri Sep 12 01:19:58 
2008
@@ -34,6 +34,9 @@
 #include <axis2_op.h>
 #include <sandesha2_property_bean.h>
 #include <sandesha2_msg_ctx.h>
+#include <axis2_policy_include.h>
+#include <axis2_svc.h>
+#include <axis2_rm_assertion.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -292,6 +295,12 @@
     const axutil_env_t * env,
     axis2_endpoint_ref_t * endpoint_ref);
 
+axis2_rm_assertion_t *AXIS2_CALL
+sandesha2_util_get_rm_assertion(
+    const axutil_env_t * env,
+    axis2_svc_t * svc);
+
+
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/sandesha/trunk/c/src/core/mod_sandesha2.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/core/mod_sandesha2.c?rev=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/core/mod_sandesha2.c (original)
+++ webservices/sandesha/trunk/c/src/core/mod_sandesha2.c Fri Sep 12 01:19:58 
2008
@@ -64,8 +64,8 @@
     axis2_conf_ctx_t *conf_ctx,
     axis2_module_desc_t *module_desc)
 {
-    sandesha2_property_bean_t *property_bean = NULL;
-    axutil_param_t *param = NULL;
+    /*sandesha2_property_bean_t *property_bean = NULL;
+    axutil_param_t *param = NULL;*/
     axis2_conf_t *conf = NULL;
     axis2_ctx_t *ctx = NULL;
     
@@ -74,17 +74,17 @@
     AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
     
     sandesha2_error_init();
-    property_bean = 
sandesha2_property_mgr_load_properties_from_module_desc(env, module_desc);
+    /*property_bean = 
sandesha2_property_mgr_load_properties_from_module_desc(env, module_desc);
     if(!property_bean)
     {
         property_bean = 
sandesha2_property_mgr_load_properties_from_def_values(env);
     }
         
     param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN, 
property_bean);
-    axutil_param_set_value_free(param, env, 
sandesha2_property_bean_free_void_arg); 
+    axutil_param_set_value_free(param, env, 
sandesha2_property_bean_free_void_arg); */
 
     conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-    axis2_conf_add_param(conf, env, param);
+    /*axis2_conf_add_param(conf, env, param);*/
 
     ctx = axis2_conf_ctx_get_base(conf_ctx, env);
     axis2_ctx_set_property(ctx, env, SANDESHA2_INMEMORY_STORAGE_MGR, NULL);

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=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Fri Sep 12 
01:19:58 2008
@@ -41,6 +41,8 @@
 #include <sandesha2_ack_requested.h>
 #include <sandesha2_app_msg_processor.h>
 #include <axutil_types.h>
+#include <axis2_rm_assertion.h>
+#include <sandesha2_property_mgr.h>
 
 static axis2_status_t AXIS2_CALL
 sandesha2_in_handler_invoke(
@@ -114,7 +116,10 @@
     axis2_char_t *value = NULL;
     axutil_property_t *property = NULL;
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
-    
+    axutil_param_t *property_param = NULL;   
+    sandesha2_property_bean_t *property_bean = NULL; 
+    axis2_rm_assertion_t *rm_assertion = NULL;
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] 
Start:sandesha2_in_handler_invoke");
 
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
@@ -166,6 +171,34 @@
         return AXIS2_FAILURE;
     }
 
+    property_param = axis2_svc_get_param(svc, env, 
SANDESHA2_SANDESHA_PROPERTY_BEAN);
+    if(!property_param)
+    {
+        rm_assertion = sandesha2_util_get_rm_assertion(env, svc); 
+        if(rm_assertion)
+        {
+            property_bean = sandesha2_property_mgr_load_properties_from_policy(
+                env, rm_assertion);
+            if(property_bean)
+            {
+                property_param = axutil_param_create(env, 
SANDESHA2_SANDESHA_PROPERTY_BEAN, property_bean);
+                axutil_param_set_value_free(property_param, env, 
sandesha2_property_bean_free_void_arg);
+                axis2_svc_add_param(svc, env, property_param);
+            }
+            else
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] 
[sandesha_in_handler]Cannot create Property bean");
+                return AXIS2_FAILURE;
+            }
+        }   
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
"[sandesha2][sandesha_in_handler] Cannot Retreive RM assertion");
+            return AXIS2_FAILURE;
+        }
+    }
+
+
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);

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=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Fri Sep 
12 01:19:58 2008
@@ -32,6 +32,8 @@
 #include <sandesha2_client_constants.h>
 #include <sandesha2_sender_mgr.h>
 #include <platforms/axutil_platform_auto_sense.h>
+#include <axis2_rm_assertion.h>
+#include <sandesha2_property_mgr.h>
 
 axis2_status_t AXIS2_CALL
 sandesha2_out_handler_invoke(
@@ -78,6 +80,10 @@
     sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     sandesha2_msg_processor_t *msg_processor = NULL;
     int msg_type = -1;
+    axutil_param_t *property_param = NULL;
+    sandesha2_property_bean_t *property_bean = NULL;
+    axis2_rm_assertion_t *rm_assertion = NULL;
+
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] 
Entry:sandesha2_out_handler_invoke");
@@ -122,6 +128,34 @@
     {
         axutil_qname_free(module_qname, env);
     }
+
+    property_param = axis2_svc_get_param(svc, env, 
SANDESHA2_SANDESHA_PROPERTY_BEAN);
+    if(!property_param)
+    {
+        rm_assertion = sandesha2_util_get_rm_assertion(env, svc);
+        if(rm_assertion)
+        {
+            property_bean = sandesha2_property_mgr_load_properties_from_policy(
+                env, rm_assertion);
+            if(property_bean)
+            {
+                property_param = axutil_param_create(env, 
SANDESHA2_SANDESHA_PROPERTY_BEAN, property_bean);
+                axutil_param_set_value_free(property_param, env, 
sandesha2_property_bean_free_void_arg);
+                axis2_svc_add_param(svc, env, property_param);
+            }
+            else
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
"[sandesha2][Sandesha_out_handler]Cannot create Property bean");
+                return AXIS2_FAILURE;
+            }
+        }
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
"[sandesha2][Sandesha_out_handler] Cannot Retreive RM assertion");
+            return AXIS2_FAILURE;
+        }
+    }
+
     temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, 
SANDESHA2_APPLICATION_PROCESSING_DONE);
     if(temp_prop)
     {

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=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_creator.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_creator.c Fri Sep 12 01:19:58 2008
@@ -449,11 +449,11 @@
     axis2_msg_ctx_set_wsa_action(out_msg, env, temp_action);
 
     soap_action = axutil_string_create(env, temp_action);
-    if(soap_action)
+    /*if(soap_action)
     {
         axis2_msg_ctx_set_soap_action(out_msg, env, soap_action);
         axutil_string_free(soap_action, env);
-    }
+    }*/
 
     if(addressing_ns_value)
     {

Modified: webservices/sandesha/trunk/c/src/util/property_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/property_mgr.c?rev=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/property_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/property_mgr.c Fri Sep 12 01:19:58 
2008
@@ -265,6 +265,146 @@
     return property_bean;
 }
 
+
+AXIS2_EXTERN sandesha2_property_bean_t* AXIS2_CALL
+sandesha2_property_mgr_load_properties_from_policy(
+    const axutil_env_t *env,
+    axis2_rm_assertion_t *rm_assertion)
+{
+    sandesha2_property_bean_t *property_bean = NULL;
+    axis2_char_t *retrans_int_str = NULL;
+    axis2_char_t *ack_int_str = NULL;
+    axis2_char_t *inactive_timeout_str = NULL;
+    axis2_char_t *msg_types_str = NULL;
+    axis2_char_t *inactive_to_measure_str = NULL;   
+    int max_retrans_count = -1;
+    axis2_char_t *storage_mgr = NULL;
+    axis2_char_t *max_retrans_count_str = NULL;
+    axis2_char_t *terminate_delay_str = NULL;
+    int terminate_delay = -1;
+    int polling_delay = -1;
+    axis2_char_t *polling_delay_str = NULL; 
+
+    AXIS2_PARAM_CHECK(env->error, rm_assertion, NULL);
+    
+    property_bean = sandesha2_property_bean_create(env);
+
+    sandesha2_property_bean_set_exp_backoff(property_bean, env, 
+        axis2_rm_assertion_get_is_exp_backoff(rm_assertion, env));   
+
+    sandesha2_property_bean_set_in_order(property_bean, env ,
+        axis2_rm_assertion_get_is_inorder(rm_assertion, env));
+
+    retrans_int_str = axis2_rm_assertion_get_retrans_interval(rm_assertion, 
env);
+    if(retrans_int_str)
+    {
+        sandesha2_property_mgr_load_retrans_int(env, retrans_int_str, 
property_bean);
+    }
+        
+    ack_int_str = axis2_rm_assertion_get_ack_interval(rm_assertion, env);
+    if(ack_int_str)
+    {
+        sandesha2_property_mgr_load_ack_int(env, ack_int_str, property_bean);
+    }
+
+    inactive_timeout_str = 
axis2_rm_assertion_get_inactivity_timeout(rm_assertion, env);
+    if(inactive_timeout_str)
+    {
+        inactive_to_measure_str = SANDESHA2_DEF_VAL_INACTIVETIMEOUT_MEASURE;
+        
+        sandesha2_property_mgr_load_inactive_timeout(env, 
inactive_timeout_str, 
+                inactive_to_measure_str, property_bean);
+    }
+
+    msg_types_str = axis2_rm_assertion_get_message_types_to_drop(rm_assertion, 
env);
+    if(msg_types_str)
+    {
+        sandesha2_property_mgr_load_msg_types_to_drop(env, msg_types_str, 
property_bean);        
+    }
+    
+    storage_mgr = axis2_rm_assertion_get_storage_mgr(rm_assertion, env);
+    if(storage_mgr)
+    {
+        sandesha2_property_bean_set_storage_mgr(property_bean, env, 
storage_mgr);        
+    }
+    
+    max_retrans_count_str = axis2_rm_assertion_get_max_retrans_count(
+        rm_assertion, env);
+    if(max_retrans_count_str)
+    {
+        axis2_char_t *str = sandesha2_utils_trim_string(env, 
max_retrans_count_str);
+        if(str)
+        {
+            max_retrans_count = atoi(str);
+        }
+
+        if(0 < max_retrans_count)
+        {
+            sandesha2_property_bean_set_max_retrans_count(property_bean, env, 
max_retrans_count);
+        }
+
+        if(str)
+        {
+            AXIS2_FREE(env->allocator, str);
+        }
+    }
+
+
+    terminate_delay_str = axis2_rm_assertion_get_terminate_delay(
+        rm_assertion, env);
+
+    if(terminate_delay_str)
+    {
+        axis2_char_t *str = sandesha2_utils_trim_string(env, 
terminate_delay_str);
+        if(str)
+        {
+            terminate_delay = atoi(str);
+        }
+        else
+        {
+            terminate_delay = SANDESHA2_TERMINATE_DELAY;
+        }
+
+        if(0 < terminate_delay)
+        {
+            sandesha2_property_bean_set_terminate_delay(property_bean, env, 
terminate_delay);
+        }
+
+        if(str)
+        {
+            AXIS2_FREE(env->allocator, str);
+        }
+    }
+
+    polling_delay_str = axis2_rm_assertion_get_polling_wait_time(rm_assertion, 
env);
+    if(polling_delay_str)
+    {
+        axis2_char_t *str = sandesha2_utils_trim_string(env, 
polling_delay_str);
+        if(str)
+        {
+            polling_delay = axutil_atoi(str);
+        }
+        else
+        {
+            polling_delay = SANDESHA2_POLLING_DELAY;
+        }
+
+        if(0 < polling_delay)
+        {
+            sandesha2_property_bean_set_polling_delay(property_bean, env, 
polling_delay);
+        }
+
+        if(str)
+        {
+            AXIS2_FREE(env->allocator, str);
+        }
+    }
+
+    return property_bean;
+}
+
+
+
 AXIS2_EXTERN  axis2_status_t AXIS2_CALL
 sandesha2_property_mgr_load_exp_backoff(
     const axutil_env_t *env, 

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?rev=694645&r1=694644&r2=694645&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Fri Sep 12 01:19:58 
2008
@@ -44,7 +44,8 @@
 #include <axutil_param.h>
 #include <stdlib.h>
 #include <sys/timeb.h>
-
+#include <axis2_policy_include.h>
+#include <neethi_policy.h>
 
 static axutil_array_list_t *
 get_sorted_msg_no_list(
@@ -215,6 +216,7 @@
 sandesha2_utils_get_property_bean(
     const axutil_env_t *env,
     axis2_conf_t *conf)
+    
 {
     axutil_param_t *param = NULL;
     
@@ -1408,3 +1410,39 @@
     return new_endpoint_ref;
 }
 
+
+axis2_rm_assertion_t *AXIS2_CALL
+sandesha2_util_get_rm_assertion(
+    const axutil_env_t * env,
+    axis2_svc_t * svc)
+{
+    axis2_desc_t *desc = NULL;
+    axis2_policy_include_t *policy_include = NULL;
+    neethi_policy_t *service_policy = NULL;
+    
+    desc = axis2_svc_get_base(svc, env);
+    if(!desc)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[sandesha][sandesha_util] Cannot find policy. Axis2 description 
is NULL.");
+        return NULL;
+    }
+
+    policy_include = axis2_desc_get_policy_include(desc, env);
+    if(!policy_include)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[sandesha][sandesha_util] Policy include is NULL.");
+        return NULL;
+    }
+
+    service_policy = axis2_policy_include_get_effective_policy(policy_include, 
env);
+    if(!service_policy)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[sandesha][sandesha_util] Policy is NULL.");
+        return NULL;
+    }
+
+    return axis2_rm_assertion_get_from_policy(env, service_policy);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to