ws-savan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
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 GMT
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;
 }
 



Mime
View raw message