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 2006/12/15 06:56:32 UTC
svn commit: r487458 [2/2] - in /webservices/sandesha/trunk/c: include/
src/core/ src/storage/permanent/ src/util/
Added: webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c Thu Dec 14 21:56:31 2006
@@ -0,0 +1,628 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sandesha2_permanent_sender_mgr.h>
+#include <sandesha2_permanent_bean_mgr.h>
+#include <sandesha2_sender_mgr.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_error.h>
+#include <sandesha2_utils.h>
+#include <sandesha2_sender_bean.h>
+#include <sandesha2_storage_mgr.h>
+#include <axis2_log.h>
+#include <axis2_hash.h>
+#include <axis2_thread.h>
+#include <axis2_property.h>
+#include <axis2_types.h>
+
+/**
+ * @brief Sandesha2 Permanent Sender Manager Struct Impl
+ * Sandesha2 Permanent Sender Manager
+ */
+typedef struct sandesha2_permanent_sender_mgr
+{
+ sandesha2_sender_mgr_t sender_mgr;
+ sandesha2_permanent_bean_mgr_t *bean_mgr;
+} sandesha2_permanent_sender_mgr_t;
+
+#define SANDESHA2_INTF_TO_IMPL(sender_mgr) \
+ ((sandesha2_permanent_sender_mgr_t *) sender_mgr)
+
+static int
+sandesha2_sender_find_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ int i;
+ sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+ axis2_array_list_t *data_list = (axis2_array_list_t *) args->data;
+ const axis2_env_t *env = args->env;
+ for(i = 0; i < argc; i++)
+ {
+ sandesha2_sender_bean_t *bean = NULL;
+ if(0 == AXIS2_STRCMP(col_name[i], "msg_id"))
+ sandesha2_sender_bean_set_msg_id(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "msg_ctx_ref_key"))
+ sandesha2_sender_bean_set_msg_ctx_ref_key(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "internal_seq_ID"))
+ sandesha2_sender_bean_set_internal_seq_id(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "sent_count"))
+ sandesha2_sender_bean_set_sent_count(bean, env,
+ argv[i] ? AXIS2_ATOI(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "msg_no"))
+ sandesha2_sender_bean_set_msg_no(bean, env,
+ argv[i] ? atol(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "send"))
+ sandesha2_sender_bean_set_send(bean, env,
+ argv[i] ? AXIS2_ATOI(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "resend"))
+ sandesha2_sender_bean_set_resend(bean, env,
+ argv[i] ? AXIS2_ATOI(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "time_to_send"))
+ sandesha2_sender_bean_set_time_to_send(bean, env,
+ argv[i] ? atol(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "msg_type"))
+ sandesha2_sender_bean_set_msg_type(bean, env,
+ argv[i] ? AXIS2_ATOI(argv[i]) : 0);
+ if(0 == AXIS2_STRCMP(col_name[i], "seq_id"))
+ sandesha2_sender_bean_set_seq_id(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "wsrm_anon_uri"))
+ sandesha2_sender_bean_set_wsrm_anon_uri(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "to_address"))
+ sandesha2_sender_bean_set_to_address(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ axis2_array_list_add(data_list, env, bean);
+ }
+ return 0;
+}
+
+static int
+sandesha2_sender_retrieve_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+ const axis2_env_t *env = args->env;
+ sandesha2_sender_bean_t *bean = (sandesha2_sender_bean_t *) args->data;
+ sandesha2_sender_bean_set_msg_id(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_sender_bean_set_msg_ctx_ref_key(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_sender_bean_set_internal_seq_id(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_sender_bean_set_sent_count(bean, env,
+ argv[0] ? AXIS2_ATOI(argv[0]) : 0);
+ sandesha2_sender_bean_set_msg_no(bean, env,
+ argv[0] ? atol(argv[0]) : 0);
+ sandesha2_sender_bean_set_send(bean, env,
+ argv[0] ? AXIS2_ATOI(argv[0]) : 0);
+ sandesha2_sender_bean_set_resend(bean, env,
+ argv[0] ? AXIS2_ATOI(argv[0]) : 0);
+ sandesha2_sender_bean_set_time_to_send(bean, env,
+ argv[0] ? atol(argv[0]) : 0);
+ sandesha2_sender_bean_set_msg_type(bean, env,
+ argv[0] ? AXIS2_ATOI(argv[0]) : 0);
+ sandesha2_sender_bean_set_seq_id(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_sender_bean_set_wsrm_anon_uri(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_sender_bean_set_to_address(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ return 0;
+}
+
+static int
+sandesha2_sender_count_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ int *count = (int *) not_used;
+ *count = AXIS2_ATOI(argv[0]);
+ return 0;
+}
+
+
+void AXIS2_CALL
+sandesha2_permanent_sender_mgr_free(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_insert(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_remove(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *msg_id);
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_retrieve(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *msg_id);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_update(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean);
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_by_internal_seq_id(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *internal_seq_id);
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_by_sender_bean(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean);
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_unique(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_match(
+ sandesha2_permanent_bean_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate);
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_get_next_msg_to_send(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env);
+
+static const sandesha2_sender_mgr_ops_t sender_mgr_ops =
+{
+ sandesha2_permanent_sender_mgr_free,
+ sandesha2_permanent_sender_mgr_insert,
+ sandesha2_permanent_sender_mgr_remove,
+ sandesha2_permanent_sender_mgr_retrieve,
+ sandesha2_permanent_sender_mgr_update,
+ 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,
+};
+
+AXIS2_EXTERN sandesha2_sender_mgr_t * AXIS2_CALL
+sandesha2_permanent_sender_mgr_create(
+ const axis2_env_t *env,
+ sandesha2_storage_mgr_t *storage_mgr,
+ axis2_ctx_t *ctx)
+{
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+ sender_mgr_impl = AXIS2_MALLOC(env->allocator,
+ sizeof(sandesha2_permanent_sender_mgr_t));
+
+ sender_mgr_impl->bean_mgr = sandesha2_permanent_bean_mgr_create(env,
+ storage_mgr, ctx, SANDESHA2_BEAN_MAP_RETRANSMITTER);
+ sender_mgr_impl->bean_mgr->ops.match = sandesha2_permanent_sender_mgr_match;
+ sender_mgr_impl->sender_mgr.ops = sender_mgr_ops;
+ return &(sender_mgr_impl->sender_mgr);
+}
+
+void AXIS2_CALL
+sandesha2_permanent_sender_mgr_free(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ if(sender_mgr_impl->bean_mgr)
+ {
+ sandesha2_permanent_bean_mgr_free(sender_mgr_impl->bean_mgr, env);
+ sender_mgr_impl->bean_mgr = NULL;
+ }
+ if(sender_mgr_impl)
+ {
+ AXIS2_FREE(env->allocator, sender_mgr_impl);
+ sender_mgr_impl = NULL;
+ }
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_insert(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean)
+{
+ axis2_char_t *insert_sql = NULL;
+ axis2_char_t *msg_id = NULL;
+ axis2_char_t *msg_ctx_ref_key = NULL;
+ axis2_char_t *internal_seq_id = NULL;
+ int sent_count = -1;
+ long msg_no = -1;
+ axis2_bool_t send = AXIS2_FALSE;
+ axis2_bool_t resend = AXIS2_FALSE;
+ long time_to_send = -1;
+ int msg_type = -1;
+ axis2_char_t *seq_id = NULL;
+ axis2_char_t *wsrm_anon_uri = NULL;
+ axis2_char_t *to_address = NULL;
+ axis2_bool_t ret = AXIS2_FALSE;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_insert");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ msg_id = sandesha2_sender_bean_get_msg_id((sandesha2_rm_bean_t *) 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);
+ msg_no = sandesha2_sender_bean_get_msg_no(bean, env);
+ send = sandesha2_sender_bean_is_send(bean, env);
+ resend = sandesha2_sender_bean_is_resend(bean, env);
+ time_to_send = sandesha2_sender_bean_get_time_to_send(bean, env);
+ msg_type = sandesha2_sender_bean_get_msg_type(bean, env);
+ seq_id = sandesha2_sender_bean_get_seq_id(bean, env);
+ wsrm_anon_uri = sandesha2_sender_bean_get_wsrm_anon_uri(bean, env);
+ to_address = sandesha2_sender_bean_get_to_address(bean, env);
+ insert_sql = axis2_strcat(env, "insert into sender(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) values('", 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, "');",
+ NULL);
+ ret = sandesha2_permanent_bean_mgr_insert(sender_mgr_impl->bean_mgr, env,
+ insert_sql);
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_insert:return:%d", ret);
+ return ret;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_remove(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *msg_id)
+{
+ axis2_char_t *sql_retrieve = NULL;
+ axis2_char_t *sql_remove = NULL;
+ sandesha2_sender_bean_t *bean = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, msg_id, AXIS2_FALSE);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+ sql_remove = axis2_strcat(env, "delete from sender where msg_id='",
+ msg_id, "';", NULL);
+ sql_retrieve = axis2_strcat(env, "select 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 msg_id='", msg_id, "';", NULL);
+ bean = sandesha2_sender_bean_create(env);
+ return sandesha2_permanent_bean_mgr_remove(sender_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) bean, sandesha2_sender_retrieve_callback,
+ sql_retrieve, sql_remove);
+}
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_retrieve(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *msg_id)
+{
+ axis2_char_t *sql_retrieve = NULL;
+ sandesha2_sender_bean_t *bean = NULL;
+ sandesha2_sender_bean_t *ret = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_retrieve");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, msg_id, AXIS2_FALSE);
+ sql_retrieve = axis2_strcat(env, "select 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 msg_id='", msg_id, "';", NULL);
+ bean = sandesha2_sender_bean_create(env);
+ ret = (sandesha2_sender_bean_t *) sandesha2_permanent_bean_mgr_retrieve(
+ sender_mgr_impl->bean_mgr, env, (sandesha2_rm_bean_t *) bean,
+ sandesha2_sender_retrieve_callback, sql_retrieve);
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_retrieve");
+ return ret;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_update(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean)
+{
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_update");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ /* No need to update. Being a reference does the job. */
+ return AXIS2_SUCCESS;
+}
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_by_internal_seq_id(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *internal_seq_id)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_sender_bean_t *bean = NULL;
+ axis2_array_list_t *ret = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_find_by_internal_seq_id");
+ AXIS2_ENV_CHECK(env, NULL);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ bean = sandesha2_sender_bean_create(env);
+ sandesha2_sender_bean_set_internal_seq_id(bean, env,
+ internal_seq_id);
+ sql_find = axis2_strcat(env, "select 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;", NULL);
+ sql_count = "select count(*) as no_recs from sender;";
+ ret = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) bean, sandesha2_sender_find_callback,
+ sandesha2_sender_count_callback, sql_find, sql_count);
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_find_by_internal_seq_id");
+ return ret;
+}
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_by_sender_bean(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ axis2_array_list_t *ret = NULL;
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_find_by_sender_bean");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+ sql_find = axis2_strcat(env, "select 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;", NULL);
+ sql_count = "select count(*) as no_recs from sender;";
+ ret = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) bean, sandesha2_sender_find_callback,
+ sandesha2_sender_count_callback, sql_find, sql_count);
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_find_by_sender_bean");
+ return ret;
+}
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_find_unique(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_sender_bean_t *bean)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+ sql_find = axis2_strcat(env, "select 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;", NULL);
+ sql_count = "select count(*) as no_recs from sender;";
+ return (sandesha2_sender_bean_t *) sandesha2_permanent_bean_mgr_find(
+ sender_mgr_impl->bean_mgr, env, (sandesha2_rm_bean_t *) bean,
+ sandesha2_sender_find_callback, sandesha2_sender_count_callback,
+ sql_find, sql_count);
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_sender_mgr_match(
+ sandesha2_permanent_bean_mgr_t *sender_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate)
+{
+ axis2_bool_t add = AXIS2_TRUE;
+ axis2_char_t *ref_key = NULL;
+ axis2_char_t *temp_ref_key = NULL;
+ long time_to_send = 0;
+ long temp_time_to_send = 0;
+ axis2_char_t *msg_id = NULL;
+ axis2_char_t *temp_msg_id = NULL;
+ axis2_char_t *internal_seq_id = NULL;
+ axis2_char_t *temp_internal_seq_id = NULL;
+ long msg_no = 0;
+ long temp_msg_no = 0;
+ int msg_type = 0;
+ int temp_msg_type = 0;
+ axis2_bool_t is_send = AXIS2_FALSE;
+ axis2_bool_t temp_is_send = AXIS2_FALSE;
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_match");
+ ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
+ (sandesha2_sender_bean_t *) candidate, env);
+ if(ref_key && temp_ref_key && 0 != AXIS2_STRCMP(ref_key, temp_ref_key))
+ {
+ add = AXIS2_FALSE;
+ }
+ time_to_send = sandesha2_sender_bean_get_time_to_send(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_time_to_send = sandesha2_sender_bean_get_time_to_send(
+ (sandesha2_sender_bean_t *) candidate, env);
+ /*if(time_to_send > 0 && (time_to_send < temp_time_to_send))*/
+ if(time_to_send > 0 && (time_to_send != temp_time_to_send))
+ {
+ add = AXIS2_FALSE;
+ }
+ msg_id = sandesha2_sender_bean_get_msg_id(bean, env);
+ temp_msg_id = sandesha2_sender_bean_get_msg_id(candidate, env);
+ if(msg_id && temp_msg_id && 0 != AXIS2_STRCMP(msg_id, temp_msg_id))
+ {
+ add = AXIS2_FALSE;
+ }
+ internal_seq_id = sandesha2_sender_bean_get_internal_seq_id(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_internal_seq_id = sandesha2_sender_bean_get_internal_seq_id(
+ (sandesha2_sender_bean_t *) candidate,
+ env);
+ if(internal_seq_id && temp_internal_seq_id && 0 != AXIS2_STRCMP(
+ internal_seq_id, temp_internal_seq_id))
+ {
+ add = AXIS2_FALSE;
+ }
+ msg_no = sandesha2_sender_bean_get_msg_no(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_msg_no = sandesha2_sender_bean_get_msg_no(
+ (sandesha2_sender_bean_t *) candidate, env);
+ if(msg_no > 0 && (msg_no != temp_msg_no))
+ {
+ add = AXIS2_FALSE;
+ }
+ msg_type = sandesha2_sender_bean_get_msg_type(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_msg_type = sandesha2_sender_bean_get_msg_type(
+ (sandesha2_sender_bean_t *) candidate, env);
+ if(msg_type != SANDESHA2_MSG_TYPE_UNKNOWN && (msg_type != temp_msg_type))
+ {
+ add = AXIS2_FALSE;
+ }
+ is_send = sandesha2_sender_bean_is_send(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_is_send = sandesha2_sender_bean_is_send(
+ (sandesha2_sender_bean_t *) candidate, env);
+ if(is_send != temp_is_send)
+ {
+ add = AXIS2_FALSE;
+ }
+ /* Do not use the is_resend flag to match messages, as it can stop us from
+ * detecting RM messages during 'get_next_msg_to_send'*/
+ /*is_resend = sandesha2_sender_bean_is_resend(
+ (sandesha2_sender_bean_t *) bean, env);
+ temp_is_resend = sandesha2_sender_bean_is_resend(
+ (sandesha2_sender_bean_t *) candidate, env);
+ if(is_resend != temp_is_resend)
+ {
+ add = AXIS2_FALSE;
+ }*/
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_match:add:%d",
+ add);
+ return add;
+}
+
+sandesha2_sender_bean_t *AXIS2_CALL
+sandesha2_permanent_sender_mgr_get_next_msg_to_send(
+ sandesha2_sender_mgr_t *sender_mgr,
+ const axis2_env_t *env)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_sender_bean_t *matcher = sandesha2_sender_bean_create(env);
+ sandesha2_sender_bean_t *result = NULL;
+ long time_now = 0;
+ int i = 0, size = 0;
+ axis2_array_list_t *match_list = NULL;
+ sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_sender_mgr_get_next_msg_to_send");
+ AXIS2_ENV_CHECK(env, NULL);
+ sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
+
+ sandesha2_sender_bean_set_send(matcher, env, AXIS2_TRUE);
+ time_now = sandesha2_utils_get_current_time_in_millis(env);
+ sandesha2_sender_bean_set_time_to_send(matcher, env, time_now);
+ sql_find = axis2_strcat(env, "select 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;", NULL);
+ sql_count = "select count(*) as no_recs from sender;";
+ match_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) matcher, sandesha2_sender_find_callback,
+ sandesha2_sender_count_callback, sql_find, sql_count);
+
+ /*
+ * 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
+ * sure that we send the lowest app message avaliable. If we hit a RM
+ * message first then we are done.
+ */
+ if(match_list)
+ size = AXIS2_ARRAY_LIST_SIZE(match_list, env);
+ for(i = 0; i < size; i++)
+ {
+ sandesha2_sender_bean_t *bean = NULL;
+ int msg_type = -1;
+ bean = (sandesha2_sender_bean_t *) AXIS2_ARRAY_LIST_GET(match_list,
+ env, i);
+ msg_type = sandesha2_sender_bean_get_msg_type(bean, env);
+ if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
+ {
+ 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;
+ }
+ else if(!result)
+ {
+ result = bean;
+ break;
+ }
+ }
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_sender_mgr_get_next_msg_to_send");
+ return result;
+}
+
Added: webservices/sandesha/trunk/c/src/storage/permanent/permanent_seq_property_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_seq_property_mgr.c?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_seq_property_mgr.c (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_seq_property_mgr.c Thu Dec 14 21:56:31 2006
@@ -0,0 +1,503 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sandesha2_seq_property_mgr.h>
+#include <sandesha2_permanent_seq_property_mgr.h>
+#include <sandesha2_permanent_bean_mgr.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_error.h>
+#include <sandesha2_utils.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_seq_property_mgr.h>
+#include <sandesha2_rm_bean.h>
+#include <axis2_log.h>
+#include <axis2_hash.h>
+#include <axis2_thread.h>
+#include <axis2_property.h>
+#include <axis2_types.h>
+
+/**
+ * @brief Sandesha Permanent Sequence Property Manager Struct Impl
+ * Sandesha Permanent Sequence Property Manager
+ */
+typedef struct sandesha2_permanent_seq_property_mgr
+{
+ sandesha2_seq_property_mgr_t seq_prop_mgr;
+ sandesha2_permanent_bean_mgr_t *bean_mgr;
+ axis2_array_list_t *values;
+} sandesha2_permanent_seq_property_mgr_t;
+
+#define SANDESHA2_INTF_TO_IMPL(seq_property_mgr) \
+ ((sandesha2_permanent_seq_property_mgr_t *) seq_property_mgr)
+
+static int
+sandesha2_seq_property_find_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ int i;
+ sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+ axis2_array_list_t *data_list = (axis2_array_list_t *) args->data;
+ const axis2_env_t *env = args->env;
+ for(i = 0; i < argc; i++)
+ {
+ sandesha2_seq_property_bean_t *bean = NULL;
+ if(0 == AXIS2_STRCMP(col_name[i], "seq_id"))
+ sandesha2_seq_property_bean_set_seq_id(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "name"))
+ sandesha2_seq_property_bean_set_name(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ if(0 == AXIS2_STRCMP(col_name[i], "value"))
+ sandesha2_seq_property_bean_set_value(bean, env,
+ argv[i] ? argv[i] : "NULL");
+ axis2_array_list_add(data_list, env, bean);
+ }
+ return 0;
+}
+
+static int
+sandesha2_seq_property_retrieve_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+ const axis2_env_t *env = args->env;
+ sandesha2_seq_property_bean_t *bean = (sandesha2_seq_property_bean_t *) args->data;
+ sandesha2_seq_property_bean_set_seq_id(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_seq_property_bean_set_name(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ sandesha2_seq_property_bean_set_value(bean, env,
+ argv[0] ? argv[0] : "NULL");
+ return 0;
+}
+
+static int
+sandesha2_seq_property_count_callback(
+ void *not_used,
+ int argc,
+ char **argv,
+ char **col_name)
+{
+ int *count = (int *) not_used;
+ *count = AXIS2_ATOI(argv[0]);
+ return 0;
+}
+
+
+void AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_free(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_insert(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_remove(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name);
+
+sandesha2_seq_property_bean_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_retrieve(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_update(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean);
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_find(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean);
+
+sandesha2_seq_property_bean_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_find_unique(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean);
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_match(
+ sandesha2_permanent_bean_mgr_t *seq_prop,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate);
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_retrieve_all(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env);
+
+static axis2_char_t *
+sandesha2_permanent_seq_property_mgr_get_id_with_bean(
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean);
+
+static axis2_char_t *
+sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name);
+
+static const sandesha2_seq_property_mgr_ops_t seq_property_mgr_ops =
+{
+ sandesha2_permanent_seq_property_mgr_free,
+ sandesha2_permanent_seq_property_mgr_insert,
+ sandesha2_permanent_seq_property_mgr_remove,
+ sandesha2_permanent_seq_property_mgr_retrieve,
+ 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,
+};
+
+AXIS2_EXTERN sandesha2_seq_property_mgr_t * AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_create(
+ const axis2_env_t *env,
+ sandesha2_storage_mgr_t *storage_mgr,
+ axis2_ctx_t *ctx)
+{
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ seq_prop_mgr_impl = AXIS2_MALLOC(env->allocator,
+ sizeof(sandesha2_permanent_seq_property_mgr_t));
+
+ seq_prop_mgr_impl->values = NULL;
+ seq_prop_mgr_impl->bean_mgr = sandesha2_permanent_bean_mgr_create(env,
+ storage_mgr, ctx, SANDESHA2_BEAN_MAP_SEQ_PROPERTY);
+ seq_prop_mgr_impl->bean_mgr->ops.match = sandesha2_permanent_seq_property_mgr_match;
+ seq_prop_mgr_impl->seq_prop_mgr.ops = seq_property_mgr_ops;
+ return &(seq_prop_mgr_impl->seq_prop_mgr);
+}
+
+void AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_free(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+
+ if(seq_prop_mgr_impl->values)
+ {
+ AXIS2_ARRAY_LIST_FREE(seq_prop_mgr_impl->values, env);
+ seq_prop_mgr_impl->values = NULL;
+ }
+ if(seq_prop_mgr_impl->bean_mgr)
+ {
+ sandesha2_permanent_bean_mgr_free(seq_prop_mgr_impl->bean_mgr, env);
+ seq_prop_mgr_impl->bean_mgr = NULL;
+ }
+ if(seq_prop_mgr_impl)
+ {
+ AXIS2_FREE(env->allocator, seq_prop_mgr_impl);
+ seq_prop_mgr_impl = NULL;
+ }
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_insert(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean)
+{
+ axis2_char_t *insert_sql = NULL;
+ axis2_char_t *id = NULL;
+ axis2_char_t *seq_id = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *value = NULL;
+ axis2_bool_t ret = AXIS2_FALSE;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "Entry:[sandesha2]sandesha2_permanent_seq_property_mgr_insert");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+
+ 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);
+ value = sandesha2_seq_property_bean_get_value(bean, env);
+ insert_sql = axis2_strcat(env, "insert into seq_property(seq_id, "\
+ "name, value) values('", id, "','", seq_id, "','", name, "','", value,
+ "');", NULL);
+ ret = sandesha2_permanent_bean_mgr_insert(seq_prop_mgr_impl->bean_mgr, env,
+ insert_sql);
+ AXIS2_LOG_INFO(env->log,
+ "Exit:[sandesha2]sandesha2_permanent_seq_property_mgr_insert:return%d",
+ ret);
+ return ret;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_remove(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name)
+{
+ sandesha2_seq_property_bean_t *bean = NULL;
+ axis2_char_t *key = NULL;
+ axis2_char_t *sql_remove = NULL;
+ axis2_char_t *sql_retrieve = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ 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);
+ sql_remove = axis2_strcat(env, "delete from seq_property where id='",
+ key, "';", NULL);
+ sql_retrieve = axis2_strcat(env, "select seq_id, name, value from seq_property "\
+ "where id='", key, "';", NULL);
+ bean = sandesha2_seq_property_bean_create(env);
+ status = sandesha2_permanent_bean_mgr_remove(seq_prop_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) bean, sandesha2_seq_property_retrieve_callback,
+ sql_retrieve, sql_remove);
+ AXIS2_FREE(env->allocator, key);
+ return status;
+}
+
+sandesha2_seq_property_bean_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_retrieve(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name)
+{
+ axis2_char_t *key = NULL;
+ axis2_char_t *sql_retrieve = NULL;
+ sandesha2_seq_property_bean_t *bean = NULL;
+ sandesha2_seq_property_bean_t *ret = NULL;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_retrieve");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ 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);
+ sql_retrieve = axis2_strcat(env, "select seq_id, name, value from seq_property "\
+ "where id='", key, "';", NULL);
+ bean = sandesha2_seq_property_bean_create(env);
+ return (sandesha2_seq_property_bean_t *) sandesha2_permanent_bean_mgr_retrieve(
+ seq_prop_mgr_impl->bean_mgr, env, (sandesha2_rm_bean_t *) bean,
+ sandesha2_seq_property_retrieve_callback, sql_retrieve);
+ AXIS2_FREE(env->allocator, key);
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_retrieve");
+ return ret;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_update(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean)
+{
+ axis2_char_t *id = NULL;
+ axis2_char_t *seq_id = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *value = NULL;
+ axis2_char_t *sql_update = NULL;
+ axis2_char_t *sql_retrieve = NULL;
+ axis2_bool_t ret = AXIS2_FALSE;
+ sandesha2_seq_property_bean_t *old_bean = NULL;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "Entry:[sandesha2]sandesha2_permanent_seq_property_mgr_update");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+
+ id = sandesha2_permanent_seq_property_mgr_get_id_with_bean(env, bean);
+ if(!id)
+ {
+ return AXIS2_FALSE;
+ }
+ seq_id = sandesha2_seq_property_bean_get_seq_id(bean, env);
+ name = sandesha2_seq_property_bean_get_name(bean, env);
+ value = sandesha2_seq_property_bean_get_value(bean, env);
+ sql_retrieve = axis2_strcat(env, "select seq_id, name value from seq_property "\
+ "where id='", id, "';", NULL);
+ sql_update = axis2_strcat(env, "update seq_property set seq_id='", seq_id,
+ "', seq_id='", seq_id, "', name='", name, "', value='", value,
+ "' where id='", id, "';", NULL);
+ old_bean = sandesha2_seq_property_bean_create(env);
+ ret = sandesha2_permanent_bean_mgr_update(seq_prop_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) old_bean, sandesha2_seq_property_retrieve_callback,
+ sql_retrieve, sql_update);
+ AXIS2_LOG_INFO(env->log,
+ "Exit:[sandesha2]sandesha2_permanent_seq_property_mgr_update:return:%d", ret);
+ return ret;
+}
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_find(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+ axis2_array_list_t *ret = NULL;
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_find");
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+ sql_find = axis2_strcat(env, "select seq_id, name,value from seq_property;",
+ NULL);
+ sql_count = "select count(*) as no_recs from seq_property;";
+ ret = sandesha2_permanent_bean_mgr_find(seq_prop_mgr_impl->bean_mgr, env,
+ (sandesha2_rm_bean_t *) bean, sandesha2_seq_property_find_callback,
+ sandesha2_seq_property_count_callback, sql_find, sql_count);
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_find");
+ return ret;
+}
+
+sandesha2_seq_property_bean_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_find_unique(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean)
+{
+ axis2_char_t *sql_find = NULL;
+ axis2_char_t *sql_count = NULL;
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+ sql_find = axis2_strcat(env, "select seq_id, name,value from seq_property;",
+ NULL);
+ sql_count = "select count(*) as no_recs from seq_property;";
+ return (sandesha2_seq_property_bean_t *)
+ sandesha2_permanent_bean_mgr_find_unique(seq_prop_mgr_impl->bean_mgr,
+ env, (sandesha2_rm_bean_t *) bean, sandesha2_seq_property_find_callback,
+ sandesha2_seq_property_count_callback, sql_find, sql_count);
+}
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_match(
+ sandesha2_permanent_bean_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate)
+{
+ axis2_bool_t equal = AXIS2_TRUE;
+ axis2_char_t *seq_id = NULL;
+ axis2_char_t *temp_seq_id = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *temp_name = NULL;
+ axis2_char_t *value = NULL;
+ axis2_char_t *temp_value = NULL;
+
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Entry:sandesha2_permanent_seq_property_mgr_match");
+ seq_id = sandesha2_seq_property_bean_get_seq_id(
+ (sandesha2_seq_property_bean_t *) bean, env);
+ temp_seq_id = sandesha2_seq_property_bean_get_seq_id(
+ (sandesha2_seq_property_bean_t *) candidate, env);
+ if(seq_id && temp_seq_id && 0 != AXIS2_STRCMP(seq_id, temp_seq_id))
+ {
+ equal = AXIS2_FALSE;
+ }
+ name = sandesha2_seq_property_bean_get_name(
+ (sandesha2_seq_property_bean_t *) bean, env);
+ temp_name = sandesha2_seq_property_bean_get_name(
+ (sandesha2_seq_property_bean_t *) candidate, env);
+ if(name && temp_name && 0 != AXIS2_STRCMP(name, temp_name))
+ {
+ equal = AXIS2_FALSE;
+ }
+ value = sandesha2_seq_property_bean_get_value(
+ (sandesha2_seq_property_bean_t *) bean, env);
+ temp_value = sandesha2_seq_property_bean_get_value(
+ (sandesha2_seq_property_bean_t *) candidate, env);
+ if(value && temp_value && 0 != AXIS2_STRCMP(value, temp_value))
+ {
+ equal = AXIS2_FALSE;
+ }
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_seq_property_mgr_match:equal:%d",
+ equal);
+ return equal;
+}
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_seq_property_mgr_retrieve_all(
+ sandesha2_seq_property_mgr_t *seq_prop_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_seq_property_mgr_t *seq_prop_mgr_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ seq_prop_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_prop_mgr);
+ return sandesha2_seq_property_mgr_find(seq_prop_mgr, env, NULL);
+}
+
+static axis2_char_t *
+sandesha2_permanent_seq_property_mgr_get_id_with_seq_id_and_name(
+ const axis2_env_t *env,
+ axis2_char_t *seq_id,
+ axis2_char_t *name)
+{
+ axis2_char_t *id = NULL;
+
+ id = axis2_strcat(env, env, seq_id, ":", name, NULL);
+ return id;
+}
+
+static axis2_char_t *
+sandesha2_permanent_seq_property_mgr_get_id_with_bean(
+ const axis2_env_t *env,
+ sandesha2_seq_property_bean_t *bean)
+{
+ axis2_char_t *seq_id = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *id = NULL;
+
+ seq_id = sandesha2_seq_property_bean_get_seq_id(bean, env);
+ name = sandesha2_seq_property_bean_get_name(bean, env);
+ id = axis2_strcat(env, env, seq_id, ":", name, NULL);
+
+ return id;
+}
+
Added: webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c Thu Dec 14 21:56:31 2006
@@ -0,0 +1,561 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_create_seq_mgr.h>
+#include <sandesha2_permanent_create_seq_mgr.h>
+#include <sandesha2_invoker_mgr.h>
+#include <sandesha2_permanent_invoker_mgr.h>
+#include <sandesha2_next_msg_mgr.h>
+#include <sandesha2_permanent_next_msg_mgr.h>
+#include <sandesha2_sender_mgr.h>
+#include <sandesha2_permanent_sender_mgr.h>
+#include <sandesha2_seq_property_mgr.h>
+#include <sandesha2_permanent_seq_property_mgr.h>
+#include <sandesha2_transaction.h>
+#include <sandesha2_permanent_transaction.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_error.h>
+#include <sandesha2_utils.h>
+#include <sandesha2_rm_bean.h>
+#include <axis2_log.h>
+#include <axis2_hash.h>
+#include <axis2_thread.h>
+#include <axis2_property.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_uuid_gen.h>
+#include <axis2_conf_ctx.h>
+
+/**
+ * @brief Sandesha2 Permanent Storage Manager Struct Impl
+ * Sandesha2 Permanent Storage Manager
+ */
+typedef struct sandesha2_permanent_storage_mgr
+{
+ sandesha2_storage_mgr_t storage_mgr;
+ axis2_char_t *SANDESHA2_MSG_MAP_KEY;
+ sandesha2_create_seq_mgr_t *create_seq_mgr;
+ sandesha2_next_msg_mgr_t *next_msg_mgr;
+ sandesha2_seq_property_mgr_t *seq_property_mgr;
+ sandesha2_sender_mgr_t *sender_mgr;
+ sandesha2_invoker_mgr_t *invoker_mgr;
+ axis2_conf_ctx_t *conf_ctx;
+} sandesha2_permanent_storage_mgr_t;
+
+#define SANDESHA2_INTF_TO_IMPL(trans) \
+ ((sandesha2_permanent_storage_mgr_t *) trans)
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_free_void_arg(
+ void *storage_mgr,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_free(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *envv);
+
+struct sandesha2_transaction *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_transaction(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+void AXIS2_CALL
+sandesha2_permanent_storage_mgr_enlist_bean(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *rm_bean);
+
+sandesha2_create_seq_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_create_seq_mgr(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+sandesha2_next_msg_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_next_msg_mgr(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+sandesha2_sender_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_retrans_mgr(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+sandesha2_seq_property_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_seq_property_mgr(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+sandesha2_invoker_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_storage_map_mgr(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_set_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx);
+
+axis2_conf_ctx_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_init(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx);
+
+axis2_msg_ctx_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_retrieve_msg_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_conf_ctx_t *conf_ctx);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_store_msg_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_msg_ctx_t *msg_ctx);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_update_msg_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_msg_ctx_t *msg_ctx);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_remove_msg_ctx(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_char_t *key);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_init_storage(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_module_desc_t *module_desc);
+
+axiom_soap_envelope_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_retrieve_soap_envelope(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axis2_char_t *key);
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_store_soap_envelope(
+ sandesha2_storage_mgr_t *storage,
+ const axis2_env_t *env,
+ axiom_soap_envelope_t *soap_env,
+ axis2_char_t *key);
+
+static const sandesha2_storage_mgr_ops_t storage_mgr_ops =
+{
+ sandesha2_permanent_storage_mgr_free,
+ sandesha2_permanent_storage_mgr_free_void_arg,
+ sandesha2_permanent_storage_mgr_get_transaction,
+ sandesha2_permanent_storage_mgr_enlist_bean,
+ sandesha2_permanent_storage_mgr_get_create_seq_mgr,
+ sandesha2_permanent_storage_mgr_get_next_msg_mgr,
+ sandesha2_permanent_storage_mgr_get_retrans_mgr,
+ sandesha2_permanent_storage_mgr_get_seq_property_mgr,
+ sandesha2_permanent_storage_mgr_get_storage_map_mgr,
+ sandesha2_permanent_storage_mgr_set_ctx,
+ sandesha2_permanent_storage_mgr_get_ctx,
+ sandesha2_permanent_storage_mgr_init,
+ sandesha2_permanent_storage_mgr_retrieve_msg_ctx,
+ sandesha2_permanent_storage_mgr_store_msg_ctx,
+ sandesha2_permanent_storage_mgr_update_msg_ctx,
+ sandesha2_permanent_storage_mgr_remove_msg_ctx,
+ sandesha2_permanent_storage_mgr_init_storage,
+ sandesha2_permanent_storage_mgr_retrieve_soap_envelope,
+ sandesha2_permanent_storage_mgr_store_soap_envelope
+};
+
+AXIS2_EXTERN sandesha2_storage_mgr_t * AXIS2_CALL
+sandesha2_permanent_storage_mgr_create(
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ axis2_ctx_t *ctx = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+ storage_mgr_impl = AXIS2_MALLOC(env->allocator,
+ sizeof(sandesha2_permanent_storage_mgr_t));
+
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY = AXIS2_STRDUP("Sandesha2MessageMap",
+ env);
+ storage_mgr_impl->conf_ctx = conf_ctx;
+ ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+ storage_mgr_impl->create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(
+ env, &(storage_mgr_impl->storage_mgr), ctx);
+ storage_mgr_impl->next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(
+ env, &(storage_mgr_impl->storage_mgr), ctx);
+ storage_mgr_impl->seq_property_mgr =
+ sandesha2_permanent_seq_property_mgr_create(env,
+ &(storage_mgr_impl->storage_mgr), ctx);
+ storage_mgr_impl->sender_mgr = sandesha2_permanent_sender_mgr_create(env,
+ &(storage_mgr_impl->storage_mgr), ctx);
+ storage_mgr_impl->invoker_mgr = sandesha2_permanent_invoker_mgr_create(env,
+ &(storage_mgr_impl->storage_mgr), ctx);
+
+ storage_mgr_impl->storage_mgr.ops = &storage_mgr_ops;
+
+ return &(storage_mgr_impl->storage_mgr);
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_free_void_arg(
+ void *storage_mgr,
+ const axis2_env_t *env)
+{
+ storage_mgr = (sandesha2_permanent_storage_mgr_t *) storage_mgr;
+ return sandesha2_permanent_storage_mgr_free(storage_mgr, env);
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_free(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+
+ if(storage_mgr_impl->create_seq_mgr)
+ {
+ sandesha2_create_seq_mgr_free(storage_mgr_impl->create_seq_mgr, env);
+ storage_mgr_impl->create_seq_mgr = NULL;
+ }
+ if(storage_mgr_impl->next_msg_mgr)
+ {
+ sandesha2_next_msg_mgr_free(storage_mgr_impl->next_msg_mgr, env);
+ storage_mgr_impl->next_msg_mgr = NULL;
+ }
+ if(storage_mgr_impl->sender_mgr)
+ {
+ sandesha2_sender_mgr_free(storage_mgr_impl->sender_mgr, env);
+ storage_mgr_impl->sender_mgr = NULL;
+ }
+ if(storage_mgr_impl->seq_property_mgr)
+ {
+ sandesha2_seq_property_mgr_free(storage_mgr_impl->seq_property_mgr,
+ env);
+ storage_mgr_impl->seq_property_mgr = NULL;
+ }
+ if(storage_mgr_impl->invoker_mgr)
+ {
+ sandesha2_invoker_mgr_free(storage_mgr_impl->invoker_mgr, env);
+ storage_mgr_impl->invoker_mgr = NULL;
+ }
+ if(storage_mgr_impl->SANDESHA2_MSG_MAP_KEY)
+ {
+ AXIS2_FREE(env->allocator, storage_mgr_impl->SANDESHA2_MSG_MAP_KEY);
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY = NULL;
+ }
+
+ if(storage_mgr_impl)
+ {
+ AXIS2_FREE(env->allocator, storage_mgr_impl);
+ storage_mgr_impl = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+sandesha2_transaction_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_transaction(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ return sandesha2_permanent_transaction_create(env, storage_mgr);
+}
+
+void AXIS2_CALL
+sandesha2_permanent_storage_mgr_enlist_bean(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *rm_bean)
+{
+ sandesha2_transaction_t *t = sandesha2_permanent_storage_mgr_get_transaction(
+ storage_mgr, env);
+ sandesha2_transaction_enlist(t, env, rm_bean);
+}
+
+sandesha2_create_seq_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_create_seq_mgr(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ return storage_mgr_impl->create_seq_mgr;
+}
+
+sandesha2_next_msg_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_next_msg_mgr(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ return storage_mgr_impl->next_msg_mgr;
+}
+
+sandesha2_sender_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_retrans_mgr(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ return storage_mgr_impl->sender_mgr;
+}
+
+sandesha2_seq_property_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_seq_property_mgr(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+
+ return storage_mgr_impl->seq_property_mgr;
+}
+
+sandesha2_invoker_mgr_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_storage_map_mgr(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ return storage_mgr_impl->invoker_mgr;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_set_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
+ storage_mgr_impl->conf_ctx = conf_ctx;
+ return AXIS2_SUCCESS;
+}
+
+axis2_conf_ctx_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_get_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ return storage_mgr_impl->conf_ctx;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_init(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ sandesha2_permanent_storage_mgr_set_ctx(storage_mgr, env, conf_ctx);
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_msg_ctx_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_retrieve_msg_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_conf_ctx_t *conf_ctx)
+{
+ axis2_hash_t *storage_map = NULL;
+ axis2_property_t *property = NULL;
+ axis2_ctx_t *ctx = NULL;
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ conf_ctx = sandesha2_permanent_storage_mgr_get_ctx(storage_mgr, env);
+ ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+ property = AXIS2_CTX_GET_PROPERTY(ctx, env,
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY, AXIS2_FALSE);
+ storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
+ if(!storage_map)
+ return NULL;
+ return (axis2_msg_ctx_t *) axis2_hash_get(storage_map, key,
+ AXIS2_HASH_KEY_STRING);
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_store_msg_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_hash_t *storage_map = NULL;
+ axis2_property_t *property = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_ctx_t *ctx = NULL;
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+
+ conf_ctx = sandesha2_permanent_storage_mgr_get_ctx(storage_mgr, env);
+ ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+ property = AXIS2_CTX_GET_PROPERTY(ctx, env,
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY, AXIS2_FALSE);
+ if(!property)
+ {
+ property = axis2_property_create(env);
+ }
+ storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
+ if(!storage_map)
+ {
+ storage_map = axis2_hash_make(env);
+ AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(property, env, storage_map);
+ AXIS2_PROPERTY_SET_FREE_FUNC(property, env, axis2_hash_free_void_arg);
+ AXIS2_CTX_SET_PROPERTY(ctx, env, storage_mgr_impl->SANDESHA2_MSG_MAP_KEY,
+ property, AXIS2_FALSE);
+ }
+ if(!key)
+ {
+ key = axis2_uuid_gen(env);
+ }
+ AXIS2_MSG_CTX_SET_KEEP_ALIVE(msg_ctx, env, AXIS2_TRUE);
+ axis2_hash_set(storage_map, key, AXIS2_HASH_KEY_STRING, msg_ctx);
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_update_msg_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_hash_t *storage_map = NULL;
+ axis2_property_t *property = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_ctx_t *ctx = NULL;
+ void *old_entry = NULL;
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ conf_ctx = sandesha2_permanent_storage_mgr_get_ctx(storage_mgr, env);
+ ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+ property = AXIS2_CTX_GET_PROPERTY(ctx, env,
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY, AXIS2_FALSE);
+ if(!property)
+ {
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
+ if(!storage_map)
+ {
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ old_entry = axis2_hash_get(storage_map, key, AXIS2_HASH_KEY_STRING);
+ if(!old_entry)
+ {
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_ENTRY_IS_NOT_PRESENT_FOR_UPDATING,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ return sandesha2_permanent_storage_mgr_store_msg_ctx(storage_mgr, env, key, msg_ctx);
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_remove_msg_ctx(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *key)
+{
+ axis2_hash_t *storage_map = NULL;
+ axis2_property_t *property = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_ctx_t *ctx = NULL;
+ void *entry = NULL;
+ sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+ conf_ctx = sandesha2_permanent_storage_mgr_get_ctx(storage_mgr, env);
+ ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+ property = AXIS2_CTX_GET_PROPERTY(ctx, env,
+ storage_mgr_impl->SANDESHA2_MSG_MAP_KEY, AXIS2_FALSE);
+ if(!property)
+ {
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
+ if(!storage_map)
+ {
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ entry = axis2_hash_get(storage_map, key, AXIS2_HASH_KEY_STRING);
+ if(entry)
+ {
+ axis2_hash_set(storage_map, key, AXIS2_HASH_KEY_STRING, NULL);
+ }
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_init_storage(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_module_desc_t *module_desc)
+{
+ return AXIS2_SUCCESS;
+}
+
+axiom_soap_envelope_t *AXIS2_CALL
+sandesha2_permanent_storage_mgr_retrieve_soap_envelope(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *key)
+{
+ /* TODO No real value */
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_permanent_storage_mgr_store_soap_envelope(
+ sandesha2_storage_mgr_t *storage_mgr,
+ const axis2_env_t *env,
+ axiom_soap_envelope_t *soap_env,
+ axis2_char_t *key)
+{
+ /* TODO No real value */
+ return AXIS2_SUCCESS;
+}
+
Added: webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c Thu Dec 14 21:56:31 2006
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sandesha2_permanent_transaction.h>
+#include <sandesha2_transaction.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_error.h>
+#include <sandesha2_rm_bean.h>
+#include <sandesha2_storage_mgr.h>
+#include <axis2_log.h>
+#include <axis2_hash.h>
+#include <axis2_thread.h>
+#include <axis2_property.h>
+#include <platforms/axis2_platform_auto_sense.h>
+
+typedef struct sandesha2_permanent_transaction_impl
+ sandesha2_permanent_transaction_impl_t;
+
+/**
+ * @brief Sandesha Permanent Transaction Struct Impl
+ * Sandesha2 Permanent Transaction
+ */
+struct sandesha2_permanent_transaction_impl
+{
+ sandesha2_transaction_t trans;
+ sandesha2_storage_mgr_t *storage_mgr;
+ axis2_array_list_t *enlisted_beans;
+ axis2_thread_mutex_t *mutex;
+};
+
+#define SANDESHA2_INTF_TO_IMPL(trans) \
+ ((sandesha2_permanent_transaction_impl_t *) trans)
+
+static axis2_status_t
+sandesha2_permanent_transaction_free(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env);
+
+static axis2_bool_t
+sandesha2_permanent_transaction_is_active(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env);
+
+static void
+sandesha2_permanent_transaction_commit(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env);
+
+static void
+sandesha2_permanent_transaction_rollback(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env);
+
+static void
+sandesha2_permanent_transaction_enlist(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *rm_bean);
+
+static void
+sandesha2_permanent_transaction_release_locks(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env);
+
+static const sandesha2_transaction_ops_t transaction_ops =
+{
+ sandesha2_permanent_transaction_free,
+ sandesha2_permanent_transaction_is_active,
+ sandesha2_permanent_transaction_commit,
+ sandesha2_permanent_transaction_rollback,
+ sandesha2_permanent_transaction_enlist
+};
+
+AXIS2_EXTERN sandesha2_transaction_t* AXIS2_CALL
+sandesha2_permanent_transaction_create(
+ const axis2_env_t *env,
+ sandesha2_storage_mgr_t *storage_mgr)
+{
+ sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trans_impl = (sandesha2_permanent_transaction_impl_t *)AXIS2_MALLOC
+ (env->allocator, sizeof(sandesha2_permanent_transaction_impl_t));
+
+ trans_impl->storage_mgr = storage_mgr;
+ trans_impl->enlisted_beans = axis2_array_list_create(env, 0);
+ trans_impl->mutex = axis2_thread_mutex_create(env->allocator,
+ AXIS2_THREAD_MUTEX_DEFAULT);
+ trans_impl->trans.ops = &transaction_ops;
+
+ return &(trans_impl->trans);
+}
+
+static axis2_status_t
+sandesha2_permanent_transaction_free(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
+
+ if(trans_impl->mutex)
+ {
+ axis2_thread_mutex_destroy(trans_impl->mutex);
+ trans_impl->mutex = NULL;
+ }
+ if(trans_impl->enlisted_beans)
+ {
+ AXIS2_ARRAY_LIST_FREE(trans_impl->enlisted_beans, env);
+ trans_impl->enlisted_beans = NULL;
+ }
+ if(trans_impl)
+ {
+ AXIS2_FREE(env->allocator, trans_impl);
+ trans_impl = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+static axis2_bool_t
+sandesha2_permanent_transaction_is_active(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
+ trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
+ int size = 0;
+ if(trans_impl->enlisted_beans)
+ size = AXIS2_ARRAY_LIST_SIZE(trans_impl->enlisted_beans, env);
+ if(size > 0)
+ return AXIS2_TRUE;
+ else
+ return AXIS2_FALSE;
+}
+
+static void
+sandesha2_permanent_transaction_commit(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_transaction_release_locks(trans, env);
+}
+
+static void
+sandesha2_permanent_transaction_rollback(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_transaction_release_locks(trans, env);
+}
+
+static void
+sandesha2_permanent_transaction_release_locks(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env)
+{
+ sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
+ int i = 0, size = 0;
+ trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
+ if(trans_impl->enlisted_beans)
+ size = AXIS2_ARRAY_LIST_SIZE(trans_impl->enlisted_beans, env);
+ for(i = 0; i < size; i++)
+ {
+ sandesha2_rm_bean_t *rm_bean_l = NULL;
+ sandesha2_rm_bean_t *rm_bean = (sandesha2_rm_bean_t *)
+ AXIS2_ARRAY_LIST_GET(trans_impl->enlisted_beans, env, i);
+ rm_bean_l = sandesha2_rm_bean_get_base(rm_bean, env);
+ axis2_thread_mutex_lock(trans_impl->mutex);
+ sandesha2_rm_bean_set_transaction(rm_bean_l, env, NULL);
+ axis2_thread_mutex_unlock(trans_impl->mutex);
+ }
+ AXIS2_ARRAY_LIST_FREE(trans_impl->enlisted_beans, env);
+ trans_impl->enlisted_beans = NULL;
+}
+
+static void
+sandesha2_permanent_transaction_enlist(
+ sandesha2_transaction_t *trans,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *rm_bean)
+{
+ sandesha2_rm_bean_t *rm_bean_l = NULL;
+ sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Start:sandesha2_permanent_transaction_enlist");
+ trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
+ rm_bean_l = sandesha2_rm_bean_get_base(rm_bean, env);
+ if(rm_bean)
+ {
+ sandesha2_transaction_t *other = NULL;
+ axis2_thread_mutex_lock(trans_impl->mutex);
+ other = sandesha2_rm_bean_get_transaction(rm_bean_l, env);
+ /*while(other && other != trans)
+ {
+ int size = 0;
+ if(trans_impl->enlisted_beans)
+ size = AXIS2_ARRAY_LIST_SIZE(trans_impl->enlisted_beans, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "size:%d", size);
+ if(size > 0)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Possible deadlock");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_POSSIBLE_DEADLOCK,
+ AXIS2_FAILURE);
+ }
+ AXIS2_SLEEP(6);
+ other = sandesha2_rm_bean_get_transaction(rm_bean_l, env);
+ }*/
+ if(!other)
+ {
+ sandesha2_rm_bean_set_transaction(rm_bean_l, env, trans);
+ AXIS2_ARRAY_LIST_ADD(trans_impl->enlisted_beans, env, rm_bean);
+ }
+ axis2_thread_mutex_unlock(trans_impl->mutex);
+ }
+ AXIS2_LOG_INFO(env->log,
+ "[sandesha2]Exit:sandesha2_permanent_transaction_enlist");
+}
+
Added: webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_permanent_bean_mgr.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_permanent_bean_mgr.h?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_permanent_bean_mgr.h (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_permanent_bean_mgr.h Thu Dec 14 21:56:31 2006
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_PERMANENT_BEAN_MGR_H
+#define SANDESHA2_PERMANENT_BEAN_MGR_H
+
+/**
+ * @file sandesha2_permanent_bean_mgr.h
+ * @brief Sandesha In Memory Bean Manager Interface
+ */
+
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <axis2_array_list.h>
+#include <sandesha2_rm_bean.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct sandesha2_bean_mgr_args sandesha2_bean_mgr_args_t;
+typedef struct sandesha2_permanent_bean_mgr sandesha2_permanent_bean_mgr_t;
+typedef struct sandesha2_permanent_bean_mgr_ops sandesha2_permanent_bean_mgr_ops_t;
+struct sandesha2_storage_mgr;
+struct axis2_ctx;
+
+AXIS2_DECLARE_DATA struct sandesha2_permanent_bean_mgr_ops
+{
+ axis2_bool_t (AXIS2_CALL *
+ match) (
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate);
+};
+
+AXIS2_DECLARE_DATA struct sandesha2_permanent_bean_mgr
+{
+ sandesha2_permanent_bean_mgr_ops_t ops;
+};
+
+struct sandesha2_bean_mgr_args
+{
+ const axis2_env_t *env;
+ void *data;
+};
+
+AXIS2_EXTERN sandesha2_permanent_bean_mgr_t * AXIS2_CALL
+sandesha2_permanent_bean_mgr_create(
+ const axis2_env_t *env,
+ struct sandesha2_storage_mgr *storage_mgr,
+ struct axis2_ctx *ctx,
+ axis2_char_t *key);
+
+void AXIS2_CALL
+sandesha2_permanent_bean_mgr_free(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_insert(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ axis2_char_t *sql_stmt_insert);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_remove(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ int (*retrieve_func)(void *, int, char **, char **),
+ axis2_char_t *sql_stmt_retrieve,
+ axis2_char_t *sql_stmt_remove);
+
+sandesha2_rm_bean_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_retrieve(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ int (*retrieve_func)(void *, int, char **, char **),
+ axis2_char_t *sql_stmt_retrieve);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_update(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *old_bean,
+ int (*update_func)(void *, int, char **, char **),
+ axis2_char_t *sql_stmt_retrieve_old_bean,
+ axis2_char_t *sql_stmt_update);
+
+axis2_array_list_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_find(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ int (*find_func)(void *, int, char **, char **),
+ int (*count_func)(void *, int, char **, char **),
+ axis2_char_t *sql_stmt_find,
+ axis2_char_t *sql_stmt_count);
+
+sandesha2_rm_bean_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_find_unique(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ int (*find_func)(void *, int, char **, char **),
+ int (*count_func)(void *, int, char **, char **),
+ axis2_char_t *sql_stmt_find,
+ axis2_char_t *sql_stmt_count);
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_match(
+ sandesha2_permanent_bean_mgr_t *bean_mgr,
+ const axis2_env_t *env,
+ sandesha2_rm_bean_t *bean,
+ sandesha2_rm_bean_t *candidate);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* SANDESHA2_PERMANENT_BEAN_MGR_H */
Added: webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_sqls.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_sqls.h?view=auto&rev=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_sqls.h (added)
+++ webservices/sandesha/trunk/c/src/storage/permanent/sandesha2_sqls.h Thu Dec 14 21:56:31 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_SQLS_H
+#define SANDESHA2_SQLS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup sandesha2_sqls
+ * @ingroup Sandesha2 SQLs
+ * @{
+ */
+ /**
+ * Create Sequence Table
+ */
+
+ /**
+ * Invoker Table
+ */
+
+ /**
+ * Sender Table
+ */
+
+ /* Next Message Table */
+
+ /**
+ * Sequence Property Table
+ */
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*SANDESHA2_SQLS_H*/
Modified: webservices/sandesha/trunk/c/src/util/property_bean.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/property_bean.c?view=diff&rev=487458&r1=487457&r2=487458
==============================================================================
--- webservices/sandesha/trunk/c/src/util/property_bean.c (original)
+++ webservices/sandesha/trunk/c/src/util/property_bean.c Thu Dec 14 21:56:31 2006
@@ -34,6 +34,7 @@
axis2_bool_t is_in_order;
axis2_array_list_t *msg_types_to_drop;
int max_retrans_count;
+ axis2_char_t *db_path;
};
AXIS2_EXTERN sandesha2_property_bean_t* AXIS2_CALL
@@ -60,6 +61,7 @@
bean->is_in_order = AXIS2_FALSE;
bean->msg_types_to_drop = NULL;
bean->max_retrans_count = 0;
+ bean->db_path = NULL;
return bean;
}
@@ -86,6 +88,11 @@
}
AXIS2_ARRAY_LIST_FREE(bean->msg_types_to_drop, env);
}
+ if(bean->db_path)
+ {
+ AXIS2_FREE(env->allocator, bean->db_path);
+ bean->db_path = NULL;
+ }
if(bean->in_mem_storage_mgr)
{
AXIS2_FREE(env->allocator, bean->in_mem_storage_mgr);
@@ -319,3 +326,22 @@
bean->max_retrans_count = count;
return AXIS2_SUCCESS;
}
+
+axis2_char_t *AXIS2_CALL
+sandesha2_property_bean_get_db_path(
+ sandesha2_property_bean_t *bean,
+ const axis2_env_t *env,
+ axis2_char_t *db_path)
+{
+ return bean->db_path;
+}
+axis2_status_t AXIS2_CALL
+sandesha2_property_bean_set_db_path(
+ sandesha2_property_bean_t *bean,
+ const axis2_env_t *env,
+ axis2_char_t *db_path)
+{
+ bean->db_path = AXIS2_STRDUP(db_path, env);
+ return AXIS2_SUCCESS;
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org