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 2008/08/29 08:56:38 UTC
svn commit: r690127 [7/11] - in /webservices/sandesha/trunk/c: ./
build/win32/ config/ ides/vc8/sandesha2/sandesha2/ include/
include/sandesha2/ samples/ samples/RMSampleService/ samples/rm_echo_1_0/
samples/rm_echo_1_0_large_sequence/ samples/rm_echo_...
Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c Thu Aug 28 23:56:29 2008
@@ -69,10 +69,10 @@
sandesha2_create_seq_bean_set_create_seq_msg_id(bean, env, argv[i]);
if(0 == axutil_strcmp(col_name[i], "internal_seq_id"))
if(argv[i])
- sandesha2_create_seq_bean_set_internal_seq_id(bean, env, argv[i]);
+ sandesha2_create_seq_bean_set_internal_sequence_id(bean, env, argv[i]);
if(0 == axutil_strcmp(col_name[i], "seq_id"))
if(argv[i])
- sandesha2_create_seq_bean_set_seq_id(bean, env, argv[i]);
+ sandesha2_create_seq_bean_set_rms_sequence_id(bean, env, argv[i]);
if(0 == axutil_strcmp(col_name[i], "create_seq_msg_store_key"))
if(argv[i])
sandesha2_create_seq_bean_set_create_seq_msg_store_key(bean, env,
@@ -108,21 +108,39 @@
}
for(i = 0; i < argc; i++)
{
- if(0 == axutil_strcmp(col_name[i], "create_seq_msg_id"))
+ if(!axutil_strcmp(col_name[i], "create_seq_msg_id"))
+ {
sandesha2_create_seq_bean_set_create_seq_msg_id(bean, env, argv[i]);
- if(0 == axutil_strcmp(col_name[i], "internal_seq_id"))
+ }
+
+ if(!axutil_strcmp(col_name[i], "internal_seq_id"))
+ {
if(argv[i])
- sandesha2_create_seq_bean_set_internal_seq_id(bean, env, argv[i]);
- if(0 == axutil_strcmp(col_name[i], "seq_id"))
+ {
+ sandesha2_create_seq_bean_set_internal_sequence_id(bean, env, argv[i]);
+ }
+ }
+ if(!axutil_strcmp(col_name[i], "seq_id"))
+ {
if(argv[i])
- sandesha2_create_seq_bean_set_seq_id(bean, env, argv[i]);
- if(0 == axutil_strcmp(col_name[i], "create_seq_msg_store_key"))
+ {
+ sandesha2_create_seq_bean_set_rms_sequence_id(bean, env, argv[i]);
+ }
+ }
+ if(!axutil_strcmp(col_name[i], "create_seq_msg_store_key"))
+ {
if(argv[i])
- sandesha2_create_seq_bean_set_create_seq_msg_store_key(bean, env,
- argv[i]);
- if(0 == axutil_strcmp(col_name[i], "ref_msg_store_key"))
+ {
+ sandesha2_create_seq_bean_set_create_seq_msg_store_key(bean, env, argv[i]);
+ }
+ }
+ if(!axutil_strcmp(col_name[i], "ref_msg_store_key"))
+ {
if(argv[i])
+ {
sandesha2_create_seq_bean_set_ref_msg_store_key(bean, env, argv[i]);
+ }
+ }
}
return 0;
}
@@ -176,7 +194,7 @@
sandesha2_permanent_create_seq_mgr_retrieve,
sandesha2_permanent_create_seq_mgr_update,
sandesha2_permanent_create_seq_mgr_find,
- sandesha2_permanent_create_seq_mgr_find_unique,
+ sandesha2_permanent_create_seq_mgr_find_unique
};
AXIS2_EXTERN sandesha2_create_seq_mgr_t * AXIS2_CALL
@@ -229,13 +247,11 @@
axis2_char_t *create_seq_msg_store_key = NULL;
axis2_char_t *ref_msg_store_key = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_insert");
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
create_seq_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(
bean, env);
- internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(bean, env);
- seq_id = sandesha2_create_seq_bean_get_seq_id(bean, env);
+ internal_seq_id = sandesha2_create_seq_bean_get_internal_sequence_id(bean, env);
+ seq_id = sandesha2_create_seq_bean_get_rms_sequence_id(bean, env);
create_seq_msg_store_key = sandesha2_create_seq_bean_get_create_seq_msg_store_key(bean, env);
ref_msg_store_key = sandesha2_create_seq_bean_get_ref_msg_store_key(bean, env);
@@ -248,8 +264,7 @@
ret = sandesha2_permanent_bean_mgr_insert(seq_mgr_impl->bean_mgr, env,
sql_insert);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_insert");
+
return ret;
}
@@ -262,15 +277,13 @@
sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
axis2_char_t sql_remove[256];
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_remove");
AXIS2_PARAM_CHECK(env->error, msg_id, AXIS2_FALSE);
+
seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr);
sprintf(sql_remove, "delete from create_seq where create_seq_msg_id='%s';",
msg_id);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_remove");
+
return sandesha2_permanent_bean_mgr_remove(seq_mgr_impl->bean_mgr, env,
sql_remove);
}
@@ -283,16 +296,15 @@
{
axis2_char_t sql_retrieve[256];
sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_retrieve");
+
AXIS2_PARAM_CHECK(env->error, msg_id, AXIS2_FALSE);
+
seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr);
sprintf(sql_retrieve, "select create_seq_msg_id, internal_seq_id,"\
"seq_id, create_seq_msg_store_key, ref_msg_store_key from create_seq "\
"where create_seq_msg_id='%s';", msg_id);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_retrieve");
+
return (sandesha2_create_seq_bean_t *) sandesha2_permanent_bean_mgr_retrieve(
seq_mgr_impl->bean_mgr, env, sandesha2_create_seq_retrieve_callback,
sql_retrieve);
@@ -312,13 +324,13 @@
axis2_char_t *create_seq_msg_store_key = NULL;
axis2_char_t *seq_id = NULL;
axis2_char_t *ref_msg_store_key = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "Entry:[sandesha2]sandesha2_permanent_create_seq_mgr_update");
+
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+
create_seq_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(
bean, env);
- internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(bean, env);
- seq_id = sandesha2_create_seq_bean_get_seq_id(bean, env);
+ internal_seq_id = sandesha2_create_seq_bean_get_internal_sequence_id(bean, env);
+ seq_id = sandesha2_create_seq_bean_get_rms_sequence_id(bean, env);
create_seq_msg_store_key = sandesha2_create_seq_bean_get_create_seq_msg_store_key(bean, env);
ref_msg_store_key = sandesha2_create_seq_bean_get_ref_msg_store_key(bean, env);
@@ -328,11 +340,9 @@
",create_seq_msg_store_key='%s', ref_msg_store_key='%s' where "\
"create_seq_msg_id='%s';", internal_seq_id, seq_id,
create_seq_msg_store_key, ref_msg_store_key, create_seq_msg_id);
- ret = sandesha2_permanent_bean_mgr_update(seq_mgr_impl->bean_mgr, env,
- sql_update);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "Exit:[sandesha2]sandesha2_permanent_create_seq_mgr_update:return:%d",
- ret);
+
+ ret = sandesha2_permanent_bean_mgr_update(seq_mgr_impl->bean_mgr, env, sql_update);
+
return ret;
}
@@ -349,15 +359,14 @@
axis2_char_t *seq_id = NULL;
axutil_array_list_t *find_list = NULL;
sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "Entry:[sandesha2]sandesha2_permanent_create_seq_mgr_find");
+
seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr);
if(bean)
{
create_seq_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(
bean, env);
- internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(bean, env);
- seq_id = sandesha2_create_seq_bean_get_seq_id(bean, env);
+ internal_seq_id = sandesha2_create_seq_bean_get_internal_sequence_id(bean, env);
+ seq_id = sandesha2_create_seq_bean_get_rms_sequence_id(bean, env);
}
sprintf(sql_find, "select create_seq_msg_id,internal_seq_id,"\
"seq_id,create_seq_msg_store_key, ref_msg_store_key from create_seq");
@@ -395,8 +404,6 @@
find_list = sandesha2_permanent_bean_mgr_find(seq_mgr_impl->bean_mgr, env,
sandesha2_create_seq_find_callback, sql_find);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "Exit:[sandesha2]sandesha2_permanent_create_seq_mgr_find");
return find_list;
}
@@ -409,7 +416,9 @@
int size = 0;
sandesha2_create_seq_bean_t *result = NULL;
axutil_array_list_t *find_list = NULL;
+
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+
find_list = sandesha2_permanent_create_seq_mgr_find(seq_mgr, env, bean);
if(find_list)
size = axutil_array_list_size(find_list, env);
Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_next_msg_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_next_msg_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_next_msg_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_next_msg_mgr.c Thu Aug 28 23:56:29 2008
@@ -258,8 +258,6 @@
long msg_no;
sandesha2_permanent_next_msg_mgr_t *next_msg_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_next_msg_mgr_insert");
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
seq_id = sandesha2_next_msg_bean_get_seq_id(bean,
@@ -275,8 +273,7 @@
"ref_msg_key,"\
"polling_mode, msg_no) values('%s', '%s', '%s', %d, %ld);", seq_id,
internal_seq_id, ref_msg_key, polling_mode, msg_no);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_next_msg_mgr_insert");
+
return sandesha2_permanent_bean_mgr_insert(next_msg_mgr_impl->bean_mgr, env,
sql_insert);
}
@@ -289,14 +286,12 @@
{
axis2_char_t sql_remove[256];
sandesha2_permanent_next_msg_mgr_t *next_msg_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_next_msg_mgr_remove");
+
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
next_msg_mgr_impl = SANDESHA2_INTF_TO_IMPL(next_msg_mgr);
sprintf(sql_remove, "delete from next_msg where seq_id='%s'",
seq_id);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_next_msg_mgr_remove");
+
return sandesha2_permanent_bean_mgr_remove(next_msg_mgr_impl->bean_mgr, env,
sql_remove);
}
@@ -313,15 +308,13 @@
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
next_msg_mgr_impl = SANDESHA2_INTF_TO_IMPL(next_msg_mgr);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_next_msg_mgr_retrieve");
+
sprintf(sql_retrieve, "select seq_id, internal_seq_id, ref_msg_key, "\
"polling_mode, msg_no from next_msg where seq_id='%s';", seq_id);
bean = (sandesha2_next_msg_bean_t *) sandesha2_permanent_bean_mgr_retrieve(
next_msg_mgr_impl->bean_mgr, env, sandesha2_next_msg_retrieve_callback,
sql_retrieve);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_next_msg_mgr_retrieve");
+
return bean;
}
@@ -339,8 +332,7 @@
axis2_char_t *ref_msg_key = NULL;
axis2_bool_t polling_mode = AXIS2_FALSE;
long msg_no;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_next_msg_mgr_update");
+
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
seq_id = sandesha2_next_msg_bean_get_seq_id(bean,
env);
@@ -358,8 +350,7 @@
polling_mode, msg_no, seq_id);
ret = sandesha2_permanent_bean_mgr_update(next_msg_mgr_impl->bean_mgr, env,
sql_update);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_next_msg_mgr_update");
+
return ret;
}
@@ -377,8 +368,7 @@
axutil_array_list_t *find_list = NULL;
sandesha2_permanent_next_msg_mgr_t *next_msg_mgr_impl = NULL;
next_msg_mgr_impl = SANDESHA2_INTF_TO_IMPL(next_msg_mgr);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_next_msg_mgr_find");
+
if(bean)
{
seq_id = sandesha2_next_msg_bean_get_seq_id(bean,
@@ -423,8 +413,6 @@
find_list = sandesha2_permanent_bean_mgr_find(next_msg_mgr_impl->bean_mgr,
env, sandesha2_next_msg_find_callback, sql_find);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_next_msg_mgr_find");
return find_list;
}
Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c Thu Aug 28 23:56:29 2008
@@ -203,6 +203,13 @@
sandesha2_sender_bean_t *bean);
sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_get_application_msg_to_send(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axutil_env_t *env,
+ const axis2_char_t *seq_id,
+ const axis2_char_t *msg_id);
+
+sandesha2_sender_bean_t *AXIS2_CALL
sandesha2_permanent_sender_mgr_get_next_msg_to_send(
sandesha2_sender_mgr_t *sender_mgr,
const axutil_env_t *env,
@@ -218,7 +225,8 @@
sandesha2_permanent_sender_mgr_find_by_internal_seq_id,
sandesha2_permanent_sender_mgr_find_by_sender_bean,
sandesha2_permanent_sender_mgr_find_unique,
- sandesha2_permanent_sender_mgr_get_next_msg_to_send,
+ sandesha2_permanent_sender_mgr_get_application_msg_to_send,
+ sandesha2_permanent_sender_mgr_get_next_msg_to_send
};
AXIS2_EXTERN sandesha2_sender_mgr_t * AXIS2_CALL
@@ -279,12 +287,9 @@
axis2_char_t *wsrm_anon_uri = NULL;
axis2_char_t *to_address = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_sender_mgr_insert");
-
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
- msg_id = sandesha2_sender_bean_get_msg_id(bean,
- env);
+
+ msg_id = sandesha2_sender_bean_get_msg_id(bean, env);
msg_ctx_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(bean, env);
internal_seq_id = sandesha2_sender_bean_get_internal_seq_id(bean, env);
sent_count = sandesha2_sender_bean_get_sent_count(bean, env);
@@ -306,10 +311,8 @@
internal_seq_id, sent_count, msg_no, send, resend, time_to_send,
msg_type, seq_id, wsrm_anon_uri, to_address);
- ret = sandesha2_permanent_bean_mgr_insert(sender_mgr_impl->bean_mgr, env,
- sql_insert);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_sender_mgr_insert");
+ ret = sandesha2_permanent_bean_mgr_insert(sender_mgr_impl->bean_mgr, env, sql_insert);
+
return ret;
}
@@ -345,8 +348,6 @@
sandesha2_sender_bean_t *ret = NULL;
sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_sender_mgr_retrieve");
AXIS2_PARAM_CHECK(env->error, msg_id, AXIS2_FALSE);
sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
@@ -358,8 +359,6 @@
sender_mgr_impl->bean_mgr, env, sandesha2_sender_retrieve_callback,
sql_retrieve);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_sender_mgr_retrieve");
return ret;
}
@@ -385,11 +384,9 @@
axis2_char_t *wsrm_anon_uri = NULL;
axis2_char_t *to_address = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_sender_mgr_update");
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
- msg_id = sandesha2_sender_bean_get_msg_id(bean,
- env);
+
+ msg_id = sandesha2_sender_bean_get_msg_id(bean, env);
msg_ctx_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(bean, env);
internal_seq_id = sandesha2_sender_bean_get_internal_seq_id(bean, env);
sent_count= sandesha2_sender_bean_get_sent_count(bean, env);
@@ -414,11 +411,7 @@
ret = sandesha2_permanent_bean_mgr_update(sender_mgr_impl->bean_mgr, env,
sql_update);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_sender_mgr_update");
return ret;
-
- return AXIS2_SUCCESS;
}
axutil_array_list_t *AXIS2_CALL
@@ -430,18 +423,17 @@
axutil_array_list_t *find_list = NULL;
axis2_char_t sql_find[1054];
sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_sender_mgr_find_by_internal_seq_id");
+
sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
sprintf(sql_find, "select msg_id, msg_ctx_ref_key, internal_seq_id, "\
"sent_count, msg_no, send, resend, time_to_send, msg_type, seq_id, "\
"wsrm_anon_uri, to_address from sender where internal_seq_id='%s';",
internal_seq_id);
+
find_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
sandesha2_sender_find_callback, sql_find);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_sender_mgr_find_by_internal_seq_id");
+
return find_list;
}
@@ -455,6 +447,7 @@
axis2_char_t *msg_id = NULL;
axis2_char_t *msg_ctx_ref_key = NULL;
axis2_char_t *internal_seq_id = NULL;
+ axis2_char_t *seq_id = NULL;
long msg_no = 0;
axis2_bool_t send = AXIS2_FALSE;
long time_to_send = 0;
@@ -462,15 +455,16 @@
axutil_array_list_t *find_list = NULL;
axis2_char_t sql_find[1024];
sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_sender_mgr_find_by_sender_bean");
+
sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
if(bean)
{
msg_id = sandesha2_sender_bean_get_msg_id(bean,
env);
msg_ctx_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(bean, env);
internal_seq_id = sandesha2_sender_bean_get_internal_seq_id(bean, env);
+ seq_id = sandesha2_sender_bean_get_seq_id(bean, env);
msg_no = sandesha2_sender_bean_get_msg_no(bean, env);
send = sandesha2_sender_bean_is_send(bean, env);
time_to_send = sandesha2_sender_bean_get_time_to_send(bean, env);
@@ -509,18 +503,35 @@
sprintf(sql_find + axutil_strlen(sql_find),
" and msg_id = '%s'", msg_id);
}
+
if(internal_seq_id)
{
if(!add_where)
{
add_where = AXIS2_TRUE;
- sprintf(sql_find + axutil_strlen(sql_find),
- " where internal_seq_id = '%s'", internal_seq_id);
+ sprintf(sql_find + axutil_strlen(sql_find), " where internal_seq_id = '%s'",
+ internal_seq_id);
}
else
- sprintf(sql_find + axutil_strlen(sql_find),
- " and internal_seq_id = '%s'", internal_seq_id);
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), " and internal_seq_id = '%s'",
+ internal_seq_id);
+ }
}
+
+ if(seq_id)
+ {
+ if(!add_where)
+ {
+ add_where = AXIS2_TRUE;
+ sprintf(sql_find + axutil_strlen(sql_find), " where seq_id = '%s'", seq_id);
+ }
+ else
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), " and seq_id = '%s'", seq_id);
+ }
+ }
+
if(msg_no > 0)
{
if(!add_where)
@@ -556,11 +567,12 @@
sprintf(sql_find + axutil_strlen(sql_find),
" and send = %d", send);
}
+
sprintf(sql_find + axutil_strlen(sql_find), ";");
+
find_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
sandesha2_sender_find_callback, sql_find);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_sender_mgr_find_by_sender_bean");
+
return find_list;
}
@@ -587,6 +599,100 @@
}
sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_get_application_msg_to_send(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axutil_env_t *env,
+ const axis2_char_t *seq_id,
+ const axis2_char_t *msg_id)
+{
+ int i = 0;
+ int index = 0;
+ int match_list_size = 0;
+ axutil_array_list_t *match_list = NULL;
+ axis2_char_t sql_find[1024];
+ /*long time_now = 0;*/
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ sandesha2_sender_bean_t *result = NULL;
+
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ sprintf(sql_find, "select msg_id, msg_ctx_ref_key, "\
+ "internal_seq_id, sent_count, msg_no, send, resend, "\
+ "time_to_send, msg_type, seq_id, wsrm_anon_uri, "\
+ "to_address from sender where ");
+
+ /*time_now = sandesha2_utils_get_current_time_in_millis(env);
+ if(time_now > 0)
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), "time_to_send <= %ld ", time_now);
+ }*/
+
+ sprintf(sql_find + axutil_strlen(sql_find), "msg_type='%d'", SANDESHA2_MSG_TYPE_APPLICATION);
+
+ if(seq_id)
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), "and internal_seq_id='%s'", seq_id);
+ }
+
+ if(msg_id)
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), "and msg_id='%s'", msg_id);
+ }
+
+ sprintf(sql_find + axutil_strlen(sql_find), " and send='%d'", AXIS2_TRUE);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sql_find:%s", sql_find);
+
+ match_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
+ sandesha2_sender_find_callback, sql_find);
+ match_list_size = axutil_array_list_size(match_list, env);
+
+ /*
+ * We carry on through the application message list to be sure that we send the lowest application
+ * message avaliable.
+ */
+ for(i = 0; i < match_list_size; i++)
+ {
+ sandesha2_sender_bean_t *bean = NULL;
+ long result_msg_no = -1;
+ long msg_no = -1;
+
+ bean = (sandesha2_sender_bean_t *) axutil_array_list_get(match_list, env, i);
+
+ msg_no = sandesha2_sender_bean_get_msg_no(bean, env);
+
+ if(result)
+ {
+ result_msg_no = sandesha2_sender_bean_get_msg_no(result, env);
+ }
+
+ if(!result || result_msg_no > msg_no)
+ {
+ result = bean;
+ index = i;
+ }
+ }
+
+ result = axutil_array_list_remove(match_list, env, index);
+ if(match_list)
+ {
+ int j = 0, sizej = 0;
+
+ sizej = axutil_array_list_size(match_list, env);
+ for(j = 0; j < sizej; j++)
+ {
+ sandesha2_sender_bean_t *temp_bean = NULL;
+ temp_bean = axutil_array_list_get(match_list, env, j);
+ sandesha2_sender_bean_free(temp_bean, env);
+ }
+
+ axutil_array_list_free(match_list, env);
+ }
+
+ return result;
+}
+
+sandesha2_sender_bean_t *AXIS2_CALL
sandesha2_permanent_sender_mgr_get_next_msg_to_send(
sandesha2_sender_mgr_t *sender_mgr,
const axutil_env_t *env,
@@ -601,25 +707,34 @@
sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
sandesha2_sender_bean_t *result = NULL;
axis2_bool_t send_make_connection = AXIS2_TRUE;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_"\
- "permanent_sender_mgr_get_next_msg_to_send");
+
+
sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
sprintf(sql_find, "select msg_id, msg_ctx_ref_key, "\
"internal_seq_id, sent_count, msg_no, send, resend, "\
"time_to_send, msg_type, seq_id, wsrm_anon_uri, "\
"to_address from sender where ");
+
time_now = sandesha2_utils_get_current_time_in_millis(env);
if(time_now > 0)
- sprintf(sql_find + axutil_strlen(sql_find), "time_to_send <= %ld ",
- time_now);
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), "time_to_send <= %ld ", time_now);
+ }
+
if(seq_id)
- sprintf(sql_find + axutil_strlen(sql_find), "and internal_seq_id='%s'",
- seq_id);
+ {
+ sprintf(sql_find + axutil_strlen(sql_find), "and internal_seq_id='%s'", seq_id);
+ }
+
sprintf(sql_find + axutil_strlen(sql_find), " and send=%d", AXIS2_TRUE);
- match_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr,
- env, sandesha2_sender_find_callback, sql_find);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sql_find:%s", sql_find);
+
+ match_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
+ sandesha2_sender_find_callback, sql_find);
match_list_size = axutil_array_list_size(match_list, env);
+
/*
* We either return an application message or an RM message. If we find
* an application message first then we carry on through the list to be
@@ -629,23 +744,17 @@
for(i = 0; i < match_list_size; i++)
{
sandesha2_sender_bean_t *bean = NULL;
+
int msg_type = -1;
- bean = (sandesha2_sender_bean_t *) axutil_array_list_get(match_list,
- env, i);
+
+ bean = (sandesha2_sender_bean_t *) axutil_array_list_get(match_list, env, i);
msg_type = sandesha2_sender_bean_get_msg_type(bean, env);
- if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]msg_type:%d", msg_type);
+ if(msg_type == SANDESHA2_MSG_TYPE_ACK)
{
- long msg_no = sandesha2_sender_bean_get_msg_no(bean, env);
- long result_msg_no = -1;
- if(result)
- result_msg_no = sandesha2_sender_bean_get_msg_no(result, env);
- if(result == NULL || result_msg_no > msg_no)
- {
- result = bean;
- index = i;
- send_make_connection = AXIS2_FALSE;
- }
+ continue;
}
+
else if(msg_type == SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG)
{
if(send_make_connection)
@@ -662,10 +771,12 @@
send_make_connection = AXIS2_FALSE;
}
}
+
result = axutil_array_list_remove(match_list, env, index);
if(match_list)
{
int j = 0, sizej = 0;
+
sizej = axutil_array_list_size(match_list, env);
for(j = 0; j < sizej; j++)
{
@@ -673,10 +784,10 @@
temp_bean = axutil_array_list_get(match_list, env, j);
sandesha2_sender_bean_free(temp_bean, env);
}
+
axutil_array_list_free(match_list, env);
}
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:sandesha2_"\
- "permanent_sender_mgr_get_next_msg_to_send");
+
return result;
}
Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_seq_property_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_seq_property_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_seq_property_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_seq_property_mgr.c Thu Aug 28 23:56:29 2008
@@ -137,8 +137,8 @@
sandesha2_permanent_seq_property_mgr_retrieve(
sandesha2_seq_property_mgr_t *seq_prop_mgr,
const axutil_env_t *env,
- axis2_char_t *seq_id,
- axis2_char_t *name);
+ const axis2_char_t *seq_id,
+ const axis2_char_t *name);
axis2_bool_t AXIS2_CALL
sandesha2_permanent_seq_property_mgr_update(
@@ -171,8 +171,8 @@
static axis2_char_t *
sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(
const axutil_env_t *env,
- axis2_char_t *seq_id,
- axis2_char_t *name);
+ const axis2_char_t *seq_id,
+ const axis2_char_t *name);
static const sandesha2_seq_property_mgr_ops_t seq_property_mgr_ops =
{
@@ -183,7 +183,7 @@
sandesha2_permanent_seq_property_mgr_update,
sandesha2_permanent_seq_property_mgr_find,
sandesha2_permanent_seq_property_mgr_find_unique,
- sandesha2_permanent_seq_property_mgr_retrieve_all,
+ sandesha2_permanent_seq_property_mgr_retrieve_all
};
AXIS2_EXTERN sandesha2_seq_property_mgr_t * AXIS2_CALL
@@ -241,9 +241,8 @@
axis2_char_t *name = NULL;
axis2_char_t *value = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_insert");
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+
id = sandesha2_permanent_seq_property_mgr_get_id_with_bean(env, bean);
seq_id = sandesha2_seq_property_bean_get_seq_id(bean, env);
name = sandesha2_seq_property_bean_get_name(bean, env);
@@ -257,8 +256,6 @@
AXIS2_FREE(env->allocator, id);
ret = sandesha2_permanent_bean_mgr_insert(seq_prop_mgr_impl->bean_mgr, env,
sql_insert);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_insert");
return ret;
}
@@ -273,11 +270,10 @@
axis2_char_t sql_remove[256];
axis2_status_t status = AXIS2_FAILURE;
sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_remove");
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FALSE);
+
seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
key = sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(env,
seq_id, name);
@@ -285,8 +281,6 @@
status = sandesha2_permanent_bean_mgr_remove(seq_prop_mgr_impl->bean_mgr, env,
sql_remove);
AXIS2_FREE(env->allocator, key);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_remove");
return status;
}
@@ -294,19 +288,17 @@
sandesha2_permanent_seq_property_mgr_retrieve(
sandesha2_seq_property_mgr_t *seq_prop_mgr,
const axutil_env_t *env,
- axis2_char_t *seq_id,
- axis2_char_t *name)
+ const axis2_char_t *seq_id,
+ const axis2_char_t *name)
{
axis2_char_t *key = NULL;
axis2_char_t sql_retrieve[1024];
sandesha2_seq_property_bean_t *ret = NULL;
sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_retrieve");
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FALSE);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]seq_property_name:%s", name);
+
seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
key = sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(env,
seq_id, name);
@@ -316,8 +308,6 @@
seq_prop_mgr_impl->bean_mgr, env, sandesha2_seq_property_retrieve_callback,
sql_retrieve);
AXIS2_FREE(env->allocator, key);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_retrieve");
return ret;
}
@@ -335,9 +325,8 @@
axis2_char_t *name = NULL;
axis2_char_t *value = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_update");
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+
id = sandesha2_permanent_seq_property_mgr_get_id_with_bean(env, bean);
seq_id = sandesha2_seq_property_bean_get_seq_id(bean, env);
name = sandesha2_seq_property_bean_get_name(bean, env);
@@ -351,8 +340,6 @@
AXIS2_FREE(env->allocator, id);
ret = sandesha2_permanent_bean_mgr_update(seq_prop_mgr_impl->bean_mgr, env,
sql_update);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_update");
return ret;
}
@@ -369,8 +356,7 @@
axis2_char_t *value = NULL;
axutil_array_list_t *find_list = NULL;
sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_find");
+
seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
if(bean)
{
@@ -413,8 +399,7 @@
find_list = sandesha2_permanent_bean_mgr_find(seq_prop_mgr_impl->bean_mgr,
env, sandesha2_seq_property_find_callback, sql_find);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_find");
+
return find_list;
}
@@ -427,7 +412,9 @@
int size = 0;
sandesha2_seq_property_bean_t *result = NULL;
axutil_array_list_t *find_list = NULL;
+
AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+
find_list = sandesha2_permanent_seq_property_mgr_find(seq_prop_mgr, env,
bean);
if(find_list)
@@ -453,8 +440,8 @@
static axis2_char_t *
sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(
const axutil_env_t *env,
- axis2_char_t *seq_id,
- axis2_char_t *name)
+ const axis2_char_t *seq_id,
+ const axis2_char_t *name)
{
axis2_char_t *id = NULL;
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=690127&r1=690126&r2=690127&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 Thu Aug 28 23:56:29 2008
@@ -52,6 +52,7 @@
{
sandesha2_storage_mgr_t storage_mgr;
sandesha2_permanent_bean_mgr_t *bean_mgr;
+ axutil_array_list_t *envelope_buffer_list;
} sandesha2_permanent_storage_mgr_t;
#define SANDESHA2_INTF_TO_IMPL(trans) \
@@ -67,13 +68,13 @@
sandesha2_storage_mgr_t *storage,
const axutil_env_t *envv);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_init(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axis2_conf_ctx_t *conf_ctx);
-axis2_msg_ctx_t *AXIS2_CALL
+static axis2_msg_ctx_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_msg_ctx(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
@@ -81,21 +82,22 @@
axis2_conf_ctx_t *conf_ctx,
const axis2_bool_t persistent);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_msg_ctx(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axis2_char_t *key,
- axis2_msg_ctx_t *msg_ctx);
+ axis2_msg_ctx_t *msg_ctx,
+ axis2_bool_t store_in_memory);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_update_msg_ctx(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axis2_char_t *key,
axis2_msg_ctx_t *msg_ctx);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_remove_msg_ctx(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
@@ -103,26 +105,26 @@
axis2_conf_ctx_t *conf_ctx,
int msg_type);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_init_storage(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axis2_module_desc_t *module_desc);
-axiom_soap_envelope_t *AXIS2_CALL
+static axiom_soap_envelope_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_soap_envelope(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axis2_char_t *key);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_soap_envelope(
sandesha2_storage_mgr_t *storage,
const axutil_env_t *env,
axiom_soap_envelope_t *soap_env,
axis2_char_t *key);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -131,14 +133,14 @@
int msg_no,
int soap_version);
-axiom_soap_envelope_t * AXIS2_CALL
+static axiom_soap_envelope_t * AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
axis2_char_t *seq_id,
int msg_no);
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_remove_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -151,10 +153,10 @@
const axutil_env_t *env,
axis2_msg_ctx_t *msg_ctx);
-static axutil_hash_t *AXIS2_CALL
+/*static axutil_hash_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_get_property_map_from_string(
const axutil_env_t *env,
- axis2_char_t *str);
+ axis2_char_t *str);*/
static axis2_char_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_get_property_string(
@@ -189,6 +191,7 @@
sizeof(sandesha2_permanent_storage_mgr_t));
storage_mgr_impl->bean_mgr = NULL;
+ storage_mgr_impl->envelope_buffer_list = axutil_array_list_create(env, 0);
storage_mgr_impl->bean_mgr = sandesha2_permanent_bean_mgr_create(env,
dbname, NULL);
storage_mgr_impl->storage_mgr.ops = &storage_mgr_ops;
@@ -218,6 +221,27 @@
sandesha2_permanent_bean_mgr_free(storage_mgr_impl->bean_mgr, env);
storage_mgr_impl->bean_mgr = NULL;
}
+
+ if(storage_mgr_impl->envelope_buffer_list)
+ {
+ int i = 0, size = 0;
+
+ size = axutil_array_list_size(storage_mgr_impl->envelope_buffer_list, env);
+ for(i = 0; i < size; i++)
+ {
+ axis2_char_t *buffer = NULL;
+
+ buffer = axutil_array_list_get(storage_mgr_impl->envelope_buffer_list, env, i);
+ if(buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ }
+ }
+
+ axutil_array_list_free(storage_mgr_impl->envelope_buffer_list, env);
+ storage_mgr_impl->envelope_buffer_list = NULL;
+ }
+
if(storage_mgr_impl)
{
AXIS2_FREE(env->allocator, storage_mgr_impl);
@@ -226,7 +250,7 @@
return AXIS2_SUCCESS;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_init(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -235,12 +259,13 @@
return AXIS2_SUCCESS;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_msg_ctx(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
axis2_char_t *key,
- axis2_msg_ctx_t *msg_ctx)
+ axis2_msg_ctx_t *msg_ctx,
+ axis2_bool_t store_in_memory)
{
axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
axutil_property_t *property = NULL;
@@ -250,25 +275,30 @@
storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
property = axis2_ctx_get_property(ctx, env, SANDESHA2_MSG_CTX_MAP);
- axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_TRUE);
+ /*axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_TRUE);*/
msg_store_bean = sandesha2_permanent_storage_mgr_get_msg_store_bean(
storage_mgr, env, msg_ctx);
sandesha2_msg_store_bean_set_stored_key(msg_store_bean, env, key);
- sandesha2_permanent_bean_mgr_insert_msg_store_bean(storage_mgr_impl->bean_mgr,
- env, msg_store_bean);
- if(property)
+ sandesha2_permanent_bean_mgr_insert_msg_store_bean(storage_mgr_impl->bean_mgr, env,
+ msg_store_bean);
+
+ /*if(property && store_in_memory)
{
axutil_hash_t *msg_ctx_map = NULL;
msg_ctx_map = axutil_property_get_value(property, env);
axutil_hash_set(msg_ctx_map, axutil_strdup(env, key),
AXIS2_HASH_KEY_STRING, msg_ctx);
- }
+ }*/
+
if(msg_store_bean)
+ {
sandesha2_msg_store_bean_free(msg_store_bean, env);
+ }
+
return AXIS2_SUCCESS;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_update_msg_ctx(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -290,24 +320,26 @@
msg_ctx_map = axutil_property_get_value(property, env);
if(msg_ctx_map)
{
- axutil_hash_set(msg_ctx_map, axutil_strdup(env, key),
- AXIS2_HASH_KEY_STRING, msg_ctx);
+ axutil_hash_set(msg_ctx_map, axutil_strdup(env, key), AXIS2_HASH_KEY_STRING, msg_ctx);
}
}
}
- axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_TRUE);
- msg_store_bean = sandesha2_permanent_storage_mgr_get_msg_store_bean(
- storage_mgr, env, msg_ctx);
+ /*axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_TRUE);*/
+ msg_store_bean = sandesha2_permanent_storage_mgr_get_msg_store_bean(storage_mgr, env, msg_ctx);
sandesha2_msg_store_bean_set_stored_key(msg_store_bean, env, key);
- sandesha2_permanent_bean_mgr_update_msg_store_bean(storage_mgr_impl->bean_mgr,
- env, msg_store_bean);
+ sandesha2_permanent_bean_mgr_update_msg_store_bean(storage_mgr_impl->bean_mgr, env,
+ msg_store_bean);
+
if(msg_store_bean)
+ {
sandesha2_msg_store_bean_free(msg_store_bean, env);
+ }
+
return AXIS2_SUCCESS;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_remove_msg_ctx(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -316,7 +348,6 @@
int msg_type)
{
sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
- axis2_msg_ctx_t *msg_ctx = NULL;
axutil_property_t *property = NULL;
axis2_ctx_t *ctx = axis2_conf_ctx_get_base(conf_ctx, env);
axutil_hash_t *msg_ctx_map = NULL;
@@ -329,8 +360,8 @@
if(msg_ctx_map)
{
axutil_hash_index_t *i = NULL;
- for (i = axutil_hash_first(msg_ctx_map, env); i; i =
- axutil_hash_next(env, i))
+
+ for (i = axutil_hash_first(msg_ctx_map, env); i; i = axutil_hash_next(env, i))
{
const void *k = NULL;
void *v = NULL;
@@ -338,46 +369,24 @@
axutil_hash_this(i, &k, NULL, &v);
key_l = (axis2_char_t *) k;
- if(0 == axutil_strcmp(key, key_l))
+ if(!axutil_strcmp(key, key_l))
{
- axis2_op_ctx_t *op_ctx = NULL;
- msg_ctx = (axis2_msg_ctx_t *) v;
- op_ctx =
- axis2_msg_ctx_get_op_ctx(msg_ctx, env);
if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
{
- /*axiom_soap_envelope_t *soap_envelope =
- axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
- axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
- axiom_soap_envelope_free(soap_envelope, env);
- axis2_op_ctx_free(op_ctx, env);*/
- axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING,
- NULL);
+ axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING, NULL);
AXIS2_FREE(env->allocator, key_l);
}
- else if(msg_type != SANDESHA2_MSG_TYPE_CREATE_SEQ)
- {
- /*AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]Removing msg_ctx with msg_id:%s",
- axis2_msg_ctx_get_msg_id(msg_ctx, env));
- axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
- axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_FALSE);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);
- axis2_op_ctx_free(op_ctx, env);
- axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING,
- NULL);
- AXIS2_FREE(env->allocator, key_l);*/
- }
}
}
}
}
- sandesha2_permanent_bean_mgr_remove_msg_store_bean(
- storage_mgr_impl->bean_mgr, env, key);
+
+ sandesha2_permanent_bean_mgr_remove_msg_store_bean(storage_mgr_impl->bean_mgr, env, key);
+
return AXIS2_SUCCESS;
}
-axis2_msg_ctx_t * AXIS2_CALL
+static axis2_msg_ctx_t * AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_msg_ctx(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -388,259 +397,158 @@
sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
axis2_msg_ctx_t *msg_ctx = NULL;
axis2_conf_t *conf = NULL;
- axis2_svc_grp_t *svc_grp = NULL;
- axis2_svc_t *svc = NULL;
AXIS2_TRANSPORT_ENUMS transport_out = -1;
- axis2_char_t *soap_env_str = NULL;
- axis2_char_t *svc_grp_name_str = NULL;
- axis2_char_t *svc_name_str = NULL;
- axis2_char_t *op_name_str = NULL;
- axis2_char_t *op_mep_str = NULL;
axis2_char_t *to_url_str = NULL;
axis2_char_t *reply_to_str = NULL;
axis2_char_t *transport_to_str = NULL;
- axis2_char_t *persistent_prop_str = NULL;
axis2_transport_out_desc_t *transport_out_desc = NULL;
axis2_endpoint_ref_t *endpoint_ref = NULL;
- axis2_op_t *op = NULL;
- /*axis2_options_t *options = NULL;*/
axiom_xml_reader_t *reader = NULL;
int soap_version = -1;
axiom_stax_builder_t *om_builder = NULL;
axiom_soap_builder_t *soap_builder = NULL;
axiom_soap_envelope_t *soap_envelope = NULL;
sandesha2_msg_store_bean_t *msg_store_bean = NULL;
+ axis2_char_t *soap_env_str = NULL;
+ /*axis2_char_t *persistent_prop_str = NULL;
+ axutil_property_t *prop_property = NULL;*/
storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
- if(!persistent)
- {
- axutil_property_t *property = NULL;
- axis2_ctx_t *ctx = axis2_conf_ctx_get_base(conf_ctx, env);
- axutil_hash_t *msg_ctx_map = NULL;
- property = axis2_ctx_get_property(ctx, env, SANDESHA2_MSG_CTX_MAP);
- if(property)
- {
- msg_ctx_map = axutil_property_get_value(property, env);
- msg_ctx = (axis2_msg_ctx_t *) axutil_hash_get(msg_ctx_map, key,
- AXIS2_HASH_KEY_STRING);
- }
- }
- if(msg_ctx)
- return msg_ctx;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]retrieved from database");
- msg_store_bean = sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(
- storage_mgr_impl->bean_mgr, env, key);
+ 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, "[sandesha2] Message store bean is NULL");
return NULL;
}
+
msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
- soap_env_str = sandesha2_msg_store_bean_get_soap_envelope_str(msg_store_bean, env);
- reader = axiom_xml_reader_create_for_memory(env, soap_env_str, axutil_strlen(
- soap_env_str), NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
- om_builder = axiom_stax_builder_create(env, reader);
- soap_version = sandesha2_msg_store_bean_get_soap_version(msg_store_bean, env);
- if(SANDESHA2_SOAP_VERSION_1_1 == soap_version)
- {
- soap_builder = axiom_soap_builder_create(env, om_builder,
- AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI);
- }
- else if(SANDESHA2_SOAP_VERSION_1_2 == soap_version)
+ soap_env_str = axutil_strdup(env, sandesha2_msg_store_bean_get_soap_envelope_str(msg_store_bean, env));
+ if(soap_env_str)
{
- soap_builder = axiom_soap_builder_create(env, om_builder,
- AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
- }
- soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
- if (!soap_envelope)
- {
- 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));
+ axutil_array_list_add(storage_mgr_impl->envelope_buffer_list, env, soap_env_str);
- conf = axis2_conf_ctx_get_conf(conf_ctx, env);
- transport_out = sandesha2_msg_store_bean_get_transport_out(msg_store_bean,
- env);
- transport_out_desc = axis2_conf_get_transport_out(conf, env, transport_out);
- axis2_msg_ctx_set_transport_out_desc(msg_ctx, env, transport_out_desc);
- svc_grp_name_str = sandesha2_msg_store_bean_get_svc_grp(msg_store_bean, env);
- if(svc_grp_name_str)
- {
- svc_grp = axis2_conf_get_svc_grp(conf, env, svc_grp_name_str);
- if(svc_grp)
- axis2_msg_ctx_set_svc_grp(msg_ctx, env, svc_grp);
- }
- else
- {
- svc_grp = axis2_svc_grp_create_with_conf(env, conf);
- axis2_msg_ctx_set_svc_grp(msg_ctx, env, svc_grp);
- }
- svc_name_str = sandesha2_msg_store_bean_get_svc(msg_store_bean, env);
- if(svc_name_str)
- {
- svc = axis2_conf_get_svc(conf, env, svc_name_str);
- if(svc)
- axis2_msg_ctx_set_svc(msg_ctx, env, svc);
- else
+ reader = axiom_xml_reader_create_for_memory(env, soap_env_str, axutil_strlen(soap_env_str),
+ NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
+
+ om_builder = axiom_stax_builder_create(env, reader);
+
+ soap_version = sandesha2_msg_store_bean_get_soap_version(msg_store_bean, env);
+
+ if(SANDESHA2_SOAP_VERSION_1_1 == soap_version)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot build message "\
- "context since service %s is not present", svc_name_str);
- AXIS2_ERROR_SET(env->error,
- SANDESHA2_ERROR_CANNOT_BUILD_MSG_CTX_WHEN_SVC_NOT_PRESENT,
- AXIS2_FAILURE);
- axiom_soap_builder_free(soap_builder, env);
- return NULL;
+ soap_builder = axiom_soap_builder_create(env, om_builder,
+ AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI);
}
- }
- op_name_str = sandesha2_msg_store_bean_get_op(msg_store_bean, env);
- op_mep_str = sandesha2_msg_store_bean_get_op_mep(msg_store_bean, env);
- svc = axis2_msg_ctx_get_svc(msg_ctx, env);
- if((op_name_str || op_mep_str) && svc)
- {
- axis2_op_t *op = NULL;
- if(op_name_str)
+ else if(SANDESHA2_SOAP_VERSION_1_2 == soap_version)
{
- axutil_qname_t *op_qname = axutil_qname_create_from_string(env,
- op_name_str);
- op = axis2_svc_get_op_with_qname(svc, env, op_qname);
- if(op_qname)
- axutil_qname_free(op_qname, env);
- }
- if(!op && op_mep_str && svc)
- {
- axutil_hash_t *all_ops = NULL;
- axutil_hash_index_t *index = NULL;
- /* Finding an operation using the MEP */
- all_ops = axis2_svc_get_all_ops(svc, env);
- for (index = axutil_hash_first(all_ops, env); index; index =
- axutil_hash_next(env, index))
- {
- void *v = NULL;
- axis2_char_t *mep = NULL;
- axis2_op_t *temp = NULL;
- axutil_hash_this(index, NULL, NULL, &v);
- temp = (axis2_op_t *) v;
- mep = (axis2_char_t *) axis2_op_get_msg_exchange_pattern(temp,
- env);
- if(0 == axutil_strcmp(mep, op_mep_str))
- {
- op = temp;
- break;
- }
- }
+ soap_builder = axiom_soap_builder_create(env, om_builder,
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
}
- if(op)
- axis2_msg_ctx_set_op(msg_ctx, env, op);
- else
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
+ if (!soap_envelope)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cant find a suitable "\
- "operation for the generated message");
- AXIS2_ERROR_SET(env->error,
- SANDESHA2_ERROR_CANNOT_FIND_OP_FOR_GENERATED_MSG, AXIS2_FAILURE);
axiom_soap_builder_free(soap_builder, env);
+
+ if(msg_store_bean)
+ {
+ sandesha2_msg_store_bean_free(msg_store_bean, env);
+ }
+
return NULL;
}
+
+ axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
}
- /* Setting contexts TODO is this necessary? */
- svc_grp = axis2_msg_ctx_get_svc_grp(msg_ctx, env);
- if(svc_grp)
- {
- axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_svc_grp_ctx_create(env, svc_grp, conf_ctx);
- axis2_msg_ctx_set_svc_grp_ctx(msg_ctx, env, svc_grp_ctx);
- }
- svc = axis2_msg_ctx_get_svc(msg_ctx, env);
- if(svc)
- {
- axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_msg_ctx_get_svc_grp_ctx(
- msg_ctx, env);
- axis2_svc_ctx_t *svc_ctx = axis2_svc_ctx_create(env, svc, svc_grp_ctx);
- if(svc_ctx)
- {
- axis2_svc_ctx_set_parent(svc_ctx, env, svc_grp_ctx);
- axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx);
- }
-
- }
- op = axis2_msg_ctx_get_op(msg_ctx, env);
- if(op)
+
+ axis2_msg_ctx_set_msg_id(msg_ctx, env, sandesha2_msg_store_bean_get_msg_id(msg_store_bean, env));
+
+ conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+ transport_out = sandesha2_msg_store_bean_get_transport_out(msg_store_bean, env);
+ transport_out_desc = axis2_conf_get_transport_out(conf, env, transport_out);
+ if(transport_out_desc)
{
- axis2_op_ctx_t *op_ctx = NULL;
- axis2_svc_ctx_t *svc_ctx = axis2_msg_ctx_get_svc_ctx(msg_ctx, env);
- op_ctx = axis2_op_ctx_create(env, op, svc_ctx);
- if(op_ctx)
- {
- 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);
- msg_id = (axis2_char_t *) axis2_msg_ctx_get_msg_id(msg_ctx, env);
- }
+ axis2_msg_ctx_set_transport_out_desc(msg_ctx, env, transport_out_desc);
}
+
axis2_msg_ctx_set_server_side(msg_ctx, env,
sandesha2_msg_store_bean_is_svr_side(msg_store_bean, env));
+
axis2_msg_ctx_set_flow(msg_ctx, env,
sandesha2_msg_store_bean_get_flow(msg_store_bean, env));
- transport_to_str = sandesha2_msg_store_bean_get_transport_to(msg_store_bean,
- env);
+
+ transport_to_str = sandesha2_msg_store_bean_get_transport_to(msg_store_bean, env);
if(transport_to_str)
{
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);
if(to_url_str)
{
endpoint_ref = axis2_endpoint_ref_create(env, to_url_str);
axis2_msg_ctx_set_to(msg_ctx, env, endpoint_ref);
}
+
reply_to_str = sandesha2_msg_store_bean_get_reply_to(msg_store_bean, env);
if(reply_to_str)
{
endpoint_ref = axis2_endpoint_ref_create(env, reply_to_str);
axis2_msg_ctx_set_reply_to(msg_ctx, env, endpoint_ref);
}
- /*options = (axis2_options_t *) axis2_msg_ctx_get_options(msg_ctx, env);
- if(options)
- {
- axis2_char_t *action = sandesha2_msg_store_bean_get_action(
- msg_store_bean, env);
- axis2_options_set_action(options, env, action);
- }*/
- {
- axis2_char_t *action = sandesha2_msg_store_bean_get_action(
- msg_store_bean, env);
- axis2_msg_ctx_set_wsa_action(msg_ctx, env, action);
- }
- persistent_prop_str =
- sandesha2_msg_store_bean_get_persistent_property_str(msg_store_bean,
- env);
+
+ axis2_msg_ctx_set_wsa_action(msg_ctx, env, sandesha2_msg_store_bean_get_action(msg_store_bean, env));
+
+ /*persistent_prop_str = axutil_strdup(env, sandesha2_msg_store_bean_get_persistent_property_str(
+ msg_store_bean, env));
+
+ prop_property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, persistent_prop_str);
+ axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_PROPERTY_STRING, prop_property);
+
if(persistent_prop_str && 0 != axutil_strcmp("", persistent_prop_str))
{
- axutil_hash_t *map =
- sandesha2_permanent_storage_mgr_get_property_map_from_string(env,
- persistent_prop_str);
+ axutil_hash_t *map = NULL;
axutil_hash_index_t *index = NULL;
+
+ map = sandesha2_permanent_storage_mgr_get_property_map_from_string(env, persistent_prop_str);
if(map)
- for (index = axutil_hash_first(map, env); index; index =
- axutil_hash_next(env, index))
+ {
+ for (index = axutil_hash_first(map, env); index; index = axutil_hash_next(env, index))
{
axutil_property_t *property = NULL;
+ axutil_property_t *temp_property = NULL;
void *v = NULL;
const void *k = NULL;
axis2_char_t *key = NULL;
+
axutil_hash_this(index, &k, NULL, &v);
key = (axis2_char_t *) k;
property = (axutil_property_t *) v;
+ temp_property = axis2_msg_ctx_get_property(msg_ctx, env, key);
+ if(temp_property)
+ {
+ axutil_property_free(temp_property, env);
+ }
+
axis2_msg_ctx_set_property(msg_ctx, env, key, property);
}
+
+ axutil_hash_free(map, env);
+ }
+ }*/
+
+ if(msg_store_bean)
+ {
+ sandesha2_msg_store_bean_free(msg_store_bean, env);
}
- /*if(msg_store_bean)
- sandesha2_msg_store_bean_free(msg_store_bean, env);*/
+
return msg_ctx;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_init_storage(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -649,7 +557,7 @@
return AXIS2_SUCCESS;
}
-axiom_soap_envelope_t *AXIS2_CALL
+static axiom_soap_envelope_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_soap_envelope(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -659,7 +567,7 @@
return NULL;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_soap_envelope(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -691,7 +599,6 @@
axis2_char_t *address = NULL;
axis2_char_t *action = NULL;
axutil_property_t *property = NULL;
- /*axis2_options_t *options = NULL;*/
axis2_char_t *prop_str = NULL;
axis2_op_ctx_t *op_ctx = NULL;
sandesha2_msg_store_bean_t *bean = NULL;
@@ -699,19 +606,20 @@
envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
if (!envelope)
{
- AXIS2_ERROR_SET(env->error,
- AXIS2_ERROR_NULL_SOAP_ENVELOPE_IN_MSG_CTX,
- AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s",
- AXIS2_ERROR_GET_MESSAGE(env->error));
- return AXIS2_FAILURE;
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NULL_SOAP_ENVELOPE_IN_MSG_CTX, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s", AXIS2_ERROR_GET_MESSAGE(env->error));
+ return NULL;
}
- xml_writer = axiom_xml_writer_create_for_memory(env, NULL,
- AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
+
+ xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+
if (!xml_writer)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s", AXIS2_ERROR_GET_MESSAGE(env->error));
return AXIS2_FAILURE;
}
+
om_output = axiom_output_create(env, xml_writer);
if (!om_output)
{
@@ -719,14 +627,19 @@
xml_writer = NULL;
return AXIS2_FAILURE;
}
- axiom_output_set_soap11(om_output, env, axis2_msg_ctx_get_is_soap_11(
- msg_ctx, env));
+
+ axiom_output_set_soap11(om_output, env, axis2_msg_ctx_get_is_soap_11(msg_ctx, env));
axiom_soap_envelope_serialize(envelope, env, om_output, AXIS2_FALSE);
soap_str = (axis2_char_t *)axiom_xml_writer_get_xml(xml_writer, env);
if (axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
+ {
soap_version = SANDESHA2_SOAP_VERSION_1_1;
+ }
else
+ {
soap_version = SANDESHA2_SOAP_VERSION_1_2;
+ }
+
bean = sandesha2_msg_store_bean_create(env);
transport_out_desc = axis2_msg_ctx_get_transport_out_desc(msg_ctx, env);
svc_grp = axis2_msg_ctx_get_svc_grp(msg_ctx, env);
@@ -734,21 +647,24 @@
op = axis2_msg_ctx_get_op(msg_ctx, env);
if(transport_out_desc)
{
- AXIS2_TRANSPORT_ENUMS transport_out = axis2_transport_out_desc_get_enum(
- transport_out_desc, env);
+ AXIS2_TRANSPORT_ENUMS transport_out = axis2_transport_out_desc_get_enum(transport_out_desc,
+ env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "transport_out:%d", transport_out);
sandesha2_msg_store_bean_set_transport_out(bean, env, transport_out);
}
+
if(svc_grp)
{
- axis2_char_t *svc_grp_name = (axis2_char_t *) axis2_svc_grp_get_name(
- svc_grp, env);
+ axis2_char_t *svc_grp_name = (axis2_char_t *) axis2_svc_grp_get_name(svc_grp, env);
sandesha2_msg_store_bean_set_svc_grp(bean, env, svc_grp_name);
}
+
if (svc)
{
axis2_char_t *svc_name = (axis2_char_t *) axis2_svc_get_name(svc, env);
sandesha2_msg_store_bean_set_svc(bean, env, svc_name);
}
+
if(op)
{
axutil_qname_t *qname = (axutil_qname_t *) axis2_op_get_qname(op, env);
@@ -758,77 +674,94 @@
axis2_char_t *op_name = axutil_qname_to_string(qname, env);
sandesha2_msg_store_bean_set_op(bean, env, op_name);
}
+
mep = (axis2_char_t *) axis2_op_get_msg_exchange_pattern(op, env);
sandesha2_msg_store_bean_set_op_mep(bean, env, mep);
}
- sandesha2_msg_store_bean_set_flow(bean, env, axis2_msg_ctx_get_flow(msg_ctx,
- env));
- sandesha2_msg_store_bean_set_svr_side(bean, env,
- axis2_msg_ctx_get_server_side(msg_ctx, env));
+
+ sandesha2_msg_store_bean_set_flow(bean, env, axis2_msg_ctx_get_flow(msg_ctx, env));
+ sandesha2_msg_store_bean_set_svr_side(bean, env, axis2_msg_ctx_get_server_side(msg_ctx, env));
sandesha2_msg_store_bean_set_soap_envelope_str(bean, env, soap_str);
- if(xml_writer)
+ /*if(xml_writer)
+ {
axiom_xml_writer_free(xml_writer, env);
+ }*/
+ if(om_output)
+ {
+ axiom_output_free(om_output, env);
+ }
+
sandesha2_msg_store_bean_set_soap_version(bean, env, soap_version);
- sandesha2_msg_store_bean_set_msg_id(bean, env, (axis2_char_t *)
- axis2_msg_ctx_get_msg_id(msg_ctx, env));
+ sandesha2_msg_store_bean_set_msg_id(bean, env, (axis2_char_t *) axis2_msg_ctx_get_msg_id(msg_ctx,
+ env));
+
to = axis2_msg_ctx_get_to(msg_ctx, env);
if(to)
{
address = (axis2_char_t *) axis2_endpoint_ref_get_address(to, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_address:%s", address);
sandesha2_msg_store_bean_set_to_url(bean, env, address);
}
+
reply_to = axis2_msg_ctx_get_reply_to(msg_ctx, env);
if(reply_to)
{
address = (axis2_char_t *) axis2_endpoint_ref_get_address(reply_to, env);
sandesha2_msg_store_bean_set_reply_to(bean, env, address);
}
+
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);*/
action = (axis2_char_t *) axis2_msg_ctx_get_wsa_action(msg_ctx, env);
sandesha2_msg_store_bean_set_action(bean, env, action);
prop_str = sandesha2_permanent_storage_mgr_get_property_string(env, msg_ctx);
if (prop_str)
{
- sandesha2_msg_store_bean_set_persistent_property_str(bean, env,
- prop_str);
- AXIS2_FREE(env->allocator, prop_str);
+ sandesha2_msg_store_bean_set_persistent_property_str(bean, env, prop_str);
+ if(prop_str && axutil_strlen(prop_str) > 0)
+ {
+ AXIS2_FREE(env->allocator, prop_str);
+ }
}
+
/* setting the request message if this a response message.*/
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
if(op_ctx)
{
axis2_msg_ctx_t *in_msg_ctx = NULL;
- in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env,
- AXIS2_WSDL_MESSAGE_LABEL_IN);
+ in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
if(in_msg_ctx)
{
axis2_char_t *in_msg_store_key = NULL;
axis2_bool_t insert = AXIS2_FALSE;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_IN_MESSAGE_STORAGE_KEY);
+
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_IN_MESSAGE_STORAGE_KEY);
if(property)
- in_msg_store_key = (axis2_char_t *) axutil_property_get_value(
- property, env);
+ {
+ in_msg_store_key = (axis2_char_t *) axutil_property_get_value(property, env);
+ }
if(!in_msg_store_key)
{
in_msg_store_key = (axis2_char_t *) axutil_uuid_gen(env);
insert = AXIS2_TRUE;
}
+
/*if(insert)
sandesha2_permanent_storage_mgr_store_msg_ctx(storage_mgr, env,
in_msg_store_key, in_msg_ctx);
else
sandesha2_permanent_storage_mgr_update_msg_ctx(storage_mgr, env,
in_msg_store_key, in_msg_ctx);*/
- sandesha2_msg_store_bean_set_in_msg_store_key(bean, env,
- in_msg_store_key);
+
+ sandesha2_msg_store_bean_set_in_msg_store_key(bean, env, in_msg_store_key);
+ AXIS2_FREE(env->allocator, in_msg_store_key);
}
}
+
return bean;
}
@@ -841,37 +774,39 @@
axutil_property_t *property = NULL;
axutil_hash_index_t *index = NULL;
axutil_hash_t *properties = NULL;
- /*axis2_options_t *options = (axis2_options_t *) axis2_msg_ctx_get_options(
- msg_ctx, env);
- properties = axis2_options_get_properties(options, env);*/
- properties = axis2_ctx_get_property_map(axis2_msg_ctx_get_base(msg_ctx,
- env), env);
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_QUALIFIED_FOR_SENDING);
+
+ prop_str = axutil_strcat(env, "temp_key", SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, "temp_value",
+ NULL);
+ properties = axis2_ctx_get_property_map(axis2_msg_ctx_get_base(msg_ctx, env), env);
+ 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);
+
+ 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))
+
+ for (index = axutil_hash_first(properties, env); index; index = axutil_hash_next(env, index))
{
axis2_char_t *temp_str = NULL;
void *v = NULL;
@@ -880,68 +815,133 @@
axis2_char_t *value = NULL;
axutil_hash_this(index, &k, NULL, &v);
key = (axis2_char_t *) k;
- if(0 == axutil_strcmp(AXIS2_HTTP_OUT_TRANSPORT_INFO, key))
+
+ if(!axutil_strcmp(AXIS2_HTTP_OUT_TRANSPORT_INFO, key))
+ {
continue;
- if(0 == axutil_strcmp(AXIS2_TRANSPORT_OUT, key))
+ }
+
+ if(!axutil_strcmp(AXIS2_TRANSPORT_OUT, key))
+ {
+ continue;
+ }
+
+ if(!axutil_strcmp(AXIS2_TRANSPORT_IN, key))
+ {
continue;
- if(0 == axutil_strcmp(AXIS2_TRANSPORT_IN, key))
+ }
+
+ if(!axutil_strcmp(AXIS2_TRANSPORT_HEADERS, key))
+ {
continue;
- if(0 == axutil_strcmp(AXIS2_TRANSPORT_HEADERS, key))
+ }
+
+ if(!axutil_strcmp(SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, key))
+ {
continue;
- if(0 == axutil_strcmp(SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, key))
+ }
+
+ if(!axutil_strcmp(AXIS2_HTTP_CLIENT, key))
+ {
continue;
- if(0 == axutil_strcmp(AXIS2_HTTP_CLIENT, key))
+ }
+
+ if(!axutil_strcmp(AXIS2_HTTP_HEADER_CONTENT_LENGTH, key))
+ {
continue;
+ }
property = (axutil_property_t *) v;
if(property)
+ {
value = axutil_property_get_value(property, env);
+ }
+
if(value)
{
temp_str = prop_str;
- prop_str = axutil_strcat(env, temp_str,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, key,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR,
- value, NULL);
- if(temp_str && axutil_strlen(temp_str)> 0)
+ prop_str = axutil_strcat(env, temp_str, SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, key,
+ SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR, value, NULL);
+
+ if(temp_str && axutil_strlen(temp_str) > 0)
+ {
AXIS2_FREE(env->allocator, temp_str);
+ }
}
}
+
return prop_str;
}
-static axutil_hash_t *AXIS2_CALL
+/*static axutil_hash_t *AXIS2_CALL
sandesha2_permanent_storage_mgr_get_property_map_from_string(
const axutil_env_t *env,
axis2_char_t *str)
{
+ axutil_array_list_t *values = NULL;
+ axis2_char_t *value = NULL;
int i = 0, size = 0;
axutil_hash_t *map = axutil_hash_make(env);
- axutil_array_list_t *values = sandesha2_utils_split(env, str,
- SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR);
+ values = sandesha2_utils_split(env, str, 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(1 == size)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Invalid persistence property string");
+ value = axutil_array_list_get(values, env, 0);
+ }
+
+ if((size % 2 != 0) || (size == 1 && !axutil_strcmp("", value)))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid persistence property string");
AXIS2_ERROR_SET(env->error,
SANDESHA2_ERROR_INVALID_PERSISTENCE_PROPERTY_STRING, AXIS2_FAILURE);
+
+ if(values)
+ {
+ int i = 0, size = 0;
+
+ size = axutil_array_list_size(values, env);
+ for(i = 0; i < size; i++)
+ {
+ axis2_char_t *value = axutil_array_list_get(values, env, i);
+ AXIS2_FREE(env->allocator, value);
+ }
+
+ axutil_array_list_free(values, env);
+ }
return NULL;
}
+
for(i = 0; i < size; i=i+2)
{
+ axutil_property_t *property = NULL;
axis2_char_t *key = axutil_array_list_get(values, env, i);
axis2_char_t *value = axutil_array_list_get(values, env, i+1);
- axutil_property_t *property = axutil_property_create_with_args(env, 0,
- 0, 0, value);
- axutil_hash_set(map, key, AXIS2_HASH_KEY_STRING, property);
+
+ property = axutil_hash_get(map, key, AXIS2_HASH_KEY_STRING);
+ if(property)
+ {
+ axutil_property_set_value(property, env, value);
+ }
+ else
+ {
+ property = axutil_property_create_with_args(env, 0, 0, 0, value);
+ axutil_hash_set(map, key, AXIS2_HASH_KEY_STRING, property);
+ }
+ }
+
+ if(values)
+ {
+ axutil_array_list_free(values, env);
}
+
return map;
-}
+}*/
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_store_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -988,7 +988,7 @@
return AXIS2_SUCCESS;
}
-axiom_soap_envelope_t * AXIS2_CALL
+static axiom_soap_envelope_t * AXIS2_CALL
sandesha2_permanent_storage_mgr_retrieve_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -1032,7 +1032,7 @@
return response_envelope;
}
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
sandesha2_permanent_storage_mgr_remove_response(
sandesha2_storage_mgr_t *storage_mgr,
const axutil_env_t *env,
@@ -1062,8 +1062,10 @@
axis2_char_t *sql_stmt6 = NULL;
axis2_char_t *sql_stmt7 = NULL;
axis2_char_t *error_msg = NULL;
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Entry:sandesha2_permanent_storage_mgr_create_db");
+
dbname = sandesha2_util_get_dbname(env, conf_ctx);
if(AXIS2_SUCCESS == axutil_file_handler_access(dbname, AXIS2_F_OK))
{
@@ -1071,8 +1073,9 @@
"[sandesha2]Database %s already created.", dbname);
return AXIS2_SUCCESS;
}
- dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env,
- dbname);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]dbname:%s", dbname);
+ dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, dbname);
+
#if !defined(WIN32)
{
axis2_char_t permission_str[256];
@@ -1080,6 +1083,7 @@
system(permission_str);
}
#endif
+
sql_stmt1 = "create table create_seq("\
"create_seq_msg_id varchar(100) primary key, "\
"internal_seq_id varchar(200), seq_id varchar(200), "\
@@ -1191,6 +1195,7 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Database %s creation failed", dbname);
return AXIS2_FAILURE;
}
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Exit:sandesha2_permanent_storage_mgr_create_db");
return AXIS2_SUCCESS;
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org