From randylloyd@example.com Sun Jun 01 09:17:26 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 25251 invoked from network); 1 Jun 2008 09:17:26 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 Jun 2008 09:17:26 -0000
Received: (qmail 87592 invoked by uid 500); 1 Jun 2008 09:17:28 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 87576 invoked by uid 500); 1 Jun 2008 09:17:28 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 87565 invoked by uid 99); 1 Jun 2008 09:17:28 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2008 02:17:28 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2008 09:16:41 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 0774C2388A1B; Sun,  1 Jun 2008 02:16:58 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r662186 - in /webservices/savan/trunk/c: configure.ac
 src/subscribers/savan_subscriber.c
Date: Sun, 01 Jun 2008 09:16:57 -0000
To: randylloyd@example.com
From: randylloyd@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <randylloyd@example.com>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: damitha
Date: Sun Jun  1 02:16:57 2008
New Revision: 662186

URL: http://svn.apache.org/viewvc?rev=662186&view=rev
Log:
Applying patch in AXIS2C-1164

Modified:
    webservices/savan/trunk/c/configure.ac
    webservices/savan/trunk/c/src/subscribers/savan_subscriber.c

Modified: webservices/savan/trunk/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/configure.ac?rev=662186&r1=662185&r2=662186&view=diff
==============================================================================
--- webservices/savan/trunk/c/configure.ac (original)
+++ webservices/savan/trunk/c/configure.ac Sun Jun  1 02:16:57 2008
@@ -45,7 +45,7 @@
 abs_top_builddir=`pwd`
 AC_SUBST(abs_top_builddir)
 
-AC_MSG_CHECKING(path to use Axis2C . This is a compulsory to build Sandesha2C)
+AC_MSG_CHECKING(path to use Axis2C . This is a compulsory to build Savan/C)
 AC_ARG_WITH(axis2,
 [  --with-axis2[=PATH]      use axis2c.],
 [ case "$withval" in

Modified: webservices/savan/trunk/c/src/subscribers/savan_subscriber.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subscribers/savan_subscriber.c?rev=662186&r1=662185&r2=662186&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/subscribers/savan_subscriber.c (original)
+++ webservices/savan/trunk/c/src/subscribers/savan_subscriber.c Sun Jun  1 02:16:57 2008
@@ -380,7 +380,7 @@
     axis2_svc_client_t *svc_client = NULL;
     axis2_char_t *path = NULL;
     axis2_options_t *options = NULL;
-    axis2_status_t status = AXIS2_FAILURE;
+    axis2_status_t status = AXIS2_SUCCESS;
     axis2_endpoint_ref_t *to = NULL;
     const axis2_char_t *address = NULL;
 
@@ -415,20 +415,26 @@
 
 	/* Apply the filter, and check whether it evaluates to success */
 
-#ifdef SAVAN_FILTERING
+    #ifdef SAVAN_FILTERING
 	if (savan_util_apply_filter(subscriber, env, payload) == AXIS2_FAILURE)
 	{
 		return AXIS2_SUCCESS;
 	}
-#endif
+    #endif
 	
     /* Set service client options */
     axis2_svc_client_set_options(svc_client, env, options);
     status = axis2_svc_client_send_robust(svc_client, env, payload);
-    axis2_svc_client_free(svc_client, env);
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_subscriber_publish");
+    axiom_node_detach(payload, env); /*insert this to prevent payload corruption in subsequent 
+                                       "publish" calls with some payload.*/
+    if(svc_client)
+    {
+        axis2_svc_client_free(svc_client, env);
+    }
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] End:savan_subscriber_publish");
+
     return status;
 }
 



From randylloyd@example.com Mon Jun 02 05:50:17 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 91011 invoked from network); 2 Jun 2008 05:50:17 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 2 Jun 2008 05:50:17 -0000
Received: (qmail 68514 invoked by uid 500); 2 Jun 2008 05:50:20 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 68497 invoked by uid 500); 2 Jun 2008 05:50:19 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 68486 invoked by uid 99); 2 Jun 2008 05:50:19 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2008 22:50:19 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2008 05:49:28 +0000
Received: from brutus (localhost [83.161.120.155])
	by brutus.apache.org (Postfix) with ESMTP id 7BD85234C126
	for <randylloyd@example.com>; Sun,  1 Jun 2008 22:49:45 -0700 (PDT)
Message-ID: <811719416.1212385785492.JavaMail.jira@brutus>
Date: Sun, 1 Jun 2008 22:49:45 -0700 (PDT)
From: "Vasiliy Sokov (JIRA)" <randylloyd@example.com>
To: randylloyd@example.com
Subject: [jira] Closed: (SAVAN-6) Publishing_client crashes when trying to
 publish message when more then 1 subscription to this event source exists
 at moment.
In-Reply-To: <616979563.1211438155814.JavaMail.jira@brutus>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Virus-Checked: Checked by ClamAV on apache.org


     [ https://issues.apache.org/jira/browse/SAVAN-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasiliy Sokov closed SAVAN-6.
-----------------------------

    Resolution: Fixed

This bug fixed here:
http://mail.rambler.ru/mail/mail.cgi?mode=redirect;url=https://issues.apache.org%2Fjira%2Fbrowse%2FAXIS2C-1164%3Fpage%3Dcom.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel;href=1

> Publishing_client crashes when trying to publish message when more then 1 subscription to this event source randylloyd@example.com.
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SAVAN-6
>                 URL: https://issues.apache.org/jira/browse/SAVAN-6
>             Project: Savan
>          Issue Type: Bug
>         Environment: Windows XP, Intel P4
>            Reporter: Vasiliy Sokov
>            Priority: Critical
>         Attachments: savan_subscriber.c
>
>
> Hello.
> I've already fix this problem. 
> The cause is in module savan_subscriber.c, function savan_subscriber_publish, line 420:
> ******************************************************************
>     /* Set service client options */
>     axis2_svc_client_set_options(svc_client, env, options);
>     axis2_svc_client_send_robust(svc_client, env, payload);
> 	axiom_node_detach(payload, env); //Vsokov 21.0.2008 insert this to prevent payload corruption in subsequent "publish" calls with some payload.
>     if(svc_client)
>         axis2_svc_client_free(svc_client, env); 
> ******************************************************************
> The call of axis2_svc_client_send_robust() attaches payload to svc_client. Thus, axis2_svc_client_free() removes payload at the same time with removing of svc_client, and following call of savan_subscriber_publish() by savan_publishing_client_publish() with same payload causes access to free'd memory.
> To prevent it, i've insert axiom_node_detach() before call of axis2_svc_client_free(). Now, i can subscribe several listeners to one event source at the time.
> Best regards,
> Vasiliy Sokov.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


From randylloyd@example.com Mon Jun 02 09:47:44 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 70361 invoked from network); 2 Jun 2008 09:47:44 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 2 Jun 2008 09:47:44 -0000
Received: (qmail 19033 invoked by uid 500); 2 Jun 2008 09:47:47 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 19012 invoked by uid 500); 2 Jun 2008 09:47:47 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 19001 invoked by uid 99); 2 Jun 2008 09:47:47 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2008 02:47:47 -0700
X-ASF-Spam-Status: No, hits=-1998.5 required=10.0
	tests=ALL_TRUSTED,WEIRD_PORT
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2008 09:46:51 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 7337C23889C1; Mon,  2 Jun 2008 02:47:12 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r662376 - in /webservices/savan/trunk/c: ./ include/ samples/
 src/client/ src/core/ src/data/ src/subs_mgr/ src/util/
Date: Mon, 02 Jun 2008 09:47:11 -0000
To: randylloyd@example.com
From: randylloyd@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <randylloyd@example.com>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: damitha
Date: Mon Jun  2 02:47:11 2008
New Revision: 662376

URL: http://svn.apache.org/viewvc?rev=662376&view=rev
Log:
Fixing database related issues

Modified:
    webservices/savan/trunk/c/INSTALL
    webservices/savan/trunk/c/build.sh
    webservices/savan/trunk/c/configure.ac
    webservices/savan/trunk/c/include/savan_constants.h
    webservices/savan/trunk/c/include/savan_db_mgr.h
    webservices/savan/trunk/c/include/savan_util.h
    webservices/savan/trunk/c/samples/build.sh
    webservices/savan/trunk/c/samples/configure.ac
    webservices/savan/trunk/c/src/client/savan_publishing_client.c
    webservices/savan/trunk/c/src/core/mod_savan.c
    webservices/savan/trunk/c/src/core/savan_sub_processor.c
    webservices/savan/trunk/c/src/data/module.xml
    webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c
    webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c
    webservices/savan/trunk/c/src/util/db_mgr.c
    webservices/savan/trunk/c/src/util/savan_util.c

Modified: webservices/savan/trunk/c/INSTALL
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/INSTALL?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/INSTALL (original)
+++ webservices/savan/trunk/c/INSTALL Mon Jun  2 02:47:11 2008
@@ -35,7 +35,7 @@
 This will install the Savan/C as a module in Axis2/C in <AXIS2C_HOME>/modules folder. The module
 folder contains the Savan/C libraries and the module.xml file. In the module.xml file give a valid path 
 for database storage. The database name should be savan_db.
-<parameter name="savan_db" locked="false">/axis2c/deploy/savan_db</parameter>
+<parameter name="savan_db" locked="false">/tmp/savan_db</parameter>
 It will also install libsavan_client.so savan client
 library in <AXIS2C_HOME>/lib folder. This client library is needed for savan clients to be linked with.
 To test the installation you can run the subscriber sample by running 
@@ -62,7 +62,7 @@
     To deploy Savan/C in Axis2/C running environment do the following
     1. Copy the modules/savan into <AXIS2C_HOME>/modules folder.
     2  In the module.xml file give a valid path for database storage. savan_db should be the database name.
-        <parameter name="savan_db" locked="false">/axis2c/deploy/savan_db</parameter>
+        <parameter name="savan_db" locked="false">/tmp/savan_db</parameter>
     3. Copy the libsavan_client.so into <AXIS2C_HOME>/lib folder. This client library is needed for savan clients 
         to be linked with.
     4. Copy the samples/server/axis2.xml into <AXIS2C_HOME> or do neccessary changes as described in README 
@@ -105,7 +105,7 @@
 
     1 Copy Savan directory ( containing savan dll and module.xml ) to <AXIS2C_HOME>\modules directory.
     2  In the module.xml file give a valid path for database storage. savan_db should be the database name.
-        <parameter name="savan_db" locked="false">/axis2c/deploy/savan_db</parameter>
+        <parameter name="savan_db" locked="false">/tmp/savan_db</parameter>
     3. Copy the savan_client.dll into <AXIS2C_HOME>/lib folder. This client library is needed for savan clients 
         to be linked with.
     4. Copy the samples/server/axis2.xml into <AXIS2C_HOME> or do neccessary changes as described in README 

Modified: webservices/savan/trunk/c/build.sh
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/build.sh?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/build.sh (original)
+++ webservices/savan/trunk/c/build.sh Mon Jun  2 02:47:11 2008
@@ -4,9 +4,9 @@
 make -j30
 make install
 
-cd samples
-sh autogen.sh
-./configure --prefix=${AXIS2C_HOME} --with-axis2=${AXIS2C_HOME}/include/axis2-1.4.0 --with-savan=${AXIS2C_HOME}/include/savan-0.90
-make -j10
-make install
-cd ..
+#cd samples
+#sh autogen.sh
+#./configure --prefix=${AXIS2C_HOME} --with-axis2=${AXIS2C_HOME}/include/axis2-1.4.0 --with-savan=${AXIS2C_HOME}/include/savan-0.90
+#make -j10
+#make install
+#cd ..

Modified: webservices/savan/trunk/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/configure.ac?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/configure.ac (original)
+++ webservices/savan/trunk/c/configure.ac Mon Jun  2 02:47:11 2008
@@ -26,7 +26,7 @@
 
 CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
 if test "$GCC" = "yes"; then
-    CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
+    CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration -Werror"
     #CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
 fi
 LDFLAGS="-lpthread"

Modified: webservices/savan/trunk/c/include/savan_constants.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_constants.h?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_constants.h (original)
+++ webservices/savan/trunk/c/include/savan_constants.h Mon Jun  2 02:47:11 2008
@@ -123,6 +123,7 @@
 #define SAVAN_SUBSCRIBER       "savan_subscriber"
 #define SAVAN_TOPIC_LIST       "savan_topic_list"
 #define SAVAN_DB "savan_db"
+#define SAVAN_MODULE  "savan"
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/savan/trunk/c/include/savan_db_mgr.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_db_mgr.h?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_db_mgr.h (original)
+++ webservices/savan/trunk/c/include/savan_db_mgr.h Mon Jun  2 02:47:11 2008
@@ -29,7 +29,6 @@
 #include <axutil_string.h>
 #include <axutil_utils.h>
 #include <axutil_array_list.h>
-#include <axis2_conf_ctx.h>
 #include <savan_subscriber.h>
 #include <sqlite3.h>
 
@@ -50,13 +49,13 @@
  */
 typedef struct savan_db_mgr
 {
-    axis2_conf_ctx_t *conf_ctx;
+    axis2_char_t *dbname;
 }savan_db_mgr_t;
 
 AXIS2_EXTERN savan_db_mgr_t * AXIS2_CALL
 savan_db_mgr_create(
     const axutil_env_t *env,
-    axis2_conf_ctx_t *conf_ctx);
+    axis2_char_t *dbname);
 
 AXIS2_EXTERN void AXIS2_CALL
 savan_db_mgr_free(
@@ -134,17 +133,10 @@
     savan_db_mgr_t *db_mgr, 
     const axutil_env_t *env);
 
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-savan_db_mgr_create_insert_sql(
-    const axutil_env_t *env,
-    savan_subscriber_t *subscriber,
-    axis2_conf_ctx_t *conf_ctx);
-
 axis2_char_t *AXIS2_CALL
 savan_db_mgr_create_update_sql(
     const axutil_env_t *env,
-    savan_subscriber_t *subscriber,
-    axis2_conf_ctx_t *conf_ctx);
+    savan_subscriber_t *subscriber);
 
 /**
  * This function will create the savan_db database if it is not aleardy exists

Modified: webservices/savan/trunk/c/include/savan_util.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_util.h?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_util.h (original)
+++ webservices/savan/trunk/c/include/savan_util.h Mon Jun  2 02:47:11 2008
@@ -296,6 +296,11 @@
     savan_util_get_svc_client(
         const axutil_env_t *env);
 
+    axis2_char_t *AXIS2_CALL
+    savan_util_get_dbname(
+        const axutil_env_t *env,
+        axis2_conf_ctx_t *conf_ctx);
+
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/savan/trunk/c/samples/build.sh
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/samples/build.sh?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/samples/build.sh (original)
+++ webservices/savan/trunk/c/samples/build.sh Mon Jun  2 02:47:11 2008
@@ -2,6 +2,6 @@
 
 ./autogen.sh
 
-./configure --prefix=${AXIS2C_HOME} --with-axis2=${AXIS2C_HOME}/include/axis2-1.3.0 --with-savan=${AXIS2C_HOME}/include/savan-0.90
-make -j30
-
+./configure --prefix=${AXIS2C_HOME} --with-axis2=${AXIS2C_HOME}/include/axis2-1.4.0 --with-savan=${AXIS2C_HOME}/include/savan-0.90
+make -j10
+make install

Modified: webservices/savan/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/samples/configure.ac?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/samples/configure.ac (original)
+++ webservices/savan/trunk/c/samples/configure.ac Mon Jun  2 02:47:11 2008
@@ -47,7 +47,7 @@
 dnl Checks for libraries.
 AC_CHECK_LIB(dl, dlopen)
 
-CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE "
+CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -Werror"
 LDFLAGS="$LDFLAGS -lpthread"
 
 dnl Checks for header files.

Modified: webservices/savan/trunk/c/src/client/savan_publishing_client.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/client/savan_publishing_client.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/client/savan_publishing_client.c (original)
+++ webservices/savan/trunk/c/src/client/savan_publishing_client.c Mon Jun  2 02:47:11 2008
@@ -156,7 +156,7 @@
             "expires, filter, renewed, topic_url from subscriber, topic"\
             " where topic.topic_name=subscriber.topic_name and"\
             " topic.topic_name='%s';", topic_name);
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(!db_mgr)
         {
             AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,

Modified: webservices/savan/trunk/c/src/core/mod_savan.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/core/mod_savan.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/mod_savan.c (original)
+++ webservices/savan/trunk/c/src/core/mod_savan.c Mon Jun  2 02:47:11 2008
@@ -17,9 +17,11 @@
 #include <axis2_conf_ctx.h>
 
 #include <mod_savan.h>
-#include <sqlite3.h>
 #include <savan_db_mgr.h>
 #include <savan_constants.h>
+#include <savan_util.h>
+
+#include <sqlite3.h>
 
 /**************************** Function Prototypes *****************************/
 
@@ -44,8 +46,6 @@
 	mod_savan_fill_handler_create_func_map
 };
 
-/*************************** End of Function Prototypes ***********************/
-
 axis2_module_t *
 mod_savan_create(const axutil_env_t *env)
 {
@@ -65,8 +65,6 @@
     return module;
 }
 
-/******************************************************************************/
-
 axis2_status_t AXIS2_CALL
 mod_savan_init(
         axis2_module_t *module,
@@ -78,18 +76,17 @@
 	savan_db_mgr_t *db_mgr = NULL; 
     axis2_status_t status = AXIS2_FAILURE;
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[SAVAN] Start:mod_savan_init");
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[SAVAN] Entry:mod_savan_init");
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(!db_mgr)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[SAVAN] Error creating db_mgr struct");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
         return status;
     }
 
     if(!savan_db_mgr_create_db(db_mgr, env))
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[SAVAN] Could not create "\
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create "\
             "the database. Check whether database path is correct and "\
             "accessible. Exit loading the Savan module");
     }
@@ -103,12 +100,11 @@
         savan_db_mgr_free(db_mgr, env);
     }
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[SAVAN] End:mod_savan_init");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:mod_savan_init");
+
     return status;
 }
 
-/******************************************************************************/
-
 axis2_status_t AXIS2_CALL
 mod_savan_shutdown(axis2_module_t *module,
                         const axutil_env_t *env)
@@ -127,8 +123,6 @@
     return AXIS2_SUCCESS; 
 }
 
-/******************************************************************************/
-
 axis2_status_t AXIS2_CALL
 mod_savan_fill_handler_create_func_map(axis2_module_t *module,
                                             const axutil_env_t *env)
@@ -153,8 +147,6 @@
     return AXIS2_SUCCESS;
 }
 
-/******************************************************************************/
-
 /**
  * Following block distinguish the exposed part of the dll.
  */
@@ -172,8 +164,6 @@
     return AXIS2_SUCCESS;
 }
 
-/******************************************************************************/
-
 AXIS2_EXPORT int 
 axis2_remove_instance(axis2_module_t *inst,
                       const axutil_env_t *env)

Modified: webservices/savan/trunk/c/src/core/savan_sub_processor.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/core/savan_sub_processor.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/savan_sub_processor.c (original)
+++ webservices/savan/trunk/c/src/core/savan_sub_processor.c Mon Jun  2 02:47:11 2008
@@ -249,7 +249,7 @@
     savan_subscriber_set_expires(subscriber, env, renewed_expires);
     savan_subscriber_set_renew_status(subscriber, env, AXIS2_TRUE);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(db_mgr)
         status = savan_db_mgr_update_subscriber(db_mgr, env, subscriber);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 

Modified: webservices/savan/trunk/c/src/data/module.xml
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/data/module.xml?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/data/module.xml (original)
+++ webservices/savan/trunk/c/src/data/module.xml Mon Jun  2 02:47:11 2008
@@ -1,7 +1,7 @@
 <module name="savan" class="mod_savan">
     <!--parameter name="SubscriptionMgrURL" locked="xsd:false">http://localhost:9092/axis2/services/subscription</parameter-->
    <!-- Database connection parameters -->
-   <!--parameter name="savan_db" locked="false">/axis2c/deploy/savan_db</parameter-->
+   <!--parameter name="savan_db" locked="false">/tmp/savan_db</parameter-->
     <inflow>
         <handler name="SavanInHandler" class="mod_savan">
             <order phase="SavanPhase"/>

Modified: webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c (original)
+++ webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c Mon Jun  2 02:47:11 2008
@@ -179,7 +179,7 @@
     {
         savan_db_mgr_t *db_mgr = NULL;
 
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(savan_db_mgr_insert_subscriber(db_mgr, env, subscriber))
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                 "[savan] Subscriber %s added to the topic:%s", id, topic_url);
@@ -247,7 +247,7 @@
     
     sprintf(sql_remove, "delete from subscriber where id='%s'",
         id);
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(db_mgr)
         savan_db_mgr_remove(db_mgr, env, sql_remove);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
@@ -339,7 +339,7 @@
     sprintf(sql_retrieve, "select id, end_to, notify_to, delivery_mode, "\
         "expires, filter, renewed, topic_url from subscriber, topic"\
         " where id='%s' and topic.topic_name=subscriber.topic_name;", subs_id);
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(db_mgr)
         subscriber = savan_db_mgr_retrieve(db_mgr, env, 
         savan_db_mgr_subs_retrieve_callback, sql_retrieve);
@@ -498,7 +498,7 @@
         "expires, filter, topic_url, renewed from subscriber, topic where "\
         "subscriber.topic_name=topic.topic_name and topic.topic_name='%s';", 
             topic);
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(db_mgr)
     {
         subs_store = savan_db_mgr_retrieve_all(db_mgr, env, 
@@ -653,7 +653,7 @@
     topic_list_elem = axiom_element_create(env, NULL, ELEM_NAME_TOPICS, ns1, 
         &topic_list_node);
     sprintf(sql_retrieve, "select topic_url from topic;");
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
     if(db_mgr)
         topic_store = savan_db_mgr_retrieve_all(db_mgr, env, 
             savan_db_mgr_topic_find_callback, sql_retrieve);

Modified: webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c (original)
+++ webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c Mon Jun  2 02:47:11 2008
@@ -33,6 +33,7 @@
 #include "savan_subs_mgr.h"
 #include <savan_constants.h>
 #include <savan_db_mgr.h>
+#include <savan_util.h>
 
 int AXIS2_CALL
 savan_subs_mgr_free(
@@ -145,7 +146,7 @@
         if(0 == axutil_strcmp(topic_name, "wsamapping"))
             continue;
 
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(savan_db_mgr_insert_topic(db_mgr, env, topic_name, topic_url_str))
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                 "[SAVAN] Topic %s added", topic_url_str);

Modified: webservices/savan/trunk/c/src/util/db_mgr.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/db_mgr.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/db_mgr.c (original)
+++ webservices/savan/trunk/c/src/util/db_mgr.c Mon Jun  2 02:47:11 2008
@@ -19,7 +19,6 @@
 #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>
 #include <savan_constants.h>
@@ -57,13 +56,13 @@
 AXIS2_EXTERN savan_db_mgr_t * AXIS2_CALL
 savan_db_mgr_create(
     const axutil_env_t *env,
-    axis2_conf_ctx_t *conf_ctx)
+    axis2_char_t *dbname)
 {
     savan_db_mgr_t *db_mgr = NULL;
     
-    AXIS2_ENV_CHECK(env, NULL);
     db_mgr = AXIS2_MALLOC(env->allocator, sizeof(savan_db_mgr_t));
-    db_mgr->conf_ctx = conf_ctx;
+
+    db_mgr->dbname = axutil_strdup(env, dbname);
 
     return db_mgr;
 }
@@ -75,6 +74,13 @@
 {
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
         "[SAVAN] Start:savan_db_mgr_free");
+
+    if(db_mgr->dbname)
+    {
+        AXIS2_FREE(env->allocator, db_mgr->dbname);
+        db_mgr->dbname = NULL;
+    }
+
     if(db_mgr)
     {
         AXIS2_FREE(env->allocator, db_mgr);
@@ -895,6 +901,27 @@
     axis2_char_t *sql_stmt1 = NULL;
     axis2_char_t *sql_stmt2 = NULL;
     axis2_status_t status = AXIS2_FAILURE;
+    const axis2_char_t *dbname = NULL;
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_db_mgr_create_db");
+
+    dbname = db_mgr->dbname;
+
+    if(AXIS2_SUCCESS == axutil_file_handler_access(dbname, AXIS2_F_OK))
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Database %s already created.", dbname);
+        return AXIS2_SUCCESS;
+    }
+
+    dbconn = savan_db_mgr_get_dbconn(db_mgr, env);
+
+    #if !defined(WIN32)
+    {
+        axis2_char_t permission_str[256];
+        sprintf(permission_str, "chmod 777 %s", dbname);
+        system(permission_str);
+    }
+    #endif
 
     sql_stmt1 = "create table if not exists topic(topic_name varchar(100) "\
                  "primary key, topic_url varchar(200))";
@@ -903,25 +930,25 @@
                   "delivery_mode varchar(100), expires varchar(100), "\
                   "filter varchar(200), topic_name varchar(100), "\
                   "renewed boolean)";
-    if(db_mgr)
-        dbconn = savan_db_mgr_get_dbconn(db_mgr, env);
+
     if(dbconn)
     {
         rc = sqlite3_exec(dbconn, sql_stmt1, NULL, 0, &error_msg);
         if( rc != SQLITE_OK )
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "Error creating database table topic; SQL Error: %s", error_msg);
+                "[savan] Error creating database table topic; SQL Error: %s", error_msg);
             sqlite3_free(error_msg);
             sqlite3_close(dbconn);
             return AXIS2_FAILURE;
         }
+
         rc = sqlite3_exec(dbconn, sql_stmt2, NULL, 0, &error_msg);
         if( rc != SQLITE_OK )
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "Error creating database table subscriber; SQL Error: %s", 
-                error_msg);
+                    "[savan] Error creating database table subscriber; SQL Error: %s", error_msg);
+
             sqlite3_free(error_msg);
             sqlite3_close(dbconn);
             return AXIS2_FAILURE;
@@ -929,6 +956,14 @@
         sqlite3_close(dbconn);
         status = AXIS2_SUCCESS;
     }
+    else
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Database %s creation failed", dbname);
+        return AXIS2_FAILURE;
+    }
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_db_mgr_create_db");
+
     return status;
 }
 
@@ -961,49 +996,28 @@
     savan_db_mgr_t *db_mgr, 
     const axutil_env_t *env)
 {
-    axis2_conf_ctx_t *conf_ctx = db_mgr->conf_ctx;
-    axis2_conf_t *conf = NULL; 
-    axis2_char_t *path = "./savan_db";
     int rc = -1;
     sqlite3 *dbconn = NULL;
 
-    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-    {
-        axis2_module_desc_t *module_desc = NULL;
-        axutil_qname_t *qname = NULL;
-        qname = axutil_qname_create(env, "savan", NULL, NULL);
-        module_desc = axis2_conf_get_module(conf, env, qname);
-        if(module_desc)
-        {
-            axutil_param_t *db_param = NULL;
-            db_param = axis2_module_desc_get_param(module_desc, env, SAVAN_DB);
-            if(db_param)
-            {
-                path = (axis2_char_t *) axutil_param_get_value(db_param, env);
-            }
-        }
-        axutil_qname_free(qname, env);
-    }
-    rc = sqlite3_open(path, &dbconn);
+    rc = sqlite3_open(db_mgr->dbname, &dbconn);
     if(rc != SQLITE_OK)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Can't open database: %s"
-            " sqlite error: %s\n", path, sqlite3_errmsg(dbconn));
+            " sqlite error: %s\n", db_mgr->dbname, sqlite3_errmsg(dbconn));
         sqlite3_close(dbconn);
         dbconn = NULL;
         return NULL;
     }
+
     return dbconn;
 }
 
 axis2_char_t *AXIS2_CALL
 savan_db_mgr_create_update_sql(
     const axutil_env_t *env,
-    savan_subscriber_t *subscriber,
-    axis2_conf_ctx_t *conf_ctx)
+    savan_subscriber_t *subscriber)
 {
     axis2_char_t *sql_update = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
     axis2_char_t *id = NULL;
     axis2_char_t *endto = NULL;
     axis2_char_t *notifyto = NULL;
@@ -1033,11 +1047,12 @@
         topic = savan_util_get_topic_name_from_topic_url(env, topic_url);
     }
     renewed = savan_subscriber_get_renew_status(subscriber, env);
-    db_mgr = savan_db_mgr_create(env, conf_ctx);
+
     sprintf(sql_update, "update subscriber set end_to='%s', notify_to='%s',"\
         "delivery_mode='%s', expires='%s', filter='%s', topic_name='%s', renewed=%d"\
         " where id='%s'", endto, notifyto, delivery_mode, expires, filter, topic, 
         renewed, id);
+
     return sql_update;
 }
 

Modified: webservices/savan/trunk/c/src/util/savan_util.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/savan_util.c?rev=662376&r1=662375&r2=662376&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/savan_util.c (original)
+++ webservices/savan/trunk/c/src/util/savan_util.c Mon Jun  2 02:47:11 2008
@@ -450,7 +450,7 @@
         sprintf(sql_retrieve, "select id, end_to, notify_to, delivery_mode, "\
             "expires, filter, renewed, topic_url from subscriber, topic"\
             " where id='%s' and topic.topic_name=subscriber.topic_name;", sub_id);
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(db_mgr)
             subscriber = savan_db_mgr_retrieve(db_mgr, env, 
             savan_db_mgr_subs_retrieve_callback, sql_retrieve);
@@ -509,7 +509,7 @@
     {
         savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(db_mgr)
             status = savan_db_mgr_insert_subscriber(db_mgr, env, subscriber);
     }
@@ -539,7 +539,7 @@
     {
         savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(db_mgr)
             savan_db_mgr_update_subscriber(db_mgr, env, subscriber);
     } 
@@ -568,7 +568,7 @@
         /* Extract the store from the svc and remove the given subscriber */
         sprintf(sql_remove, "delete from subscriber where id='%s'",
             subs_id);
-        db_mgr = savan_db_mgr_create(env, conf_ctx);
+        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
         if(db_mgr)
             savan_db_mgr_remove(db_mgr, env, sql_remove);
     }
@@ -1386,3 +1386,31 @@
     return svc_client;
 }
 
+axis2_char_t *AXIS2_CALL
+savan_util_get_dbname(
+    const axutil_env_t *env,
+    axis2_conf_ctx_t *conf_ctx)
+{
+    axis2_conf_t *conf = NULL; 
+    axis2_char_t *path = "./savan_db";
+    axis2_module_desc_t *module_desc = NULL;
+    axutil_qname_t *qname = NULL;
+
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+    qname = axutil_qname_create(env, SAVAN_MODULE, NULL, NULL);
+    module_desc = axis2_conf_get_module(conf, env, qname);
+    if(module_desc)
+    {
+        axutil_param_t *db_param = NULL;
+        db_param = axis2_module_desc_get_param(module_desc, env, SAVAN_DB);
+        if(db_param)
+        {
+            path = (axis2_char_t *) axutil_param_get_value(db_param, env);
+        }
+    }
+    axutil_qname_free(qname, env);
+    
+    return path;
+}
+
+



From randylloyd@example.com Sun Jun 22 15:54:46 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 76260 invoked from network); 22 Jun 2008 15:54:46 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 22 Jun 2008 15:54:46 -0000
Received: (qmail 5812 invoked by uid 500); 22 Jun 2008 15:54:48 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 5796 invoked by uid 500); 22 Jun 2008 15:54:48 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 5785 invoked by uid 99); 22 Jun 2008 15:54:48 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jun 2008 08:54:48 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jun 2008 15:54:06 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id B2C962388A54; Sun, 22 Jun 2008 08:54:25 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r670374 - in /webservices/savan/trunk/c/src: core/mod_savan.c
 handlers/savan_in_handler.c handlers/savan_out_handler.c
Date: Sun, 22 Jun 2008 15:54:25 -0000
To: randylloyd@example.com
From: randylloyd@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <randylloyd@example.com>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: damitha
Date: Sun Jun 22 08:54:25 2008
New Revision: 670374

URL: http://svn.apache.org/viewvc?rev=670374&view=rev
Log:
Fixed database creation problem when savan/C module init by moving that code into handlers.

Modified:
    webservices/savan/trunk/c/src/core/mod_savan.c
    webservices/savan/trunk/c/src/handlers/savan_in_handler.c
    webservices/savan/trunk/c/src/handlers/savan_out_handler.c

Modified: webservices/savan/trunk/c/src/core/mod_savan.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/core/mod_savan.c?rev=670374&r1=670373&r2=670374&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/mod_savan.c (original)
+++ webservices/savan/trunk/c/src/core/mod_savan.c Sun Jun 22 08:54:25 2008
@@ -17,14 +17,11 @@
 #include <axis2_conf_ctx.h>
 
 #include <mod_savan.h>
-#include <savan_db_mgr.h>
 #include <savan_constants.h>
 #include <savan_util.h>
 
 #include <sqlite3.h>
 
-/**************************** Function Prototypes *****************************/
-
 axis2_status_t AXIS2_CALL
 mod_savan_shutdown(axis2_module_t *module,
                         const axutil_env_t *env);
@@ -73,32 +70,9 @@
         axis2_module_desc_t *module_desc)
 {
     /* Any initialization stuff of mod_savan goes here */
-	savan_db_mgr_t *db_mgr = NULL; 
-    axis2_status_t status = AXIS2_FAILURE;
+    axis2_status_t status = AXIS2_SUCCESS;
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[SAVAN] Entry:mod_savan_init");
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(!db_mgr)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
-        return status;
-    }
-
-    if(!savan_db_mgr_create_db(db_mgr, env))
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create "\
-            "the database. Check whether database path is correct and "\
-            "accessible. Exit loading the Savan module");
-    }
-    else
-    {
-        status = AXIS2_SUCCESS;
-    }
-
-    if(db_mgr)
-    {
-        savan_db_mgr_free(db_mgr, env);
-    }
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:mod_savan_init");
 

Modified: webservices/savan/trunk/c/src/handlers/savan_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/handlers/savan_in_handler.c?rev=670374&r1=670373&r2=670374&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/handlers/savan_in_handler.c (original)
+++ webservices/savan/trunk/c/src/handlers/savan_in_handler.c Sun Jun 22 08:54:25 2008
@@ -33,8 +33,7 @@
 #include <savan_sub_processor.h>
 #include <savan_util.h>
 #include <savan_msg_recv.h>
-
-/* Function Prototypes ********************************************************/
+#include <savan_db_mgr.h>
 
 axis2_status_t AXIS2_CALL
 savan_in_handler_invoke(struct axis2_handler *handler, 
@@ -42,8 +41,6 @@
                          struct axis2_msg_ctx *msg_ctx);
 
 
-/* End of Function Prototypes *************************************************/
-
 AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
 savan_in_handler_create(const axutil_env_t *env, 
                          axutil_qname_t *qname) 
@@ -66,8 +63,6 @@
     return handler;
 }
 
-/******************************************************************************/
-
 axis2_status_t AXIS2_CALL
 savan_in_handler_invoke(struct axis2_handler *handler, 
                          const axutil_env_t *env,
@@ -79,11 +74,40 @@
     const axis2_svc_t *svc = NULL;
     const axis2_char_t *svc_name = NULL;
     
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[savan] Start:savan_in_handler_invoke");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Start:savan_in_handler_invoke");
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
 
+	savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_ctx_t *conf_ctx = NULL;
+
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
+    if(!db_mgr)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
+        return AXIS2_FAILURE;
+    }
+
+    if(!savan_db_mgr_create_db(db_mgr, env))
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create the database. Check \
+                whether database path is correct and accessible. Exit loading the Savan module");
+
+        if(db_mgr)
+        {
+            savan_db_mgr_free(db_mgr, env);
+        }
+
+        return AXIS2_FAILURE;
+    }
+    
+    if(db_mgr)
+    {
+        savan_db_mgr_free(db_mgr, env);
+    }
+
     svc =  axis2_msg_ctx_get_svc(msg_ctx, env);
     if (svc)
         svc_name = axis2_svc_get_name(svc, env);
@@ -154,8 +178,9 @@
         axis2_msg_recv_t* msg_recv = savan_msg_recv_create(env);
         axis2_op_set_msg_recv(op, env, msg_recv);
     }
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_in_handler_invoke");
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] End:savan_in_handler_invoke");
     
     return AXIS2_SUCCESS;
 }
+

Modified: webservices/savan/trunk/c/src/handlers/savan_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/handlers/savan_out_handler.c?rev=670374&r1=670373&r2=670374&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/handlers/savan_out_handler.c (original)
+++ webservices/savan/trunk/c/src/handlers/savan_out_handler.c Sun Jun 22 08:54:25 2008
@@ -37,8 +37,7 @@
 #include <savan_util.h>
 #include <savan_msg_recv.h>
 #include <savan_subscriber.h>
-
-/* Function Prototypes ********************************************************/
+#include <savan_db_mgr.h>
 
 axis2_status_t AXIS2_CALL
 savan_out_handler_invoke(
@@ -46,8 +45,6 @@
     const axutil_env_t *env,
     struct axis2_msg_ctx *msg_ctx);
 
-/* End of Function Prototypes *************************************************/
-                         
 AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
 savan_out_handler_create(
     const axutil_env_t *env, 
@@ -71,14 +68,43 @@
     return handler;
 }
 
-/******************************************************************************/
-
 axis2_status_t AXIS2_CALL
 savan_out_handler_invoke(
     struct axis2_handler *handler, 
     const axutil_env_t *env,
     struct axis2_msg_ctx *msg_ctx)
 {
-    return AXIS2_SUCCESS;
+	savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_status_t status = AXIS2_SUCCESS;
+
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+
+    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
+    if(!db_mgr)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
+        return AXIS2_FAILURE;
+    }
+
+    if(!savan_db_mgr_create_db(db_mgr, env))
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create the database. Check \
+                whether database path is correct and accessible. Exit loading the Savan module");
+        
+        if(db_mgr)
+        {
+            savan_db_mgr_free(db_mgr, env);
+        }
+
+        return AXIS2_FAILURE;
+    }
+    
+    if(db_mgr)
+    {
+        savan_db_mgr_free(db_mgr, env);
+    }
+
+    return status;
 }
 



From randylloyd@example.com Wed Jun 25 08:28:08 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 49650 invoked from network); 25 Jun 2008 08:28:08 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 25 Jun 2008 08:28:08 -0000
Received: (qmail 28836 invoked by uid 500); 25 Jun 2008 08:28:09 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 28820 invoked by uid 500); 25 Jun 2008 08:28:09 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 28809 invoked by uid 99); 25 Jun 2008 08:28:09 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 01:28:09 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 08:27:25 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id D7F6C23889F3; Wed, 25 Jun 2008 01:27:14 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r671460 - in /webservices/savan/trunk/c: include/ src/client/
 src/core/ src/handlers/ src/subs_mgr/ src/util/
Date: Wed, 25 Jun 2008 08:27:14 -0000
To: randylloyd@example.com
From: randylloyd@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <randylloyd@example.com>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: damitha
Date: Wed Jun 25 01:27:12 2008
New Revision: 671460

URL: http://svn.apache.org/viewvc?rev=671460&view=rev
Log:
Fixed the segfault caused by my previous commit

Modified:
    webservices/savan/trunk/c/include/savan_db_mgr.h
    webservices/savan/trunk/c/include/savan_util.h
    webservices/savan/trunk/c/src/client/savan_publishing_client.c
    webservices/savan/trunk/c/src/core/savan_sub_processor.c
    webservices/savan/trunk/c/src/handlers/savan_in_handler.c
    webservices/savan/trunk/c/src/handlers/savan_out_handler.c
    webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c
    webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c
    webservices/savan/trunk/c/src/util/db_mgr.c
    webservices/savan/trunk/c/src/util/savan_util.c

Modified: webservices/savan/trunk/c/include/savan_db_mgr.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_db_mgr.h?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_db_mgr.h (original)
+++ webservices/savan/trunk/c/include/savan_db_mgr.h Wed Jun 25 01:27:12 2008
@@ -85,53 +85,53 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_insert_subscriber(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     savan_subscriber_t *subscriber);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_update_subscriber(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     savan_subscriber_t *subscriber);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_insert_topic(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *topic_name,
     axis2_char_t *topic_url);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_remove(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *sql_stmt_remove);
 
 AXIS2_EXTERN savan_subscriber_t *AXIS2_CALL
 savan_db_mgr_retrieve(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     int (*retrieve_func)(void *, int, char **, char **),
     axis2_char_t *sql_stmt_retrieve);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_update(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *sql_stmt_update);
 
 AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL
 savan_db_mgr_retrieve_all(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     int (*find_func)(void *, int, char **, char **),
     axis2_char_t *sql_stmt_find);
 
 AXIS2_EXTERN void * AXIS2_CALL
 savan_db_mgr_get_dbconn(
-    savan_db_mgr_t *db_mgr, 
-    const axutil_env_t *env);
+    const axutil_env_t *env,
+    const axis2_char_t *dbname);
 
 axis2_char_t *AXIS2_CALL
 savan_db_mgr_create_update_sql(
@@ -146,8 +146,8 @@
  */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_create_db(
-    savan_db_mgr_t *db_mgr,
-    const axutil_env_t *env);
+    const axutil_env_t *env,
+    const axis2_char_t *dbname);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/savan/trunk/c/include/savan_util.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_util.h?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_util.h (original)
+++ webservices/savan/trunk/c/include/savan_util.h Wed Jun 25 01:27:12 2008
@@ -276,7 +276,7 @@
     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
     savan_util_get_dbname(
         const axutil_env_t *env,
-        axis2_conf_ctx_t *conf_ctx);
+        axis2_conf_t *conf);
 
     /**
     * Get the topics registered in a subscription manager

Modified: webservices/savan/trunk/c/src/client/savan_publishing_client.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/client/savan_publishing_client.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/client/savan_publishing_client.c (original)
+++ webservices/savan/trunk/c/src/client/savan_publishing_client.c Wed Jun 25 01:27:12 2008
@@ -148,7 +148,6 @@
     else
     {
         axis2_char_t sql_retrieve[256];
-        savan_db_mgr_t *db_mgr = NULL;
         axis2_char_t *topic_name = NULL;
 
         topic_name = savan_util_get_topic_name_from_topic_url(env, topic_url);
@@ -156,14 +155,8 @@
             "expires, filter, renewed, topic_url from subscriber, topic"\
             " where topic.topic_name=subscriber.topic_name and"\
             " topic.topic_name='%s';", topic_name);
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(!db_mgr)
-        {
-            AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
-                             "[savan]database manager creation failed");
-        }
 
-        subs_store = savan_db_mgr_retrieve_all(db_mgr, env,
+        subs_store = savan_db_mgr_retrieve_all(env, savan_util_get_dbname(env, conf),
                                                savan_db_mgr_subs_find_callback, 
                                                sql_retrieve);
     }

Modified: webservices/savan/trunk/c/src/core/savan_sub_processor.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/core/savan_sub_processor.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/savan_sub_processor.c (original)
+++ webservices/savan/trunk/c/src/core/savan_sub_processor.c Wed Jun 25 01:27:12 2008
@@ -204,8 +204,8 @@
     axis2_bool_t renewable = AXIS2_TRUE;
     axis2_char_t *expires = NULL;
     axis2_char_t *renewed_expires = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_conf_t *conf = NULL;
     axis2_status_t status = AXIS2_FAILURE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -249,9 +249,9 @@
     savan_subscriber_set_expires(subscriber, env, renewed_expires);
     savan_subscriber_set_renew_status(subscriber, env, AXIS2_TRUE);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(db_mgr)
-        status = savan_db_mgr_update_subscriber(db_mgr, env, subscriber);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+    status = savan_db_mgr_update_subscriber(env, savan_util_get_dbname(env, conf), subscriber);
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                     "[SAVAN] End:savan_sub_processor_renew_subscription");
 

Modified: webservices/savan/trunk/c/src/handlers/savan_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/handlers/savan_in_handler.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/handlers/savan_in_handler.c (original)
+++ webservices/savan/trunk/c/src/handlers/savan_in_handler.c Wed Jun 25 01:27:12 2008
@@ -78,36 +78,20 @@
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
 
-	savan_db_mgr_t *db_mgr = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_conf_t *conf = NULL;
 
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
 
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(!db_mgr)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
-        return AXIS2_FAILURE;
-    }
-
-    if(!savan_db_mgr_create_db(db_mgr, env))
+    if(!savan_db_mgr_create_db(env, savan_util_get_dbname(env, conf)))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create the database. Check \
                 whether database path is correct and accessible. Exit loading the Savan module");
 
-        if(db_mgr)
-        {
-            savan_db_mgr_free(db_mgr, env);
-        }
-
         return AXIS2_FAILURE;
     }
     
-    if(db_mgr)
-    {
-        savan_db_mgr_free(db_mgr, env);
-    }
-
     svc =  axis2_msg_ctx_get_svc(msg_ctx, env);
     if (svc)
         svc_name = axis2_svc_get_name(svc, env);

Modified: webservices/savan/trunk/c/src/handlers/savan_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/handlers/savan_out_handler.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/handlers/savan_out_handler.c (original)
+++ webservices/savan/trunk/c/src/handlers/savan_out_handler.c Wed Jun 25 01:27:12 2008
@@ -74,37 +74,21 @@
     const axutil_env_t *env,
     struct axis2_msg_ctx *msg_ctx)
 {
-	savan_db_mgr_t *db_mgr = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_conf_t *conf = NULL;
     axis2_status_t status = AXIS2_SUCCESS;
 
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
 
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(!db_mgr)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Error creating db_mgr struct");
-        return AXIS2_FAILURE;
-    }
-
-    if(!savan_db_mgr_create_db(db_mgr, env))
+    if(!savan_db_mgr_create_db(env, savan_util_get_dbname(env, conf)))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create the database. Check \
                 whether database path is correct and accessible. Exit loading the Savan module");
         
-        if(db_mgr)
-        {
-            savan_db_mgr_free(db_mgr, env);
-        }
-
         return AXIS2_FAILURE;
     }
     
-    if(db_mgr)
-    {
-        savan_db_mgr_free(db_mgr, env);
-    }
-
     return status;
 }
 

Modified: webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c (original)
+++ webservices/savan/trunk/c/src/subs_mgr/subs_mgr.c Wed Jun 25 01:27:12 2008
@@ -34,6 +34,7 @@
     axis2_msg_ctx_t *msg_ctx)
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_conf_t *conf = NULL;
     savan_subscriber_t *subscriber = NULL;
     axis2_char_t *topic_url = NULL;
     axis2_char_t *topic = NULL;
@@ -68,6 +69,7 @@
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] Start:savan_subs_mgr_add_subscriber");
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     subscriber = savan_subscriber_create(env);
     if(add_sub_node)
         add_sub_elem = (axiom_element_t*)axiom_node_get_data_element(
@@ -153,44 +155,48 @@
         }
     
         /* Expires */
-        qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, 
-            NULL);
-        expires_elem = axiom_element_get_first_child_with_qname(sub_elem, env, 
-            qname, sub_node, &expires_node);
+        qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, NULL);
+        expires_elem = axiom_element_get_first_child_with_qname(sub_elem, env, qname, sub_node, 
+                &expires_node);
+
         axutil_qname_free(qname, env);
         if(expires_elem)
         {
             expires = axiom_element_get_text(expires_elem, env, expires_node);
             if(expires)
+            {
                 savan_subscriber_set_expires(subscriber, env, expires);
+            }
         }
     
         /* Filter */
         qname = axutil_qname_create(env, ELEM_NAME_FILTER, EVENTING_NAMESPACE, NULL);
-        filter_elem = axiom_element_get_first_child_with_qname(sub_elem, env, qname,
-            sub_node, &filter_node);
+        filter_elem = axiom_element_get_first_child_with_qname(sub_elem, env, qname, sub_node, 
+                &filter_node);
+
         axutil_qname_free(qname, env);
         if(filter_elem)
         {
             filter = axiom_element_get_text(filter_elem, env, filter_node);
             if(filter)
+            {
                 savan_subscriber_set_filter(subscriber, env, filter);
+            }
         }
-    } 
-    {
-        savan_db_mgr_t *db_mgr = NULL;
+    }
 
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(savan_db_mgr_insert_subscriber(db_mgr, env, subscriber))
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[savan] Subscriber %s added to the topic:%s", id, topic_url);
-        else
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[savan] Subscriber %s could not be added to the topic:%s", id, 
-                    topic_url);
+    if(savan_db_mgr_insert_subscriber(env, savan_util_get_dbname(env, conf), subscriber))
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+            "[savan] Subscriber %s added to the topic:%s", id, topic_url);
     }
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_subs_mgr_add_subscriber");
+    else
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                "[savan] Subscriber %s could not be added to the topic:%s", id, topic_url);
+    }
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] End:savan_subs_mgr_add_subscriber");
     return NULL;   
 }
 
@@ -215,11 +221,12 @@
     axis2_char_t *id = NULL;
     axis2_char_t sql_remove[256];
     axis2_conf_ctx_t *conf_ctx = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_t *conf = NULL;
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Start:savan_subs_mgr_remove_subscriber");
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] Start:savan_subs_mgr_remove_subscriber");
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     remove_sub_elem = (axiom_element_t*)axiom_node_get_data_element(
         remove_sub_node, env);
     
@@ -246,15 +253,16 @@
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] Removing subscriber with id %s from topic %s", id, topic_url);
     
-    sprintf(sql_remove, "delete from subscriber where id='%s'",
-        id);
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(db_mgr)
-        savan_db_mgr_remove(db_mgr, env, sql_remove);
+    sprintf(sql_remove, "delete from subscriber where id='%s'", id);
+
+    savan_db_mgr_remove(env, savan_util_get_dbname(env, conf), sql_remove);
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] Subscriber %s removed from the topic:%s", id, topic_url);
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] End:savan_subs_mgr_remove_subscriber");
+
     return NULL;   
 }
 
@@ -273,7 +281,7 @@
     axiom_node_t *subs_node = NULL;
     axiom_element_t *subs_elem = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_t *conf = NULL;
     axis2_char_t sql_retrieve[256];
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
@@ -285,6 +293,7 @@
      * </ns1:get_subscriber>
      */
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     if (!node) /* 'get_subscriber' node */
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, 
@@ -340,10 +349,10 @@
     sprintf(sql_retrieve, "select id, end_to, notify_to, delivery_mode, "\
         "expires, filter, renewed, topic_url from subscriber, topic"\
         " where id='%s' and topic.topic_name=subscriber.topic_name;", subs_id);
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(db_mgr)
-        subscriber = savan_db_mgr_retrieve(db_mgr, env, 
-        savan_db_mgr_subs_retrieve_callback, sql_retrieve);
+
+    subscriber = savan_db_mgr_retrieve(env, savan_util_get_dbname(env, conf), 
+                savan_db_mgr_subs_retrieve_callback, sql_retrieve);
+
     if (subscriber)
     {
         axiom_node_t *sub_node = NULL;
@@ -430,7 +439,7 @@
     axiom_node_t *topic_node = NULL;
     axiom_element_t* subs_list_elem = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_t *conf = NULL;
     axis2_char_t sql_retrieve[256];
     int i = 0, size = 0;
 
@@ -448,6 +457,7 @@
      * </ns1:Subscribers>
      */
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     if (!node) /* 'get_subscriber_list' node */
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, 
@@ -499,12 +509,9 @@
         "expires, filter, topic_url, renewed from subscriber, topic where "\
         "subscriber.topic_name=topic.topic_name and topic.topic_name='%s';", 
             topic);
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(db_mgr)
-    {
-        subs_store = savan_db_mgr_retrieve_all(db_mgr, env, 
+
+    subs_store = savan_db_mgr_retrieve_all(env, savan_util_get_dbname(env, conf),
             savan_db_mgr_subs_find_callback, sql_retrieve);
-    }
 
     if(subs_store)
     {
@@ -629,7 +636,7 @@
     axiom_node_t *topic_list_node = NULL;
     axiom_element_t* topic_list_elem = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
-    savan_db_mgr_t *db_mgr = NULL;
+    axis2_conf_t *conf = NULL;
     axis2_char_t sql_retrieve[256];
     int i = 0, size = 0;
 
@@ -641,6 +648,7 @@
      * </ns1:get_topic_list>
      */
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     if (!node) /* 'get_topic_list' node */
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, 
@@ -654,10 +662,10 @@
     topic_list_elem = axiom_element_create(env, NULL, ELEM_NAME_TOPICS, ns1, 
         &topic_list_node);
     sprintf(sql_retrieve, "select topic_url from topic;");
-    db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-    if(db_mgr)
-        topic_store = savan_db_mgr_retrieve_all(db_mgr, env, 
+
+    topic_store = savan_db_mgr_retrieve_all(env, savan_util_get_dbname(env, conf),
             savan_db_mgr_topic_find_callback, sql_retrieve);
+
     size = axutil_array_list_size(topic_store, env);
     for(i = 0; i < size; i++)
     {

Modified: webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c (original)
+++ webservices/savan/trunk/c/src/subs_mgr/subs_mgr_skel.c Wed Jun 25 01:27:12 2008
@@ -123,39 +123,56 @@
     axis2_op_t *op = NULL;
     int i = 0, size = 0;
     axis2_conf_ctx_t *conf_ctx = NULL;
+    const axis2_char_t *dbname = NULL;
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Start:savan_subs_mgr_init_with_conf");
+
+    dbname = savan_util_get_dbname(env, conf);
+
+    if(!savan_db_mgr_create_db(env, dbname))
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[savan] Could not create the database for name %s. Check whether database path "\
+                "is correct and accessible. Exit loading the Savan module", dbname);
+        
+        return AXIS2_FAILURE;
+    }
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] Start:savan_subs_mgr_init_with_conf");
     savan_subs_mgr_init(svc_skeleton, env);
     conf_ctx = axis2_conf_ctx_create(env, conf);
     subs_svc = axis2_conf_get_svc(conf, env, "subscription");
     op = axis2_svc_get_op_with_name(subs_svc, env, "get_topic_list");
     topic_param_list = axis2_op_get_all_params(op, env);
     if(topic_param_list)
+    {
         size = axutil_array_list_size(topic_param_list, env);
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_size:%d", size);
+    }
+
     for(i = 0; i < size; i++)
     {
-        savan_db_mgr_t *db_mgr = NULL;
         axutil_param_t *topic_param = NULL;
         axis2_char_t *topic_url_str = NULL;
         axis2_char_t *topic_name = NULL;
         topic_param = axutil_array_list_get(topic_param_list, env, i);
         topic_url_str = axutil_param_get_value(topic_param, env);
         topic_name = axutil_param_get_name(topic_param, env);
-        if(0 == axutil_strcmp(topic_name, "wsamapping"))
+        if(!axutil_strcmp(topic_name, "wsamapping"))
+        {
             continue;
+        }
 
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(savan_db_mgr_insert_topic(db_mgr, env, topic_name, topic_url_str))
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[SAVAN] Topic %s added", topic_url_str);
+        if(savan_db_mgr_insert_topic(env, dbname, topic_name, topic_url_str))
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Topic %s added", topic_url_str);
+        }
         else
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[SAVAN] Topic %s could not be added", topic_url_str);
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Topic %s could not be added", topic_url_str);
+        }
     }
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_subs_mgr_init_with_conf");
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] End:savan_subs_mgr_init_with_conf");
+
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/savan/trunk/c/src/util/db_mgr.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/db_mgr.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/db_mgr.c (original)
+++ webservices/savan/trunk/c/src/util/db_mgr.c Wed Jun 25 01:27:12 2008
@@ -268,8 +268,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_insert_subscriber(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     savan_subscriber_t *subscriber)
 {
     axis2_char_t *sql_insert = NULL;
@@ -354,8 +354,7 @@
         sprintf(sql_insert, "%s%s", sql_insert, ");");
     }
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sql_insert:%s", sql_insert);
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
         return AXIS2_FAILURE;
 
@@ -444,8 +443,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_update_subscriber(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     savan_subscriber_t *subscriber)
 {
     axis2_char_t *sql_update = NULL;
@@ -523,8 +522,7 @@
         sprintf(sql_update, "%s%s", sql_update, "renewed=? where id=?;");   
     }
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sql_update:%s", sql_update);
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
         return AXIS2_FAILURE;
 
@@ -614,8 +612,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_insert_topic(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *topic_name,
     axis2_char_t *topic_url)
 {
@@ -624,43 +622,51 @@
     struct sqlite3_stmt* insertqry;
 
     sql_insert = "insert into topic(topic_name, topic_url) values(?, ?);";
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
+    {
         return AXIS2_FAILURE;
+    }
 
     if (sqlite3_prepare(dbconn, sql_insert, strlen(sql_insert), &insertqry, NULL))
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[SAVAN] Sql Insert Error: %s", sqlite3_errmsg(dbconn));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Sql Insert Error: %s", 
+                sqlite3_errmsg(dbconn));
     }
+
     if (sqlite3_bind_text(insertqry, 1, topic_name, strlen(topic_name), SQLITE_STATIC))
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[SAVAN] Sql Insert Error: %s", sqlite3_errmsg(dbconn));
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Sql Insert Error: %s", 
+                sqlite3_errmsg(dbconn));
+    }
     if (sqlite3_bind_text(insertqry, 2, topic_url, strlen(topic_url), SQLITE_STATIC))
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[SAVAN] Sql Insert Error: %s", sqlite3_errmsg(dbconn));
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Sql Insert Error: %s", 
+                sqlite3_errmsg(dbconn));
+    }
     if (sqlite3_step(insertqry) == SQLITE_DONE)
+    {
         sqlite3_reset(insertqry);
+    }
     
     sqlite3_finalize(insertqry);
     sqlite3_close(dbconn);
+
     return AXIS2_SUCCESS;
 }
 
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_remove(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *sql_stmt_remove)
 {
     axis2_char_t *error_msg = NULL;
     sqlite3 *dbconn = NULL;
     int rc = -1;
     AXIS2_ENV_CHECK(env, AXIS2_FALSE);
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
         return AXIS2_FAILURE;
     rc = sqlite3_exec(dbconn, "BEGIN;", 0, 0, &error_msg);
@@ -700,8 +706,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_update(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     axis2_char_t *sql_stmt_update)
 {
     sqlite3 *dbconn = NULL;
@@ -710,8 +716,7 @@
     AXIS2_ENV_CHECK(env, AXIS2_FALSE);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[SAVAN] Start:savan_db_mgr_update");
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
         return AXIS2_FAILURE;
     rc = sqlite3_exec(dbconn, "BEGIN;", 0, 0, &error_msg);
@@ -753,8 +758,8 @@
 
 AXIS2_EXTERN savan_subscriber_t *AXIS2_CALL
 savan_db_mgr_retrieve(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     int (*retrieve_func)(void *, int, char **, char **),
     axis2_char_t *sql_stmt_retrieve)
 {
@@ -766,8 +771,7 @@
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[SAVAN] Start:savan_db_mgr_retrieve");
     AXIS2_ENV_CHECK(env, AXIS2_FALSE);
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
         return NULL;
     rc = sqlite3_exec(dbconn, "BEGIN READ_ONLY;", 0, 0, &error_msg);
@@ -817,8 +821,8 @@
 
 AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL
 savan_db_mgr_retrieve_all(
-    savan_db_mgr_t *db_mgr,
     const axutil_env_t *env,
+    const axis2_char_t *dbname,
     int (*find_func)(void *, int, char **, char **),
     axis2_char_t *sql_stmt_find)
 {
@@ -837,8 +841,7 @@
     args = AXIS2_MALLOC(env->allocator, sizeof(savan_db_mgr_args_t));
     args->env = (axutil_env_t*)env;
     args->data = NULL;
-    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(
-        db_mgr, env);
+    dbconn = (sqlite3 *) savan_db_mgr_get_dbconn(env, dbname);
     if(!dbconn)
     {
         return NULL;
@@ -893,8 +896,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 savan_db_mgr_create_db(
-    savan_db_mgr_t *db_mgr,
-    const axutil_env_t *env)
+    const axutil_env_t *env,
+    const axis2_char_t *dbname)
 {
     int rc = -1;
     axis2_char_t *error_msg = NULL;
@@ -902,19 +905,16 @@
     axis2_char_t *sql_stmt1 = NULL;
     axis2_char_t *sql_stmt2 = NULL;
     axis2_status_t status = AXIS2_FAILURE;
-    const axis2_char_t *dbname = NULL;
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_db_mgr_create_db");
 
-    dbname = db_mgr->dbname;
-
     if(AXIS2_SUCCESS == axutil_file_handler_access(dbname, AXIS2_F_OK))
     {
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Database %s already created.", dbname);
         return AXIS2_SUCCESS;
     }
 
-    dbconn = savan_db_mgr_get_dbconn(db_mgr, env);
+    dbconn = savan_db_mgr_get_dbconn(env, dbname);
 
     #if !defined(WIN32)
     {
@@ -994,17 +994,18 @@
 
 void * AXIS2_CALL
 savan_db_mgr_get_dbconn(
-    savan_db_mgr_t *db_mgr, 
-    const axutil_env_t *env)
+    const axutil_env_t *env,
+    const axis2_char_t *dbname)
 {
     int rc = -1;
     sqlite3 *dbconn = NULL;
 
-    rc = sqlite3_open(db_mgr->dbname, &dbconn);
+    rc = sqlite3_open(dbname, &dbconn);
     if(rc != SQLITE_OK)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Can't open database: %s"
-            " sqlite error: %s\n", db_mgr->dbname, sqlite3_errmsg(dbconn));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Can't open database: %s sqlite error: %s\n", 
+                dbname, sqlite3_errmsg(dbconn));
+
         sqlite3_close(dbconn);
         dbconn = NULL;
         return NULL;

Modified: webservices/savan/trunk/c/src/util/savan_util.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/savan_util.c?rev=671460&r1=671459&r2=671460&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/savan_util.c (original)
+++ webservices/savan/trunk/c/src/util/savan_util.c Wed Jun 25 01:27:12 2008
@@ -444,17 +444,17 @@
     }
     { 
         axis2_char_t sql_retrieve[256];
-        savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+        axis2_conf_t *conf = axis2_conf_ctx_get_conf(conf_ctx, env);
 
         sprintf(sql_retrieve, "select id, end_to, notify_to, delivery_mode, "\
             "expires, filter, renewed, topic_url from subscriber, topic"\
             " where id='%s' and topic.topic_name=subscriber.topic_name;", sub_id);
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(db_mgr)
-            subscriber = savan_db_mgr_retrieve(db_mgr, env, 
-            savan_db_mgr_subs_retrieve_callback, sql_retrieve);
+
+        subscriber = savan_db_mgr_retrieve(env, savan_util_get_dbname(env, conf), 
+        savan_db_mgr_subs_retrieve_callback, sql_retrieve);
     }
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] End:savan_util_get_subscriber_from_msg");
     
@@ -507,11 +507,10 @@
     }
     else
     {
-        savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(db_mgr)
-            status = savan_db_mgr_insert_subscriber(db_mgr, env, subscriber);
+        axis2_conf_t *conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+
+        status = savan_db_mgr_insert_subscriber(env, savan_util_get_dbname(env, conf), subscriber);
     }
     if(status)
     {
@@ -520,6 +519,7 @@
             savan_subscriber_free_void_arg, subscriber);
         axis2_msg_ctx_set_property(msg_ctx, env, SAVAN_SUBSCRIBER, subs_prop);
     }
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] End:savan_util_add_subscriber"); 
     return status;
@@ -533,18 +533,17 @@
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] Start:savan_util_update_subscriber");
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Start:savan_util_update_subscriber");
+
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     {
-        savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(db_mgr)
-            savan_db_mgr_update_subscriber(db_mgr, env, subscriber);
-    } 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_util_update_subscriber"); 
+        axis2_conf_t *conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+
+        savan_db_mgr_update_subscriber(env, savan_util_get_dbname(env, conf), subscriber);
+    }
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] End:savan_util_update_subscriber"); 
     return AXIS2_SUCCESS;
 }
 
@@ -555,25 +554,24 @@
     savan_subscriber_t *subscriber)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] Start:savan_util_remove_subscriber");
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Start:savan_util_remove_subscriber");
 
     {
         axis2_char_t *subs_id = NULL;
         axis2_char_t sql_remove[256];
-        savan_db_mgr_t *db_mgr = NULL;
         axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+        axis2_conf_t *conf = axis2_conf_ctx_get_conf(conf_ctx, env);
 
         subs_id = savan_subscriber_get_id(subscriber, env);
+
         /* Extract the store from the svc and remove the given subscriber */
-        sprintf(sql_remove, "delete from subscriber where id='%s'",
-            subs_id);
-        db_mgr = savan_db_mgr_create(env, savan_util_get_dbname(env, conf_ctx));
-        if(db_mgr)
-            savan_db_mgr_remove(db_mgr, env, sql_remove);
+
+        sprintf(sql_remove, "delete from subscriber where id='%s'", subs_id);
+
+        savan_db_mgr_remove(env, savan_util_get_dbname(env, conf), sql_remove);
     }
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[savan] End:savan_util_remove_subscriber");
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] End:savan_util_remove_subscriber");
     return AXIS2_SUCCESS;
 }
 
@@ -1389,14 +1387,12 @@
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 savan_util_get_dbname(
     const axutil_env_t *env,
-    axis2_conf_ctx_t *conf_ctx)
+    axis2_conf_t *conf)
 {
-    axis2_conf_t *conf = NULL; 
     axis2_char_t *path = "./savan_db";
     axis2_module_desc_t *module_desc = NULL;
     axutil_qname_t *qname = NULL;
 
-    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     qname = axutil_qname_create(env, SAVAN_MODULE, NULL, NULL);
     module_desc = axis2_conf_get_module(conf, env, qname);
     if(module_desc)



From randylloyd@example.com Wed Jun 25 08:32:40 2008
Return-Path: <randylloyd@example.com>
Delivered-To: randylloyd@example.com
Received: (qmail 51035 invoked from network); 25 Jun 2008 08:32:40 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 25 Jun 2008 08:32:40 -0000
Received: (qmail 36742 invoked by uid 500); 25 Jun 2008 08:32:33 -0000
Delivered-To: randylloyd@example.com
Received: (qmail 36728 invoked by uid 500); 25 Jun 2008 08:32:33 -0000
Mailing-List: contact randylloyd@example.com; run by ezmlm
Precedence: bulk
List-Help: <mailto:randylloyd@example.com>
List-Unsubscribe: <mailto:randylloyd@example.com>
List-Post: <mailto:randylloyd@example.com>
List-Id: <savan-dev.ws.apache.org>
Reply-To: randylloyd@example.com
Delivered-To: mailing list randylloyd@example.com
Received: (qmail 36630 invoked by uid 99); 25 Jun 2008 08:32:32 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 01:32:32 -0700
X-ASF-Spam-Status: No, hits=-1998.5 required=10.0
	tests=ALL_TRUSTED,WEIRD_PORT
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 08:31:51 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id BF8292388A16; Wed, 25 Jun 2008 01:32:10 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r671463 - /webservices/savan/trunk/c/src/data/module.xml
Date: Wed, 25 Jun 2008 08:32:10 -0000
To: randylloyd@example.com
From: randylloyd@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <randylloyd@example.com>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: damitha
Date: Wed Jun 25 01:32:10 2008
New Revision: 671463

URL: http://svn.apache.org/viewvc?rev=671463&view=rev
Log:
create the database in /tmp/savan_db by default

Modified:
    webservices/savan/trunk/c/src/data/module.xml

Modified: webservices/savan/trunk/c/src/data/module.xml
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/data/module.xml?rev=671463&r1=671462&r2=671463&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/data/module.xml (original)
+++ webservices/savan/trunk/c/src/data/module.xml Wed Jun 25 01:32:10 2008
@@ -1,7 +1,7 @@
 <module name="savan" class="mod_savan">
     <!--parameter name="SubscriptionMgrURL" locked="xsd:false">http://localhost:9092/axis2/services/subscription</parameter-->
    <!-- Database connection parameters -->
-   <!--parameter name="savan_db" locked="false">/tmp/savan_db</parameter-->
+   <parameter name="savan_db" locked="false">/tmp/savan_db</parameter>
     <inflow>
         <handler name="SavanInHandler" class="mod_savan">
             <order phase="SavanPhase"/>




{'source': 'Apache Software Foundation Public Mail Archives'}