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

svn commit: r606398 - in /webservices/sandesha/trunk/c: samples/rm_echo_1_0/ samples/rm_echo_1_1/ src/handlers/ src/storage/sqlite/ src/util/ src/workers/

Author: damitha
Date: Fri Dec 21 23:05:01 2007
New Revision: 606398

URL: http://svn.apache.org/viewvc?rev=606398&view=rev
Log:
Now all the samples in rm 1.0 and rm 1.1 are working with apache2

Modified:
    webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c
    webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
    webservices/sandesha/trunk/c/src/util/msg_init.c
    webservices/sandesha/trunk/c/src/workers/sender.c
    webservices/sandesha/trunk/c/src/workers/sender_worker.c

Modified: webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c Fri Dec 21 23:05:01 2007
@@ -63,9 +63,8 @@
     const axis2_char_t *client_home = NULL;
     axis2_svc_client_t* svc_client = NULL;
     axiom_node_t *payload = NULL;
-    /*axis2_callback_t *callback1 = NULL;
-    axis2_callback_t *callback2 = NULL;*/
-    axis2_callback_t *callback3 = NULL;
+    axis2_callback_t *callback1 = NULL;
+    axis2_callback_t *callback2 = NULL;
     axutil_property_t *property = NULL;
     axis2_listener_manager_t *listener_manager = NULL;
     axutil_string_t *soap_action = NULL;
@@ -174,7 +173,7 @@
         axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, 
             property);
     }
-    /*payload = build_om_payload_for_echo_svc(env, "echo1", seq_key);
+    payload = build_om_payload_for_echo_svc(env, "echo1", seq_key);
     callback1 = axis2_callback_create(env);
     axis2_callback_set_on_complete(callback1, rm_echo_callback_on_complete);
     axis2_callback_set_on_error(callback1, rm_echo_callback_on_error);
@@ -182,22 +181,14 @@
     wait_on_callback(env, callback1);
 
     axis2_svc_client_remove_all_headers(svc_client, env);
+    property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
+    axis2_options_set_property(options, env, "Sandesha2LastMessage", property);
     payload = build_om_payload_for_echo_svc(env, "echo2", seq_key);
     callback2 = axis2_callback_create(env);
     axis2_callback_set_on_complete(callback2, rm_echo_callback_on_complete);
     axis2_callback_set_on_error(callback2, rm_echo_callback_on_error);
     axis2_svc_client_send_receive_non_blocking(svc_client, env, payload, callback2);
-    wait_on_callback(env, callback2);*/
-    
-    axis2_svc_client_remove_all_headers(svc_client, env);
-    property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
-    axis2_options_set_property(options, env, "Sandesha2LastMessage", property);
-    payload = build_om_payload_for_echo_svc(env, "echo1", seq_key);
-    callback3 = axis2_callback_create(env);
-    axis2_callback_set_on_complete(callback3, rm_echo_callback_on_complete);
-    axis2_callback_set_on_error(callback3, rm_echo_callback_on_error);
-    axis2_svc_client_send_receive_non_blocking(svc_client, env, payload, callback3);
-    wait_on_callback(env, callback3);
+    wait_on_callback(env, callback2);
     AXIS2_SLEEP(4 * SANDESHA2_MAX_COUNT);
     AXIS2_FREE(env->allocator, seq_key);
     if (svc_client)

Modified: webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c Fri Dec 21 23:05:01 2007
@@ -198,16 +198,15 @@
     axis2_callback_set_on_error(callback, rm_echo_callback_on_error);
     sandesha2_client_send_non_blocking(env, svc_client, options, NULL, 
         callback, payload, listener_manager);
-
     wait_on_callback(env, callback);
 
-    /*payload = build_om_payload_for_echo_svc(env, "echo2", seq_key);
+    payload = build_om_payload_for_echo_svc(env, "echo2", seq_key);
     callback2 = axis2_callback_create(env);
     axis2_callback_set_on_complete(callback2, rm_echo_callback_on_complete);
     axis2_callback_set_on_error(callback2, rm_echo_callback_on_error);
     sandesha2_client_send_non_blocking(env, svc_client, options, NULL, 
         callback2, payload, listener_manager);
-    wait_on_callback(env, callback2);*/
+    wait_on_callback(env, callback2);
 
     AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
     callback3 = axis2_callback_create(env);

Modified: 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=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c Fri Dec 21 23:05:01 2007
@@ -93,7 +93,6 @@
 {
     
     axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_conf_t *conf = NULL;
     axis2_ctx_t *ctx = NULL;
     axiom_soap_envelope_t *soap_envelope = NULL;
     axiom_soap_fault_t *fault_part = NULL;
@@ -102,7 +101,7 @@
     const axis2_char_t *wsa_action = NULL;
     const axis2_char_t *soap_action = NULL;
     axis2_bool_t is_rm_global_msg = AXIS2_FALSE;
-    /*sandesha2_msg_ctx_t *rm_msg_ctx = NULL;*/
+    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     /*axis2_bool_t dropped = AXIS2_FALSE;*/
     axis2_bool_t isolated_last_msg = AXIS2_FALSE;
     axutil_property_t *property = NULL;
@@ -177,8 +176,8 @@
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     if(!conf_ctx)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Configuration"\
-            " Context is 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;
     }
@@ -191,7 +190,6 @@
         axis2_ctx_set_property(conf_ctx_base, env, SANDESHA2_IS_SVR_SIDE, 
             property);
     }
-    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     
     soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
     if(!soap_envelope)
@@ -245,8 +243,12 @@
             }
         }
     }
-    /*rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
-    if(!isolated_last_msg)
+    if(!sandesha2_permanent_storage_mgr_create_db(env, conf_ctx))
+    {
+        return AXIS2_FAILURE;
+    }
+    rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
+    /*if(!isolated_last_msg)
         dropped = sandesha2_global_in_handler_drop_if_duplicate(handler, env, 
             rm_msg_ctx);
     if(dropped)

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=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Fri Dec 21 23:05:01 2007
@@ -126,10 +126,6 @@
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    if(!sandesha2_permanent_storage_mgr_create_db(env, conf_ctx))
-    {
-        return AXIS2_FAILURE;
-    }
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
 
     if(!AXIS2_ERROR_GET_STATUS_CODE(env->error))

Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c Fri Dec 21 23:05:01 2007
@@ -320,11 +320,9 @@
             if(entry)
             {
                 axis2_op_ctx_t *op_ctx = NULL;
-                axutil_allocator_switch_to_global_pool(env->allocator);
                 op_ctx = 
                     axis2_msg_ctx_get_op_ctx((axis2_msg_ctx_t *) entry, env);
                 axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
-                axutil_allocator_switch_to_local_pool(env->allocator);
                 axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING, NULL);
             }
         }
@@ -524,7 +522,6 @@
     {
 		axis2_op_ctx_t *op_ctx = NULL;
         axis2_svc_ctx_t *svc_ctx = axis2_msg_ctx_get_svc_ctx(msg_ctx, env);
-        axutil_allocator_switch_to_global_pool(env->allocator);
 		op_ctx = axis2_op_ctx_create(env, op, svc_ctx);
         if(op_ctx)
         {
@@ -533,7 +530,6 @@
             axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx);
             msg_id = (axis2_char_t *) axis2_msg_ctx_get_msg_id(msg_ctx, env);
         }
-        axutil_allocator_switch_to_local_pool(env->allocator);
     }
     axis2_msg_ctx_set_server_side(msg_ctx, env, 
         sandesha2_msg_store_bean_is_svr_side(msg_store_bean, env));

Modified: webservices/sandesha/trunk/c/src/util/msg_init.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_init.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_init.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_init.c Fri Dec 21 23:05:01 2007
@@ -15,7 +15,6 @@
  */
  
 #include <sandesha2_msg_init.h>
-#include <sandesha2_storage_mgr.h>
 #include <sandesha2_seq_property_mgr.h>
 #include <sandesha2_permanent_seq_property_mgr.h>
 #include <sandesha2_spec_specific_consts.h>
@@ -272,12 +271,10 @@
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_conf_t *conf = NULL;
     axis2_msg_ctx_t *temp_msg_ctx = NULL;
     axis2_char_t *seq_id = NULL;
     axis2_char_t *rm_ns = NULL;
     axis2_char_t *prop_key = NULL;
-    sandesha2_storage_mgr_t *storage_mgr = NULL;
     sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
     sandesha2_create_seq_t *create_seq = NULL;
     sandesha2_create_seq_res_t *create_seq_res = NULL;
@@ -296,9 +293,7 @@
         "[sandesha2]Entry:validate_msg");
     temp_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(temp_msg_ctx, env);
-    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
-    storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
     seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
     create_seq = (sandesha2_create_seq_t *) sandesha2_msg_ctx_get_msg_part(
             rm_msg_ctx, env, SANDESHA2_MSG_PART_CREATE_SEQ);
@@ -400,7 +395,7 @@
         sandesha2_identifier_t *idf = NULL;
         sandesha2_address_t *address = NULL;
         sandesha2_msg_ctx_set_msg_type(rm_msg_ctx, env, 
-                SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG);
+            SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG);
         idf = sandesha2_make_connection_get_identifier(make_conn, env);
         address = sandesha2_make_connection_get_address(make_conn, env);
         if(idf)
@@ -416,12 +411,10 @@
             AXIS2_ERROR_SET(env->error, 
                 SANDESHA2_ERROR_INVALID_MAKE_CONNECTION_MSG, AXIS2_FAILURE);
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                " Invalid MakeConnection message. Either Address or Identifier" \
-                " must be present");
+                "[sandesha2]Invalid MakeConnection message. Either Address "\
+                "or Identifier must be present");
             if(seq_prop_mgr)
                 sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-            if(storage_mgr)
-                sandesha2_storage_mgr_free(storage_mgr, env);
             return AXIS2_FALSE;
         } 
     }
@@ -467,16 +460,12 @@
                     AXIS2_FAILURE);
                 if(seq_prop_mgr)
                     sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-                if(storage_mgr)
-                    sandesha2_storage_mgr_free(storage_mgr, env);
                 return AXIS2_FALSE;
             }
         }
     }
     if(seq_prop_mgr)
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-    if(storage_mgr)
-        sandesha2_storage_mgr_free(storage_mgr, env);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Exit:validate_msg");
     return AXIS2_TRUE; 

Modified: webservices/sandesha/trunk/c/src/workers/sender.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender.c Fri Dec 21 23:05:01 2007
@@ -76,8 +76,10 @@
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Entry:sandesha2_sender_run_for_seq");
     
+    axutil_allocator_switch_to_global_pool(env->allocator);
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_sender_args_t));
-    args->env = (axutil_env_t*)env;
+    args->env = axutil_init_thread_env(env);
+    axutil_allocator_switch_to_local_pool(env->allocator);
     args->conf_ctx = conf_ctx;
     args->seq_id = seq_id;
     args->persistent_msg_ctx = persistent_msg_ctx;
@@ -122,7 +124,8 @@
     axis2_bool_t persistent_msg_ctx = AXIS2_FALSE;
     
     args = (sandesha2_sender_args_t*)data;
-    env = axutil_init_thread_env(args->env);
+    env = args->env;
+    axutil_allocator_switch_to_global_pool(env->allocator);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Entry:sandesha2_sender_worker_func");
     conf_ctx = args->conf_ctx;
@@ -186,6 +189,7 @@
         sandesha2_storage_mgr_free(storage_mgr, env);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Exit:sandesha2_sender_worker_func");
+    axutil_allocator_switch_to_local_pool(env->allocator);
     return NULL;
 }
 

Modified: webservices/sandesha/trunk/c/src/workers/sender_worker.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender_worker.c?rev=606398&r1=606397&r2=606398&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Fri Dec 21 23:05:01 2007
@@ -223,8 +223,8 @@
     }
     if(!msg_ctx)
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]msg_ctx is "\
-            "not present in the store yet.");
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+            "[sandesha2]msg_ctx is not present in the store yet.");
         /*msg_ctx is still not stored so try again later.*/
         return AXIS2_SUCCESS;
     }
@@ -296,8 +296,8 @@
         sandesha2_identifier_t *identifier = NULL;
         
         seq = (sandesha2_seq_t*)
-                    sandesha2_msg_ctx_get_msg_part(rm_msg_ctx, 
-                    env, SANDESHA2_MSG_PART_SEQ);
+            sandesha2_msg_ctx_get_msg_part(rm_msg_ctx, env, 
+                SANDESHA2_MSG_PART_SEQ);
         identifier = sandesha2_seq_get_identifier(seq, env);
         seq_id = sandesha2_identifier_get_identifier(identifier, env);
     }
@@ -317,7 +317,6 @@
     {
         /* This is neccessary to avoid a double free */
         axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
-        /* Consider building soap envelope */
         if(AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, msg_ctx))
 		{
         	successfully_sent = AXIS2_TRUE;



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