axiom_node_t* AXIS2_CALL adb_CipherReference_serialize_obj( adb_CipherReference_t* _CipherReference, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axis2_char_t* xsi_prefix = NULL; axiom_namespace_t* xsi_ns = NULL; axiom_attribute_t* xsi_type_attri = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _CipherReference, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://www.w3.org/2001/04/xmlenc#", "n"); axutil_hash_set(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "CipherReference", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.w3.org/2001/04/xmlenc#", p_prefix)); } if (!_CipherReference->is_valid_CipherReference) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property CipherReference"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("CipherReference"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("CipherReference"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing CipherReference element */ sprintf(start_input_str, "<%s%sCipherReference", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sCipherReference>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); adb_CipherReferenceType_serialize(_CipherReference->property_CipherReference, env, current_node, parent_element, adb_CipherReferenceType_is_particle() || AXIS2_TRUE, namespaces, next_ns_index); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL adb_listExternalUsersResponse_serialize_obj( adb_listExternalUsersResponse_t* _listExternalUsersResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; int i = 0; int count = 0; void *element = NULL; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _listExternalUsersResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://service.mgt.user.carbon.wso2.org", "n"); axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "listExternalUsersResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://service.mgt.user.carbon.wso2.org", p_prefix)); } if (!_listExternalUsersResponse->is_valid_return) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * Parsing return array */ if (_listExternalUsersResponse->property_return != NULL) { sprintf(start_input_str, "<%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); count = axutil_array_list_size(_listExternalUsersResponse->property_return, env); for(i = 0; i < count; i ++) { element = axutil_array_list_get(_listExternalUsersResponse->property_return, env, i); if(NULL == element) { continue; } /* * parsing return element */ text_value_1 = (axis2_char_t*)element; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); } } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL adb_getServiceGroupParameterResponse_serialize_obj( adb_getServiceGroupParameterResponse_t* _getServiceGroupParameterResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _getServiceGroupParameterResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://org.apache.axis2/xsd", "n"); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "getServiceGroupParameterResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_getServiceGroupParameterResponse->is_valid_return) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing return element */ sprintf(start_input_str, "<%s%sreturn", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); if(!adb_ParameterMetaData_is_particle()) { axutil_stream_write(stream, env, start_input_str, start_input_str_len); } adb_ParameterMetaData_serialize(_getServiceGroupParameterResponse->property_return, env, current_node, parent_element, adb_ParameterMetaData_is_particle() || AXIS2_FALSE, namespaces, next_ns_index); if(!adb_ParameterMetaData_is_particle()) { axutil_stream_write(stream, env, end_input_str, end_input_str_len); } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
/** * Traverse thru the node and its descendents. Check if the node has a particular attribute with * name as in @attr and namespace as in @ns. Returns the attribute value. * @param env Environment. MUST NOT be NULL, * @param node the node to be searched * @param attribute_name the attribute name of the node * @param ns namespace of the attribute * @return the attribute value if found, else NULL */ AXIS2_EXTERN axis2_char_t* AXIS2_CALL oxs_axiom_get_attribute_value_of_node_by_name( const axutil_env_t *env, axiom_node_t *node, axis2_char_t *attribute_name, axis2_char_t *ns_uri) { axis2_char_t *found_val = NULL; axiom_element_t *ele = NULL; axutil_hash_t *attr_list = NULL; axutil_hash_index_t *hi = NULL; ele = axiom_node_get_data_element(node, env); /* Get attribute list of the element */ attr_list = axiom_element_extract_attributes(ele, env, node); if(!attr_list) { return NULL; } /* namespace uri can be NULL. In that case, use empty string */ if(!ns_uri) { ns_uri = ""; } /* Traverse thru all the attributes. If both localname and the nsuri matches return the val */ for (hi = axutil_hash_first(attr_list, env); hi; hi = axutil_hash_next(env, hi)) { void *attr = NULL; axiom_attribute_t *om_attr = NULL; axutil_hash_this(hi, NULL, NULL, &attr); if (attr) { axis2_char_t *this_attr_name = NULL; axis2_char_t *this_attr_ns_uri = NULL; axiom_namespace_t *attr_ns = NULL; om_attr = (axiom_attribute_t*)attr; this_attr_name = axiom_attribute_get_localname(om_attr, env); attr_ns = axiom_attribute_get_namespace(om_attr, env); if(attr_ns) { this_attr_ns_uri = axiom_namespace_get_uri(attr_ns, env); } else { this_attr_ns_uri = ""; } if((!axutil_strcmp(attribute_name, this_attr_name)) && (!axutil_strcmp(ns_uri, this_attr_ns_uri))) { /* Got it !!! */ found_val = axiom_attribute_get_value(om_attr, env); AXIS2_FREE(env->allocator, hi); break; } } } for(hi = axutil_hash_first(attr_list, env); hi; hi = axutil_hash_next(env, hi)) { void *val = NULL; axutil_hash_this(hi, NULL, NULL, &val); if (val) { axiom_attribute_free((axiom_attribute_t *)val, env); val = NULL; } } axutil_hash_free(attr_list, env); attr_list = NULL; return found_val; }
wsf_unit_status_t WSF_UNIT_CALL test_hash(wsf_unit_suite_t * suite) { wsf_unit_status_t status = WSF_UNIT_FAILURE; axutil_env_t *env = NULL; axutil_test_data_t *data = NULL; test_axutil_hash_t *test_data = NULL; status = WSF_UNIT_ADD_SUB_SUITE(suite); env = CREATE_TEST_ENV(); if (env) { data = AXIS2_MALLOC(env->allocator, sizeof(axutil_test_data_t)); } if (data) { data->test_env = env; test_data = AXIS2_MALLOC(env->allocator, sizeof(test_axutil_hash_t)); if (test_data) { data->test_data = test_data; test_data->hash = NULL; test_data->a1 = (a_t *) AXIS2_MALLOC(env->allocator, sizeof(a_t)); if (test_data->a1) { test_data->a1->value = "value1"; } else { status = WSF_UNIT_FAILURE; } test_data->a2 = (a_t *) AXIS2_MALLOC(env->allocator, sizeof(a_t)); if (test_data->a2) { test_data->a2->value = "value2"; } else { status = WSF_UNIT_FAILURE; } test_data->a3 = (a_t *) AXIS2_MALLOC(env->allocator, sizeof(a_t)); if (test_data->a3) { test_data->a3->value = (axis2_char_t *)axutil_strdup(env, "value3"); } else { status = WSF_UNIT_FAILURE; } test_data->a4 = (a_t *) AXIS2_MALLOC(env->allocator, sizeof(a_t)); if (test_data->a4) { test_data->a4->value = (axis2_char_t *)axutil_strdup(env, "value4"); } else { status = WSF_UNIT_FAILURE; } } else { data->test_data = NULL; } } wsf_unit_run_test(suite, test_axutil_hash_create, data); wsf_unit_run_test(suite, test_axutil_hash_get, data); wsf_unit_run_test(suite, test_axutil_hash_reset, data); wsf_unit_run_test(suite, test_axutil_hash_this, data); if (test_data) { if (test_data->a1) { AXIS2_FREE(env->allocator, test_data->a1); } else { status = WSF_UNIT_FAILURE; } if (test_data->a2) { AXIS2_FREE(env->allocator, test_data->a2); } else { status = WSF_UNIT_FAILURE; } if (test_data->a3) { if (test_data->a3->value) { AXIS2_FREE(env->allocator, test_data->a3->value); } else { status = WSF_UNIT_FAILURE; } AXIS2_FREE(env->allocator, test_data->a3); } else { status = WSF_UNIT_FAILURE; } if (test_data->a4) { if (test_data->a4->value) { AXIS2_FREE(env->allocator, test_data->a4->value); } else { status = WSF_UNIT_FAILURE; } AXIS2_FREE(env->allocator, test_data->a4); } else { status = WSF_UNIT_FAILURE; } if (test_data->hash) { axutil_hash_free(test_data->hash, env); } AXIS2_FREE(env->allocator, test_data); } else { status = WSF_UNIT_FAILURE; } if (data) { data->test_env = NULL; AXIS2_FREE(env->allocator, data); } else { status = WSF_UNIT_FAILURE; } if (env) { axutil_env_free(env); } else { status = WSF_UNIT_FAILURE; } return status; }
AXIS2_EXTERN void AXIS2_CALL axis2_svc_free( axis2_svc_t * svc, const axutil_env_t * env) { if(!svc) { return; } if(svc->impl_class) { AXIS2_SVC_SKELETON_FREE((axis2_svc_skeleton_t *)svc->impl_class, env); } if(svc->param_container) { axutil_param_container_free(svc->param_container, env); } if(svc->flow_container) { axis2_flow_container_free(svc->flow_container, env); } if(svc->filename) { AXIS2_FREE(env->allocator, svc->filename); svc->filename = NULL; } if(svc->svc_desc) { AXIS2_FREE(env->allocator, svc->svc_desc); svc->svc_desc = NULL; } svc->parent = NULL; if(svc->module_list) { int i = 0; int size = 0; size = axutil_array_list_size(svc->module_list, env); for(i = 0; i < size; i++) { axutil_qname_t *qname = NULL; qname = axutil_array_list_get(svc->module_list, env, i); if(qname) { axutil_qname_free(qname, env); } } axutil_array_list_free(svc->module_list, env); } if(svc->schema_list) { axutil_array_list_free(svc->schema_list, env); } if(svc->engaged_module_list) { axutil_array_list_free(svc->engaged_module_list, env); } if(svc->axis_svc_name) { AXIS2_FREE(env->allocator, svc->axis_svc_name); svc->axis_svc_name = NULL; } if(svc->op_alias_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(svc->op_alias_map, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); if(val) { if(axis2_op_is_from_module((axis2_op_t *)val, env) == AXIS2_FALSE) { axis2_op_free((axis2_op_t *)val, env); } val = NULL; } } axutil_hash_free(svc->op_alias_map, env); } if(svc->op_action_map) { axutil_hash_index_t *hi = NULL; const void *key = NULL; for(hi = axutil_hash_first(svc->op_action_map, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, NULL); if(key) { AXIS2_FREE(env->allocator, (axis2_char_t *)key); key = NULL; } } axutil_hash_free(svc->op_action_map, env); } if(svc->op_rest_map) { axis2_core_utils_free_rest_map(env, svc->op_rest_map); } if(svc->schema_target_ns_prefix) { AXIS2_FREE(env->allocator, svc->schema_target_ns_prefix); svc->schema_target_ns_prefix = NULL; } if(svc->target_ns) { AXIS2_FREE(env->allocator, svc->target_ns); svc->target_ns = NULL; } if(svc->wsdl_path) { AXIS2_FREE(env->allocator, svc->wsdl_path); svc->wsdl_path = NULL; } if(svc->folder_path) { AXIS2_FREE(env->allocator, svc->folder_path); svc->folder_path = NULL; } if(svc->target_ns_prefix) { AXIS2_FREE(env->allocator, svc->target_ns_prefix); svc->target_ns_prefix = NULL; } if(svc->qname) { axutil_qname_free(svc->qname, env); } if(svc->style) { AXIS2_FREE(env->allocator, svc->style); } if(svc->base) { axis2_desc_free(svc->base, env); } if(svc->mutex) { axutil_thread_mutex_destroy(svc->mutex); } AXIS2_FREE(env->allocator, svc); }
axiom_node_t* AXIS2_CALL adb_updateSystemLog_serialize_obj( adb_updateSystemLog_t* _updateSystemLog, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *text_value_2; axis2_char_t *text_value_2_temp; axis2_char_t text_value_3[ADB_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _updateSystemLog, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://org.apache.axis2/xsd", "n"); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "updateSystemLog", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_updateSystemLog->is_valid_logLevel) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("logLevel"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("logLevel"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing logLevel element */ sprintf(start_input_str, "<%s%slogLevel>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%slogLevel>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _updateSystemLog->property_logLevel; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_updateSystemLog->is_valid_logPattern) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("logPattern"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("logPattern"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing logPattern element */ sprintf(start_input_str, "<%s%slogPattern>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%slogPattern>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_2 = _updateSystemLog->property_logPattern; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_2_temp = axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE); if (text_value_2_temp) { axutil_stream_write(stream, env, text_value_2_temp, axutil_strlen(text_value_2_temp)); AXIS2_FREE(env->allocator, text_value_2_temp); } else { axutil_stream_write(stream, env, text_value_2, axutil_strlen(text_value_2)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_updateSystemLog->is_valid_persist) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("persist"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("persist"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing persist element */ sprintf(start_input_str, "<%s%spersist>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%spersist>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); strcpy(text_value_3, (_updateSystemLog->property_persist)?"true":"false"); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_3, axutil_strlen(text_value_3)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL adb_unsubscribeResponse_serialize_obj( adb_unsubscribeResponse_t* _unsubscribeResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _unsubscribeResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://mopevm.ru/axis2/services/types", "n"); axutil_hash_set(namespaces, "http://mopevm.ru/axis2/services/types", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "unsubscribeResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); p_prefix = NULL; if (!_unsubscribeResponse->is_valid_message) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property message"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("message"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("message"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing message element */ sprintf(start_input_str, "<%s%smessage>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%smessage>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _unsubscribeResponse->property_message; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
int test_hash_get( const axutil_env_t * env) { axutil_hash_t *ht; a *a1, *a2, *a3, *a4; axutil_hash_index_t *i = 0; void *v = NULL; char *key1 = "key1"; char *key2 = "key2"; char *key3 = "key3"; char *key4 = "key4"; int cnt = 0; axis2_char_t ***rettt = NULL; axis2_status_t stat = AXIS2_FAILURE; stat = axutil_parse_rest_url_for_params(env, "ech{a}tring", "/echoString?text=Hello%20World%21", &cnt, &rettt); stat = axutil_parse_rest_url_for_params(env, "{a}ny/mor/sum", "echoStringmany/mor/sum", &cnt, &rettt); /* rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}re/{b}?", "/echoString/more/sum/?"); rettt = axutil_parse_rest_url_for_params(env, "/ech{c}tring{a}more/{b}/", "/echoStringma/nymore/sum?"); rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}/more/{b}?{c}", "echoString/many/more/sum/"); rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}/more/{b}/?", "echoString/many/more/sum/?test=");*/ a1 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); a2 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); a3 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); a4 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); a1->value = axutil_strdup(env, "value1"); a2->value = axutil_strdup(env, "value2"); a3->value = axutil_strdup(env, "value3"); a4->value = axutil_strdup(env, "value4"); ht = axutil_hash_make(env); axutil_hash_set(ht, key1, AXIS2_HASH_KEY_STRING, a1); axutil_hash_set(ht, key2, AXIS2_HASH_KEY_STRING, a2); axutil_hash_set(ht, key3, AXIS2_HASH_KEY_STRING, a3); axutil_hash_set(ht, key4, AXIS2_HASH_KEY_STRING, a4); axutil_hash_set(ht, key2, AXIS2_HASH_KEY_STRING, NULL); axutil_hash_set(ht, key2, AXIS2_HASH_KEY_STRING, a2); for (i = axutil_hash_first(ht, env); i; i = axutil_hash_next(env, i)) { axutil_hash_this(i, NULL, NULL, &v); printf("\n %s \n", ((a *) v)->value); } printf("\n demo get %s ", ((a *) axutil_hash_get(ht, key1, AXIS2_HASH_KEY_STRING))->value); printf("\n demo get %s ", ((a *) axutil_hash_get(ht, key2, AXIS2_HASH_KEY_STRING))->value); printf("\n demo get %s ", ((a *) axutil_hash_get(ht, key3, AXIS2_HASH_KEY_STRING))->value); printf("\n demo get %s \n", ((a *) axutil_hash_get(ht, key4, AXIS2_HASH_KEY_STRING))->value); axutil_hash_free(ht, env); AXIS2_FREE(env->allocator, a1->value); AXIS2_FREE(env->allocator, a2->value); AXIS2_FREE(env->allocator, a3->value); AXIS2_FREE(env->allocator, a4->value); AXIS2_FREE(env->allocator, a1); AXIS2_FREE(env->allocator, a2); AXIS2_FREE(env->allocator, a3); AXIS2_FREE(env->allocator, a4); return 0; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL remote_registry_resource_free( remote_registry_resource_t *resource, const axutil_env_t *env) { if(resource->author_name != NULL) { AXIS2_FREE(env->allocator, resource->author_name); resource->author_name = NULL; } if(resource->created_time != NULL) { axutil_date_time_free(resource->created_time, env); resource->created_time = NULL; } if(resource->last_updated_username != NULL) { AXIS2_FREE(env->allocator, resource->last_updated_username); resource->last_updated_username = NULL; } if(resource->description != NULL) { AXIS2_FREE(env->allocator, resource->description); resource->description = NULL; } if(resource->path != NULL) { AXIS2_FREE(env->allocator, resource->path); resource->path = NULL; } if(resource->media_type != NULL) { AXIS2_FREE(env->allocator, resource->media_type); resource->media_type = NULL; } if(resource->parent_path != NULL) { AXIS2_FREE(env->allocator, resource->parent_path); resource->parent_path = NULL; } if(resource->properties != NULL) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(resource->properties, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); AXIS2_FREE(env->allocator, val); } axutil_hash_free(resource->properties, env); resource->properties = NULL; } if(resource->depends_on != NULL) { axutil_array_list_free(resource->depends_on, env); resource->depends_on = NULL; } if(resource->depended_on_by != NULL) { AXIS2_FREE(env->allocator, resource->depended_on_by); resource->depended_on_by = NULL; } if(resource->content != NULL) { AXIS2_FREE(env->allocator, resource->content); resource->content = NULL; } if(resource->subtitle != NULL) { AXIS2_FREE(env->allocator, resource->subtitle); resource->subtitle = NULL; } if(resource->title != NULL) { AXIS2_FREE(env->allocator, resource->title); resource->title = NULL; } if(resource->collection != NULL) { AXIS2_FREE(env->allocator, resource->collection); resource->collection = NULL; } if(resource->entries != NULL) { int i = 0; /* needed to free all the resouces recursively */ for(i = 0; i < axutil_array_list_size(resource->entries, env); i ++ ) { remote_registry_resource_t *res = NULL; res = axutil_array_list_get(resource->entries, env, i); remote_registry_resource_free(res, env); } axutil_array_list_free(resource->entries, env); resource->entries = NULL; } if(resource->child_paths != NULL) { axutil_array_list_free(resource->child_paths, env); resource->child_paths = NULL; } if(resource->link_self != NULL) { AXIS2_FREE(env->allocator, resource->link_self); } if(resource->link_alternate != NULL) { AXIS2_FREE(env->allocator, resource->link_alternate); } if(resource->link_path != NULL) { AXIS2_FREE(env->allocator, resource->link_path); } if(resource->link_edit != NULL) { AXIS2_FREE(env->allocator, resource->link_edit); } if(resource->link_edit_media != NULL) { AXIS2_FREE(env->allocator, resource->link_edit_media); } if(resource->content_src_url != NULL) { AXIS2_FREE(env->allocator, resource->content_src_url); } AXIS2_FREE(env->allocator, resource); return AXIS2_SUCCESS; }
axiom_node_t* AXIS2_CALL adb_disengageModuleForService_serialize_obj( adb_disengageModuleForService_t* _disengageModuleForService, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *text_value_2; axis2_char_t *text_value_2_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _disengageModuleForService, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://service.mgt.module.carbon.wso2.org", "n"); axutil_hash_set(namespaces, "http://service.mgt.module.carbon.wso2.org", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "disengageModuleForService", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://service.mgt.module.carbon.wso2.org", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://service.mgt.module.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://service.mgt.module.carbon.wso2.org", p_prefix)); } if (!_disengageModuleForService->is_valid_moduleId) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("moduleId"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("moduleId"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing moduleId element */ sprintf(start_input_str, "<%s%smoduleId>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%smoduleId>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _disengageModuleForService->property_moduleId; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://service.mgt.module.carbon.wso2.org", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://service.mgt.module.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://service.mgt.module.carbon.wso2.org", p_prefix)); } if (!_disengageModuleForService->is_valid_serviceName) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("serviceName"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("serviceName"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing serviceName element */ sprintf(start_input_str, "<%s%sserviceName>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sserviceName>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_2 = _disengageModuleForService->property_serviceName; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_2_temp = axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE); if (text_value_2_temp) { axutil_stream_write(stream, env, text_value_2_temp, axutil_strlen(text_value_2_temp)); AXIS2_FREE(env->allocator, text_value_2_temp); } else { axutil_stream_write(stream, env, text_value_2, axutil_strlen(text_value_2)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL adb_item_serialize_obj( adb_item_t* _item, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axis2_char_t* xsi_prefix = NULL; axiom_namespace_t* xsi_ns = NULL; axiom_attribute_t* xsi_type_attri = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _item, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://www.daisy.org/ns/daisy-online/", "n"); axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "item", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.daisy.org/ns/daisy-online/", p_prefix)); } if (!_item->is_valid_item) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property item"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("item"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("item"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing item element */ sprintf(start_input_str, "<%s%sitem>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sitem>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _item->property_item; text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL adb_UserNotRegisteredException1_serialize( adb_UserNotRegisteredException1_t* _UserNotRegisteredException1, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t *current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[64]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _UserNotRegisteredException1, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://esb.callbackservice.services.hdviper.psnc.pl/", "n"); axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "UserNotRegisteredException", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://esb.callbackservice.services.hdviper.psnc.pl/", p_prefix)); } if (!_UserNotRegisteredException1->is_valid_UserNotRegisteredException) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property UserNotRegisteredException"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("UserNotRegisteredException"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("UserNotRegisteredException"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing UserNotRegisteredException element */ sprintf(start_input_str, "<%s%sUserNotRegisteredException", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sUserNotRegisteredException>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); adb_UserNotRegisteredException_serialize(_UserNotRegisteredException1->property_UserNotRegisteredException, env, current_node, parent_element, adb_UserNotRegisteredException_is_particle() || AXIS2_TRUE, namespaces, next_ns_index); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL remote_registry_rest_client_free( remote_registry_rest_client_t *rest_client, const axutil_env_t *env) { if(rest_client->conf) { remote_registry_conf_free(rest_client->conf, env); rest_client->conf = NULL; } if(rest_client->last_response_content_type) { AXIS2_FREE(env->allocator, rest_client->last_response_content_type); rest_client->last_response_content_type = NULL; } if(rest_client->cached_entries) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->cached_entries, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); AXIS2_FREE(env->allocator, val); } axutil_hash_free(rest_client->cached_entries, env); } /* freeing the keys, and the value are just numbers */ if(rest_client->cached_entries_len) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->cached_entries_len, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); } axutil_hash_free(rest_client->cached_entries_len, env); } /* freeing the keys, and the value are also should be freed*/ if(rest_client->etags) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->etags, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); AXIS2_FREE(env->allocator, val); } axutil_hash_free(rest_client->etags, env); } if(rest_client->cached_order) { int i; void *cached_url; for(i = 0; i < axutil_array_list_size(rest_client->cached_order, env); i ++) { cached_url = axutil_array_list_get(rest_client->cached_order, env, i); AXIS2_FREE(env->allocator, cached_url); } axutil_array_list_free(rest_client->cached_order, env); } if(rest_client->reverse_cached_order) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->reverse_cached_order, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); } axutil_hash_free(rest_client->reverse_cached_order, env); } /* we are keeping the cached entries key to the cached_entries_len * so no need to re free */ axutil_hash_free(rest_client->cached_entries_len, env); AXIS2_FREE(env->allocator, rest_client); return AXIS2_SUCCESS; }
AXIS2_EXTERN void AXIS2_CALL axis2_conf_ctx_free( axis2_conf_ctx_t * conf_ctx, const axutil_env_t * env) { if(conf_ctx->base) { axis2_ctx_free(conf_ctx->base, env); } if(conf_ctx->op_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->op_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_op_ctx_t *op_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); op_ctx = (axis2_op_ctx_t *)val; if(op_ctx) axis2_op_ctx_free(op_ctx, env); val = NULL; op_ctx = NULL; } axutil_hash_free(conf_ctx->op_ctx_map, env); } if(conf_ctx->svc_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->svc_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_svc_ctx_t *svc_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); svc_ctx = (axis2_svc_ctx_t *)val; if(svc_ctx) axis2_svc_ctx_free(svc_ctx, env); val = NULL; svc_ctx = NULL; } axutil_hash_free(conf_ctx->svc_ctx_map, env); } if(conf_ctx->svc_grp_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->svc_grp_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_svc_grp_ctx_t *svc_grp_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); svc_grp_ctx = (axis2_svc_grp_ctx_t *)val; if(svc_grp_ctx) axis2_svc_grp_ctx_free(svc_grp_ctx, env); val = NULL; svc_grp_ctx = NULL; } axutil_hash_free(conf_ctx->svc_grp_ctx_map, env); } if(conf_ctx->conf) { axis2_conf_free(conf_ctx->conf, env); } if(conf_ctx->mutex) { axutil_thread_mutex_destroy(conf_ctx->mutex); } if(conf_ctx->root_dir) { AXIS2_FREE(env->allocator, conf_ctx->root_dir); } AXIS2_FREE(env->allocator, conf_ctx); }
AXIS2_EXTERN void AXIS2_CALL axiom_stax_builder_free_self_original( axiom_stax_builder_t * om_builder, const axutil_env_t * env) { axiom_node_t *temp_node = NULL; axiom_node_t *nodes[256]; axiom_node_t *om_node = NULL; int count = 0; om_node = om_builder->root_node; nodes[count++] = om_node; if(om_node) { do { axiom_node_set_builder(om_node, env, NULL); temp_node = axiom_node_get_first_child(om_node, env); if(temp_node) { /* process the child node */ om_node = temp_node; nodes[count++] = om_node; } else { /* no child node. check whether current node has any siblings */ temp_node = axiom_node_get_next_sibling(om_node, env); if(temp_node) { /* process sibling nodes */ om_node = temp_node; nodes[count - 1] = om_node; } else { /* no siblings. so fallback to parent of current node and process */ while(count > 1 && !temp_node) { count--; om_node = nodes[count - 1]; temp_node = axiom_node_get_next_sibling(om_node, env); } if(temp_node && count > 1) { om_node = temp_node; nodes[count - 1] = om_node; } else { count--; } } } } while(count > 0); } axutil_hash_free(om_builder->declared_namespaces, env); axiom_xml_reader_free(om_builder->parser, env); axiom_document_free_self(om_builder->document, env); AXIS2_FREE(env->allocator, om_builder); }