You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ma...@apache.org on 2008/09/12 08:31:50 UTC

svn commit: r694617 - in /webservices/axis2/trunk/c/neethi: include/axis2_rm_assertion.h src/rmpolicy/rm_assertion.c

Author: manjula
Date: Thu Sep 11 23:31:49 2008
New Revision: 694617

URL: http://svn.apache.org/viewvc?rev=694617&view=rev
Log:
Adding rm_policy related stuff.

Modified:
    webservices/axis2/trunk/c/neethi/include/axis2_rm_assertion.h
    webservices/axis2/trunk/c/neethi/src/rmpolicy/rm_assertion.c

Modified: webservices/axis2/trunk/c/neethi/include/axis2_rm_assertion.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/axis2_rm_assertion.h?rev=694617&r1=694616&r2=694617&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/axis2_rm_assertion.h (original)
+++ webservices/axis2/trunk/c/neethi/include/axis2_rm_assertion.h Thu Sep 11 23:31:49 2008
@@ -26,7 +26,7 @@
  */
 
 #include <neethi_includes.h>
-
+#include <neethi_policy.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -243,6 +243,12 @@
         const axutil_env_t * env,
         axis2_char_t* sandesha2_db);
 
+    AXIS2_EXTERN axis2_rm_assertion_t* AXIS2_CALL
+        axis2_rm_assertion_get_from_policy(
+        const axutil_env_t *env,
+        neethi_policy_t *policy);
+
+
 
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/neethi/src/rmpolicy/rm_assertion.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/rmpolicy/rm_assertion.c?rev=694617&r1=694616&r2=694617&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/rmpolicy/rm_assertion.c (original)
+++ webservices/axis2/trunk/c/neethi/src/rmpolicy/rm_assertion.c Thu Sep 11 23:31:49 2008
@@ -17,6 +17,8 @@
  */
 
 #include <axis2_rm_assertion.h>
+#include <neethi_assertion.h>
+#include <neethi_all.h>
 
 struct axis2_rm_assertion_t
 {
@@ -535,3 +537,49 @@
  
     return AXIS2_SUCCESS;
 }
+
+
+AXIS2_EXTERN axis2_rm_assertion_t* AXIS2_CALL
+axis2_rm_assertion_get_from_policy(
+    const axutil_env_t *env,
+    neethi_policy_t *policy)
+{
+    axutil_array_list_t *alternatives = NULL;
+    neethi_operator_t *component = NULL;
+    neethi_all_t *all = NULL;
+    axutil_array_list_t *arraylist = NULL;
+    neethi_operator_t *operator = NULL;
+    neethi_assertion_t *assertion = NULL;
+    neethi_assertion_type_t type;
+    void *value = NULL;
+    int i = 0;
+
+    alternatives = neethi_policy_get_alternatives(policy, env);
+
+    component =
+        (neethi_operator_t *) axutil_array_list_get(alternatives, env, 0);
+    all = (neethi_all_t *) neethi_operator_get_value(component, env);
+
+    arraylist = neethi_all_get_policy_components(all, env);
+
+    for (i = 0; i < axutil_array_list_size(arraylist, env); i++)
+    {
+        operator =(neethi_operator_t *) axutil_array_list_get(arraylist, env,
+                                                              i);
+        assertion =
+            (neethi_assertion_t *) neethi_operator_get_value(operator, env);
+        value = neethi_assertion_get_value(assertion, env);
+        type = neethi_assertion_get_type(assertion, env);
+
+        if (value)
+        {
+            if (type == ASSERTION_TYPE_RM_ASSERTION)
+            {
+                return (axis2_rm_assertion_t *)value;
+            }
+        }
+    }
+    
+    return NULL;
+}
+