You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/11/13 19:44:26 UTC

svn commit: r333098 - in /webservices/axis2/trunk/c: include/axis2_handler.h modules/core/engine/src/handler.c

Author: samisa
Date: Sun Nov 13 10:44:00 2005
New Revision: 333098

URL: http://svn.apache.org/viewcvs?rev=333098&view=rev
Log:
Added set invoke for the base class method to be set from the derived class

Modified:
    webservices/axis2/trunk/c/include/axis2_handler.h
    webservices/axis2/trunk/c/modules/core/engine/src/handler.c

Modified: webservices/axis2/trunk/c/include/axis2_handler.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler.h?rev=333098&r1=333097&r2=333098&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler.h Sun Nov 13 10:44:00 2005
@@ -69,19 +69,27 @@
       /**
         * Invoke is called to do the actual work of the Handler object.
         * If there is a fault during the processing of this method it is
-        * invoke's job to catch the exception and undo any partial work
-        * that has been completed.  Once we leave 'invoke' if a fault
-        * is thrown, this classes 'onFault' method will be called.
-        * Invoke should rethrow any exceptions it catches, wrapped in
-        * an AxisFault.
+        * invoke's job to report the error and undo any partial work
+        * that has been completed. 
         *
         * @param msgContext the <code>axis2_context_message</code> to process with this
         *                   <code>Handler</code>.
-        * @throws AxisFault if the handler encounters an error
         */
         axis2_status_t (AXIS2_CALL *invoke) (struct axis2_handler * handler, 
                                              axis2_env_t **env,
                                              struct axis2_msg_ctx *msg_ctx);
+      /**
+        * set invoke can be used to set the invoke method to be called in a 
+        * handler invokation. The deriving struct should implement the 
+        * invoke method and use this method to set the function pointer
+        *
+        * @param 
+        */
+        axis2_status_t (AXIS2_CALL *set_invoke) (struct axis2_handler * handler, 
+                                             axis2_env_t **env,
+                                             axis2_status_t (AXIS2_CALL *invoke_func_ptr) (struct axis2_handler*, 
+                                             axis2_env_t**,
+                                             struct axis2_msg_ctx*));
 
 
       /**
@@ -130,6 +138,7 @@
 #define AXIS2_HANDLER_FREE(handler, env) ((handler)->ops->free(handler, env))
 #define AXIS2_HANDLER_INIT(handler, env, handler_desc) ((handler)->ops->init(handler, env, handler_desc))
 #define AXIS2_HANDLER_INVOKE(handler, env, msg_ctx) ((handler)->ops->invoke(handler, env, msg_ctx))
+#define AXIS2_HANDLER_SET_INVOKE(handler, env, invoke) ((handler)->ops->set_invoke(handler, env, invoke))
 #define AXIS2_HANDLER_GET_NAME(handler, env) ((handler)->ops->get_name(handler, env))
 #define AXIS2_HANDLER_GET_PARAM(handler, env, name) ((handler)->ops->get_param(handler, env, name))
 #define AXIS2_HANDLER_GET_HANDLER_DESC(handler, env) ((handler)->ops->get_handler_desc(handler, env))

Modified: webservices/axis2/trunk/c/modules/core/engine/src/handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/handler.c?rev=333098&r1=333097&r2=333098&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/handler.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/handler.c Sun Nov 13 10:44:00 2005
@@ -35,6 +35,11 @@
 axis2_status_t AXIS2_CALL axis2_handler_invoke (struct axis2_handler * handler, 
                                                 axis2_env_t **env,
                                                 struct axis2_msg_ctx *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_handler_set_invoke (struct axis2_handler * handler, 
+                                                axis2_env_t **env,
+                                                axis2_status_t AXIS2_CALL invoke_func_ptr (struct axis2_handler * handler, 
+                                                axis2_env_t **env,
+                                                struct axis2_msg_ctx *msg_ctx));
 axis2_param_t* AXIS2_CALL axis2_handler_get_param (struct axis2_handler * handler, 
                                                            axis2_env_t **env, 
                                                            axis2_char_t *name);
@@ -75,6 +80,7 @@
     handler_impl->handler.ops->free = axis2_handler_free;
     handler_impl->handler.ops->init = axis2_handler_init;
     handler_impl->handler.ops->invoke = axis2_handler_invoke;
+    handler_impl->handler.ops->set_invoke = axis2_handler_set_invoke;
     handler_impl->handler.ops->get_name = axis2_handler_get_name;
     handler_impl->handler.ops->get_param = axis2_handler_get_param;
     handler_impl->handler.ops->get_handler_desc = axis2_handler_get_handler_desc;
@@ -89,7 +95,7 @@
     axis2_handler_impl_t *handler_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(handler, env, AXIS2_FAILURE);
     handler_impl = AXIS2_INTF_TO_IMPL(handler);
-    if (handler->ops)
+    if (handler_impl->handler.ops)
     {
         AXIS2_FREE((*env)->allocator, handler_impl->handler.ops);
         handler_impl->handler.ops = NULL;
@@ -120,6 +126,24 @@
     /**TODO invoke has to be implemented by an implementing handler */
     return AXIS2_SUCCESS;
 }
+
+axis2_status_t AXIS2_CALL axis2_handler_set_invoke (struct axis2_handler * handler, 
+                                                axis2_env_t **env,
+                                                axis2_status_t AXIS2_CALL invoke_func_ptr (struct axis2_handler * handler, 
+                                                axis2_env_t **env,
+                                                struct axis2_msg_ctx *msg_ctx))
+{
+    axis2_handler_impl_t *handler_impl = NULL;
+    AXIS2_FUNC_PARAM_CHECK(handler, env, AXIS2_FAILURE);
+    handler_impl = AXIS2_INTF_TO_IMPL(handler);
+    if (handler_impl->handler.ops)
+    {
+        handler_impl->handler.ops->invoke = invoke_func_ptr;
+    }
+    /**TODO invoke has to be implemented by an implementing handler */
+    return AXIS2_SUCCESS;
+}
+
 
 axis2_param_t* AXIS2_CALL axis2_handler_get_param (struct axis2_handler * handler, 
                                                 axis2_env_t **env,