static axis2_status_t axis2_phase_remove_unique( const axutil_env_t * env, axutil_array_list_t * list, axis2_handler_t * handler) { int i = 0, size = 0; axis2_bool_t remove_handler = AXIS2_FALSE; const axutil_string_t *handler_name = NULL; handler_name = axis2_handler_get_name(handler, env); size = axutil_array_list_size(list, env); for(i = 0; i < size; i++) { axis2_handler_t *obj = NULL; const axutil_string_t *obj_name = NULL; obj = (axis2_handler_t *)axutil_array_list_get(list, env, i); obj_name = axis2_handler_get_name(obj, env); if(obj == handler) { remove_handler = AXIS2_TRUE; break; } else if(!axutil_strcmp(axutil_string_get_buffer(handler_name, env), axutil_string_get_buffer(obj_name, env))) { remove_handler = AXIS2_TRUE; break; } } if(remove_handler) axutil_array_list_remove(list, env, i); return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_disengage_module( axis2_svc_t * svc, const axutil_env_t * env, axis2_module_desc_t * module_desc, axis2_conf_t * conf) { axis2_phase_resolver_t *phase_resolver = NULL; axis2_status_t status = AXIS2_FAILURE; const axis2_char_t *svcname = NULL; AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, conf, AXIS2_FAILURE); svcname = axis2_svc_get_name(svc, env); phase_resolver = axis2_phase_resolver_create_with_config(env, conf); if(!phase_resolver) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creating phase resolver failed for service %s", svcname); return AXIS2_FAILURE; } status = axis2_phase_resolver_disengage_module_from_svc(phase_resolver, env, svc, module_desc); if(status == AXIS2_SUCCESS) { /** Remove this module from the engaged modules list */ const axutil_qname_t *mod_qname = NULL; int i = 0, size = 0; mod_qname = axis2_module_desc_get_qname(module_desc, env); size = axutil_array_list_size(svc->engaged_module_list, env); for(i = 0; i < size; i++) { const axutil_qname_t *module_qname_l = NULL; axis2_module_desc_t *module_desc_l = NULL; module_desc_l = (axis2_module_desc_t *)axutil_array_list_get(svc->engaged_module_list, env, i); module_qname_l = axis2_module_desc_get_qname(module_desc_l, env); if(axutil_qname_equals(mod_qname, env, module_qname_l)) { axutil_array_list_remove(svc->engaged_module_list, env, i); break; } } } axis2_phase_resolver_free(phase_resolver, env); return status; }
void test_array_list( const axutil_env_t * env) { axutil_array_list_t *al; a *entry = NULL; int size; al = axutil_array_list_create(env, 1); printf("list size %d\n", axutil_array_list_size(al, env)); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value1"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value2"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value3"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value4"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value5"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value6"); axutil_array_list_add(al, env, (void *) entry); entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a)); entry->value = axutil_strdup(env, "value7"); axutil_array_list_set(al, env, 3, (void *) entry); axutil_array_list_remove(al, env, 2); entry = (a *) axutil_array_list_get(al, env, 0); printf("entry->value:%s\n", entry->value); entry = (a *) axutil_array_list_get(al, env, 2); printf("entry->value:%s\n", entry->value); size = axutil_array_list_size(al, env); printf("list size %d\n", axutil_array_list_size(al, env)); }
AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_remove_action(saml_autho_decision_query_t *autho_dec_query, const axutil_env_t *env, int index) { saml_action_t *act; if(autho_dec_query->saml_actions) { act = axutil_array_list_remove(autho_dec_query->saml_actions, env, index); if(act) { saml_action_free(act, env); return AXIS2_SUCCESS; } } return AXIS2_FAILURE; }
AXIS2_EXTERN int AXIS2_CALL saml_attr_query_remove_designator(saml_attr_query_t *attr_query, const axutil_env_t *env, int index) { saml_attr_desig_t *desig; if(attr_query->attr_desigs) { desig = axutil_array_list_remove(attr_query->attr_desigs, env, index); if(desig) { saml_attr_desig_free(desig, env); return AXIS2_SUCCESS; } } return AXIS2_FAILURE; }
static void axis2_libcurl_free_headers( axis2_libcurl_t *curl, const axutil_env_t * env) { int count = 0; axutil_array_list_t *header_group = curl->alist; if (header_group) { while ((count = axutil_array_list_size(header_group, env)) > 0) { axis2_char_t *header = axutil_array_list_remove(header_group, env, count-1); AXIS2_FREE(env->allocator, header); } } }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_client_remove_all_headers( axis2_svc_client_t * svc_client, const axutil_env_t * env) { int i = 0; int size = 0; AXIS2_PARAM_CHECK(env->error, svc_client, AXIS2_FAILURE); if(!svc_client->headers) { return AXIS2_SUCCESS; } size = axutil_array_list_size(svc_client->headers, env); for(i = size - 1; i > -1; i--) { axutil_array_list_remove(svc_client->headers, env, i); } return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_ws_info_list_check_for_undeploy( axis2_ws_info_list_t * ws_info_list, const axutil_env_t * env) { int list_size = 0; axutil_array_list_t *temp_list = NULL; int i = 0; /* Create temp list */ temp_list = axutil_array_list_create(env, 0); if(!temp_list) { return AXIS2_FAILURE; } list_size = axutil_array_list_size(ws_info_list->ws_info_list, env); for(i = 0; i < list_size; i++) { /* For each ws_info item in the ws_info_list check whether it is also * in the current_info_list. If not mark it to be undeployed by adding * it to a temporarily list. Also add that item to the undeploy list of * deployment engine.*/ int current_lists_size = 0; axis2_ws_info_t *file_item = NULL; axis2_char_t *file_item_name = NULL; axis2_bool_t exist = AXIS2_FALSE; int j = 0; file_item = (axis2_ws_info_t *)axutil_array_list_get(ws_info_list-> ws_info_list, env, i); file_item_name = axis2_ws_info_get_file_name(file_item, env); current_lists_size = axutil_array_list_size(ws_info_list->current_info_list, env); for(j = 0; j < current_lists_size; j++) { axis2_char_t *file_name = NULL; file_name = (axis2_char_t *)axutil_array_list_get(ws_info_list-> current_info_list, env, j); if(!axutil_strcmp(file_name, file_item_name)) { exist = AXIS2_TRUE; break; } } if(!exist) { axis2_ws_info_t *ws_info = NULL; long last_modified_date = 0; last_modified_date = axis2_ws_info_get_last_modified_date(file_item, env); axutil_array_list_add(temp_list, env, file_item); ws_info = axis2_ws_info_create_with_file_name_and_last_modified_date(env, file_item_name, last_modified_date); /* This ws_info is to be undeployed */ axis2_dep_engine_add_ws_to_undeploy(ws_info_list->dep_engine, env, ws_info); } } list_size = axutil_array_list_size(temp_list, env); for(i = 0; i < list_size; i++) { /* Get each ws_info item from the temp list created and remove that * item from the ws_info_list */ axis2_ws_info_t *file_item = NULL; int index = 0; file_item = (axis2_ws_info_t *)axutil_array_list_get(temp_list, env, i); index = axutil_array_list_index_of(ws_info_list->ws_info_list, env, file_item); axutil_array_list_remove(ws_info_list->ws_info_list, env, index); } axutil_array_list_free(temp_list, env); return AXIS2_SUCCESS; }
void axis2_svc_client_set_http_info( axis2_svc_client_t * svc_client, const axutil_env_t * env, axis2_msg_ctx_t * msg_ctx) { axis2_transport_in_desc_t *transport_in = NULL; axutil_param_t *expose_headers_param = NULL; axis2_bool_t expose_headers = AXIS2_FALSE; if(msg_ctx) { transport_in = axis2_msg_ctx_get_transport_in_desc(msg_ctx, env); if(transport_in) { expose_headers_param = axutil_param_container_get_param( axis2_transport_in_desc_param_container(transport_in, env), env, AXIS2_EXPOSE_HEADERS); } if(expose_headers_param) { axis2_char_t *expose_headers_value = NULL; expose_headers_value = axutil_param_get_value(expose_headers_param, env); if(expose_headers_value && 0 == axutil_strcasecmp(expose_headers_value, AXIS2_VALUE_TRUE)) { expose_headers = AXIS2_TRUE; } } } if(expose_headers) { if(svc_client->http_headers == axis2_msg_ctx_get_http_output_headers(msg_ctx, env)) { svc_client->http_status_code = axis2_msg_ctx_get_status_code(msg_ctx, env); return; } } if(svc_client->http_headers) { axis2_http_header_t *header = NULL; while(axutil_array_list_size(svc_client->http_headers, env)) { header = (axis2_http_header_t *)axutil_array_list_remove(svc_client->http_headers, env, 0); if(header) { axis2_http_header_free(header, env); } } axutil_array_list_free(svc_client->http_headers, env); svc_client->http_headers = NULL; } svc_client->http_status_code = 0; if(msg_ctx) { if(expose_headers) { svc_client->http_headers = axis2_msg_ctx_extract_http_output_headers(msg_ctx, env); } svc_client->http_status_code = axis2_msg_ctx_get_status_code(msg_ctx, env); } }
static axis2_bool_t axis2_svc_client_fill_soap_envelope( const axutil_env_t * env, axis2_svc_client_t * svc_client, axis2_msg_ctx_t * msg_ctx, const axiom_node_t * payload) { const axis2_char_t *soap_version_uri; int soap_version; axiom_soap_envelope_t *envelope = NULL; AXIS2_PARAM_CHECK(env->error, svc_client, AXIS2_FAILURE); soap_version_uri = axis2_options_get_soap_version_uri(svc_client->options, env); if(!soap_version_uri) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find soap version uri."); return AXIS2_FALSE; } if(axutil_strcmp(soap_version_uri, AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI) == 0) { soap_version = AXIOM_SOAP11; } else { soap_version = AXIOM_SOAP12; } envelope = axiom_soap_envelope_create_default_soap_envelope(env, soap_version); if(!envelope) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create default soap envelope."); return AXIS2_FALSE; } if(svc_client->headers) { axiom_soap_header_t *soap_header = NULL; soap_header = axiom_soap_envelope_get_header(envelope, env); if(soap_header) { axiom_node_t *header_node = NULL; header_node = axiom_soap_header_get_base_node(soap_header, env); if(header_node) { int size = 0; int i = 0; size = axutil_array_list_size(svc_client->headers, env); while(i < size) { axiom_node_t *node = NULL; node = axutil_array_list_remove(svc_client->headers, env, 0); /* This removes and retrieves data. The order of the * removal is chosen such that the headers are appended * in the order they were added. */ size--; if(node) { axiom_node_add_child(header_node, env, node); } } } } } if(payload) { axiom_soap_body_t *soap_body = NULL; soap_body = axiom_soap_envelope_get_body(envelope, env); if(soap_body) { axiom_node_t *node = NULL; node = axiom_soap_body_get_base_node(soap_body, env); if(node) { axiom_node_add_child(node, env, (axiom_node_t *)payload); } } } axis2_msg_ctx_set_soap_envelope(msg_ctx, env, envelope); return AXIS2_TRUE; }