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 da...@apache.org on 2006/02/22 11:00:53 UTC

svn commit: r379735 [2/2] - in /webservices/axis2/trunk/c: include/ modules/core/deployment/ modules/core/description/ modules/core/engine/ modules/core/phaseresolver/ modules/core/transport/http/server/simple_axis2_server/ modules/util/ modules/wsdl/ ...

Modified: webservices/axis2/trunk/c/modules/wsdl/wsdl_component.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/wsdl_component.c?rev=379735&r1=379734&r2=379735&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/wsdl_component.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/wsdl_component.c Wed Feb 22 02:00:47 2006
@@ -1,4 +1,5 @@
 #include <axis2_wsdl_component.h>
+#include <axis2_property.h>
 
 /** 
  * @brief Wsdl Component struct impl
@@ -8,7 +9,6 @@
 {
 	axis2_wsdl_component_t wsdl_component;
 	axis2_hash_t *component_properties;
-    axis2_hash_t *component_properties_free_func_ptrs;
     /**
      * Field Namespace Qualified elements that can be sticked in the component.
      */
@@ -48,13 +48,6 @@
                                         axis2_env_t **env,
                                         axis2_char_t *key, 
                                         void *value);
-
-axis2_status_t AXIS2_CALL
-axis2_wsdl_component_set_component_property_free_func(
-                                        axis2_wsdl_component_t *wsdl_component, 
-                                        axis2_env_t **env,
-                                        axis2_char_t *key, 
-                                        void *value);
                                         
 void * AXIS2_CALL
 axis2_wsdl_component_get_component_property(
@@ -92,7 +85,6 @@
 	}
     
     wsdl_component_impl->component_properties = NULL;
-    wsdl_component_impl->component_properties_free_func_ptrs = NULL;
     wsdl_component_impl->elements = NULL;
     wsdl_component_impl->attributes = NULL;
 	
@@ -104,15 +96,6 @@
         return NULL;        
     }
     
-    wsdl_component_impl->component_properties_free_func_ptrs = 
-        axis2_hash_make (env);
-    if(NULL == wsdl_component_impl->component_properties_free_func_ptrs)
-    {
-        axis2_wsdl_component_free(&(wsdl_component_impl->wsdl_component), env);
-		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;        
-    }
-    
 	wsdl_component_impl->wsdl_component.ops = (axis2_wsdl_component_ops_t *)
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_component_ops_t));
     
@@ -130,8 +113,6 @@
             axis2_wsdl_component_get_component_properties;
     wsdl_component_impl->wsdl_component.ops->set_component_property =
             axis2_wsdl_component_set_component_property;
-    wsdl_component_impl->wsdl_component.ops->set_component_property_free_func =
-            axis2_wsdl_component_set_component_property_free_func;
     wsdl_component_impl->wsdl_component.ops->get_component_property =
             axis2_wsdl_component_get_component_property;
     wsdl_component_impl->wsdl_component.ops->add_extensibility_element = 
@@ -168,21 +149,16 @@
         for (hi = axis2_hash_first (component_impl->component_properties, env); 
             hi; hi = axis2_hash_next ( env, hi))
         {  
-            AXIS2_FREE_VOID_ARG free_func_ptr = NULL;            
+            axis2_property_t *property = NULL;
             
             axis2_hash_this (hi, &key, NULL, &val);
-            free_func_ptr = axis2_hash_get(component_impl->
-                component_properties_free_func_ptrs, key, AXIS2_HASH_KEY_STRING);
-            if(!free_func_ptr)
+            property = (axis2_property_t *) val;
+            
+            if(property)
             {
-                /* If free_func_ptr is NULL we assume that property is of type
-                 * axis2_char_t* (that is string)
-                 */
-                AXIS2_FREE((*env)->allocator, val);
+                AXIS2_PROPERTY_FREE(property, env);
+                property = NULL;
             }
-
-            /* TODO: commenting this for the time being. Should if AXIS2C-73 to solve the problem permanantly
-            free_func_ptr(val, env);*/
             
             val = NULL;
             key = NULL;
@@ -228,20 +204,15 @@
         for (hi = axis2_hash_first (component_impl->component_properties, env); 
             hi; hi = axis2_hash_next ( env, hi))
         {  
-            AXIS2_FREE_VOID_ARG free_func_ptr = NULL;            
+            axis2_property_t *property;            
             
             axis2_hash_this (hi, &key, NULL, &val);
-            free_func_ptr = axis2_hash_get(component_impl->
-                component_properties_free_func_ptrs, key, AXIS2_HASH_KEY_STRING);
-            if(!free_func_ptr)
+            property = (axis2_property_t *) val;
+            if(property)
             {
-                /* If free_func_ptr is NULL we assume that property is type
-                 * axis2_char_t *
-                 */
-                AXIS2_FREE((*env)->allocator, val);
+                AXIS2_PROPERTY_FREE(property, env);
+                property = NULL;
             }
-            free_func_ptr(val, env);
-            
             val = NULL;
             key = NULL;
         }
@@ -276,26 +247,6 @@
     component_impl = AXIS2_INTF_TO_IMPL(wsdl_component);
     
 	axis2_hash_set (component_impl->component_properties, key, 
-        AXIS2_HASH_KEY_STRING, value);
-    
-	return AXIS2_SUCCESS;
-}
-
-axis2_status_t AXIS2_CALL
-axis2_wsdl_component_set_component_property_free_func(
-                                        axis2_wsdl_component_t *wsdl_component, 
-                                        axis2_env_t **env,
-                                        axis2_char_t *key, 
-                                        void *value) 
-{
-    axis2_wsdl_component_impl_t *component_impl = NULL;
-    
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK((*env)->error, key, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
-    component_impl = AXIS2_INTF_TO_IMPL(wsdl_component);
-    
-	axis2_hash_set (component_impl->component_properties_free_func_ptrs, key, 
         AXIS2_HASH_KEY_STRING, value);
     
 	return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/test/unit/wsdl/test_wsdl_component.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/wsdl/test_wsdl_component.c?rev=379735&r1=379734&r2=379735&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/wsdl/test_wsdl_component.c (original)
+++ webservices/axis2/trunk/c/test/unit/wsdl/test_wsdl_component.c Wed Feb 22 02:00:47 2006
@@ -3,6 +3,7 @@
 #include <axis2_module_desc.h>
 #include <axis2_hash.h>
 #include <axis2_array_list.h>
+#include <axis2_property.h>
 
 axis2_array_list_t *
 get_module_list(axis2_env_t **env)
@@ -33,6 +34,7 @@
 {
     axis2_hash_t *module_list_map = NULL;
     axis2_array_list_t *module_list = NULL;
+    axis2_property_t *property = NULL;
     
     module_list_map = axis2_hash_make(env);
     if(!module_list_map)
@@ -40,24 +42,33 @@
         return NULL;
     }
     module_list = get_module_list(env);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+        axis2_module_desc_array_list_free);
+    AXIS2_PROPERTY_SET_VALUE(property, env, module_list);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
     axis2_hash_set(module_list_map, AXIS2_MODULEREF_KEY, 
-        AXIS2_HASH_KEY_STRING, module_list);
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY_FREE_FUNC(wsdl_comp, 
-        env, AXIS2_MODULEREF_KEY, axis2_module_desc_array_list_free);
+        AXIS2_HASH_KEY_STRING, property);
     module_list = NULL;
 
     module_list = get_module_list(env);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+        axis2_module_desc_array_list_free);
+    AXIS2_PROPERTY_SET_VALUE(property, env, module_list);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
     axis2_hash_set(module_list_map, AXIS2_MODULEREF_KEY, 
-        AXIS2_HASH_KEY_STRING, module_list);
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY_FREE_FUNC(wsdl_comp, 
-        env, AXIS2_MODULEREF_KEY, axis2_module_desc_array_list_free);
+        AXIS2_HASH_KEY_STRING, property);
     module_list = NULL;
     
     module_list = get_module_list(env);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+        axis2_module_desc_array_list_free);
+    AXIS2_PROPERTY_SET_VALUE(property, env, module_list);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
     axis2_hash_set(module_list_map, AXIS2_MODULEREF_KEY, 
-        AXIS2_HASH_KEY_STRING, module_list);
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY_FREE_FUNC(wsdl_comp, 
-        env, AXIS2_MODULEREF_KEY, axis2_module_desc_array_list_free);
+        AXIS2_HASH_KEY_STRING, property);
     module_list = NULL;
 
     return module_list_map;