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

svn commit: r532207 [1/3] - /webservices/sandesha/trunk/c/src/storage/sqlite/

Author: damitha
Date: Tue Apr 24 23:01:28 2007
New Revision: 532207

URL: http://svn.apache.org/viewvc?view=rev&rev=532207
Log:
added sqlite storage with changes to reflect current axis2c svn changes

Added:
    webservices/sandesha/trunk/c/src/storage/sqlite/
    webservices/sandesha/trunk/c/src/storage/sqlite/Makefile.am
    webservices/sandesha/trunk/c/src/storage/sqlite/msg_store_bean.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_invoker_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_next_msg_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_seq_property_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_transaction.c
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_create_seq_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_invoker_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_next_msg_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_sender_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_seq_property_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_storage_mgr.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_transaction.h
    webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_sqls.h
    webservices/sandesha/trunk/c/src/storage/sqlite/svn-commit.2.tmp
    webservices/sandesha/trunk/c/src/storage/sqlite/svn-commit.3.tmp
    webservices/sandesha/trunk/c/src/storage/sqlite/svn-commit.tmp

Added: webservices/sandesha/trunk/c/src/storage/sqlite/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/Makefile.am?view=auto&rev=532207
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/Makefile.am (added)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/Makefile.am Tue Apr 24 23:01:28 2007
@@ -0,0 +1,18 @@
+noinst_LTLIBRARIES = libsandesha2_permanent.la
+
+libsandesha2_permanent_la_SOURCES = \
+								permanent_create_seq_mgr.c \
+								permanent_invoker_mgr.c \
+								permanent_sender_mgr.c \
+								permanent_next_msg_mgr.c \
+								permanent_seq_property_mgr.c \
+								permanent_transaction.c \
+								permanent_storage_mgr.c \
+								permanent_bean_mgr.c \
+								msg_store_bean.c
+
+INCLUDES = -I$(top_builddir)/include \
+			-I$(top_builddir)/include/sandesha2 \
+			-I. \
+			@AXIS2INC@
+

Added: webservices/sandesha/trunk/c/src/storage/sqlite/msg_store_bean.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/msg_store_bean.c?view=auto&rev=532207
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/msg_store_bean.c (added)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/msg_store_bean.c Tue Apr 24 23:01:28 2007
@@ -0,0 +1,441 @@
+/*
+ * 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_msg_store_bean.h>
+#include <axutil_string.h>
+#include <axutil_utils.h>
+#include <axis2_const.h>
+
+/**
+ * Defines a set of properties which extracted from a Message Context
+ * when serializing it.
+ */
+struct sandesha2_msg_store_bean_t 
+{
+
+	
+	axis2_char_t * stored_key;
+	
+    axis2_char_t * msg_id;
+	
+    axis2_char_t * soap_env_str;
+	
+	int soap_version;
+
+	AXIS2_TRANSPORT_ENUMS transport_out;
+	
+    axis2_char_t * op;
+	
+    axis2_char_t * svc;
+	
+	axis2_char_t * svc_grp;
+	
+	axis2_char_t * op_mep;
+	
+	axis2_char_t * to_url;
+	
+    axis2_char_t * reply_to;
+	
+	axis2_char_t * transport_to;
+	
+	axis2_char_t * execution_chain_str;
+
+	int flow;
+	
+	axis2_char_t * msg_recv_str;
+	
+	axis2_bool_t svr_side;
+	
+	axis2_char_t * in_msg_store_key;
+		
+	axis2_char_t * persistent_property_str;
+	
+	axis2_char_t * action;
+};
+	
+AXIS2_EXTERN sandesha2_msg_store_bean_t* AXIS2_CALL
+sandesha2_msg_store_bean_create(const axutil_env_t *env)
+{
+	sandesha2_msg_store_bean_t *msg_store_bean = NULL;
+	AXIS2_ENV_CHECK(env, NULL);
+
+	msg_store_bean = (sandesha2_msg_store_bean_t*) AXIS2_MALLOC(env->allocator,
+	    sizeof(sandesha2_msg_store_bean_t));
+
+	if(!msg_store_bean)
+	{
+		AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+    msg_store_bean->stored_key = NULL;
+    msg_store_bean->msg_id = NULL;
+    msg_store_bean->soap_env_str = NULL;
+	msg_store_bean->soap_version = -1;
+	msg_store_bean->transport_out = -1;
+    msg_store_bean->op = NULL;
+    msg_store_bean->svc = NULL;
+	msg_store_bean->svc_grp = NULL;
+	msg_store_bean->op_mep = NULL;
+	msg_store_bean->to_url = NULL;
+	msg_store_bean->reply_to = NULL;
+	msg_store_bean->transport_to = NULL;
+	msg_store_bean->execution_chain_str = NULL;
+	msg_store_bean->flow = -1;
+	msg_store_bean->msg_recv_str = NULL;
+	msg_store_bean->svr_side = -1;
+	msg_store_bean->in_msg_store_key = NULL;
+	msg_store_bean->persistent_property_str = NULL;
+	msg_store_bean->action = NULL;
+
+    return msg_store_bean;
+}
+
+void AXIS2_CALL
+sandesha2_msg_store_bean_free (
+    sandesha2_msg_store_bean_t *msg_store_bean,
+	const axutil_env_t *env)
+{
+    if(msg_store_bean)
+    {
+        AXIS2_FREE(env->allocator, msg_store_bean);
+        msg_store_bean = NULL;
+    }
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_msg_id(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->msg_id;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_msg_id(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * msg_id) 
+{
+    msg_store_bean->msg_id = axutil_strdup(env, msg_id);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_stored_key(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->stored_key;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_stored_key(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * key) 
+{
+    msg_store_bean->stored_key = axutil_strdup(env, key);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_soap_envelope_str(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->soap_env_str;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_soap_envelope_str(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * soap_env_str) 
+{
+    msg_store_bean->soap_env_str = axutil_strdup(env, soap_env_str);
+}
+
+int AXIS2_CALL 
+sandesha2_msg_store_bean_get_soap_version( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->soap_version;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_soap_version(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    int soap_version) 
+{		
+    msg_store_bean->soap_version = soap_version;
+}
+
+AXIS2_TRANSPORT_ENUMS AXIS2_CALL 
+sandesha2_msg_store_bean_get_transport_out(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->transport_out;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_transport_out(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    AXIS2_TRANSPORT_ENUMS transport_sender) 
+{
+    msg_store_bean->transport_out = transport_sender;
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_op( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->op;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_op(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * op) 
+{
+    msg_store_bean->op = axutil_strdup(env, op);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_svc( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->svc;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_svc(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * svc) 
+{
+    msg_store_bean->svc = axutil_strdup(env, svc);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_svc_grp( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->svc_grp;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_svc_grp(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * svc_grp) 
+{
+    msg_store_bean->svc_grp = axutil_strdup(env, svc_grp);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_op_mep( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->op_mep;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_op_mep(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * opAdd) 
+{
+    msg_store_bean->op_mep = axutil_strdup(env, opAdd);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_to_url( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->to_url;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_to_url(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * to_url) 
+{
+    msg_store_bean->to_url = axutil_strdup(env, to_url);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_reply_to( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->reply_to;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_reply_to(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * reply_to) 
+{
+    msg_store_bean->reply_to = axutil_strdup(env, reply_to);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_transport_to( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->transport_to;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_transport_to(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * transport_to) 
+{
+    msg_store_bean->transport_to = axutil_strdup(env, transport_to);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_execution_chain_str( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->execution_chain_str;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_execution_chain_str(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * execution_chain_str) 
+{
+    msg_store_bean->execution_chain_str = axutil_strdup(env, execution_chain_str);
+}
+
+int AXIS2_CALL 
+sandesha2_msg_store_bean_get_flow( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->flow;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_flow(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    int flow) 
+{
+    msg_store_bean->flow = flow;
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_msg_recv_str( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->msg_recv_str;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_msg_recv_str(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * msg_recv_str) 
+{
+    msg_store_bean->msg_recv_str = axutil_strdup(env, msg_recv_str);
+}
+
+axis2_bool_t AXIS2_CALL 
+sandesha2_msg_store_bean_is_svr_side( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->svr_side;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_svr_side(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_bool_t svr_side) 
+{
+    msg_store_bean->svr_side = svr_side;
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_in_msg_store_key(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->in_msg_store_key;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_in_msg_store_key(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * request_msg_key) 
+{
+    msg_store_bean->in_msg_store_key = axutil_strdup(env, request_msg_key);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_persistent_property_str( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->persistent_property_str;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_persistent_property_str(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * persistent_property_str) 
+{
+    msg_store_bean->persistent_property_str = axutil_strdup(
+        env, persistent_property_str);
+}
+
+axis2_char_t *AXIS2_CALL 
+sandesha2_msg_store_bean_get_action( 
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env)
+{
+    return msg_store_bean->action;
+}
+
+void AXIS2_CALL 
+sandesha2_msg_store_bean_set_action(
+    sandesha2_msg_store_bean_t *msg_store_bean,
+    const axutil_env_t *env,
+    axis2_char_t * action) 
+{
+    msg_store_bean->action = axutil_strdup(env, action);
+}
+

Added: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c?view=auto&rev=532207
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c (added)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c Tue Apr 24 23:01:28 2007
@@ -0,0 +1,1183 @@
+/*
+ * 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_bean_mgr.h"
+#include <sandesha2_permanent_storage_mgr.h>
+#include <sandesha2_constants.h>
+#include "sandesha2_permanent_bean_mgr.h"
+#include <sandesha2_error.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_property_bean.h>
+#include <sandesha2_utils.h>
+#include <sandesha2_property_bean.h>
+#include <axutil_log.h>
+#include <axutil_hash.h>
+#include <axutil_thread.h>
+#include <axutil_property.h>
+#include <axis2_conf_ctx.h>
+#include <axutil_types.h>
+#include <platforms/axutil_platform_auto_sense.h>
+
+/** 
+ * @brief Sandesha2 Permanent Bean Manager Struct Impl
+ *   Sandesha2 Permanent Bean Manager
+ */
+typedef struct sandesha2_permanent_bean_mgr_impl
+{
+    sandesha2_permanent_bean_mgr_t bean_mgr;
+    sandesha2_storage_mgr_t *storage_mgr;
+    axutil_thread_mutex_t *mutex;
+
+}sandesha2_permanent_bean_mgr_impl_t;
+
+#define SANDESHA2_INTF_TO_IMPL(bean_mgr) \
+    ((sandesha2_permanent_bean_mgr_impl_t *) bean_mgr)
+
+static int 
+sandesha2_permanent_bean_mgr_count_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int *count = (int *) not_used;
+    *count = AXIS2_ATOI(argv[0]);
+    return 0;
+}
+
+static int 
+sandesha2_permanent_bean_mgr_response_retrieve_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int i = 0;
+    sandesha2_response_t *response = NULL;
+    sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+    const axutil_env_t *env = args->env;
+    if(argc < 1)
+    {
+        args->data = NULL;
+        return 0;
+    }
+    response = (sandesha2_response_t *) args->data;
+    if(!response && argc > 0)
+    {
+        response = (sandesha2_response_t *) AXIS2_MALLOC(env->allocator, sizeof(
+            sandesha2_response_t));
+        args->data = response;
+    }
+    for(i = 0; i < argc; i++)
+    {
+        if(0 == axis2_strcmp(col_name[i], "response_str"))
+            if(argv[i])
+                response->response_str = axutil_strdup(env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "soap_version"))
+            if(argv[i])
+                response->soap_version = axis2_atoi(argv[i]);
+    }
+    return 0;
+}
+
+
+static int 
+sandesha2_msg_store_bean_retrieve_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int i = 0;
+    sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+    const axutil_env_t *env = args->env;
+    sandesha2_msg_store_bean_t *bean = NULL;
+    if(argc < 1)
+    {
+        args->data = NULL;
+        return 0;
+    }
+    bean = (sandesha2_msg_store_bean_t *) args->data;
+    if(!bean && argc > 0)
+    {
+        bean = sandesha2_msg_store_bean_create(env);
+        args->data = bean;
+    }
+    for(i = 0; i < argc; i++)
+    {
+        if(0 == axis2_strcmp(col_name[i], "stored_key"))
+            if(argv[i])
+            {
+                sandesha2_msg_store_bean_set_stored_key(bean, env, argv[i]);
+            }
+        if(0 == axis2_strcmp(col_name[i], "msg_id"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_msg_id(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "soap_env_str"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_soap_envelope_str(bean, env, 
+                    argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "soap_version"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_soap_version(bean, env, AXIS2_ATOI(argv[i]));
+        if(0 == axis2_strcmp(col_name[i], "transport_out"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_transport_out(bean, env, AXIS2_ATOI(argv[i]));
+        if(0 == axis2_strcmp(col_name[i], "op"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_op(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "svc"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_svc(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "svc_grp"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_svc_grp(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "op_mep"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_op_mep(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "to_url"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_to_url(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "transport_to"))
+            if(argv[i] && 0 != axis2_strcmp("(null)", argv[i]))
+            {
+                sandesha2_msg_store_bean_set_transport_to(bean, env, argv[i]);
+            }
+        if(0 == axis2_strcmp(col_name[i], "execution_chain_str"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_execution_chain_str(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "flow"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_flow(bean, env, AXIS2_ATOI(argv[i]));
+        if(0 == axis2_strcmp(col_name[i], "msg_recv_str"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_msg_recv_str(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "svr_side"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_svr_side(bean, env, AXIS2_ATOI(argv[i]));
+        if(0 == axis2_strcmp(col_name[i], "in_msg_store_key"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_in_msg_store_key(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "prop_str"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_persistent_property_str(bean, 
+                    env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "action"))
+            if(argv[i])
+                sandesha2_msg_store_bean_set_action(bean, env, argv[i]);
+    }
+    return 0;
+}
+
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_match(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    sandesha2_rm_bean_t *bean,
+    sandesha2_rm_bean_t *candidate)
+{
+    return bean_mgr->ops.match(bean_mgr, env, bean, candidate);
+}
+
+AXIS2_EXTERN sandesha2_permanent_bean_mgr_t * AXIS2_CALL
+sandesha2_permanent_bean_mgr_create(
+    const axutil_env_t *env,
+    sandesha2_storage_mgr_t *storage_mgr,
+    axis2_conf_ctx_t *conf_ctx,
+    axis2_char_t *key)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    bean_mgr_impl = AXIS2_MALLOC(env->allocator, 
+        sizeof(sandesha2_permanent_bean_mgr_impl_t));
+
+    bean_mgr_impl->storage_mgr = storage_mgr;
+    bean_mgr_impl->mutex = sandesha2_permanent_storage_mgr_get_mutex(storage_mgr, env);
+    return &(bean_mgr_impl->bean_mgr);
+}
+
+void AXIS2_CALL
+sandesha2_permanent_bean_mgr_free(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Start:sandesha2_permanent_bean_mgr_free_impl");
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+
+    if(bean_mgr_impl)
+    {
+        AXIS2_FREE(env->allocator, bean_mgr_impl);
+        bean_mgr_impl = NULL;
+    }
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_bean_mgr_free_impl");
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_insert(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_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_update,
+    axis2_char_t *sql_stmt_insert)
+{
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    sqlite3 *dbconn = NULL;
+    sandesha2_rm_bean_t *retrieve_bean = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    
+    sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, bean);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = env;
+    args->data = NULL;
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, retrieve_func, args,
+        &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            retrieve_func, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt:%s. sql error: %s",
+            sql_stmt_retrieve, error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        retrieve_bean = (sandesha2_rm_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    if(retrieve_bean)
+    {
+        rc = sqlite3_exec(dbconn, sql_stmt_update, 0, 0, &error_msg);
+        if(rc == SQLITE_BUSY)
+            rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_update, 
+            0, 0, &error_msg, rc);
+        if( rc != SQLITE_OK )
+        {
+            axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, 
+                AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s.sql error: %s", 
+                sql_stmt_update, error_msg);
+            printf("sql_stmt_update:%s\n", sql_stmt_update);
+            printf("update error_msg:%s\n", error_msg);
+            sqlite3_free(error_msg);
+            return AXIS2_FALSE;
+        }
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        return AXIS2_TRUE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    rc = sqlite3_exec(dbconn, sql_stmt_insert, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_insert, 
+            0, 0, &error_msg, rc);
+    if( rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s", 
+            sql_stmt_insert, error_msg);
+        printf("sql_stmt_insert:%s\n", sql_stmt_insert);
+        printf("insert error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return AXIS2_TRUE;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_remove(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    int (*retrieve_func)(void *, int, char **, char **),
+    axis2_char_t *sql_stmt_retrieve,
+    axis2_char_t *sql_stmt_remove)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    axis2_char_t *error_msg = NULL;
+    sandesha2_rm_bean_t *bean = NULL;
+    sqlite3 *dbconn = NULL;
+    int rc = -1;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = env;
+    args->data = NULL;
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, retrieve_func, args, 
+        &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            retrieve_func, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s",
+            sql_stmt_retrieve, error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        bean = (sandesha2_rm_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    if(bean)
+    {
+        if(sandesha2_rm_bean_get_key(bean, env))
+            sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, 
+                bean);
+    }
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    rc = sqlite3_exec(dbconn, sql_stmt_remove, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_remove, 
+            0, 0, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s",
+            sql_stmt_remove, error_msg);
+        printf("sql_stmt_remove:%s\n", sql_stmt_remove);
+        printf("remove error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return AXIS2_TRUE;
+}
+
+sandesha2_rm_bean_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_retrieve(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    int (*retrieve_func)(void *, int, char **, char **),
+    axis2_char_t *sql_stmt_retrieve)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    axis2_char_t *error_msg = NULL;
+    sandesha2_rm_bean_t *bean = NULL;
+    sqlite3 *dbconn = NULL;
+    int rc = -1;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return NULL;
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, retrieve_func, args, 
+        &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            retrieve_func, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s",
+            sql_stmt_retrieve, error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        bean = (sandesha2_rm_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    if(bean)
+        sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, bean);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, retrieve_func, args, 
+        &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            retrieve_func, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        bean = (sandesha2_rm_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return bean;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_update(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    sandesha2_rm_bean_t *bean,
+    int (*retrieve_func)(void *, int, char **, char **),
+    axis2_char_t *sql_stmt_retrieve_old_bean,
+    axis2_char_t *sql_stmt_update)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    sqlite3 *dbconn = NULL;
+    sandesha2_rm_bean_t *old_bean = NULL;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    axis2_char_t *key = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    if(bean)
+        sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, bean);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve_old_bean, 
+       retrieve_func, args, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve_old_bean, 
+            retrieve_func, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        if(args)
+            AXIS2_FREE(env->allocator, args);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+            error_msg);
+        printf("sql_stmt_retrieve_old_bean:%s\n", sql_stmt_retrieve_old_bean);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    rc = sqlite3_exec(dbconn, sql_stmt_update, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_update, 
+            0, 0, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+            error_msg);
+        printf("sql_stmt_update:%s\n", sql_stmt_update);
+        printf("update error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    if(args->data)
+        old_bean = (sandesha2_rm_bean_t *) args->data;
+    if(old_bean)
+        key = sandesha2_rm_bean_get_key(old_bean, env);
+    if(!key)
+        return AXIS2_FALSE;
+    sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, old_bean);
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    return AXIS2_TRUE;
+}
+
+axutil_array_list_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_find(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_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_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    axutil_array_list_t *beans = NULL;
+    int i = 0, size = 0, rc = -1;
+    sqlite3 *dbconn = NULL;
+    axutil_array_list_t *data_array = NULL;
+    axis2_char_t *error_msg = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    beans = axutil_array_list_create(env, 0);
+    if(!beans)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        return NULL;
+    }
+    rc = sqlite3_exec(dbconn, sql_stmt_find, find_func, args, 
+        &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_find, 
+            find_func, args, &error_msg, rc);
+    if(args->data)
+        data_array = (axutil_array_list_t *) args->data;
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        if(data_array)
+            axutil_array_list_free(data_array, env);
+        if(args)
+            AXIS2_FREE(env->allocator, args);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+            error_msg);
+        printf("sql_stmt_find:%s\n", sql_stmt_find);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return NULL;
+    }
+    if(data_array)
+        size = axutil_array_list_size(data_array, env);
+    for(i = 0; i < size; i++)
+    {
+        sandesha2_rm_bean_t *candidate = NULL;
+        candidate = (sandesha2_rm_bean_t *) axutil_array_list_get(data_array, 
+            env, i);
+         if(!candidate)
+            continue;
+        if(bean && sandesha2_permanent_bean_mgr_match(bean_mgr, env, bean,
+            candidate))
+        {
+            axutil_array_list_add(beans, env, candidate);
+        }
+        if(!bean)
+            axutil_array_list_add(beans, env, candidate);
+    }
+    if(data_array)
+        axutil_array_list_free(data_array, env);
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    /* Now we have a point-in-time view of the beans, lock them all.*/
+    size = axutil_array_list_size(beans, env);
+    for(i = 0; i < size; i++)
+    {
+        sandesha2_rm_bean_t *temp = axutil_array_list_get(beans, env, i);
+        if(temp)
+            sandesha2_storage_mgr_enlist_bean(bean_mgr_impl->storage_mgr, env, 
+                temp);
+    }
+    /* Finally remove any beans that are no longer in the table */
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    size = axutil_array_list_size(beans, env);
+    for(i = 0; i < size; i++)
+    {
+        sandesha2_rm_bean_t *temp = axutil_array_list_get(beans, env, i);
+        if(temp)
+        {
+            int count = -1;
+
+            rc = sqlite3_exec(dbconn, sql_stmt_count, count_func, &count, 
+                &error_msg);
+            if(rc == SQLITE_BUSY)
+                rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_count, 
+                    count_func, &count, &error_msg, rc);
+            if(rc != SQLITE_OK )
+            {
+                axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+                AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+                    error_msg);
+                printf("sql_stmt_count:%s\n", sql_stmt_count);
+                printf("retrieve error_msg:%s\n", error_msg);
+                sqlite3_free(error_msg);
+                return NULL;
+            }
+            if(count == 0)
+            {
+                axutil_array_list_remove(beans, env, i);
+            }
+        }
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return beans;
+}
+
+sandesha2_rm_bean_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_find_unique(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_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_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    axutil_array_list_t *beans = NULL;
+    int size = 0;
+    sandesha2_rm_bean_t *ret = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    beans = sandesha2_permanent_bean_mgr_find(bean_mgr, env, bean, find_func, 
+        count_func, sql_stmt_find, sql_stmt_count);
+    if(beans)
+        size = axutil_array_list_size(beans, env);
+    if( size > 1)
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Non-Unique result");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NON_UNIQUE_RESULT, 
+            AXIS2_FAILURE);
+        return NULL;
+    }
+    if(size == 1)
+       ret = axutil_array_list_get(beans, env, 0);
+    return ret;
+}
+
+sandesha2_msg_store_bean_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *key)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    axis2_char_t *error_msg = NULL;
+    sandesha2_msg_store_bean_t *msg_store_bean = NULL;
+    int rc = -1;
+    sqlite3 *dbconn = NULL;
+    axis2_char_t sql_stmt_retrieve[512];
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return NULL;
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    sprintf(sql_stmt_retrieve, "select stored_key, msg_id, soap_env_str,"\
+        "soap_version, transport_out, op, svc, svc_grp, op_mep, to_url, "\
+        "transport_to, execution_chain_str, flow, msg_recv_str, svr_side, "\
+        "in_msg_store_key, prop_str, action from msg where stored_key='%s'", 
+        key);
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, 
+        sandesha2_msg_store_bean_retrieve_callback, args, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            sandesha2_msg_store_bean_retrieve_callback, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        msg_store_bean = (sandesha2_msg_store_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return msg_store_bean;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_insert_msg_store_bean(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *key,
+    sandesha2_msg_store_bean_t *bean)
+{
+    axis2_char_t sql_stmt_retrieve[512];
+    axis2_char_t *sql_stmt_update = NULL;
+    axis2_char_t *sql_stmt_insert = NULL;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    int sql_size = -1;
+    sqlite3 *dbconn = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    sandesha2_msg_store_bean_t *msg_store_bean = NULL;
+	axis2_char_t *msg_id = NULL;
+	axis2_char_t *stored_key = NULL;
+	axis2_char_t *soap_env_str = NULL;
+	int soap_version;
+	axis2_char_t *svc_grp = NULL;
+	axis2_char_t *svc = NULL;
+	axis2_char_t *op  = NULL;
+	AXIS2_TRANSPORT_ENUMS transport_out = -1;
+	axis2_char_t *op_mep = NULL;
+	axis2_char_t *to_url = NULL;
+	axis2_char_t *reply_to = NULL;
+	axis2_char_t *transport_to = NULL;
+	axis2_char_t *execution_chain_str = NULL;
+	sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+	int flow;	
+	axis2_char_t *msg_recv_str = NULL;
+	axis2_bool_t svr_side = AXIS2_FALSE;
+	axis2_char_t *in_msg_store_key = NULL;
+	axis2_char_t *prop_str = NULL;
+	axis2_char_t *action = NULL;
+
+	bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+	msg_id = sandesha2_msg_store_bean_get_msg_id(bean, env);
+	stored_key = sandesha2_msg_store_bean_get_stored_key(bean, env);
+	soap_env_str =  sandesha2_msg_store_bean_get_soap_envelope_str(bean, env);
+	soap_version = sandesha2_msg_store_bean_get_soap_version(bean, env);
+	transport_out = sandesha2_msg_store_bean_get_transport_out(bean, env);
+	op = sandesha2_msg_store_bean_get_op(bean, env);
+    svc = sandesha2_msg_store_bean_get_svc(bean, env);
+	svc_grp = sandesha2_msg_store_bean_get_svc_grp(bean, env);
+    op_mep = sandesha2_msg_store_bean_get_op_mep(bean, env);;
+    to_url = sandesha2_msg_store_bean_get_to_url(bean, env);
+	reply_to = sandesha2_msg_store_bean_get_reply_to(bean, env);
+	transport_to = sandesha2_msg_store_bean_get_transport_to(bean, env);
+	execution_chain_str = sandesha2_msg_store_bean_get_execution_chain_str(bean, env);
+	flow = sandesha2_msg_store_bean_get_flow(bean, env);
+	msg_recv_str = sandesha2_msg_store_bean_get_msg_recv_str(bean, env);
+    svr_side = sandesha2_msg_store_bean_is_svr_side(bean, env);
+	in_msg_store_key = sandesha2_msg_store_bean_get_in_msg_store_key(bean, env);
+	prop_str = sandesha2_msg_store_bean_get_persistent_property_str(bean, env);
+	action = sandesha2_msg_store_bean_get_action(bean, env);
+
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_bean_mgr_insert_msg_store_bean");
+    sql_size = axis2_strlen(msg_id) + axis2_strlen(stored_key) + 
+        axis2_strlen(soap_env_str) + sizeof(int) + sizeof(int) + 
+        axis2_strlen(op) + axis2_strlen(svc) + axis2_strlen(svc_grp) + 
+        axis2_strlen(op_mep) + axis2_strlen(to_url) + axis2_strlen(reply_to) +
+        axis2_strlen(transport_to) + axis2_strlen(execution_chain_str) + sizeof(int) + 
+        axis2_strlen(msg_recv_str) + sizeof(int) + axis2_strlen(in_msg_store_key) +
+        axis2_strlen(prop_str) + axis2_strlen(action) + 512;
+
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        return AXIS2_FALSE;
+    }
+
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = env;
+    args->data = NULL;
+    sprintf(sql_stmt_retrieve, "select stored_key, msg_id, soap_env_str,"\
+        "soap_version, transport_out, op, svc, svc_grp, op_mep, to_url, reply_to, "\
+        "transport_to, execution_chain_str, flow, msg_recv_str, svr_side, "\
+        "in_msg_store_key, prop_str, action from msg where stored_key = '%s'", 
+        key);
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve,
+        sandesha2_msg_store_bean_retrieve_callback, args, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            sandesha2_msg_store_bean_retrieve_callback, args, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(args->data)
+        msg_store_bean = (sandesha2_msg_store_bean_t *) args->data;
+    if(args)
+        AXIS2_FREE(env->allocator, args);
+    if(msg_store_bean)
+    {
+        sql_stmt_update = AXIS2_MALLOC(env->allocator, sql_size);
+        sprintf(sql_stmt_update, "update msg set msg_id='%s',"\
+            "soap_env_str='%s', soap_version=%d, transport_out='%d', op='%s',"\
+            "svc='%s', svc_grp='%s', op_mep='%s', to_url='%s',"\
+            "transport_to='%s', reply_to='%s', execution_chain_str='%s',"\
+            "flow=%d, msg_recv_str='%s', svr_side='%d', in_msg_store_key='%s',"\
+            "prop_str='%s', action='%s' where stored_key='%s'", msg_id, 
+            soap_env_str, soap_version, transport_out, op, svc, svc_grp, op_mep, 
+            to_url, transport_to, reply_to, execution_chain_str, flow, 
+            msg_recv_str, svr_side, in_msg_store_key, prop_str, action, key);
+        rc = sqlite3_exec(dbconn, sql_stmt_update, 0, 0, &error_msg);
+        if(rc == SQLITE_BUSY)
+            rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_update, 
+                0, 0, &error_msg, rc);
+        if( rc != SQLITE_OK )
+        {
+            axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, 
+                AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+                error_msg);
+            printf("sql_stmt_update:%s\n", sql_stmt_update);
+            printf("update error_msg:%s\n", error_msg);
+            AXIS2_FREE(env->allocator, sql_stmt_update);
+            sqlite3_free(error_msg);
+            return AXIS2_FALSE;
+        }
+        AXIS2_FREE(env->allocator, sql_stmt_update);
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        return AXIS2_TRUE;
+    }
+    sql_stmt_insert = AXIS2_MALLOC(env->allocator, sql_size);
+    sprintf(sql_stmt_insert, "insert into msg(stored_key, msg_id, "\
+        "soap_env_str, soap_version, transport_out, op, svc, svc_grp, op_mep,"\
+        "to_url, reply_to,transport_to, execution_chain_str, flow,"\
+        "msg_recv_str, svr_side, in_msg_store_key, prop_str, action) "\
+        "values('%s', '%s', '%s', %d, '%d', '%s', '%s', '%s', '%s', '%s',"\
+        "'%s', '%s', '%s', %d, '%s', %d, '%s', '%s', '%s')", stored_key, msg_id, 
+        soap_env_str, soap_version, transport_out, op, svc, svc_grp, op_mep, 
+        to_url, reply_to, transport_to, execution_chain_str, flow, msg_recv_str, 
+        svr_side, in_msg_store_key, prop_str, action);
+    rc = sqlite3_exec(dbconn, sql_stmt_insert, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_insert, 
+            0, 0, &error_msg, rc);
+    if( rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", error_msg);
+        printf("sql_stmt_insert:%s\n", sql_stmt_insert);
+        printf("insert error_msg:%s\n", error_msg);
+        AXIS2_FREE(env->allocator, sql_stmt_insert);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    AXIS2_FREE(env->allocator, sql_stmt_insert);
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_bean_mgr_insert_msg_store_bean");
+    return AXIS2_TRUE;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_remove_msg_store_bean(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *key)
+{
+    axis2_char_t sql_stmt_remove[256];
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    sqlite3 *dbconn = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_bean_mgr_remove_msg_store_bean");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    sprintf(sql_stmt_remove, "delete from msg where stored_key='%s'", key);
+    rc = sqlite3_exec(dbconn, sql_stmt_remove, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_remove, 
+            0, 0, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_remove:%s\n", sql_stmt_remove);
+        printf("remove error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_bean_mgr_remove_msg_store_bean");
+    return AXIS2_TRUE;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_store_response(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *seq_id,
+    axis2_char_t *response,
+    int msg_no,
+    int soap_version)
+{
+    axis2_char_t sql_stmt_count[512];
+    axis2_char_t *sql_stmt_update;
+    axis2_char_t *sql_stmt_insert;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    int sql_size = -1;
+    sqlite3 *dbconn = NULL;
+	sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    int count = -1;
+
+	bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Start:sandesha2_permanent_bean_mgr_store_response");
+    sql_size = axis2_strlen(seq_id) + axis2_strlen(response) + 
+        sizeof(int) + sizeof(int) + 512;
+    sprintf(sql_stmt_count, "select count(seq_id)"\
+        " from response where seq_id = '%s' and msg_no=%d", seq_id, msg_no);
+
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    rc = sqlite3_exec(dbconn, sql_stmt_count, 
+        sandesha2_permanent_bean_mgr_count_callback, &count, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_count, 
+            sandesha2_permanent_bean_mgr_count_callback, &count, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+            error_msg);
+        printf("sql_stmt_count:%s\n", sql_stmt_count);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    if(count > 0)
+    {
+        sql_stmt_update = AXIS2_MALLOC(env->allocator, sql_size);
+        sprintf(sql_stmt_update, "update response set response_str='%s',"\
+            "soap_version=%d where seq_id='%s' and msg_no=%d", response, 
+            soap_version, seq_id, msg_no);
+        rc = sqlite3_exec(dbconn, sql_stmt_update, 0, 0, &error_msg);
+        if(rc == SQLITE_BUSY)
+            rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_update, 
+                0, 0, &error_msg, rc);
+        if( rc != SQLITE_OK )
+        {
+            axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, 
+                AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", 
+                error_msg);
+            printf("sql_stmt_update:%s\n", sql_stmt_update);
+            printf("update error_msg:%s\n", error_msg);
+            AXIS2_FREE(env->allocator, sql_stmt_update);
+            sqlite3_free(error_msg);
+            return AXIS2_FALSE;
+        }
+        AXIS2_FREE(env->allocator, sql_stmt_update);
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        return AXIS2_TRUE;
+    }
+    else
+    {
+        sql_stmt_insert = AXIS2_MALLOC(env->allocator, sql_size);
+        sprintf(sql_stmt_insert, "insert into response(seq_id, response_str,"\
+            "msg_no, soap_version) values('%s', '%s', %d, %d)", seq_id, 
+            response, msg_no, soap_version);
+        rc = sqlite3_exec(dbconn, sql_stmt_insert, 0, 0, &error_msg);
+        if(rc == SQLITE_BUSY)
+            rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_insert, 
+                0, 0, &error_msg, rc);
+        if( rc != SQLITE_OK )
+        {
+            axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s", error_msg);
+            printf("sql_stmt_insert:%s\n", sql_stmt_insert);
+            printf("insert error_msg:%s\n", error_msg);
+            AXIS2_FREE(env->allocator, sql_stmt_insert);
+            sqlite3_free(error_msg);
+            return AXIS2_FALSE;
+        }
+        AXIS2_FREE(env->allocator, sql_stmt_insert);
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    }
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_bean_mgr_store_response");
+    return AXIS2_TRUE;
+}
+
+axis2_bool_t AXIS2_CALL
+sandesha2_permanent_bean_mgr_remove_response(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *seq_id,
+    int msg_no)
+{
+    axis2_char_t sql_stmt_remove[256];
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    sqlite3 *dbconn = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_bean_mgr_remove_response");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return AXIS2_FALSE;
+    sprintf(sql_stmt_remove, 
+        "delete from response where seq_id='%s' and msg_no=%d", seq_id, msg_no);
+    rc = sqlite3_exec(dbconn, sql_stmt_remove, 0, 0, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_remove, 
+            0, 0, &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_remove:%s\n", sql_stmt_remove);
+        printf("remove error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_bean_mgr_remove_response");
+    return AXIS2_TRUE;
+}
+
+sandesha2_response_t *AXIS2_CALL
+sandesha2_permanent_bean_mgr_retrieve_response(
+    sandesha2_permanent_bean_mgr_t *bean_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *seq_id,
+    int msg_no)
+{
+    sandesha2_permanent_bean_mgr_impl_t *bean_mgr_impl = NULL;
+    sandesha2_bean_mgr_args_t *args = NULL;
+    axis2_char_t *error_msg = NULL;
+    int rc = -1;
+    sqlite3 *dbconn = NULL;
+    axis2_char_t sql_stmt_retrieve[512];
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
+    axutil_thread_mutex_lock(bean_mgr_impl->mutex);
+    dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
+        bean_mgr_impl->storage_mgr, env);
+    if(!dbconn)
+        return NULL;
+    args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
+    args->env = (axutil_env_t*)env;
+    args->data = NULL;
+    sprintf(sql_stmt_retrieve, "select response_str, soap_version from response"\
+        " where seq_id='%s' and msg_no=%d", seq_id, msg_no);
+    rc = sqlite3_exec(dbconn, sql_stmt_retrieve, 
+        sandesha2_permanent_bean_mgr_response_retrieve_callback, args, &error_msg);
+    if(rc == SQLITE_BUSY)
+        rc = sandesha2_permanent_bean_mgr_busy_handler(dbconn, sql_stmt_retrieve, 
+            sandesha2_permanent_bean_mgr_response_retrieve_callback, args, 
+            &error_msg, rc);
+    if(rc != SQLITE_OK )
+    {
+        axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
+            error_msg);
+        printf("sql_stmt_retrieve:%s\n", sql_stmt_retrieve);
+        printf("retrieve error_msg:%s\n", error_msg);
+        sqlite3_free(error_msg);
+        return AXIS2_FALSE;
+    }
+    axutil_thread_mutex_unlock(bean_mgr_impl->mutex);
+    return (sandesha2_response_t *) args->data;
+}
+
+int
+sandesha2_permanent_bean_mgr_busy_handler(
+    sqlite3* dbconn,
+    char *sql_stmt,
+    int (*callback_func)(void *, int, char **, char **),
+    void *args,
+    char **error_msg,
+    int rc)
+{
+    int counter = 0;
+    printf("in busy handler1\n");
+    while(rc == SQLITE_BUSY && counter < 512)
+    {
+        printf("in busy handler11\n");
+        if(*error_msg)
+             sqlite3_free(*error_msg);
+        counter++;
+        /*AXIS2_SLEEP(SANDESHA2_BUSY_WAIT_TIME);*/
+        AXIS2_USLEEP(100000);
+        rc = sqlite3_exec(dbconn, sql_stmt, callback_func, args, error_msg);
+    }
+    printf("in busy handler2\n");
+    return rc;
+}
+
+

Added: 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?view=auto&rev=532207
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c (added)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_create_seq_mgr.c Tue Apr 24 23:01:28 2007
@@ -0,0 +1,473 @@
+/*
+ * 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_create_seq_mgr.h>
+#include "sandesha2_permanent_bean_mgr.h"
+#include <sandesha2_constants.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_create_seq_mgr.h>
+#include <sandesha2_error.h>
+#include <sandesha2_rm_bean.h>
+#include <axutil_log.h>
+#include <axutil_hash.h>
+#include <axutil_thread.h>
+#include <axutil_property.h>
+#include <axutil_types.h>
+
+/** 
+ * @brief Sandesha2 Permanent Create Sequence Manager Struct Impl
+ *   Sandesha2 Permanent Create Sequence Manager
+ */ 
+typedef struct sandesha2_permanent_create_seq_mgr
+{
+    sandesha2_create_seq_mgr_t seq_mgr;
+    sandesha2_permanent_bean_mgr_t *bean_mgr;
+
+}sandesha2_permanent_create_seq_mgr_t;
+
+#define SANDESHA2_INTF_TO_IMPL(seq_mgr) \
+    ((sandesha2_permanent_create_seq_mgr_t *) seq_mgr)
+
+static int 
+sandesha2_create_seq_find_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int i = 0;
+    sandesha2_create_seq_bean_t *bean = NULL;
+    sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+    const axutil_env_t *env = args->env;
+    axutil_array_list_t *data_list = (axutil_array_list_t *) args->data;
+    if(argc < 1)
+    {
+        args->data = NULL;
+        return 0;
+    }
+    if(!data_list)
+    {
+        data_list = axutil_array_list_create(env, 0);
+        args->data = data_list;
+    }
+    bean = sandesha2_create_seq_bean_create(env);
+    for(i = 0; i < argc; i++)
+    {
+        if(0 == axis2_strcmp(col_name[i], "create_seq_msg_id"))
+            sandesha2_create_seq_bean_set_create_seq_msg_id(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "internal_seq_id"))
+            if(argv[i])
+                sandesha2_create_seq_bean_set_internal_seq_id(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "seq_id"))
+            if(argv[i])
+                sandesha2_create_seq_bean_set_seq_id(bean, env, argv[i]);
+        if(0 == axis2_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 == axis2_strcmp(col_name[i], "ref_msg_store_key"))
+            if(argv[i])
+                sandesha2_create_seq_bean_set_ref_msg_store_key(bean, env, argv[i]);
+    }
+    axutil_array_list_add(data_list, env, bean);
+    return 0;
+}
+
+static int 
+sandesha2_create_seq_retrieve_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int i = 0;
+    sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) not_used;
+    const axutil_env_t *env = args->env;
+    sandesha2_create_seq_bean_t *bean = (sandesha2_create_seq_bean_t *) args->data;
+    if(argc < 1)
+    {
+        args->data = NULL;
+        return 0;
+    }
+    if(!bean)
+    {
+        bean = sandesha2_create_seq_bean_create(env);
+        args->data = bean;
+    }
+    for(i = 0; i < argc; i++)
+    {
+        if(0 == axis2_strcmp(col_name[i], "create_seq_msg_id"))
+            sandesha2_create_seq_bean_set_create_seq_msg_id(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "internal_seq_id"))
+            if(argv[i])
+                sandesha2_create_seq_bean_set_internal_seq_id(bean, env, argv[i]);
+        if(0 == axis2_strcmp(col_name[i], "seq_id"))
+            if(argv[i])
+                sandesha2_create_seq_bean_set_seq_id(bean, env, argv[i]);
+        if(0 == axis2_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 == axis2_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;
+}
+
+static int 
+sandesha2_create_seq_count_callback(
+    void *not_used, 
+    int argc, 
+    char **argv, 
+    char **col_name)
+{
+    int *count = (int *) not_used;
+    *count = AXIS2_ATOI(argv[0]);
+    return 0;
+}
+
+static void AXIS2_CALL 
+sandesha2_permanent_create_seq_mgr_free(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *envv);
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_insert(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean);
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_remove(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *msg_id);
+
+static sandesha2_create_seq_bean_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_retrieve(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *msg_id);
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_update(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean);
+
+static axutil_array_list_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_find(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean);
+
+static sandesha2_create_seq_bean_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_find_unique(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean);
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_match(
+    sandesha2_permanent_bean_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_rm_bean_t *bean,
+    sandesha2_rm_bean_t *candidate);
+
+static const sandesha2_create_seq_mgr_ops_t create_seq_mgr_ops = 
+{
+    sandesha2_permanent_create_seq_mgr_free,
+    sandesha2_permanent_create_seq_mgr_insert,
+    sandesha2_permanent_create_seq_mgr_remove,
+    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,
+};
+
+AXIS2_EXTERN sandesha2_create_seq_mgr_t * AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_create(
+    const axutil_env_t *env,
+    sandesha2_storage_mgr_t *storage_mgr,
+    axis2_conf_ctx_t *ctx)
+{
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    seq_mgr_impl = AXIS2_MALLOC(env->allocator, 
+        sizeof(sandesha2_permanent_create_seq_mgr_t));
+
+    seq_mgr_impl->bean_mgr = sandesha2_permanent_bean_mgr_create(env, 
+        storage_mgr, ctx, SANDESHA2_BEAN_MAP_CREATE_SEQUENCE);
+    seq_mgr_impl->bean_mgr->ops.match = sandesha2_permanent_create_seq_mgr_match;
+    seq_mgr_impl->seq_mgr.ops = create_seq_mgr_ops;
+    return &(seq_mgr_impl->seq_mgr);
+}
+
+static void AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_free(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env)
+{
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr);
+
+    if(seq_mgr_impl->bean_mgr)
+    {
+        sandesha2_permanent_bean_mgr_free(seq_mgr_impl->bean_mgr, env);
+        seq_mgr_impl->bean_mgr = NULL;
+    }
+    if(seq_mgr_impl)
+    {
+        AXIS2_FREE(env->allocator, seq_mgr_impl);
+        seq_mgr_impl = NULL;
+    }
+}
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_insert(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean)
+{
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    axis2_bool_t ret = AXIS2_FALSE;
+    axis2_char_t sql_insert[1024];
+    axis2_char_t sql_update[1024];
+    axis2_char_t sql_retrieve[256];
+
+    axis2_char_t *create_seq_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(
+        (sandesha2_rm_bean_t *) bean, env);
+    axis2_char_t *internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(bean, env);
+    axis2_char_t *seq_id = sandesha2_create_seq_bean_get_seq_id(bean, env);
+    axis2_char_t *create_seq_msg_store_key = 
+        sandesha2_create_seq_bean_get_create_seq_msg_store_key(bean, env);
+    axis2_char_t *ref_msg_store_key = 
+        sandesha2_create_seq_bean_get_ref_msg_store_key(bean, env);
+
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_insert");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, bean, 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';", create_seq_msg_id);
+    
+    sprintf(sql_update, "update create_seq set internal_seq_id='%s', seq_id='%s'"\
+        ",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);
+    
+    sprintf(sql_insert, "insert into create_seq(create_seq_msg_id, "\
+        "internal_seq_id, seq_id, create_seq_msg_store_key, ref_msg_store_key) "\
+        "values('%s', '%s', '%s', '%s', '%s');", create_seq_msg_id, 
+        internal_seq_id, seq_id, create_seq_msg_store_key, ref_msg_store_key);
+
+    ret = sandesha2_permanent_bean_mgr_insert(seq_mgr_impl->bean_mgr, env, 
+        (sandesha2_rm_bean_t *) bean, sandesha2_create_seq_retrieve_callback, 
+        sql_retrieve, sql_update, sql_insert);
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_insert");
+    return ret;
+}
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_remove(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *msg_id)
+{
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    axis2_char_t sql_remove[256];
+    axis2_char_t sql_retrieve[256];
+
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_remove");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    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);
+    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_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_remove");
+    return sandesha2_permanent_bean_mgr_remove(seq_mgr_impl->bean_mgr, env, 
+        sandesha2_create_seq_retrieve_callback, sql_retrieve, sql_remove);
+}
+
+static sandesha2_create_seq_bean_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_retrieve(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    axis2_char_t *msg_id)
+{
+    axis2_char_t sql_retrieve[256];
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_retrieve");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    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_INFO(env->log, 
+        "[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);
+}
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_update(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean)
+{
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    axis2_char_t sql_retrieve[256];
+    axis2_char_t sql_update[1024];
+    axis2_bool_t ret = AXIS2_FALSE;
+
+    axis2_char_t *create_seq_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(
+        (sandesha2_rm_bean_t *) bean, env);
+    axis2_char_t *internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(bean, env);
+    axis2_char_t *seq_id = sandesha2_create_seq_bean_get_seq_id(bean, env);
+    axis2_char_t *create_seq_msg_store_key = 
+        sandesha2_create_seq_bean_get_create_seq_msg_store_key(bean, env);
+    axis2_char_t *ref_msg_store_key = 
+        sandesha2_create_seq_bean_get_ref_msg_store_key(bean, env);
+
+    AXIS2_LOG_INFO(env->log, 
+        "Entry:[sandesha2]sandesha2_permanent_create_seq_mgr_update");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, bean, 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';", create_seq_msg_id);
+    sprintf(sql_update, "update create_seq set internal_seq_id='%s', seq_id='%s'"\
+        ",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, 
+        (sandesha2_rm_bean_t *)bean, sandesha2_create_seq_retrieve_callback, 
+        sql_retrieve, sql_update);
+    AXIS2_LOG_INFO(env->log, 
+        "Exit:[sandesha2]sandesha2_permanent_create_seq_mgr_update:return:%d", 
+            ret);
+    return ret;
+}
+
+static axutil_array_list_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_find(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean)
+{
+    axis2_char_t *sql_find = NULL;
+    axis2_char_t *sql_count = NULL;
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    axutil_array_list_t *ret = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "Entry:[sandesha2]sandesha2_permanent_create_seq_mgr_find");
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr); 
+    sql_find = "select create_seq_msg_id,internal_seq_id,"\
+        "seq_id,create_seq_msg_store_key, ref_msg_store_key from create_seq;";
+    sql_count = "select count(*) as no_recs from create_seq;";
+    ret = sandesha2_permanent_bean_mgr_find(seq_mgr_impl->bean_mgr, env, 
+        (sandesha2_rm_bean_t *) bean, sandesha2_create_seq_find_callback,
+        sandesha2_create_seq_count_callback, sql_find, sql_count);
+    AXIS2_LOG_INFO(env->log, 
+        "Exit:[sandesha2]sandesha2_permanent_create_seq_mgr_find");
+    return ret;
+}
+
+static sandesha2_create_seq_bean_t *AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_find_unique(
+    sandesha2_create_seq_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_create_seq_bean_t *bean)
+{
+    axis2_char_t *sql_find = NULL;
+    axis2_char_t *sql_count = NULL;
+    sandesha2_permanent_create_seq_mgr_t *seq_mgr_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, bean, AXIS2_FALSE);
+    seq_mgr_impl = SANDESHA2_INTF_TO_IMPL(seq_mgr);
+    sql_find = "select create_seq_msg_id,internal_seq_id,"\
+        "seq_id,create_seq_msg_store_key, ref_msg_store_key from create_seq;";
+    sql_count = "select count(*) as no_recs from create_seq;";
+    return (sandesha2_create_seq_bean_t *) sandesha2_permanent_bean_mgr_find_unique(
+        seq_mgr_impl->bean_mgr, env, (sandesha2_rm_bean_t *) bean, 
+        sandesha2_create_seq_find_callback, sandesha2_create_seq_count_callback, 
+        sql_find, sql_count);
+}
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_permanent_create_seq_mgr_match(
+    sandesha2_permanent_bean_mgr_t *seq_mgr,
+    const axutil_env_t *env,
+    sandesha2_rm_bean_t *bean,
+    sandesha2_rm_bean_t *candidate)
+{
+    axis2_bool_t equal = AXIS2_TRUE;
+    axis2_char_t *msg_id = NULL;
+    axis2_char_t *temp_msg_id = NULL;
+    axis2_char_t *seq_id = NULL;
+    axis2_char_t *temp_seq_id = NULL;
+    axis2_char_t *internal_seq_id = NULL;
+    axis2_char_t *temp_internal_seq_id = NULL;
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Entry:sandesha2_permanent_create_seq_mgr_match");
+    msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(bean, env);
+    temp_msg_id = sandesha2_create_seq_bean_get_create_seq_msg_id(candidate, 
+        env);
+    if(msg_id && temp_msg_id && 0 != axis2_strcmp(msg_id, temp_msg_id))
+    {
+        equal = AXIS2_FALSE;
+    }
+    seq_id = sandesha2_create_seq_bean_get_seq_id(
+        (sandesha2_create_seq_bean_t *) bean, env);
+    temp_seq_id = sandesha2_create_seq_bean_get_seq_id(
+        (sandesha2_create_seq_bean_t *) candidate, env);
+    if(seq_id && temp_seq_id && 0 != axis2_strcmp(seq_id, temp_seq_id))
+    {
+        equal = AXIS2_FALSE;
+    }
+    internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(
+        (sandesha2_create_seq_bean_t *) bean, env);
+    temp_internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(
+        (sandesha2_create_seq_bean_t *) candidate, env);
+    if(internal_seq_id && temp_internal_seq_id && 0 != axis2_strcmp(
+        internal_seq_id, temp_internal_seq_id))
+    {
+        equal = AXIS2_FALSE;
+    }
+    AXIS2_LOG_INFO(env->log, 
+        "[sandesha2]Exit:sandesha2_permanent_create_seq_mgr_match:equal:%d", 
+            equal);
+    return equal;
+}
+



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