ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r702114 - in /webservices/sandesha/trunk/c/src: handlers/sandesha2_in_handler.c handlers/sandesha2_out_handler.c msgprocessors/app_msg_processor.c util/sandesha2_utils.c
Date Mon, 06 Oct 2008 11:53:12 GMT
Author: damitha
Date: Mon Oct  6 04:53:11 2008
New Revision: 702114

URL: http://svn.apache.org/viewvc?rev=702114&view=rev
Log:
Moving policy retrieving code from handlers to util

Modified:
    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/app_msg_processor.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c

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=702114&r1=702113&r2=702114&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Mon Oct  6 04:53:11 2008
@@ -41,8 +41,6 @@
 #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(
@@ -115,9 +113,7 @@
     axis2_bool_t dropped = AXIS2_FALSE;
     axis2_char_t *value = NULL;
     axutil_property_t *property = NULL;
-    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] Start:sandesha2_in_handler_invoke");
@@ -171,33 +167,14 @@
         return AXIS2_FAILURE;
     }
 
-    property_param = axis2_svc_get_param(svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
-    if(!property_param)
+    property_bean = sandesha2_utils_get_property_bean(env, svc);
+    if(!property_bean)
     {
-        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] Cannot create Property
bean");
-                return AXIS2_FAILURE;
-            }
-        }   
-        else
-        {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot Retreive RM assertion");
-            return AXIS2_FAILURE;
-        }
-    }
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Could not retrieve property bean from service");
 
+        return AXIS2_FAILURE;
+    }
 
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);

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=702114&r1=702113&r2=702114&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Mon Oct  6 04:53:11
2008
@@ -80,9 +80,7 @@
     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);
@@ -129,31 +127,13 @@
         axutil_qname_free(module_qname, env);
     }
 
-    property_param = axis2_svc_get_param(svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
-    if(!property_param)
+    property_bean = sandesha2_utils_get_property_bean(env, svc);
+    if(!property_bean)
     {
-        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;
-        }
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Could not retrieve property bean from service");
+
+        return AXIS2_FAILURE;
     }
 
     temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);

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=702114&r1=702113&r2=702114&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Mon Oct  6 04:53:11
2008
@@ -2839,6 +2839,12 @@
     conf_ctx = axis2_msg_ctx_get_conf_ctx(app_msg_ctx, env);
 
     svc = axis2_msg_ctx_get_svc(app_msg_ctx, env);
+    property_bean = sandesha2_utils_get_property_bean(env, svc);
+    if(!property_bean)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Property bean is NULL");
+        return AXIS2_FAILURE;
+    }
 
     relates_to = axis2_msg_ctx_get_relates_to(app_msg_ctx, env);
     if(relates_to)
@@ -3244,7 +3250,6 @@
     }
 
     conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-    property_bean = sandesha2_utils_get_property_bean(env, svc);
     retrans_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env);
 
     relates_to_bean = sandesha2_seq_property_bean_create_with_data(env, msg_id, 

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=702114&r1=702113&r2=702114&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Mon Oct  6 04:53:11 2008
@@ -47,6 +47,7 @@
 #include <axis2_policy_include.h>
 #include <neethi_policy.h>
 #include <axis2_rm_assertion.h>
+#include <sandesha2_property_mgr.h>
 
 static axutil_array_list_t *
 get_sorted_msg_no_list(
@@ -220,12 +221,45 @@
     
 {
     axutil_param_t *param = NULL;
+    sandesha2_property_bean_t *property_bean = NULL; 
     
     AXIS2_PARAM_CHECK(env->error, svc, NULL);
     
     param = axis2_svc_get_param(svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
     if(!param)
     {
+        axis2_rm_assertion_t *rm_assertion = NULL;
+
+        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)
+            {
+                param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN, property_bean);
+                axutil_param_set_value_free(param, env, sandesha2_property_bean_free_void_arg);
+                axis2_svc_add_param(svc, env, param);
+            }
+            else
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot create Property
bean");
+                return NULL;
+            }
+        }   
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot Retreive RM assertion");
+            return NULL;
+        }
+    }
+    else
+    {
+        property_bean = (sandesha2_property_bean_t*) axutil_param_get_value(param, env);
+    }
+
+    if(!property_bean)
+    {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                 "[sandesha2] Property bean not found as a parameter in service");
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONFIGURATION_NOT_SET, AXIS2_FAILURE);
@@ -233,7 +267,7 @@
         return NULL;
     }
 
-    return (sandesha2_property_bean_t*)axutil_param_get_value(param, env);
+    return property_bean;
 }
 
 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL



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


Mime
View raw message