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/04/29 07:40:31 UTC
svn commit: r533465 - in /webservices/sandesha/trunk/c/src:
msgprocessors/app_msg_processor.c storage/mysql/permanent_bean_mgr.c
storage/mysql/permanent_storage_mgr.c util/sandesha2_utils.c
workers/sender_worker.c
Author: damitha
Date: Sat Apr 28 22:40:30 2007
New Revision: 533465
URL: http://svn.apache.org/viewvc?view=rev&rev=533465
Log:
Improved mysql quering
Modified:
webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
webservices/sandesha/trunk/c/src/storage/mysql/permanent_bean_mgr.c
webservices/sandesha/trunk/c/src/storage/mysql/permanent_storage_mgr.c
webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
webservices/sandesha/trunk/c/src/workers/sender_worker.c
Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?view=diff&rev=533465&r1=533464&r2=533465
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Sat Apr 28 22:40:30 2007
@@ -375,8 +375,11 @@
soap_version = SANDESHA2_SOAP_VERSION_1_1;
else
soap_version = SANDESHA2_SOAP_VERSION_1_2;
- sandesha2_storage_mgr_store_response(storage_mgr, env, client_seq_key,
- response_envelope, msg_no, soap_version);
+ if(response_envelope)
+ {
+ sandesha2_storage_mgr_store_response(storage_mgr, env,
+ client_seq_key, response_envelope, msg_no, soap_version);
+ }
}
if(highest_in_msg_no_str)
{
Modified: webservices/sandesha/trunk/c/src/storage/mysql/permanent_bean_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/mysql/permanent_bean_mgr.c?view=diff&rev=533465&r1=533464&r2=533465
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/mysql/permanent_bean_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/mysql/permanent_bean_mgr.c Sat Apr 28 22:40:30 2007
@@ -97,30 +97,48 @@
bean = (sandesha2_msg_store_bean_t *) args->data;
if((row = mysql_fetch_row(res)) != NULL)
{
+ unsigned long *lengths = NULL;
if(!bean)
{
bean = sandesha2_msg_store_bean_create(env);
args->data = bean;
}
- sandesha2_msg_store_bean_set_stored_key(bean, env, row[0]);
- sandesha2_msg_store_bean_set_msg_id(bean, env, row[1]);
- sandesha2_msg_store_bean_set_soap_envelope_str(bean, env, row[2]);
+ lengths = mysql_fetch_lengths(res);
+ if(0 < (int) lengths[0])
+ sandesha2_msg_store_bean_set_stored_key(bean, env, row[0]);
+ if(0 < (int) lengths[1])
+ sandesha2_msg_store_bean_set_msg_id(bean, env, row[1]);
+ if(0 < (int) lengths[2])
+ sandesha2_msg_store_bean_set_soap_envelope_str(bean, env, row[2]);
sandesha2_msg_store_bean_set_soap_version(bean, env, AXIS2_ATOI(row[3]));
sandesha2_msg_store_bean_set_transport_out(bean, env, AXIS2_ATOI(row[4]));
- sandesha2_msg_store_bean_set_op(bean, env, row[5]);
- sandesha2_msg_store_bean_set_svc(bean, env, row[6]);
- sandesha2_msg_store_bean_set_svc_grp(bean, env, row[7]);
- sandesha2_msg_store_bean_set_op_mep(bean, env, row[8]);
- sandesha2_msg_store_bean_set_to_url(bean, env, row[9]);
- sandesha2_msg_store_bean_set_reply_to(bean, env, row[10]);
- sandesha2_msg_store_bean_set_transport_to(bean, env, row[11]);
- sandesha2_msg_store_bean_set_execution_chain_str(bean, env, row[12]);
+ if(0 < (int) lengths[5])
+ sandesha2_msg_store_bean_set_op(bean, env, row[5]);
+ if(0 < (int) lengths[6])
+ sandesha2_msg_store_bean_set_svc(bean, env, row[6]);
+ if(0 < (int) lengths[7])
+ sandesha2_msg_store_bean_set_svc_grp(bean, env, row[7]);
+ if(0 < (int) lengths[8])
+ sandesha2_msg_store_bean_set_op_mep(bean, env, row[8]);
+ if(0 < (int) lengths[9])
+ sandesha2_msg_store_bean_set_to_url(bean, env, row[9]);
+ if(0 < (int) lengths[10])
+ sandesha2_msg_store_bean_set_reply_to(bean, env, row[10]);
+ if(0 < (int) lengths[11])
+ sandesha2_msg_store_bean_set_transport_to(bean, env, row[11]);
+ if(0 < (int) lengths[12])
+ sandesha2_msg_store_bean_set_execution_chain_str(bean, env, row[12]);
sandesha2_msg_store_bean_set_flow(bean, env, AXIS2_ATOI(row[13]));
- sandesha2_msg_store_bean_set_msg_recv_str(bean, env, row[14]);
+ if(0 < (int) lengths[14])
+ sandesha2_msg_store_bean_set_msg_recv_str(bean, env, row[14]);
sandesha2_msg_store_bean_set_svr_side(bean, env, AXIS2_ATOI(row[15]));
- sandesha2_msg_store_bean_set_in_msg_store_key(bean, env, row[16]);
- sandesha2_msg_store_bean_set_persistent_property_str(bean, env, row[17]);
- sandesha2_msg_store_bean_set_action(bean, env, row[18]);
+ if(0 < (int) lengths[16])
+ sandesha2_msg_store_bean_set_in_msg_store_key(bean, env, row[16]);
+ if(0 < (int) lengths[17])
+ sandesha2_msg_store_bean_set_persistent_property_str(bean, env, row[17]);
+ if(0 < (int) lengths[18])
+ sandesha2_msg_store_bean_set_action(bean, env, row[18]);
+
}
else
{
@@ -218,7 +236,6 @@
axis2_char_t *sql_stmt_remove)
{
sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
- sandesha2_rm_bean_t *bean = NULL;
MYSQL *dbconn = NULL;
int rc = -1;
AXIS2_ENV_CHECK(env, AXIS2_FALSE);
@@ -540,8 +557,6 @@
int sql_size = -1;
MYSQL *dbconn = NULL;
MYSQL_RES *res;
- sandesha2_bean_mgr_args_t *args = NULL;
- sandesha2_msg_store_bean_t *msg_store_bean = NULL;
axis2_char_t *msg_id = NULL;
axis2_char_t *stored_key = NULL;
axis2_char_t *soap_env_str = NULL;
@@ -557,6 +572,7 @@
axis2_char_t *execution_chain_str = NULL;
sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
int flow;
+ int num_rows = -1;
axis2_char_t *msg_recv_str = NULL;
axis2_bool_t svr_side = AXIS2_FALSE;
axis2_char_t *in_msg_store_key = NULL;
@@ -565,24 +581,39 @@
bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
msg_id = sandesha2_msg_store_bean_get_msg_id(bean, env);
+ if(!msg_id) msg_id = "";
stored_key = sandesha2_msg_store_bean_get_stored_key(bean, env);
+ if(!stored_key) stored_key = "";
soap_env_str = sandesha2_msg_store_bean_get_soap_envelope_str(bean, env);
+ if(!soap_env_str) soap_env_str = "";
soap_version = sandesha2_msg_store_bean_get_soap_version(bean, env);
transport_out = sandesha2_msg_store_bean_get_transport_out(bean, env);
op = sandesha2_msg_store_bean_get_op(bean, env);
+ if(!op) op = "";
svc = sandesha2_msg_store_bean_get_svc(bean, env);
+ if(!svc) svc = "";
svc_grp = sandesha2_msg_store_bean_get_svc_grp(bean, env);
+ if(!svc_grp) svc_grp = "";
op_mep = sandesha2_msg_store_bean_get_op_mep(bean, env);;
+ if(!op_mep) op_mep = "";
to_url = sandesha2_msg_store_bean_get_to_url(bean, env);
+ if(!to_url) to_url = "";
reply_to = sandesha2_msg_store_bean_get_reply_to(bean, env);
+ if(!reply_to) reply_to = "";
transport_to = sandesha2_msg_store_bean_get_transport_to(bean, env);
+ if(!transport_to) transport_to = "";
execution_chain_str = sandesha2_msg_store_bean_get_execution_chain_str(bean, env);
+ if(!execution_chain_str) execution_chain_str = "";
flow = sandesha2_msg_store_bean_get_flow(bean, env);
msg_recv_str = sandesha2_msg_store_bean_get_msg_recv_str(bean, env);
+ if(!msg_recv_str) msg_recv_str = "";
svr_side = sandesha2_msg_store_bean_is_svr_side(bean, env);
in_msg_store_key = sandesha2_msg_store_bean_get_in_msg_store_key(bean, env);
+ if(!in_msg_store_key) in_msg_store_key = "";
prop_str = sandesha2_msg_store_bean_get_persistent_property_str(bean, env);
+ if(!prop_str) prop_str = "";
action = sandesha2_msg_store_bean_get_action(bean, env);
+ if(!action) action = "";
sql_size = axutil_strlen(msg_id) + axutil_strlen(stored_key) +
axutil_strlen(soap_env_str) + sizeof(int) + sizeof(int) +
@@ -599,9 +630,6 @@
return AXIS2_FALSE;
}
- args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
- args->env = env;
- args->data = NULL;
sprintf(sql_stmt_retrieve, "select stored_key, msg_id, soap_env_str,"\
"soap_version, transport_out, op, svc, svc_grp, op_mep, to_url, reply_to, "\
"transport_to, execution_chain_str, flow, msg_recv_str, svr_side, "\
@@ -619,13 +647,9 @@
return AXIS2_FALSE;
}
res = mysql_store_result(dbconn);
- sandesha2_msg_store_bean_retrieve_callback(res, args);
+ num_rows = mysql_num_rows(res);
mysql_free_result(res);
- if(args->data)
- msg_store_bean = (sandesha2_msg_store_bean_t *) args->data;
- if(args)
- AXIS2_FREE(env->allocator, args);
- if(msg_store_bean)
+ if(num_rows > 0)
{
sql_stmt_update = AXIS2_MALLOC(env->allocator, sql_size);
sprintf(sql_stmt_update, "update msg set msg_id='%s',"\
Modified: webservices/sandesha/trunk/c/src/storage/mysql/permanent_storage_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/mysql/permanent_storage_mgr.c?view=diff&rev=533465&r1=533464&r2=533465
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/mysql/permanent_storage_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/mysql/permanent_storage_mgr.c Sat Apr 28 22:40:30 2007
@@ -70,7 +70,6 @@
sandesha2_invoker_mgr_t *invoker_mgr;
axis2_conf_ctx_t *conf_ctx;
axis2_char_t *db_name;
- /*MYSQL *db;*/
axutil_hash_t *transactions;
sandesha2_permanent_bean_mgr_t *bean_mgr;
axutil_hash_t *msg_ctx_map;
@@ -723,19 +722,10 @@
address = (axis2_char_t *) axis2_endpoint_ref_get_address(reply_to, env);
sandesha2_msg_store_bean_set_reply_to(bean, env, address);
}
- /*property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_TRANSPORT_URL,
- AXIS2_FALSE);
- if(property)
-
- {
+ axis2_char_t *transport_to = NULL;
+ transport_to = axis2_msg_ctx_get_transport_url(msg_ctx, env);
+ if(transport_to)
sandesha2_msg_store_bean_set_transport_to(bean, env, transport_to);
- }*/
- {
- axis2_char_t *transport_to = NULL;
- transport_to = axis2_msg_ctx_get_transport_url(msg_ctx, env);
- if(transport_to)
- sandesha2_msg_store_bean_set_transport_to(bean, env, transport_to);
- }
options = (axis2_options_t *) axis2_msg_ctx_get_options(msg_ctx, env);
action = (axis2_char_t *) axis2_options_get_action(options, env);
@@ -817,11 +807,12 @@
key, AXIS2_HASH_KEY_STRING);
if(msg_ctx)
return msg_ctx;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "retrieved from database");
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "retrieving msg_ctx from database");
msg_store_bean = sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(
storage_mgr_impl->bean_mgr, env, key);
if (!msg_store_bean)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "msg_store_bean is NULL");
return NULL;
}
msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
@@ -843,15 +834,13 @@
soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
if (!soap_envelope)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "soap_envelope retrieved is NULL");
axiom_soap_builder_free(soap_builder, env);
return NULL;
}
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
axis2_msg_ctx_set_msg_id(msg_ctx, env, sandesha2_msg_store_bean_get_msg_id(
msg_store_bean, env));
- /* You cannot set the same message id to a new message context again. So generate
- * a new message id and set it
- * axis2_msg_ctx_set_msg_id(msg_ctx, env, axutil_uuid_gen(env));*/
conf = axis2_conf_ctx_get_conf(conf_ctx, env);
transport_out = sandesha2_msg_store_bean_get_transport_out(msg_store_bean,
@@ -966,9 +955,7 @@
axis2_char_t *msg_id = NULL;
axis2_op_ctx_set_parent(op_ctx, env, svc_ctx);
axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx);
- /* axis2_op_ctx_add_msg_ctx(op_ctx, env, msg_ctx);*/
msg_id = (axis2_char_t *) axis2_msg_ctx_get_msg_id(msg_ctx, env);
- /*axis2_conf_ctx_register_op_ctx(conf_ctx, env, msg_id, op_ctx);*/
}
axutil_allocator_switch_to_local_pool(env->allocator);
}
@@ -980,9 +967,6 @@
env);
if(transport_to_str)
{
- /*property = axutil_property_create_with_args(env, 0, 0, 0, transport_to_str);
- axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_URL, property,
- AXIS2_FALSE);*/
axis2_msg_ctx_set_transport_url(msg_ctx, env, transport_to_str);
}
to_url_str = sandesha2_msg_store_bean_get_to_url(msg_store_bean, env);
@@ -1042,30 +1026,6 @@
axutil_hash_t *properties = axis2_options_get_properties(options, env);
axutil_hash_index_t *index = NULL;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_QUALIFIED_FOR_SENDING);
- if(property)
- {
- axis2_char_t *value = axutil_property_get_value(property, env);
- prop_str = axutil_strcat(env, SANDESHA2_QUALIFIED_FOR_SENDING,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, value, NULL);
- }
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- AXIS2_WSA_VERSION);
- if(property)
- {
- axis2_char_t *temp_str = NULL;
- axis2_char_t *value = axutil_property_get_value(property, env);
- if(value)
- {
- temp_str = prop_str;
- prop_str = axutil_strcat(env, temp_str,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, AXIS2_WSA_VERSION,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, value, NULL);
- if(temp_str && 0 < axutil_strlen(temp_str))
- AXIS2_FREE(env->allocator, temp_str);
- }
- }
for (index = axutil_hash_first(properties, env); index; index =
axutil_hash_next(env, index))
{
@@ -1117,11 +1077,10 @@
SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR);
if(values)
size = axutil_array_list_size(values, env);
- if((size % 2 != 0) || (size == 1 && 0 == axutil_strcmp("",
- axutil_array_list_get(values, env, 0))))
+ if((size % 2 != 0))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Invalid persistence property string");
+ "[sandesha2]Invalid persistence property string:%s", str);
AXIS2_ERROR_SET(env->error,
SANDESHA2_ERROR_INVALID_PERSISTENCE_PROPERTY_STRING, AXIS2_FAILURE);
return NULL;
Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?view=diff&rev=533465&r1=533464&r2=533465
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Sat Apr 28 22:40:30 2007
@@ -1299,12 +1299,14 @@
{
ptr[0] = AXIS2_EOLN;
value = axutil_strdup(env, str);
- axutil_array_list_add(list, env, value);
+ if(value && 0 != axutil_strcmp(value, ""))
+ axutil_array_list_add(list, env, value);
str = ptr + 3;
ptr = axutil_strstr(str, pattern);
}
value = axutil_strdup(env, str);
- axutil_array_list_add(list, env, value);
+ if(value && 0 != axutil_strcmp(value, ""))
+ axutil_array_list_add(list, env, value);
return list;
}
Modified: webservices/sandesha/trunk/c/src/workers/sender_worker.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender_worker.c?view=diff&rev=533465&r1=533464&r2=533465
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Sat Apr 28 22:40:30 2007
@@ -298,7 +298,6 @@
}
if(!msg_ctx)
{
- printf("msg_ctx is not present\n");
sandesha2_transaction_rollback(transaction, env);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] msg_ctx is "
"not present in the store");
@@ -323,7 +322,6 @@
sandesha2_sender_mgr_update(sender_mgr, env, sender_worker_bean);
if(!continue_sending)
{
- printf("do not continue\n");
sender_worker->status = AXIS2_FAILURE;
/* We commit here since we have cleaned the
* sending side data and that need to commited */
@@ -343,7 +341,6 @@
if(qualified_for_sending && 0 != axutil_strcmp(
qualified_for_sending, AXIS2_VALUE_TRUE))
{
- printf("not qualified for sending\n");
sandesha2_transaction_rollback(transaction, env);
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
"[sandesha2] Message is not qualified for sending");
@@ -378,7 +375,6 @@
}
if(continue_sending)
{
- printf("continue sending is true\n");
sandesha2_transaction_rollback(transaction, env);
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Continue "\
"Sending is true. So returning from Sender Worker");
@@ -636,8 +632,10 @@
res_envelope = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env);
if(!res_envelope)
+ {
res_envelope = axis2_http_transport_utils_create_soap_msg(env, msg_ctx,
soap_ns_uri);
+ }
property = axis2_msg_ctx_get_property(msg_ctx, env,
SANDESHA2_WITHIN_TRANSACTION);
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org