You are viewing a plain text version of this content. The canonical link for it is here.
Posted to savan-dev@ws.apache.org by da...@apache.org on 2008/11/08 02:12:29 UTC

svn commit: r712332 - in /webservices/savan/trunk/c: include/savan_error.h src/core/mod_savan.c src/core/savan_sub_processor.c src/util/Makefile.am src/util/error.c

Author: damitha
Date: Fri Nov  7 17:12:29 2008
New Revision: 712332

URL: http://svn.apache.org/viewvc?rev=712332&view=rev
Log:
Supporting axutil_error in Savan

Modified:
    webservices/savan/trunk/c/include/savan_error.h
    webservices/savan/trunk/c/src/core/mod_savan.c
    webservices/savan/trunk/c/src/core/savan_sub_processor.c
    webservices/savan/trunk/c/src/util/Makefile.am
    webservices/savan/trunk/c/src/util/error.c

Modified: webservices/savan/trunk/c/include/savan_error.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_error.h?rev=712332&r1=712331&r2=712332&view=diff
==============================================================================
--- webservices/savan/trunk/c/include/savan_error.h (original)
+++ webservices/savan/trunk/c/include/savan_error.h Fri Nov  7 17:12:29 2008
@@ -59,10 +59,24 @@
         SAVAN_ERROR_STORE_NOT_FOUND,
         /* Failed to build a default soap envelope */
         SAVAN_ERROR_FAILED_TO_BUILD_SOAP_ENV,
-	    /*Requested delivery mode is not supported */
+	    /* Requested delivery mode is not supported */
         SAVAN_ERROR_REQUESTED_DELIVERY_MODE_NOT_SUPPORTED,
-
-
+	    /* Expiration time requested is invalid */
+        SAVAN_ERROR_EXPIRATION_TIME_REQUESTED_IS_INVALID,
+	    /* Only expiration durations are supported */
+        SAVAN_ERROR_ONLY_EXPIRATION_DURATIONS_ARE_SUPPORTED,
+	    /* Filtering is not supported */
+        SAVAN_ERROR_FILTERING_IS_NOT_SUPPORTED,
+	    /* Requested filter dialect is not supported */
+        SAVAN_ERROR_REQUESTED_FILTER_DIALECT_IS_NOT_SUPPORTED,
+	    /* Messsage is not valid and cannot be processed */
+        SAVAN_ERROR_MESSAGE_IS_NOT_VALID_AND_CANNOT_BE_PROCESSED,
+        /* Message cannot be processed by the event source */
+        SAVAN_ERROR_MESSAGE_CANNOT_BE_PROCESSED_BY_EVENT_SOURCE,
+        /* Unable to Renew */
+        SAVAN_ERROR_UNABLE_TO_RENEW,
+        /* Subscriber is not found */
+        SAVAN_ERROR_SUBSCRIBER_NOT_FOUND,
         
         SAVAN_ERROR_LAST
     
@@ -78,38 +92,32 @@
 
 	#define SAVAN_FAULT_IET_CODE "s12:Sender"
 	#define SAVAN_FAULT_IET_SUB_CODE "wse:InvalidExpirationTime"
-	#define SAVAN_FAULT_IET_REASON "The expiration time requested is invalid."
 	#define SAVAN_FAULT_IET_DETAIL ""
 
 	#define SAVAN_FAULT_UET_CODE "s12:Sender"
 	#define SAVAN_FAULT_UET_SUB_CODE "wse:UnsupportedExpirationTime"
-	#define SAVAN_FAULT_UET_REASON "Only expiration durations are supported."
 	#define SAVAN_FAULT_UET_DETAIL ""
 
 	#define SAVAN_FAULT_FNS_CODE "s12:Sender"
 	#define SAVAN_FAULT_FNS_SUB_CODE "wse:FilteringNotSupported"
-	#define SAVAN_FAULT_FNS_REASON "Filtering is not supported."
-	#define SAVAN_FAULT_FNS_DETAIL ""
+	#define SAVAN_FAULT_FNS_DETAIL "Server doesn't support filtering"
 
 	#define SAVAN_FAULT_FRU_CODE "s12:Sender"
 	#define SAVAN_FAULT_FRU_SUB_CODE "wse:FilteringRequestedUnavailable"
-	#define SAVAN_FAULT_FRU_REASON "Requested filter dialect is not supported."
-	#define SAVAN_FAULT_FRU_DETAIL ""
+	#define SAVAN_FAULT_FRU_DETAIL "Server does not support the dialect"
 
 	#define SAVAN_FAULT_IM_CODE "s12:Sender"
 	#define SAVAN_FAULT_IM_SUB_CODE "wse:InvalidMessages"
-	#define SAVAN_FAULT_IM_REASON "The messsage is not valid and cannot be processed."
 	#define SAVAN_FAULT_IM_DETAIL "Invalid message."
 
 	#define SAVAN_FAULT_ESUP_CODE "s12:Receiver"
 	#define SAVAN_FAULT_ESUP_SUB_CODE "wse:EventSourceUnableToProcess"
-	#define SAVAN_FAULT_ESUP_REASON ""
 	#define SAVAN_FAULT_ESUP_DETAIL ""
 	
 	#define SAVAN_FAULT_UTR_CODE "s12:Receiver"
 	#define SAVAN_FAULT_UTR_SUB_CODE "wse:UnableToRenew"
-	#define SAVAN_FAULT_UTR_REASON ""
-	#define SAVAN_FAULT_UTR_DETAIL ""
+	#define SAVAN_FAULT_UTR_DETAIL1 "Could not find the subscriber"
+	#define SAVAN_FAULT_UTR_DETAIL2 "Subscription can not be renewed"
         
 	/*typedef enum savan_fault_types
 	{

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=712332&r1=712331&r2=712332&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/mod_savan.c (original)
+++ webservices/savan/trunk/c/src/core/mod_savan.c Fri Nov  7 17:12:29 2008
@@ -72,6 +72,8 @@
     axis2_status_t status = AXIS2_SUCCESS;
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:mod_savan_init");
+    
+    savan_error_init();
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:mod_savan_init");
 

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=712332&r1=712331&r2=712332&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/core/savan_sub_processor.c (original)
+++ webservices/savan/trunk/c/src/core/savan_sub_processor.c Fri Nov  7 17:12:29 2008
@@ -194,9 +194,14 @@
     subscriber = savan_util_get_subscriber_from_msg(env, msg_ctx, NULL);
     if (!subscriber)
     {
+        axis2_char_t *reason = NULL;
+
+        axutil_error_set_error_number(env->error, SAVAN_ERROR_SUBSCRIBER_NOT_FOUND); 
+        reason = (axis2_char_t *) axutil_error_get_message(env->error);
         savan_util_create_fault_envelope(msg_ctx, env, SAVAN_FAULT_UTR_CODE, 
-                SAVAN_FAULT_UTR_SUB_CODE, "Could not find the subscriber.", NULL);
+                SAVAN_FAULT_UTR_SUB_CODE, reason, SAVAN_FAULT_UTR_DETAIL1);
 
+        AXIS2_ERROR_SET(env->error, SAVAN_ERROR_SUBSCRIBER_NOT_FOUND, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to find the subscriber"); 
         return AXIS2_FAILURE;
     }
@@ -211,11 +216,16 @@
     renewable = savan_sub_processor_is_subscription_renewable(env, msg_ctx);
     if (!renewable)
     {
+        axis2_char_t *reason = NULL;
+
+        axutil_error_set_error_number(env->error, SAVAN_ERROR_UNABLE_TO_RENEW); 
+        reason = (axis2_char_t *) axutil_error_get_message(env->error);
         savan_util_create_fault_envelope(msg_ctx, env, SAVAN_FAULT_UTR_CODE,
                                          SAVAN_FAULT_UTR_SUB_CODE, 
-                                         "Subscription can not be renewed.", 
-                                         NULL);
+                                         reason, 
+                                         SAVAN_FAULT_UTR_DETAIL2);
 
+        AXIS2_ERROR_SET(env->error, SAVAN_ERROR_UNABLE_TO_RENEW, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                         "[savan] Subscription can not be renewed");
         savan_subscriber_set_renew_status(subscriber, env, AXIS2_FALSE);
@@ -404,10 +414,14 @@
 	}
 	else
 	{
+        axis2_char_t *reason = NULL;
+
+        axutil_error_set_error_number(env->error, SAVAN_ERROR_REQUESTED_DELIVERY_MODE_NOT_SUPPORTED); 
+        reason = (axis2_char_t *) axutil_error_get_message(env->error);
         savan_util_create_fault_envelope(msg_ctx, env,
                                          SAVAN_FAULT_DMRU_CODE, 
                                          SAVAN_FAULT_DMRU_SUB_CODE,
-                                         SAVAN_ERROR_REQUESTED_DELIVERY_MODE_NOT_SUPPORTED, 
+                                         reason, 
                                          SAVAN_FAULT_DMRU_DETAIL);
 
 		return AXIS2_FAILURE;
@@ -427,7 +441,7 @@
       {
       savan_util_create_fault_envelope(msg_ctx, env,
       SAVAN_FAULT_IET_CODE, SAVAN_FAULT_IET_SUB_CODE,
-      SAVAN_FAULT_IET_REASON, SAVAN_FAULT_IET_DETAIL);
+      SAVAN_ERROR_EXPIRATION_TIME_REQUESTED_IS_INVALID, SAVAN_FAULT_IET_DETAIL);
 
       return AXIS2_FAILURE;
       }
@@ -435,7 +449,7 @@
       {
       savan_util_create_fault_envelope(msg_ctx, env,
       SAVAN_FAULT_UET_CODE, SAVAN_FAULT_UET_SUB_CODE,
-      SAVAN_FAULT_UET_REASON, SAVAN_FAULT_UET_DETAIL);
+      SAVAN_ERROR_ONLY_EXPIRATION_DURATIONS_ARE_SUPPORTED, SAVAN_FAULT_UET_DETAIL);
 
       return AXIS2_FAILURE;
       }
@@ -462,25 +476,33 @@
 	}
 	else if(!axutil_strcmp(filter_dialect, DEFAULT_FILTER_DIALECT))
 	{
+        axis2_char_t *reason = NULL;
+
 #ifdef SAVAN_FILTERING
         return AXIS2_SUCCESS;
 #else
+        axutil_error_set_error_number(env->error, SAVAN_ERROR_FILTERING_IS_NOT_SUPPORTED); 
+        reason = (axis2_char_t *) axutil_error_get_message(env->error);
         savan_util_create_fault_envelope(msg_ctx, env,
                                          SAVAN_FAULT_FNS_CODE, 
                                          SAVAN_FAULT_FNS_SUB_CODE,
-                                         SAVAN_FAULT_FNS_REASON, 
-                                         "Server doesn't support filtering");
+                                         reason, 
+                                         SAVAN_FAULT_FNS_DETAIL);
 
 		return AXIS2_FAILURE;
 #endif
 	}
 	else
 	{
+        axis2_char_t *reason = NULL;
+        
+        axutil_error_set_error_number(env->error, SAVAN_ERROR_REQUESTED_FILTER_DIALECT_IS_NOT_SUPPORTED); 
+        reason = (axis2_char_t *) axutil_error_get_message(env->error);
 		savan_util_create_fault_envelope(msg_ctx, env,
                                          SAVAN_FAULT_FRU_CODE, 
                                          SAVAN_FAULT_FRU_SUB_CODE,
-                                         SAVAN_FAULT_FRU_REASON, 
-                                         "Server does not support the dialect.");
+                                         reason, 
+                                         SAVAN_FAULT_FRU_DETAIL);
 		return AXIS2_FAILURE;
 	}
 }

Modified: webservices/savan/trunk/c/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/Makefile.am?rev=712332&r1=712331&r2=712332&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/Makefile.am (original)
+++ webservices/savan/trunk/c/src/util/Makefile.am Fri Nov  7 17:12:29 2008
@@ -1,7 +1,7 @@
 datadir=$(prefix)/modules/savan
 noinst_LTLIBRARIES = libsavan_util.la
 
-libsavan_util_la_SOURCES = savan_util.c sqlite3.c db_mgr.c
+libsavan_util_la_SOURCES = savan_util.c sqlite3.c db_mgr.c error.c
 
 data_DATA=template.xsl
 INCLUDES = -I$(top_builddir)/include \

Modified: webservices/savan/trunk/c/src/util/error.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/util/error.c?rev=712332&r1=712331&r2=712332&view=diff
==============================================================================
--- webservices/savan/trunk/c/src/util/error.c (original)
+++ webservices/savan/trunk/c/src/util/error.c Fri Nov  7 17:12:29 2008
@@ -26,6 +26,30 @@
     axutil_error_messages[SAVAN_ERROR_REQUESTED_DELIVERY_MODE_NOT_SUPPORTED] = 
         "Requested delivery mode is not supported";
 
+    axutil_error_messages[SAVAN_ERROR_EXPIRATION_TIME_REQUESTED_IS_INVALID] = 
+        "Expiration time requested is invalid";
+
+    axutil_error_messages[SAVAN_ERROR_ONLY_EXPIRATION_DURATIONS_ARE_SUPPORTED] = 
+        "Only expiration durations are supported";
+
+    axutil_error_messages[SAVAN_ERROR_FILTERING_IS_NOT_SUPPORTED] = 
+        "Filtering is not supported";
+
+    axutil_error_messages[SAVAN_ERROR_REQUESTED_FILTER_DIALECT_IS_NOT_SUPPORTED] = 
+        "Requested filter dialect is not supported";
+
+    axutil_error_messages[SAVAN_ERROR_MESSAGE_IS_NOT_VALID_AND_CANNOT_BE_PROCESSED] = 
+        "Messsage is not valid and cannot be processed";
+
+    axutil_error_messages[SAVAN_ERROR_MESSAGE_CANNOT_BE_PROCESSED_BY_EVENT_SOURCE] = 
+        "Message cannot be processed by the event source";
+    
+    axutil_error_messages[SAVAN_ERROR_UNABLE_TO_RENEW] = 
+        "Unable to Renew";
+    
+    axutil_error_messages[SAVAN_ERROR_SUBSCRIBER_NOT_FOUND] = 
+        "Subscriber is not found";
+
     return AXIS2_SUCCESS;
 }