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 2006/05/04 08:54:26 UTC

svn commit: r399571 - in /webservices/axis2/trunk/c: include/axis2_ctx.h include/axis2_msg_ctx.h modules/core/context/ctx.c modules/core/context/msg_ctx.c

Author: samisa
Date: Wed May  3 23:54:24 2006
New Revision: 399571

URL: http://svn.apache.org/viewcvs?rev=399571&view=rev
Log:
Added support to add options to message context

Modified:
    webservices/axis2/trunk/c/include/axis2_ctx.h
    webservices/axis2/trunk/c/include/axis2_msg_ctx.h
    webservices/axis2/trunk/c/modules/core/context/ctx.c
    webservices/axis2/trunk/c/modules/core/context/msg_ctx.c

Modified: webservices/axis2/trunk/c/include/axis2_ctx.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_ctx.h?rev=399571&r1=399570&r2=399571&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_ctx.h Wed May  3 23:54:24 2006
@@ -85,6 +85,17 @@
      */
     axis2_status_t (AXIS2_CALL *free)(axis2_ctx_t *ctx,
                                         axis2_env_t **env); 
+    axis2_status_t (AXIS2_CALL *
+    set_non_persistent_map)(
+        struct axis2_ctx *ctx, 
+        axis2_env_t **env,
+        axis2_hash_t* map);
+        
+    axis2_status_t (AXIS2_CALL *
+    set_persistent_map)(
+        struct axis2_ctx *ctx, 
+        axis2_env_t **env,
+        axis2_hash_t* map);
 };
 
 /** 
@@ -100,11 +111,20 @@
     
 /************************** Start of function macros **************************/
 
-#define AXIS2_CTX_SET_PROPERTY(ctx, env, key, value, persistent) ((ctx)->ops->set_property(ctx, env, key, value, persistent))
-#define AXIS2_CTX_GET_PROPERTY(ctx, env, key, persistent) ((ctx)->ops->get_property(ctx, env, key, persistent))
-#define AXIS2_CTX_GET_NON_PERSISTANT_MAP(ctx, env) ((ctx)->ops->get_non_persistent_map(ctx, env))
-#define AXIS2_CTX_GET_PERSISTANT_MAP(ctx, env) ((ctx)->ops->get_persistent_map(ctx, env))
-#define AXIS2_CTX_FREE(ctx, env) ((ctx)->ops->free (ctx, env))
+#define AXIS2_CTX_SET_PROPERTY(ctx, env, key, value, persistent) \
+    ((ctx)->ops->set_property(ctx, env, key, value, persistent))
+#define AXIS2_CTX_GET_PROPERTY(ctx, env, key, persistent) \
+    ((ctx)->ops->get_property(ctx, env, key, persistent))
+#define AXIS2_CTX_GET_NON_PERSISTANT_MAP(ctx, env) \
+    ((ctx)->ops->get_non_persistent_map(ctx, env))
+#define AXIS2_CTX_GET_PERSISTANT_MAP(ctx, env) \
+    ((ctx)->ops->get_persistent_map(ctx, env))
+#define AXIS2_CTX_SET_NON_PERSISTANT_MAP(ctx, env, map) \
+    ((ctx)->ops->set_non_persistent_map(ctx, env, map))
+#define AXIS2_CTX_SET_PERSISTANT_MAP(ctx, env, map) \
+    ((ctx)->ops->set_persistent_map(ctx, env, map))
+#define AXIS2_CTX_FREE(ctx, env) \
+    ((ctx)->ops->free (ctx, env))
 
 /************************** End of function macros ****************************/    
 

Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=399571&r1=399570&r2=399571&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Wed May  3 23:54:24 2006
@@ -74,6 +74,7 @@
 struct axis2_op_ctx;
 struct axis2_conf;
 struct axis2_soap_envelope;
+struct axis2_options;
     
 /** 
  * @brief Message Context ops struct
@@ -679,6 +680,12 @@
     axis2_bool_t (AXIS2_CALL *
 	is_paused) (axis2_msg_ctx_t *msg_ctx,
                 axis2_env_t **env);
+             
+    axis2_status_t (AXIS2_CALL *
+	set_options )(
+        axis2_msg_ctx_t *msg_ctx,
+        axis2_env_t **env,
+        struct axis2_options *options);
 };
 
 /** 
@@ -946,6 +953,8 @@
 #define AXIS2_MSG_CTX_FIND_OP(msg_ctx, env, svc) \
 		((msg_ctx)->ops->find_op(msg_ctx, env, svc))
 		
+#define AXIS2_MSG_CTX_SET_OPTIONS(msg_ctx, env, options) \
+		((msg_ctx)->ops->set_options(msg_ctx, env, options))
 
 /************************** End of function macros ****************************/    
 

Modified: webservices/axis2/trunk/c/modules/core/context/ctx.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/ctx.c?rev=399571&r1=399570&r2=399571&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/ctx.c Wed May  3 23:54:24 2006
@@ -54,7 +54,19 @@
 axis2_hash_t* AXIS2_CALL 
 axis2_ctx_get_persistent_map(struct axis2_ctx *ctx, 
                             axis2_env_t **env);
-                            
+
+axis2_status_t AXIS2_CALL 
+axis2_ctx_set_non_persistent_map(
+    struct axis2_ctx *ctx, 
+    axis2_env_t **env,
+    axis2_hash_t* map);
+    
+axis2_status_t AXIS2_CALL
+axis2_ctx_set_persistent_map(
+    struct axis2_ctx *ctx, 
+    axis2_env_t **env,
+    axis2_hash_t* map);
+    
 axis2_status_t AXIS2_CALL 
 axis2_ctx_free (struct axis2_ctx *ctx, 
                 axis2_env_t **env);
@@ -101,20 +113,13 @@
         return NULL;        
     }
 
-    ctx_impl->ctx.ops->get_property = 
-        axis2_ctx_get_property;
-        
-    ctx_impl->ctx.ops->set_property = 
-        axis2_ctx_set_property;
-        
-    ctx_impl->ctx.ops->get_non_persistent_map = 
-        axis2_ctx_get_non_persistent_map;
-        
-    ctx_impl->ctx.ops->get_persistent_map = 
-        axis2_ctx_get_persistent_map;
-        
-    ctx_impl->ctx.ops->free = 
-        axis2_ctx_free;
+    ctx_impl->ctx.ops->get_property = axis2_ctx_get_property;        
+    ctx_impl->ctx.ops->set_property = axis2_ctx_set_property;
+    ctx_impl->ctx.ops->get_non_persistent_map = axis2_ctx_get_non_persistent_map;
+    ctx_impl->ctx.ops->get_persistent_map = axis2_ctx_get_persistent_map;
+    ctx_impl->ctx.ops->set_non_persistent_map = axis2_ctx_set_non_persistent_map;
+    ctx_impl->ctx.ops->set_persistent_map = axis2_ctx_set_persistent_map;
+    ctx_impl->ctx.ops->free = axis2_ctx_free;
 
     return &(ctx_impl->ctx);
 }
@@ -269,3 +274,88 @@
     return AXIS2_SUCCESS;
 }
 
+axis2_status_t AXIS2_CALL 
+axis2_ctx_set_non_persistent_map(
+    struct axis2_ctx *ctx, 
+    axis2_env_t **env,
+    axis2_hash_t* map)
+{
+    axis2_ctx_impl_t *ctx_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
+    
+    if (ctx_impl->non_persistent_map)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        const void *key = NULL;
+        for (hi = axis2_hash_first (ctx_impl->non_persistent_map, env); 
+            hi; hi = axis2_hash_next ( env, hi))
+        {  
+            axis2_property_t *property = NULL;
+            
+            axis2_hash_this (hi, &key, NULL, &val);
+            property = (axis2_property_t *) val;
+            
+            if(property)
+            {
+                AXIS2_PROPERTY_FREE(property, env);
+                property = NULL;
+            }
+            
+            val = NULL;
+            key = NULL;
+        }
+        axis2_hash_free(ctx_impl->non_persistent_map, env);
+        ctx_impl->non_persistent_map = NULL;
+    }    
+    
+    ctx_impl->non_persistent_map = map;
+    
+    return AXIS2_SUCCESS;
+}
+    
+axis2_status_t AXIS2_CALL
+axis2_ctx_set_persistent_map(
+    struct axis2_ctx *ctx, 
+    axis2_env_t **env,
+    axis2_hash_t* map)
+{
+    axis2_ctx_impl_t *ctx_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
+    
+    if (ctx_impl->persistent_map)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        const void *key = NULL;
+        for (hi = axis2_hash_first (ctx_impl->persistent_map, env); 
+            hi; hi = axis2_hash_next ( env, hi))
+        {  
+            axis2_property_t *property = NULL;
+            
+            axis2_hash_this (hi, &key, NULL, &val);
+            property = (axis2_property_t *) val;
+            
+            if(property)
+            {
+                AXIS2_PROPERTY_FREE(property, env);
+                property = NULL;
+            }
+            
+            val = NULL;
+            key = NULL;
+        }
+        axis2_hash_free(ctx_impl->persistent_map, env);
+        ctx_impl->persistent_map = NULL;
+    }
+    
+    ctx_impl->persistent_map = map;
+    
+    return AXIS2_SUCCESS;
+}

Modified: webservices/axis2/trunk/c/modules/core/context/msg_ctx.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/msg_ctx.c?rev=399571&r1=399570&r2=399571&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/msg_ctx.c Wed May  3 23:54:24 2006
@@ -24,6 +24,7 @@
 #include <axis2_transport_out_desc.h>
 #include <axis2_soap_envelope.h>
 #include <axis2_soap_const.h>
+#include <axis2_options.h>
 
 typedef struct axis2_msg_ctx_impl axis2_msg_ctx_impl_t;
 
@@ -410,7 +411,10 @@
 axis2_op_t* AXIS2_CALL axis2_msg_ctx_find_op(axis2_msg_ctx_t *msg_ctx,
                             axis2_env_t **env,
                             axis2_svc_t *svc);
-
+axis2_status_t AXIS2_CALL
+axis2_msg_ctx_set_options (axis2_msg_ctx_t *msg_ctx,
+    axis2_env_t **env,
+    axis2_options_t *options);
 
 /************************* End of function headers ****************************/	
 
@@ -586,7 +590,7 @@
     msg_ctx_impl->msg_ctx.ops->is_paused = axis2_msg_ctx_is_paused;
     msg_ctx_impl->msg_ctx.ops->find_svc = axis2_msg_ctx_find_svc;
     msg_ctx_impl->msg_ctx.ops->find_op = axis2_msg_ctx_find_op;
-    
+    msg_ctx_impl->msg_ctx.ops->set_options = axis2_msg_ctx_set_options;
     return &(msg_ctx_impl->msg_ctx);
 }
 
@@ -1946,4 +1950,23 @@
                             axis2_svc_t *svc)
 {
     return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_msg_ctx_set_options (axis2_msg_ctx_t *msg_ctx,
+    axis2_env_t **env,
+    axis2_options_t *options)
+{
+    axis2_msg_ctx_impl_t *msg_ctx_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, options, AXIS2_FAILURE);
+    
+    msg_ctx_impl = AXIS2_INTF_TO_IMPL(msg_ctx);
+    
+    msg_ctx_impl->msg_info_headers = 
+        AXIS2_OPTIONS_GET_MSG_INFO_HEADERS(options, env);
+    AXIS2_CTX_SET_NON_PERSISTANT_MAP(msg_ctx_impl->base, env, 
+        AXIS2_OPTIONS_GET_PROPERTIES(options, env));
+    
 }