Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 88415 invoked from network); 17 Aug 2009 07:06:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Aug 2009 07:06:23 -0000 Received: (qmail 92575 invoked by uid 500); 17 Aug 2009 07:06:30 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 92398 invoked by uid 500); 17 Aug 2009 07:06:29 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 92389 invoked by uid 500); 17 Aug 2009 07:06:29 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 92386 invoked by uid 99); 17 Aug 2009 07:06:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Aug 2009 07:06:29 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Aug 2009 07:06:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5FB502388854; Mon, 17 Aug 2009 07:06:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r804879 - in /webservices/axis2/trunk/c/neethi/src: all.c assertion.c exactlyone.c operator.c policy.c reference.c Date: Mon, 17 Aug 2009 07:06:02 -0000 To: axis2-cvs@ws.apache.org From: shankar@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090817070602.5FB502388854@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: shankar Date: Mon Aug 17 07:06:01 2009 New Revision: 804879 URL: http://svn.apache.org/viewvc?rev=804879&view=rev Log: code formatting Modified: webservices/axis2/trunk/c/neethi/src/all.c webservices/axis2/trunk/c/neethi/src/assertion.c webservices/axis2/trunk/c/neethi/src/exactlyone.c webservices/axis2/trunk/c/neethi/src/operator.c webservices/axis2/trunk/c/neethi/src/policy.c webservices/axis2/trunk/c/neethi/src/reference.c Modified: webservices/axis2/trunk/c/neethi/src/all.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/all.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/all.c (original) +++ webservices/axis2/trunk/c/neethi/src/all.c Mon Aug 17 07:06:01 2009 @@ -30,10 +30,9 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_all = (neethi_all_t *) AXIS2_MALLOC(env->allocator, - sizeof(neethi_all_t)); + neethi_all = (neethi_all_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_all_t)); - if (neethi_all == NULL) + if(neethi_all == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -42,7 +41,7 @@ neethi_all->policy_components = NULL; neethi_all->policy_components = axutil_array_list_create(env, 0); - if (!(neethi_all->policy_components)) + if(!(neethi_all->policy_components)) { neethi_all_free(neethi_all, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); @@ -57,25 +56,24 @@ neethi_all_t *neethi_all, const axutil_env_t *env) { - if (neethi_all) + if(neethi_all) { - if (neethi_all->policy_components) + if(neethi_all->policy_components) { int i = 0; int size = 0; size = axutil_array_list_size(neethi_all->policy_components, env); - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) - axutil_array_list_get(neethi_all->policy_components, env, - i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get( + neethi_all->policy_components, env, i); + if(operator) { neethi_operator_free(operator, env); - operator = NULL; + operator = NULL; } operator = NULL; } @@ -108,15 +106,14 @@ int size = axutil_array_list_size(arraylist, env); int i = 0; - if (axutil_array_list_ensure_capacity(all->policy_components, env, size + 1) - != AXIS2_SUCCESS) + if(axutil_array_list_ensure_capacity(all->policy_components, env, size + 1) != AXIS2_SUCCESS) return AXIS2_FAILURE; - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { void *value = NULL; value = axutil_array_list_get(arraylist, env, i); - neethi_operator_increment_ref((neethi_operator_t *) value, env); + neethi_operator_increment_ref((neethi_operator_t *)value, env); axutil_array_list_add(all->policy_components, env, value); } return AXIS2_SUCCESS; @@ -147,40 +144,40 @@ axiom_node_t *parent, const axutil_env_t *env) { - axiom_node_t *all_node = NULL; axiom_element_t *all_ele = NULL; axiom_namespace_t *policy_ns = NULL; axutil_array_list_t *components = NULL; - axis2_status_t status = AXIS2_FAILURE; policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX); - - all_ele = - axiom_element_create(env, parent, NEETHI_ALL, policy_ns, &all_node); - if (!all_node) + all_ele = axiom_element_create(env, parent, NEETHI_ALL, policy_ns, &all_node); + if(!all_node) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "Neethi 'all' node creation failed. Cannot serialize 'all' assertion"); return AXIS2_FAILURE; } - components = neethi_all_get_policy_components(neethi_all, env); - if (components) + components = neethi_all_get_policy_components(neethi_all, env); + if(components) { + axis2_status_t status = AXIS2_FAILURE; int i = 0; - for (i = 0; i < axutil_array_list_size(components, env); i++) + for(i = 0; i < axutil_array_list_size(components, env); i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) axutil_array_list_get(components, - env, i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get(components, env, i); + if(operator) { status = neethi_operator_serialize(operator, env, all_node); - if (status != AXIS2_SUCCESS) + if(status != AXIS2_SUCCESS) { - return status; + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "Neethi operator serialization failed. Cannot serialize 'all' assertion"); + return AXIS2_FAILURE; } } } } - return status; + return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/assertion.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/assertion.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/assertion.c (original) +++ webservices/axis2/trunk/c/neethi/src/assertion.c Mon Aug 17 07:06:01 2009 @@ -52,11 +52,10 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_assertion = (neethi_assertion_t *) AXIS2_MALLOC(env->allocator, - sizeof - (neethi_assertion_t)); + neethi_assertion = (neethi_assertion_t *)AXIS2_MALLOC(env->allocator, + sizeof(neethi_assertion_t)); - if (neethi_assertion == NULL) + if(neethi_assertion == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -65,7 +64,7 @@ neethi_assertion->policy_components = NULL; neethi_assertion->policy_components = axutil_array_list_create(env, 0); - if (!(neethi_assertion->policy_components)) + if(!(neethi_assertion->policy_components)) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -89,10 +88,10 @@ neethi_assertion_type_t type) { neethi_assertion_t *neethi_assertion = NULL; - neethi_assertion = (neethi_assertion_t *) AXIS2_MALLOC( - env->allocator, sizeof(neethi_assertion_t)); + neethi_assertion = (neethi_assertion_t *)AXIS2_MALLOC(env->allocator, + sizeof(neethi_assertion_t)); - if (!neethi_assertion) + if(!neethi_assertion) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi assertion creation failed. Out of memory"); @@ -101,10 +100,10 @@ neethi_assertion->policy_components = NULL; neethi_assertion->policy_components = axutil_array_list_create(env, 0); - if (!(neethi_assertion->policy_components)) + if(!(neethi_assertion->policy_components)) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); - AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi assertion policy components creation failed."); return NULL; } @@ -114,95 +113,95 @@ * struct. So we need to increment the ref count in order to prevent * unnecessary memory freeing */ - if (type == ASSERTION_TYPE_X509_TOKEN) + if(type == ASSERTION_TYPE_X509_TOKEN) { - rp_x509_token_increment_ref((rp_x509_token_t *) value, env); + rp_x509_token_increment_ref((rp_x509_token_t *)value, env); } - else if (type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN) + else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN) { - rp_security_context_token_increment_ref((rp_security_context_token_t *) value, env); + rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env); } - else if (type == ASSERTION_TYPE_INITIATOR_TOKEN) + else if(type == ASSERTION_TYPE_INITIATOR_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); + rp_property_increment_ref((rp_property_t *)value, env); } - else if (type == ASSERTION_TYPE_RECIPIENT_TOKEN) + else if(type == ASSERTION_TYPE_RECIPIENT_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); + rp_property_increment_ref((rp_property_t *)value, env); } - else if (type == ASSERTION_TYPE_PROTECTION_TOKEN) + else if(type == ASSERTION_TYPE_PROTECTION_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); + rp_property_increment_ref((rp_property_t *)value, env); } - else if (type == ASSERTION_TYPE_ENCRYPTION_TOKEN) + else if(type == ASSERTION_TYPE_ENCRYPTION_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); + rp_property_increment_ref((rp_property_t *)value, env); } - else if (type == ASSERTION_TYPE_TRANSPORT_TOKEN) + else if(type == ASSERTION_TYPE_TRANSPORT_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); - } - else if (type == ASSERTION_TYPE_SIGNATURE_TOKEN) + rp_property_increment_ref((rp_property_t *)value, env); + } + else if(type == ASSERTION_TYPE_SIGNATURE_TOKEN) { - rp_property_increment_ref((rp_property_t *) value, env); + rp_property_increment_ref((rp_property_t *)value, env); } - else if (type == ASSERTION_TYPE_LAYOUT) + else if(type == ASSERTION_TYPE_LAYOUT) { - rp_layout_increment_ref((rp_layout_t *) value, env); + rp_layout_increment_ref((rp_layout_t *)value, env); } - else if (type == ASSERTION_TYPE_ALGORITHM_SUITE) + else if(type == ASSERTION_TYPE_ALGORITHM_SUITE) { - rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *) value, env); + rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *)value, env); } - else if (type == ASSERTION_TYPE_WSS10) + else if(type == ASSERTION_TYPE_WSS10) { - rp_wss10_increment_ref((rp_wss10_t *) value, env); + rp_wss10_increment_ref((rp_wss10_t *)value, env); } - else if (type == ASSERTION_TYPE_WSS11) + else if(type == ASSERTION_TYPE_WSS11) { - rp_wss11_increment_ref((rp_wss11_t *) value, env); + rp_wss11_increment_ref((rp_wss11_t *)value, env); } - else if (type == ASSERTION_TYPE_TRUST10) + else if(type == ASSERTION_TYPE_TRUST10) { - rp_trust10_increment_ref((rp_trust10_t *) value, env); + rp_trust10_increment_ref((rp_trust10_t *)value, env); } - else if (type == ASSERTION_TYPE_SUPPORTING_TOKENS) + else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS) { - rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *) value, env); + rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env); } - else if (type == ASSERTION_TYPE_USERNAME_TOKEN) + else if(type == ASSERTION_TYPE_USERNAME_TOKEN) { - rp_username_token_increment_ref((rp_username_token_t *) value, env); + rp_username_token_increment_ref((rp_username_token_t *)value, env); } - else if (type == ASSERTION_TYPE_ASSYMMETRIC_BINDING) + else if(type == ASSERTION_TYPE_ASSYMMETRIC_BINDING) { - rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *) value, env); + rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *)value, env); } - else if (type == ASSERTION_TYPE_SYMMETRIC_BINDING) + else if(type == ASSERTION_TYPE_SYMMETRIC_BINDING) { - rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *) value, env); + rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *)value, env); } - else if (type == ASSERTION_TYPE_TRANSPORT_BINDING) + else if(type == ASSERTION_TYPE_TRANSPORT_BINDING) { - rp_transport_binding_increment_ref((rp_transport_binding_t *) value, env); + rp_transport_binding_increment_ref((rp_transport_binding_t *)value, env); } - else if (type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS) + else if(type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS) { rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *)value, env); } - else if (type == ASSERTION_TYPE_RAMPART_CONFIG) + else if(type == ASSERTION_TYPE_RAMPART_CONFIG) { - rp_rampart_config_increment_ref((rp_rampart_config_t *) value, env); + rp_rampart_config_increment_ref((rp_rampart_config_t *)value, env); } - else if (type == ASSERTION_TYPE_ISSUED_TOKEN) + else if(type == ASSERTION_TYPE_ISSUED_TOKEN) { - rp_issued_token_increment_ref((rp_issued_token_t *) value, env); + rp_issued_token_increment_ref((rp_issued_token_t *)value, env); } - else if (type == ASSERTION_TYPE_SAML_TOKEN) + else if(type == ASSERTION_TYPE_SAML_TOKEN) { - rp_saml_token_increment_ref((rp_saml_token_t *) value, env); + rp_saml_token_increment_ref((rp_saml_token_t *)value, env); } - + neethi_assertion->value = value; neethi_assertion->type = type; neethi_assertion->element = NULL; @@ -218,20 +217,17 @@ neethi_assertion_t *neethi_assertion, const axutil_env_t *env) { - if (neethi_assertion) + if(neethi_assertion) { - if (neethi_assertion->policy_components) + if(neethi_assertion->policy_components) { int i = 0; - for (i = 0; - i < axutil_array_list_size(neethi_assertion->policy_components, - env); i++) + for(i = 0; i < axutil_array_list_size(neethi_assertion->policy_components, env); i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) - axutil_array_list_get(neethi_assertion->policy_components, - env, i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get( + neethi_assertion->policy_components, env, i); + if(operator) neethi_operator_free(operator, env); operator = NULL; @@ -239,9 +235,9 @@ axutil_array_list_free(neethi_assertion->policy_components, env); neethi_assertion->policy_components = NULL; } - if (neethi_assertion->value) + if(neethi_assertion->value) { - if (neethi_assertion->free_func) + if(neethi_assertion->free_func) { neethi_assertion->free_func(neethi_assertion->value, env); } @@ -278,11 +274,11 @@ neethi_assertion_type_t type) { neethi_assertion->type = type; - if (type == ASSERTION_TYPE_X509_TOKEN) + if(type == ASSERTION_TYPE_X509_TOKEN) { - rp_x509_token_increment_ref((rp_x509_token_t *) value, env); + rp_x509_token_increment_ref((rp_x509_token_t *)value, env); } - neethi_assertion->value = (void *) value; + neethi_assertion->value = (void *)value; return AXIS2_SUCCESS; } @@ -361,15 +357,15 @@ int size = axutil_array_list_size(arraylist, env); int i = 0; - if (axutil_array_list_ensure_capacity - (neethi_assertion->policy_components, env, size + 1) != AXIS2_SUCCESS) + if(axutil_array_list_ensure_capacity(neethi_assertion->policy_components, env, size + 1) + != AXIS2_SUCCESS) return AXIS2_FAILURE; - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { void *value = NULL; value = axutil_array_list_get(arraylist, env, i); - neethi_operator_increment_ref((neethi_operator_t *) value, env); + neethi_operator_increment_ref((neethi_operator_t *)value, env); axutil_array_list_add(neethi_assertion->policy_components, env, value); } return AXIS2_SUCCESS; @@ -405,14 +401,14 @@ axiom_node_t *node = NULL; axis2_char_t *localname = NULL; - namespace = - axiom_element_get_namespace(assertion->element, env, assertion->node); + namespace = axiom_element_get_namespace(assertion->element, env, assertion->node); localname = axiom_element_get_localname(assertion->element, env); - element = axiom_element_create(env, parent, localname, namespace, &node); - if (!node) + if(!node) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "%s node creation failed. Cannot serialize %s assertion", localname, localname); return AXIS2_FAILURE; } return AXIS2_SUCCESS; Modified: webservices/axis2/trunk/c/neethi/src/exactlyone.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/exactlyone.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/exactlyone.c (original) +++ webservices/axis2/trunk/c/neethi/src/exactlyone.c Mon Aug 17 07:06:01 2009 @@ -30,11 +30,10 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_exactlyone = (neethi_exactlyone_t *) AXIS2_MALLOC(env->allocator, - sizeof - (neethi_exactlyone_t)); + neethi_exactlyone = (neethi_exactlyone_t *)AXIS2_MALLOC(env->allocator, + sizeof(neethi_exactlyone_t)); - if (neethi_exactlyone == NULL) + if(neethi_exactlyone == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -43,7 +42,7 @@ neethi_exactlyone->policy_components = NULL; neethi_exactlyone->policy_components = axutil_array_list_create(env, 0); - if (!(neethi_exactlyone->policy_components)) + if(!(neethi_exactlyone->policy_components)) { neethi_exactlyone_free(neethi_exactlyone, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); @@ -58,22 +57,21 @@ neethi_exactlyone_t *neethi_exactlyone, const axutil_env_t *env) { - if (neethi_exactlyone) + if(neethi_exactlyone) { - if (neethi_exactlyone->policy_components) + if(neethi_exactlyone->policy_components) { int i = 0; int size = 0; size = axutil_array_list_size(neethi_exactlyone->policy_components, env); - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) - axutil_array_list_get(neethi_exactlyone->policy_components, - env, i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get( + neethi_exactlyone->policy_components, env, i); + if(operator) { neethi_operator_free(operator, env); operator = NULL; @@ -108,15 +106,17 @@ int size = axutil_array_list_size(arraylist, env); int i = 0; - if (axutil_array_list_ensure_capacity - (exactlyone->policy_components, env, size + 1) != AXIS2_SUCCESS) + if(axutil_array_list_ensure_capacity(exactlyone->policy_components, env, size + 1) + != AXIS2_SUCCESS) + { return AXIS2_FAILURE; + } - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { void *value = NULL; value = axutil_array_list_get(arraylist, env, i); - neethi_operator_increment_ref((neethi_operator_t *) value, env); + neethi_operator_increment_ref((neethi_operator_t *)value, env); axutil_array_list_add(exactlyone->policy_components, env, value); } return AXIS2_SUCCESS; @@ -141,50 +141,47 @@ return axutil_array_list_is_empty(exactlyone->policy_components, env); } -/*This function is for serializing*/ AXIS2_EXTERN axis2_status_t AXIS2_CALL neethi_exactlyone_serialize( neethi_exactlyone_t *neethi_exactlyone, axiom_node_t *parent, const axutil_env_t *env) { - axiom_node_t *exactlyone_node = NULL; axiom_element_t *exactlyone_ele = NULL; axiom_namespace_t *policy_ns = NULL; axutil_array_list_t *components = NULL; - axis2_status_t status = AXIS2_FAILURE; policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX); - - exactlyone_ele = - axiom_element_create(env, parent, NEETHI_EXACTLYONE, policy_ns, - &exactlyone_node); - if (!exactlyone_node) + exactlyone_ele = axiom_element_create(env, parent, NEETHI_EXACTLYONE, policy_ns, + &exactlyone_node); + if(!exactlyone_node) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "Cannot create 'ExactlyOne' node. Serialization of 'ExactlyOne' assertion failed"); return AXIS2_FAILURE; } - components = - neethi_exactlyone_get_policy_components(neethi_exactlyone, env); - if (components) + components = neethi_exactlyone_get_policy_components(neethi_exactlyone, env); + if(components) { + axis2_status_t status = AXIS2_FAILURE; int i = 0; - for (i = 0; i < axutil_array_list_size(components, env); i++) + for(i = 0; i < axutil_array_list_size(components, env); i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) axutil_array_list_get(components, - env, i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get(components, env, i); + if(operator) { - status = - neethi_operator_serialize(operator, env, exactlyone_node); - if (status != AXIS2_SUCCESS) + status = neethi_operator_serialize(operator, env, exactlyone_node); + if(status != AXIS2_SUCCESS) { - return status; + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi operator serialization failed. " + "Cannot serialize 'ExactlyOne' assertion"); + return AXIS2_FAILURE; } } } } - return status; + return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/operator.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/operator.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/operator.c (original) +++ webservices/axis2/trunk/c/neethi/src/operator.c Mon Aug 17 07:06:01 2009 @@ -24,7 +24,7 @@ struct neethi_operator_t { - /* This may be a policy, all, exatlyone, refernece + /* This may be a policy, all, exatlyone, reference * or an assertion */ void *value; @@ -43,11 +43,9 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_operator = (neethi_operator_t *) AXIS2_MALLOC(env->allocator, - sizeof - (neethi_operator_t)); + neethi_operator = (neethi_operator_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_operator_t)); - if (neethi_operator == NULL) + if(neethi_operator == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -64,48 +62,44 @@ neethi_operator_t *neethi_operator, const axutil_env_t *env) { - if (neethi_operator) + if(neethi_operator) { - if (--(neethi_operator->ref) > 0) + if(--(neethi_operator->ref) > 0) { return; } - if (neethi_operator->value) + if(neethi_operator->value) { - switch (neethi_operator->type) + switch(neethi_operator->type) { - case OPERATOR_TYPE_POLICY: - neethi_policy_free((neethi_policy_t *) neethi_operator->value, - env); - neethi_operator->value = NULL; - break; - - case OPERATOR_TYPE_ALL: - neethi_all_free((neethi_all_t *) neethi_operator->value, env); - neethi_operator->value = NULL; - break; + case OPERATOR_TYPE_POLICY: + neethi_policy_free((neethi_policy_t *)neethi_operator->value, env); + neethi_operator->value = NULL; + break; + + case OPERATOR_TYPE_ALL: + neethi_all_free((neethi_all_t *)neethi_operator->value, env); + neethi_operator->value = NULL; + break; + + case OPERATOR_TYPE_EXACTLYONE: + neethi_exactlyone_free((neethi_exactlyone_t *)neethi_operator-> value, env); + neethi_operator->value = NULL; + break; + + case OPERATOR_TYPE_REFERENCE: + neethi_reference_free((neethi_reference_t *)neethi_operator-> value, env); + neethi_operator->value = NULL; + break; + + case OPERATOR_TYPE_ASSERTION: + neethi_assertion_free((neethi_assertion_t *)neethi_operator-> value, env); + neethi_operator->value = NULL; + break; - case OPERATOR_TYPE_EXACTLYONE: - neethi_exactlyone_free((neethi_exactlyone_t *) neethi_operator-> - value, env); - neethi_operator->value = NULL; - break; - - case OPERATOR_TYPE_REFERENCE: - neethi_reference_free((neethi_reference_t *) neethi_operator-> - value, env); - neethi_operator->value = NULL; - break; - - case OPERATOR_TYPE_ASSERTION: - neethi_assertion_free((neethi_assertion_t *) neethi_operator-> - value, env); - neethi_operator->value = NULL; - break; - - case OPERATOR_TYPE_UNKNOWN: - break; + case OPERATOR_TYPE_UNKNOWN: + break; } } AXIS2_FREE(env->allocator, neethi_operator); @@ -139,7 +133,7 @@ neethi_operator_type_t type) { neethi_operator->type = type; - neethi_operator->value = (void *) value; + neethi_operator->value = (void *)value; return AXIS2_SUCCESS; } @@ -149,61 +143,50 @@ const axutil_env_t *env, axiom_node_t *parent) { - neethi_policy_t *policy = NULL; neethi_all_t *all = NULL; neethi_exactlyone_t *exactlyone = NULL; neethi_reference_t *reference = NULL; neethi_assertion_t *assertion = NULL; - if (neethi_operator->value) + if(neethi_operator->value) { - switch (neethi_operator->type) + switch(neethi_operator->type) { - case OPERATOR_TYPE_POLICY: - policy = - (neethi_policy_t *) neethi_operator_get_value(neethi_operator, - env); - if (!neethi_policy_serialize(policy, parent, env)) - { - return AXIS2_FAILURE; - } - else - { - return AXIS2_SUCCESS; - } - break; + case OPERATOR_TYPE_POLICY: + policy = (neethi_policy_t *)neethi_operator_get_value(neethi_operator, env); + if(!neethi_policy_serialize(policy, parent, env)) + { + return AXIS2_FAILURE; + } + else + { + return AXIS2_SUCCESS; + } + break; + + case OPERATOR_TYPE_ALL: + all = (neethi_all_t *)neethi_operator_get_value(neethi_operator, env); + return neethi_all_serialize(all, parent, env); + break; - case OPERATOR_TYPE_ALL: - all = - (neethi_all_t *) neethi_operator_get_value(neethi_operator, - env); - return neethi_all_serialize(all, parent, env); - break; - - case OPERATOR_TYPE_EXACTLYONE: - exactlyone = - (neethi_exactlyone_t *) - neethi_operator_get_value(neethi_operator, env); - return neethi_exactlyone_serialize(exactlyone, parent, env); - break; - - case OPERATOR_TYPE_REFERENCE: - reference = - (neethi_reference_t *) - neethi_operator_get_value(neethi_operator, env); - return neethi_reference_serialize(reference, parent, env); - break; - - case OPERATOR_TYPE_ASSERTION: - assertion = - (neethi_assertion_t *) - neethi_operator_get_value(neethi_operator, env); - return neethi_assertion_serialize(assertion, parent, env); - break; + case OPERATOR_TYPE_EXACTLYONE: + exactlyone = (neethi_exactlyone_t *)neethi_operator_get_value(neethi_operator, env); + return neethi_exactlyone_serialize(exactlyone, parent, env); + break; - case OPERATOR_TYPE_UNKNOWN: - break; + case OPERATOR_TYPE_REFERENCE: + reference = (neethi_reference_t *)neethi_operator_get_value(neethi_operator, env); + return neethi_reference_serialize(reference, parent, env); + break; + + case OPERATOR_TYPE_ASSERTION: + assertion = (neethi_assertion_t *)neethi_operator_get_value(neethi_operator, env); + return neethi_assertion_serialize(assertion, parent, env); + break; + + case OPERATOR_TYPE_UNKNOWN: + break; } return AXIS2_SUCCESS; } @@ -211,13 +194,9 @@ return AXIS2_FAILURE; } -/* We need this method to prevent freeing the - * value of operator, because some times we - * wrap certail policy operators inside neethi_operator - * in order to call some functions.See engine.c in - * neethi for more info */ - - +/* We need this method to prevent freeing the value of operator, because some times we wrap certain + * policy operators inside neethi_operator in order to call some functions.See engine.c in neethi + * for more info */ AXIS2_EXTERN axis2_status_t AXIS2_CALL neethi_operator_set_value_null( neethi_operator_t *neethi_operator, Modified: webservices/axis2/trunk/c/neethi/src/policy.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/policy.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/policy.c (original) +++ webservices/axis2/trunk/c/neethi/src/policy.c Mon Aug 17 07:06:01 2009 @@ -19,7 +19,6 @@ #include #include - struct neethi_policy_t { /* Contains the child components */ @@ -33,14 +32,13 @@ axiom_node_t *root_node; }; - -static void neethi_policy_clear_attributes( +static void +neethi_policy_clear_attributes( axutil_hash_t *attributes, const axutil_env_t *env); /* Creates a neethi_policy object */ - AXIS2_EXTERN neethi_policy_t *AXIS2_CALL neethi_policy_create( const axutil_env_t * env) @@ -49,10 +47,9 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_policy = (neethi_policy_t *) AXIS2_MALLOC(env->allocator, - sizeof(neethi_policy_t)); + neethi_policy = (neethi_policy_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_policy_t)); - if (neethi_policy == NULL) + if(neethi_policy == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -61,7 +58,7 @@ neethi_policy->policy_components = NULL; neethi_policy->policy_components = axutil_array_list_create(env, 0); - if (!(neethi_policy->policy_components)) + if(!(neethi_policy->policy_components)) { neethi_policy_free(neethi_policy, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); @@ -75,32 +72,29 @@ } /* Deallocate the memory for the neethi_policy object */ - - AXIS2_EXTERN void AXIS2_CALL neethi_policy_free( neethi_policy_t *neethi_policy, const axutil_env_t *env) { - if (neethi_policy) + if(neethi_policy) { /* We first remove the component list */ - if (neethi_policy->policy_components) + if(neethi_policy->policy_components) { int i = 0; int size = 0; - size = axutil_array_list_size( - neethi_policy->policy_components, env); + size = axutil_array_list_size(neethi_policy->policy_components, env); - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *)axutil_array_list_get( + operator = (neethi_operator_t *)axutil_array_list_get( neethi_policy->policy_components, env, i); - if (operator) - { + if(operator) + { neethi_operator_free(operator, env); } operator = NULL; @@ -110,11 +104,10 @@ } if(neethi_policy->attributes) { - neethi_policy_clear_attributes(neethi_policy->attributes, - env); + neethi_policy_clear_attributes(neethi_policy->attributes, env); neethi_policy->attributes = NULL; } - if (neethi_policy->root_node) + if(neethi_policy->root_node) { axiom_node_free_tree(neethi_policy->root_node, env); neethi_policy->root_node = NULL; @@ -126,8 +119,8 @@ } /* This will free the attribute hash and its content.*/ - -static void neethi_policy_clear_attributes( +static void +neethi_policy_clear_attributes( axutil_hash_t *attributes, const axutil_env_t *env) { @@ -137,8 +130,7 @@ void *val = NULL; const void *key = NULL; - for (hi = axutil_hash_first(attributes, env); hi; - hi = axutil_hash_next(env, hi)) + for(hi = axutil_hash_first(attributes, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); @@ -148,7 +140,7 @@ key = NULL; } - if (val) + if(val) { AXIS2_FREE(env->allocator, (axis2_char_t *)val); val = NULL; @@ -159,7 +151,6 @@ } } /* Implementations */ - AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL neethi_policy_get_policy_components( neethi_policy_t *neethi_policy, @@ -177,18 +168,18 @@ int size = axutil_array_list_size(arraylist, env); int i = 0; - if (axutil_array_list_ensure_capacity - (neethi_policy->policy_components, env, size + 1) != AXIS2_SUCCESS) - { + if(axutil_array_list_ensure_capacity(neethi_policy->policy_components, env, size + 1) + != AXIS2_SUCCESS) + { return AXIS2_FAILURE; } - for (i = 0; i < size; i++) + for(i = 0; i < size; i++) { void *value = NULL; value = axutil_array_list_get(arraylist, env, i); - /* The ref count is incremented in order to prvent double frees.*/ - neethi_operator_increment_ref((neethi_operator_t *) value, env); + /* The ref count is incremented in order to prevent double frees.*/ + neethi_operator_increment_ref((neethi_operator_t *)value, env); axutil_array_list_add(neethi_policy->policy_components, env, value); } return AXIS2_SUCCESS; @@ -215,7 +206,6 @@ /* A normalized policy always has just one child and it is an exactlyone * first child. So this method */ - AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL neethi_policy_get_exactlyone( neethi_policy_t *normalized_neethi_policy, @@ -225,22 +215,21 @@ axutil_array_list_t *list = NULL; list = neethi_policy_get_policy_components(normalized_neethi_policy, env); - if (list) + if(list) { - if (axutil_array_list_size(list, env) == 1) + if(axutil_array_list_size(list, env) == 1) { neethi_operator_t *op = NULL; - op = (neethi_operator_t *) axutil_array_list_get(list, env, 0); - if (!op) + op = (neethi_operator_t *)axutil_array_list_get(list, env, 0); + if(!op) { return NULL; } - if (neethi_operator_get_type(op, env) != OPERATOR_TYPE_EXACTLYONE) + if(neethi_operator_get_type(op, env) != OPERATOR_TYPE_EXACTLYONE) { return NULL; } - exactlyone = - (neethi_exactlyone_t *) neethi_operator_get_value(op, env); + exactlyone = (neethi_exactlyone_t *)neethi_operator_get_value(op, env); return exactlyone; } else @@ -250,11 +239,8 @@ return NULL; } -/* This function is called for a normalized policy - * So it will return the components of the only - * child. That should be an exactlyone The children - * of that exactlyone are alls.*/ - +/* This function is called for a normalized policy So it will return the components of the only + * child. That should be an exactlyone The children of that exactlyone are all.*/ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL neethi_policy_get_alternatives( neethi_policy_t *neethi_policy, @@ -262,16 +248,14 @@ { neethi_exactlyone_t *exactlyone = NULL; exactlyone = neethi_policy_get_exactlyone(neethi_policy, env); - if (!exactlyone) + if(!exactlyone) return NULL; return neethi_exactlyone_get_policy_components(exactlyone, env); } -/* This will return any attribute which has - * the local name of Name */ - +/* This will return any attribute which has the local name of Name */ AXIS2_EXTERN axis2_char_t *AXIS2_CALL neethi_policy_get_name( neethi_policy_t *neethi_policy, @@ -288,13 +272,13 @@ axis2_char_t *key = axutil_qname_to_string(qname, env); if(key) { - name = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key, + name = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key, AXIS2_HASH_KEY_STRING); } axutil_qname_free(qname, env); qname = NULL; return name; - } + } else { return NULL; @@ -306,10 +290,7 @@ } } - -/* This method will return the attribute value of - * wsu:Id if there are any such attributes */ - +/* This method will return the attribute value of wsu:Id if there are any such attributes */ AXIS2_EXTERN axis2_char_t *AXIS2_CALL neethi_policy_get_id( neethi_policy_t *neethi_policy, @@ -326,13 +307,13 @@ axis2_char_t *key = axutil_qname_to_string(qname, env); if(key) { - id = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key, + id = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key, AXIS2_HASH_KEY_STRING); } axutil_qname_free(qname, env); qname = NULL; return id; - } + } else { return NULL; @@ -345,13 +326,10 @@ } -/* When we encounter an attribute with wsu:Id - * we will store it in the hash. We are not - * considering the prefix. Just the namespace and - * the local_name. */ - +/* When we encounter an attribute with wsu:Id we will store it in the hash. We are not + * considering the prefix. Just the namespace and the local_name. */ AXIS2_EXTERN axis2_status_t AXIS2_CALL - neethi_policy_set_id( +neethi_policy_set_id( neethi_policy_t * neethi_policy, const axutil_env_t * env, axis2_char_t * id) @@ -366,7 +344,7 @@ key = axutil_qname_to_string(qname, env); if(key) { - axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key), + axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key), AXIS2_HASH_KEY_STRING, axutil_strdup(env, id)); } axutil_qname_free(qname, env); @@ -378,13 +356,9 @@ } } -/* When we encounter an attribute with Name - * we will store it in the hash. This has no - * Namespace.*/ - - +/* When we encounter an attribute with Name we will store it in the hash. This has no Namespace.*/ AXIS2_EXTERN axis2_status_t AXIS2_CALL - neethi_policy_set_name( +neethi_policy_set_name( neethi_policy_t * neethi_policy, const axutil_env_t * env, axis2_char_t * name) @@ -399,7 +373,7 @@ key = axutil_qname_to_string(qname, env); if(key) { - axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key), + axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key), AXIS2_HASH_KEY_STRING, axutil_strdup(env, name)); } axutil_qname_free(qname, env); @@ -411,7 +385,6 @@ } } - AXIS2_EXTERN axutil_hash_t *AXIS2_CALL neethi_policy_get_attributes( neethi_policy_t *neethi_policy, @@ -427,38 +400,35 @@ axiom_node_t *parent, const axutil_env_t *env) { - axiom_node_t *policy_node = NULL; axiom_element_t *policy_ele = NULL; axiom_namespace_t *policy_ns = NULL; axutil_array_list_t *components = NULL; - axis2_status_t status = AXIS2_FAILURE; policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX); - - policy_ele = - axiom_element_create(env, parent, NEETHI_POLICY, policy_ns, - &policy_node); - if (!policy_ele) + policy_ele = axiom_element_create(env, parent, NEETHI_POLICY, policy_ns, &policy_node); + if(!policy_ele) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "Cannot create policy node. Policy serialization failed"); return NULL; } components = neethi_policy_get_policy_components(neethi_policy, env); - - if (components) + if(components) { int i = 0; - for (i = 0; i < axutil_array_list_size(components, env); i++) + axis2_status_t status = AXIS2_FAILURE; + for(i = 0; i < axutil_array_list_size(components, env); ++i) { neethi_operator_t *operator = NULL; - operator =(neethi_operator_t *) axutil_array_list_get(components, - env, i); - if (operator) + operator = (neethi_operator_t *)axutil_array_list_get(components, env, i); + if(operator) { status = neethi_operator_serialize(operator, env, policy_node); - if (status != AXIS2_SUCCESS) + if(status != AXIS2_SUCCESS) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi operator serialization failed."); return NULL; } } Modified: webservices/axis2/trunk/c/neethi/src/reference.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/reference.c?rev=804879&r1=804878&r2=804879&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/reference.c (original) +++ webservices/axis2/trunk/c/neethi/src/reference.c Mon Aug 17 07:06:01 2009 @@ -30,11 +30,10 @@ AXIS2_ENV_CHECK(env, NULL); - neethi_reference = (neethi_reference_t *) AXIS2_MALLOC(env->allocator, - sizeof - (neethi_reference_t)); + neethi_reference = (neethi_reference_t *)AXIS2_MALLOC(env->allocator, + sizeof(neethi_reference_t)); - if (neethi_reference == NULL) + if(neethi_reference == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); @@ -50,7 +49,7 @@ neethi_reference_t *neethi_reference, const axutil_env_t *env) { - if (neethi_reference) + if(neethi_reference) { AXIS2_FREE(env->allocator, neethi_reference); neethi_reference = NULL; @@ -90,19 +89,16 @@ axiom_attribute_t *att_uri = NULL; policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX); - - ref_ele = - axiom_element_create(env, parent, NEETHI_REFERENCE, policy_ns, - &ref_node); - if (!ref_node) + ref_ele = axiom_element_create(env, parent, NEETHI_REFERENCE, policy_ns, &ref_node); + if(!ref_node) { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "'reference' node creation failed. Cannot serialize 'reference' assertion"); return AXIS2_FAILURE; } - att_uri = - axiom_attribute_create(env, NEETHI_URI, neethi_reference->uri, NULL); + att_uri = axiom_attribute_create(env, NEETHI_URI, neethi_reference->uri, NULL); axiom_element_add_attribute(ref_ele, env, att_uri, ref_node); return AXIS2_SUCCESS; - }