axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r411118 - in /webservices/axis2/trunk/c: modules/core/deployment/desc_builder.c util/include/axis2_param.h util/src/param.c
Date Fri, 02 Jun 2006 10:44:39 GMT
Author: damitha
Date: Fri Jun  2 03:44:38 2006
New Revision: 411118

URL: http://svn.apache.org/viewvc?rev=411118&view=rev
Log:
Fixed Jira Axis2C 177

Modified:
    webservices/axis2/trunk/c/modules/core/deployment/desc_builder.c
    webservices/axis2/trunk/c/util/include/axis2_param.h
    webservices/axis2/trunk/c/util/src/param.c

Modified: webservices/axis2/trunk/c/modules/core/deployment/desc_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/deployment/desc_builder.c?rev=411118&r1=411117&r2=411118&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/desc_builder.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/desc_builder.c Fri Jun  2 03:44:38 2006
@@ -104,6 +104,13 @@
                                 const axis2_env_t *env,
                                 axis2_char_t *in);
 
+static axis2_status_t
+set_attrs_and_value(
+        axis2_param_t *param,
+        const axis2_env_t *env,
+        axis2_om_element_t *param_element,
+        axis2_om_node_t *param_node);
+
                                 
 /************************** End of function prototypes ************************/
 
@@ -589,6 +596,122 @@
     return handler_desc;
 }
 
+static axis2_status_t
+set_attrs_and_value(
+        axis2_param_t *param,
+        const axis2_env_t *env,
+        axis2_om_element_t *param_element,
+        axis2_om_node_t *param_node)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    axis2_hash_t *attrs = NULL;
+    axis2_om_child_element_iterator_t *childs = NULL;
+        
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, param, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, param_element, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, param_node, AXIS2_FAILURE);
+
+     /* Setting attributes */
+    attrs = AXIS2_OM_ELEMENT_EXTRACT_ATTRIBUTES(param_element, env, param_node);
+    if(attrs)
+    {
+        axis2_hash_index_t *i = NULL;
+
+        for (i = axis2_hash_first (attrs, env); i; i = 
+                axis2_hash_next (env, i))
+        {
+            void *v = NULL;
+            axis2_om_attribute_t *value = NULL;
+            axis2_generic_obj_t *obj = NULL;
+            axis2_qname_t *attr_qname = NULL;
+            axis2_char_t *attr_name = NULL;
+
+            axis2_hash_this (i, NULL, NULL, &v);
+            if(!v) 
+            {
+                AXIS2_PARAM_FREE(param, env);
+                return AXIS2_FAILURE;
+            }
+            obj = axis2_generic_obj_create(env);
+            if(!obj)
+            {
+                AXIS2_PARAM_FREE(param, env);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
+                        AXIS2_FAILURE);
+                return AXIS2_FAILURE;
+            }
+            value = (axis2_om_attribute_t *) v;
+            AXIS2_GENERIC_OBJ_SET_VALUE(obj, env, value);
+            AXIS2_GENERIC_OBJ_SET_FREE_FUNC(obj, env, 
+                    axis2_om_attribute_free_void_arg);
+            attr_qname = AXIS2_OM_ATTRIBUTE_GET_QNAME(value, env);
+            attr_name = AXIS2_QNAME_TO_STRING(attr_qname, env);
+            axis2_hash_set(attrs, attr_name, AXIS2_HASH_KEY_STRING, obj); 
+        }
+        AXIS2_PARAM_SET_ATTRIBUTES(param, env, attrs);
+    }
+
+    childs = AXIS2_OM_ELEMENT_GET_CHILD_ELEMENTS(param_element, env, param_node);
+    if(childs)
+    {
+        axis2_hash_t *value_map = NULL;
+        
+        value_map = axis2_hash_make(env);
+        AXIS2_PARAM_SET_VALUE_MAP(param, env, value_map);
+        
+        while(AXIS2_TRUE == AXIS2_OM_CHILD_ELEMENT_ITERATOR_HAS_NEXT(childs, env))
+        {
+            axis2_om_node_t *node = NULL;
+            axis2_om_element_t *element = NULL;
+            axis2_param_t *param = NULL;
+            axis2_qname_t *att_qname = NULL;
+            axis2_om_attribute_t *para_name = NULL;
+            axis2_char_t *pname = NULL;
+            
+            node = AXIS2_OM_CHILD_ELEMENT_ITERATOR_NEXT(childs, env);
+            element = AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+            att_qname = axis2_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
+            para_name = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(element, env, 
+                att_qname);
+            AXIS2_QNAME_FREE(att_qname, env);
+            if(!para_name)
+            {
+                AXIS2_PARAM_FREE(param, env);
+                return AXIS2_FAILURE;
+            }
+            pname = AXIS2_OM_ATTRIBUTE_GET_VALUE(para_name, env);
+            status = AXIS2_PARAM_SET_NAME(param, env, pname);
+            if(AXIS2_SUCCESS != status)
+            {
+                AXIS2_PARAM_FREE(param, env);
+                return status;
+            }
+            AXIS2_PARAM_SET_PARAM_TYPE(param, env, AXIS2_DOM_PARAM);
+            set_attrs_and_value(param, env, element, node);
+            axis2_hash_set(value_map, pname, AXIS2_HASH_KEY_STRING, param);
+        }
+    }
+    else
+    {
+        axis2_char_t *para_test_value = NULL;
+        axis2_char_t *temp = NULL;
+
+        temp = AXIS2_OM_ELEMENT_GET_TEXT(
+            param_element, env, param_node);
+        para_test_value = AXIS2_STRDUP(temp, env);
+        status = AXIS2_PARAM_SET_VALUE(param, env, para_test_value);
+        if(AXIS2_SUCCESS != status)
+        {
+            AXIS2_PARAM_FREE(param, env);
+            AXIS2_FREE(env->allocator, para_test_value);
+            return status;
+        }
+        AXIS2_PARAM_SET_PARAM_TYPE(param, env, AXIS2_TEXT_PARAM);
+    }
+    return AXIS2_SUCCESS;
+}
+
 axis2_status_t AXIS2_CALL
 axis2_desc_builder_process_params(axis2_desc_builder_t *desc_builder,
                                 const axis2_env_t *env,
@@ -607,8 +730,6 @@
     {
         axis2_om_element_t *param_element = NULL;
         axis2_om_node_t *param_node = NULL;
-        axis2_om_element_t *para_value = NULL;
-        axis2_om_node_t *para_node = NULL;
         axis2_param_t *param = NULL;
         axis2_param_t *parent_para = NULL;
         axis2_om_attribute_t *para_name = NULL;
@@ -616,7 +737,6 @@
         axis2_qname_t *att_locked = NULL;
         axis2_qname_t *att_qname = NULL;
         axis2_char_t *pname = NULL;
-        axis2_hash_t *attrs = NULL;
         
         /* This is to check whether some one has locked the parmter at the top 
          * level
@@ -635,47 +755,7 @@
             return status;
         }*/
         
-        /* Setting attributes */
-        attrs = AXIS2_OM_ELEMENT_EXTRACT_ATTRIBUTES(param_element, env, param_node);
-        if(attrs)
-        {
-            axis2_hash_index_t *i = NULL;
-
-            for (i = axis2_hash_first (attrs, env); i; i = 
-                    axis2_hash_next (env, i))
-            {
-                void *v = NULL;
-                axis2_om_attribute_t *value = NULL;
-                axis2_generic_obj_t *obj = NULL;
-                axis2_qname_t *attr_qname = NULL;
-                axis2_char_t *attr_name = NULL;
-
-                axis2_hash_this (i, NULL, NULL, &v);
-                if(!v) 
-                {
-                    AXIS2_PARAM_FREE(param, env);
-                    return AXIS2_FAILURE;
-                }
-                obj = axis2_generic_obj_create(env);
-                if(!obj)
-                {
-                    AXIS2_PARAM_FREE(param, env);
-                    AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
-                            AXIS2_FAILURE);
-                    return AXIS2_FAILURE;
-                }
-                value = (axis2_om_attribute_t *) v;
-                AXIS2_GENERIC_OBJ_SET_VALUE(obj, env, value);
-                AXIS2_GENERIC_OBJ_SET_FREE_FUNC(obj, env, 
-                        axis2_om_attribute_free_void_arg);
-                attr_qname = AXIS2_OM_ATTRIBUTE_GET_QNAME(value, env);
-                attr_name = AXIS2_QNAME_TO_STRING(attr_qname, env);
-                axis2_hash_set(attrs, attr_name, AXIS2_HASH_KEY_STRING, obj); 
-            }
-            AXIS2_PARAM_SET_ATTRIBUTES(param, env, attrs);
-        }
-
-        /* Setting paramter name */
+           /* Setting paramter name */
         att_qname = axis2_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
         para_name = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(param_element, env, 
             att_qname);
@@ -693,39 +773,9 @@
             return status;
         }
         
-        /* Setting paramter Value (the chiled elemnt of the paramter) */
-        para_value = AXIS2_OM_ELEMENT_GET_FIRST_ELEMENT(param_element, env,
-            param_node, &para_node);
-        if(para_value)
-        {
-            /* TODO uncomment this when find usages */
-            /*
-            status = AXIS2_PARAM_SET_VALUE(param, env, param_element);
-            if(AXIS2_SUCCESS != status)
-            {
-                AXIS2_PARAM_FREE(param, env);
-                return AXIS2_FAILURE;
-            }
-            AXIS2_PARAM_SET_PARAM_TYPE(param, env, AXIS2_DOM_PARAM);
-            */
-        }
-        else
-        {
-            axis2_char_t *para_test_value = NULL;
-            axis2_char_t *temp = NULL;
+        /* Setting paramter Value (the chiled elemnt of the paramter) */ 
+        set_attrs_and_value(param, env, param_element, param_node);
 
-            temp = AXIS2_OM_ELEMENT_GET_TEXT(
-                param_element, env, param_node);
-            para_test_value = AXIS2_STRDUP(temp, env);
-            status = AXIS2_PARAM_SET_VALUE(param, env, para_test_value);
-            if(AXIS2_SUCCESS != status)
-            {
-                AXIS2_PARAM_FREE(param, env);
-                AXIS2_FREE(env->allocator, para_test_value);
-                return status;
-            }
-            AXIS2_PARAM_SET_PARAM_TYPE(param, env, AXIS2_TEXT_PARAM);
-        }
         /* Setting locking attrib */
         att_locked = axis2_qname_create(env, AXIS2_ATTLOCKED, NULL, NULL);
         para_locked = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(param_element, env, 

Modified: webservices/axis2/trunk/c/util/include/axis2_param.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_param.h?rev=411118&r1=411117&r2=411118&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_param.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_param.h Fri Jun  2 03:44:38 2006
@@ -140,6 +140,17 @@
             const axis2_env_t *env);
          
     axis2_status_t (AXIS2_CALL *
+    set_value_map) (
+            struct axis2_param *param,
+            const axis2_env_t *env,
+            axis2_hash_t *value_map);
+
+    axis2_hash_t* (AXIS2_CALL *
+    get_value_map) (
+            struct axis2_param *param,
+            const axis2_env_t *env);
+
+    axis2_status_t (AXIS2_CALL *
     value_free) (void *param_value, 
                  const axis2_env_t *env);
 }axis2_param_ops_t;
@@ -193,6 +204,12 @@
 
 #define AXIS2_PARAM_GET_ATTRIBUTES(param, env) \
     ((param)->ops->get_attributes (param, env))
+	    
+#define AXIS2_PARAM_SET_VALUE_MAP(param, env, value_map) \
+    ((param)->ops->set_value_map (param , env, value_map))
+
+#define AXIS2_PARAM_GET_VALUE_MAP(param, env) \
+    ((param)->ops->get_value_map (param, env))
 	
 /** @} */
     

Modified: webservices/axis2/trunk/c/util/src/param.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/param.c?rev=411118&r1=411117&r2=411118&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/param.c (original)
+++ webservices/axis2/trunk/c/util/src/param.c Fri Jun  2 03:44:38 2006
@@ -32,6 +32,8 @@
     /** Parameter type */
     int type; /*default is AXIS2_TEXT_PARAM */
     axis2_hash_t *attrs;
+    axis2_hash_t *value_map;
+
 } axis2_param_impl_t;
 
 #define AXIS2_INTF_TO_IMPL(param) ((axis2_param_impl_t *)param)
@@ -83,6 +85,17 @@
         const axis2_env_t *env);
 
 axis2_status_t AXIS2_CALL 
+axis2_param_set_value_map(
+        axis2_param_t *param,
+        const axis2_env_t *env,
+        axis2_hash_t *value_map);
+
+axis2_hash_t* AXIS2_CALL 
+axis2_param_get_value_map(
+        axis2_param_t *param,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL 
 axis2_param_free(axis2_param_t *param, 
 						const axis2_env_t *env);
 
@@ -108,6 +121,7 @@
     param_impl->locked = AXIS2_FALSE;
     param_impl->type = AXIS2_TEXT_PARAM;
     param_impl->attrs = NULL;
+    param_impl->value_map = NULL;
     
     param_impl->param.ops = 
 		AXIS2_MALLOC (env->allocator, sizeof(axis2_param_ops_t));
@@ -133,6 +147,10 @@
         axis2_param_set_attributes;
     param_impl->param.ops->get_attributes = 
         axis2_param_get_attributes;
+    param_impl->param.ops->set_value_map = 
+        axis2_param_set_value_map;
+    param_impl->param.ops->get_value_map = 
+        axis2_param_get_value_map;
     param_impl->param.ops->free = axis2_param_free;
     
     return &(param_impl->param);
@@ -275,6 +293,48 @@
     return AXIS2_INTF_TO_IMPL(param)->attrs;
 }
 
+axis2_status_t AXIS2_CALL 
+axis2_param_set_value_map(
+        axis2_param_t *param,
+        const axis2_env_t *env,
+        axis2_hash_t *value_map)
+{
+    axis2_param_impl_t *param_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, value_map, AXIS2_FAILURE);
+    param_impl = AXIS2_INTF_TO_IMPL(param);
+
+    if(param_impl->value_map)
+    {
+        axis2_hash_index_t *i = NULL;
+        void *v = NULL;
+
+        for (i = axis2_hash_first (param_impl->value_map, env); i; 
+                i = axis2_hash_next (env, i))
+        {
+            axis2_param_t *param = NULL;
+            
+            axis2_hash_this (i, NULL, NULL, &v);
+            param = (axis2_param_t *) v;
+            AXIS2_PARAM_FREE(param, env);
+        }
+        axis2_hash_free(param_impl->value_map, env);
+    }
+   
+    param_impl->value_map = value_map;
+    return AXIS2_SUCCESS;
+}
+
+axis2_hash_t* AXIS2_CALL 
+axis2_param_get_value_map(
+        axis2_param_t *param,
+        const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    return AXIS2_INTF_TO_IMPL(param)->value_map;
+}
 
 axis2_status_t AXIS2_CALL 
 axis2_param_free(axis2_param_t *param, 
@@ -312,6 +372,23 @@
             AXIS2_GENERIC_OBJ_FREE(v, env);
         }
         axis2_hash_free(param_impl->attrs, env);
+    }
+    
+    if(param_impl->value_map)
+    {
+        axis2_hash_index_t *i = NULL;
+        void *v = NULL;
+
+        for (i = axis2_hash_first (param_impl->value_map, env); i; 
+                i = axis2_hash_next (env, i))
+        {
+            axis2_param_t *param = NULL;
+
+            axis2_hash_this (i, NULL, NULL, &v);
+            param = (axis2_param_t *) v;
+            AXIS2_PARAM_FREE(param, env);
+        }
+        axis2_hash_free(param_impl->value_map, env);
     }
     param_name = axis2_param_get_name(param, env);
     AXIS2_FREE(env->allocator, param_name);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message