You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/11/07 07:43:15 UTC

svn commit: r331226 - in /webservices/axis2/trunk/c: include/axis2_handler.h include/axis2_handler_desc.h modules/core/handlers/src/handler.c

Author: samisa
Date: Sun Nov  6 22:43:07 2005
New Revision: 331226

URL: http://svn.apache.org/viewcvs?rev=331226&view=rev
Log:
Initial compilig implementation of handler struct added. Fixed problems in macros

Modified:
    webservices/axis2/trunk/c/include/axis2_handler.h
    webservices/axis2/trunk/c/include/axis2_handler_desc.h
    webservices/axis2/trunk/c/modules/core/handlers/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=331226&r1=331225&r2=331226&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler.h Sun Nov  6 22:43:07 2005
@@ -33,7 +33,7 @@
 
     struct axis2_handler;
     struct axis2_handler_ops;
-    struct axis2_handler_description;
+    struct axis2_handler_desc;
     struct axis2_msg_ctx;
 
 /**
@@ -64,7 +64,7 @@
         */
         axis2_status_t (AXIS2_CALL *init) (struct axis2_handler * handler, 
                                            axis2_env_t **env, 
-                                           struct axis2_handler_description *handler_desc);
+                                           struct axis2_handler_desc *handler_desc);
 
       /**
         * Invoke is called to do the actual work of the Handler object.
@@ -98,7 +98,7 @@
          * @param name
          * @return
          */
-         axis2_param_t* (AXIS2_CALL *get_parameter) (struct axis2_handler * handler, 
+         axis2_param_t* (AXIS2_CALL *get_param) (struct axis2_handler * handler, 
                                                          axis2_env_t **env, 
                                                          axis2_char_t *name);
 
@@ -108,7 +108,7 @@
         *
         * @return
         */
-        struct axis2_handler_description* (AXIS2_CALL * get_handler_desc) (struct axis2_handler * handler, 
+        struct axis2_handler_desc* (AXIS2_CALL * get_handler_desc) (struct axis2_handler * handler, 
                                                                            axis2_env_t **env);
     } axis2_handler_ops_t;
 	
@@ -128,7 +128,11 @@
 AXIS2_DECLARE(axis2_handler_t*) axis2_handler_create(axis2_env_t **env);
     
 #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_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))
 /** @} */
     
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/include/axis2_handler_desc.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler_desc.h?rev=331226&r1=331225&r2=331226&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler_desc.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler_desc.h Sun Nov  6 22:43:07 2005
@@ -105,8 +105,10 @@
 #define AXIS2_HANDLER_DESC_SET_BEFORE(handler_desc, env, before) ((handler_desc)->ops->set_before(handler_desc, env, before))
 #define AXIS2_HANDLER_DESC_GET_AFTER(handler_desc, env) ((handler_desc)->ops->get_after(handler_desc, env))
 #define AXIS2_HANDLER_DESC_SET_AFTER(handler_desc, env, after) ((handler_desc)->ops->set_after(handler_desc, env, after))
-#define AXIS2_HANDLER_DESC_GET_NAME(handler_desc, env) ((handler_desc)->ops->get_name(handler_desc, env))
-#define AXIS2_HANDLER_DESC_SET_NAME(handler_desc, env, name) ((handler_desc)->ops->set_name(handler_desc, env, name))
+#define AXIS2_HANDLER_DESC_GET_QNAME(handler_desc, env) ((handler_desc)->ops->get_qname(handler_desc, env))
+#define AXIS2_HANDLER_DESC_SET_QNAME(handler_desc, env, name) ((handler_desc)->ops->set_qname(handler_desc, env, name))
+#define AXIS2_HANDLER_DESC_GET_PARAM(handler_desc, env, name) ((handler_desc)->ops->get_param(handler_desc, env, name))
+#define AXIS2_HANDLER_DESC_ADD_PARAM(handler_desc, env, param) ((handler_desc)->ops->add_param(handler_desc, env, param))
 #define AXIS2_HANDLER_DESC_IS_PHASE_FIRST(handler_desc, env) ((handler_desc)->ops->is_phase_first((handler_desc, env))
 #define AXIS2_HANDLER_DESC_GET_PHASE_FIRST(handler_desc, env, phase_first) ((handler_desc)->ops->set_phase_first(handler_desc, env, phase_first))
 #define AXIS2_HANDLER_DESC_IS_PHASE_LAST(handler_desc, env) ((handler_desc)->ops->is_phase_last(handler_desc, env))

Modified: webservices/axis2/trunk/c/modules/core/handlers/src/handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/handlers/src/handler.c?rev=331226&r1=331225&r2=331226&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/handlers/src/handler.c (original)
+++ webservices/axis2/trunk/c/modules/core/handlers/src/handler.c Sun Nov  6 22:43:07 2005
@@ -28,7 +28,24 @@
 /** Interface to implementation conversion macro */
 #define AXIS2_INTF_TO_IMPL(handler) ((axis2_handler_impl_t *)handler)
 
-axis2_handler_t* AXIS2_CALL axis2_handler_create(axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_free (struct axis2_handler * handler, 
+                                              axis2_env_t **env);
+axis2_qname_t* AXIS2_CALL axis2_handler_get_name(struct axis2_handler * handler, 
+                                                 axis2_env_t **env) ;
+axis2_status_t AXIS2_CALL axis2_handler_invoke (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);
+axis2_status_t AXIS2_CALL axis2_handler_init (struct axis2_handler * handler, 
+                                              axis2_env_t **env, 
+                                              struct axis2_handler_desc *handler_desc);
+axis2_handler_desc_t* AXIS2_CALL axis2_handler_get_handler_desc (struct axis2_handler * handler, 
+                                                          axis2_env_t **env);
+
+
+axis2_handler_t* AXIS2_CALL axis2_handler_create(axis2_env_t **env)
 {
     axis2_handler_impl_t *handler_impl = NULL;
     
@@ -51,11 +68,16 @@
     {
         AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
         AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
-        axis2_handler_free(&(handler_impl->handler));
+        axis2_handler_free(&(handler_impl->handler), env);
         return NULL;        
     }
     
+    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->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;
     
     return &(handler_impl->handler);
 }
@@ -64,15 +86,17 @@
 axis2_handler_free (struct axis2_handler * handler, 
                     axis2_env_t **env)
 {
-    AXIS2_FUNC_PARAMETER_CHECK(handler, env, AXIS2_FAILURE);
+    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)
     {
-        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(handler)->handler.ops);
-        AXIS2_INTF_TO_IMPL(handler)->handler.ops = NULL;
+        AXIS2_FREE((*env)->allocator, handler_impl->handler.ops);
+        handler_impl->handler.ops = NULL;
     }
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(handler));
-    AXIS2_INTF_TO_IMPL(handler) = NULL;
+    AXIS2_FREE((*env)->allocator, handler_impl);
+    handler_impl = NULL;
     
     return AXIS2_SUCCESS;    
 }
@@ -81,12 +105,12 @@
 axis2_handler_get_name(struct axis2_handler * handler, 
                        axis2_env_t **env) 
 {
-    AXIS2_FUNC_PARAMETER_CHECK(handler, env, NULL);
+    AXIS2_FUNC_PARAM_CHECK(handler, env, NULL);
     
     if (!(AXIS2_INTF_TO_IMPL(handler)->handler_desc))
         return NULL;
     
-    return AXIS2_HANDLER_DESC_GET_NAME(AXIS2_INTF_TO_IMPL(handler)->handler_desc);
+    return AXIS2_HANDLER_DESC_GET_QNAME(AXIS2_INTF_TO_IMPL(handler)->handler_desc, env);
 }
 
 axis2_status_t AXIS2_CALL axis2_handler_invoke (struct axis2_handler * handler, 
@@ -94,33 +118,34 @@
                                                 struct axis2_msg_ctx *msg_ctx)
 {
     /**TODO invoke has to be implemented by an implementing handler */
+    return AXIS2_SUCCESS;
 }
 
-axis2_parameter_t* AXIS2_CALL axis2_handler_get_parameter (struct axis2_handler * handler, 
+axis2_param_t* AXIS2_CALL axis2_handler_get_param (struct axis2_handler * handler, 
                                                 axis2_env_t **env, 
                                                 axis2_char_t *name)
 {
-    AXIS2_FUNC_PARAMETER_CHECK(handler, env, NULL);
+    AXIS2_FUNC_PARAM_CHECK(handler, env, NULL);
     
     if (!(AXIS2_INTF_TO_IMPL(handler)->handler_desc))
         return NULL;
     
-    return AXIS2_HANDLER_DESC_GET_PARAMETER(AXIS2_INTF_TO_IMPL(handler)->handler_desc, name);    
+    return AXIS2_HANDLER_DESC_GET_PARAM(AXIS2_INTF_TO_IMPL(handler)->handler_desc, env, name);    
 }
  
 axis2_status_t AXIS2_CALL axis2_handler_init (struct axis2_handler * handler, 
                                            axis2_env_t **env, 
-                                           struct axis2_handler_description *handler_desc)
+                                           struct axis2_handler_desc *handler_desc)
 {    
-    AXIS2_FUNC_PARAMETER_CHECK(handler, env, AXIS2_FAILURE);
+    AXIS2_FUNC_PARAM_CHECK(handler, env, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(handler)->handler_desc = handler_desc;
     
     return AXIS2_SUCCESS;    
 }
 
-axis2_handler_description_t* (AXIS2_CALL * get_handler_desc) (struct axis2_handler * handler, 
+axis2_handler_desc_t* AXIS2_CALL axis2_handler_get_handler_desc (struct axis2_handler * handler, 
                                                                            axis2_env_t **env)
 {
-    AXIS2_FUNC_PARAMETER_CHECK(handler, env, NULL);
+    AXIS2_FUNC_PARAM_CHECK(handler, env, NULL);
     return AXIS2_INTF_TO_IMPL(handler)->handler_desc;
 }