You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/04/23 14:48:44 UTC

svn commit: r531453 - in /webservices/axis2/scratch/c/neethi/axis2c: include/ src/core/deployment/ src/core/description/ src/core/engine/

Author: samisa
Date: Mon Apr 23 05:48:38 2007
New Revision: 531453

URL: http://svn.apache.org/viewvc?view=rev&rev=531453
Log:
Added service building logic to include policy parsing

Modified:
    webservices/axis2/scratch/c/neethi/axis2c/include/axis2_msg.h
    webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/Makefile.am
    webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_deployment.h
    webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_desc_builder.h
    webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/desc_builder.c
    webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/svc_builder.c
    webservices/axis2/scratch/c/neethi/axis2c/src/core/description/msg.c
    webservices/axis2/scratch/c/neethi/axis2c/src/core/engine/Makefile.am

Modified: webservices/axis2/scratch/c/neethi/axis2c/include/axis2_msg.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/include/axis2_msg.h?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/include/axis2_msg.h (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/include/axis2_msg.h Mon Apr 23 05:48:38 2007
@@ -240,6 +240,10 @@
     axis2_msg_get_base(const axis2_msg_t *msg,
         const axutil_env_t *env);
 
+    AXIS2_EXTERN axutil_param_container_t *AXIS2_CALL
+    axis2_msg_get_param_container(const axis2_msg_t *msg,
+        const axutil_env_t *env);
+
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/Makefile.am?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/Makefile.am (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/Makefile.am Mon Apr 23 05:48:38 2007
@@ -34,4 +34,5 @@
             -I$(top_builddir)/src/core/deployment \
             -I$(top_builddir)/src/core/util \
             -I$(top_builddir)/axiom/include \
+            -I$(top_builddir)/neethi/include \
             -I$(top_builddir)/util/include

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_deployment.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_deployment.h?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_deployment.h (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_deployment.h Mon Apr 23 05:48:38 2007
@@ -89,6 +89,10 @@
 #define AXIS2_ATUSE "use"
 #define AXIS2_MEP "mep"
 
+/* for messages */
+#define AXIS2_MESSAGE "message"
+#define AXIS2_LABEL "label"
+
 /* for handlers */
 #define AXIS2_REF "ref"
 #define AXIS2_CLASSNAME "class"

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_desc_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_desc_builder.h?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_desc_builder.h (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/axis2_desc_builder.h Mon Apr 23 05:48:38 2007
@@ -44,6 +44,7 @@
 #include <axiom_children_with_specific_attribute_iterator.h>
 #include <axis2_phase.h>
 #include <axutil_dll_desc.h>
+#include <axis2_policy_include.h>
 
 
 #ifdef __cplusplus
@@ -231,6 +232,17 @@
         axis2_char_t *file_name,
         struct axis2_dep_engine *engine);
 
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_process_policy_elements(const axutil_env_t *env,
+        int type, 
+        axiom_children_qname_iterator_t *iterator,
+        axis2_policy_include_t *policy_include);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_process_policy_reference_elements(const axutil_env_t *env,
+        int type, 
+        axiom_children_qname_iterator_t *iterator,
+        axis2_policy_include_t *policy_include);
 /** @} */
 
 #ifdef __cplusplus

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/desc_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/desc_builder.c?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/desc_builder.c (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/desc_builder.c Mon Apr 23 05:48:38 2007
@@ -21,6 +21,7 @@
 #include <axutil_utils.h>
 #include <axutil_generic_obj.h>
 #include <axis2_raw_xml_in_out_msg_recv.h>
+#include <neethi_engine.h>
 
 struct axis2_desc_builder
 {
@@ -797,7 +798,6 @@
     return AXIS2_SUCCESS;
 }
 
-
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_desc_builder_process_op_module_refs(axis2_desc_builder_t *desc_builder,
     const axutil_env_t *env,
@@ -1009,3 +1009,54 @@
 {
     return desc_builder->engine;
 }
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_process_policy_elements(const axutil_env_t *env,
+    int type, 
+    axiom_children_qname_iterator_t *iterator,
+    axis2_policy_include_t *policy_include) 
+{
+    while (axiom_children_qname_iterator_has_next(iterator, env))
+    {
+        axiom_node_t *node = NULL;
+        node = axiom_children_qname_iterator_next(iterator, env);
+        if (node)
+        {
+            axiom_element_t *element = NULL;
+            neethi_policy_t *policy = NULL;
+            
+            element = axiom_node_get_data_element(node, env);
+            policy = neethi_engine_get_policy(env, node, element);
+            axis2_policy_include_add_policy_element(policy_include, env, 
+                type, policy);
+        }
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_process_policy_reference_elements(const axutil_env_t *env,
+    int type, 
+    axiom_children_qname_iterator_t *iterator,
+    axis2_policy_include_t *policy_include) 
+{
+    while (axiom_children_qname_iterator_has_next(iterator, env))
+    {
+        axiom_node_t *node = NULL;
+        node = axiom_children_qname_iterator_next(iterator, env);
+        if (node)
+        {
+            axiom_element_t *element = NULL;
+            neethi_reference_t *reference = NULL;
+            
+            element = axiom_node_get_data_element(node, env);
+            /* TODO: add neethi_engine_get_policy_reference
+            reference = neethi_engine_get_policy_reference(env, node, element);*/
+            axis2_policy_include_add_policy_reference_element(policy_include, env, 
+                type, reference);
+        }
+    }
+    return AXIS2_SUCCESS;
+}
+
+

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/svc_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/svc_builder.c?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/svc_builder.c (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/deployment/svc_builder.c Mon Apr 23 05:48:38 2007
@@ -19,6 +19,7 @@
 #include <axutil_class_loader.h>
 #include <axutil_utils.h>
 #include <axutil_property.h>
+#include <axis2_msg.h>
 
 struct axis2_svc_builder
 {
@@ -31,6 +32,12 @@
     const axutil_env_t *env,
     axiom_children_qname_iterator_t *op_itr);
 
+static void 
+axis2_svc_builder_process_msgs(axis2_svc_builder_t *svc_builder,
+    const axutil_env_t *env,
+    axiom_children_qname_iterator_t *iterator,
+    axis2_op_t *op);
+
 AXIS2_EXTERN axis2_svc_builder_t *AXIS2_CALL
 axis2_svc_builder_create(const axutil_env_t *env)
 {
@@ -148,6 +155,7 @@
     axutil_qname_t *qout_faultflowst = NULL;
     axutil_qname_t *qopst = NULL;
     axutil_qname_t *qattname = NULL;
+    axutil_qname_t *qpolicy = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     axis2_svc_grp_t *parent = NULL;
     axiom_element_t *desc_element = NULL;
@@ -177,6 +185,8 @@
     int i = 0;
     int size = 0;
     AXIS2_TIME_T timestamp = 0;
+    axis2_desc_t *desc = NULL;
+    axis2_policy_include_t *policy_include = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, svc_node, AXIS2_FAILURE);
@@ -193,7 +203,11 @@
         svc_node);
     axutil_qname_free(qparamst, env);
     qparamst = NULL;
+    
     parent = axis2_svc_get_parent(svc_builder->svc, env);
+    
+    desc = axis2_svc_get_base(svc_builder->svc,  env);
+    policy_include = axis2_desc_get_policy_include(desc, env);
 
     status = axis2_desc_builder_process_params(svc_builder->desc_builder, env,
         itr, 
@@ -380,6 +394,37 @@
         axis2_svc_add_op(svc_builder->svc, env, op_desc);
     }
     axutil_array_list_free(ops, env);
+
+    /*
+      <schema targetNamespace="http://x.y.z"/>
+      setting the PolicyInclude
+      processing <wsp:Policy> .. </..> elements
+    */
+    qpolicy = axutil_qname_create(env, NEETHI_POLICY, NEETHI_NAMESPACE, NULL);
+    itr = axiom_element_get_children_with_qname(svc_element, env,
+            qpolicy, svc_node);
+    axutil_qname_free(qpolicy, env) ;
+    qpolicy = NULL;
+
+    if (itr)
+    {
+        axis2_process_policy_elements(env, AXIS2_SERVICE_POLICY, itr,
+            policy_include);
+    }
+
+    /* processing <wsp:PolicyReference> .. </..> elements */
+    qpolicy = axutil_qname_create(env, NEETHI_REFERENCE, NEETHI_NAMESPACE, NULL);
+    itr = axiom_element_get_children_with_qname(svc_element, env,
+            qpolicy, svc_node);
+    axutil_qname_free(qpolicy, env) ;
+    qpolicy = NULL;
+
+    if (itr)
+    {
+        axis2_process_policy_reference_elements(env, AXIS2_SERVICE_POLICY, itr,
+            policy_include);
+    }
+
     return AXIS2_SUCCESS;
 }
 
@@ -415,6 +460,11 @@
         axiom_node_t *recv_node = NULL;
         axis2_status_t status = AXIS2_FAILURE;
         struct axis2_dep_engine *dep_engine = NULL;
+        axis2_desc_t *desc = NULL;
+        axis2_policy_include_t *policy_include = NULL;
+        axiom_children_qname_iterator_t *itr = NULL;
+        axutil_qname_t *qpolicy = NULL;
+        axutil_qname_t *qmessage = NULL;
 
         op_node = axiom_children_qname_iterator_next(op_itr, env);
         /* getting operation name */
@@ -437,23 +487,21 @@
         if (op_mep_att)
         {
             mep_url = axiom_attribute_get_value(op_mep_att, env);
-            /*
-            TODO value has to be validate
-            TODO
-             op_descrip.setMessageExchangePattern(mep);
-            */
+            if(mep_url)
+            {
+                axis2_op_set_msg_exchange_pattern(op_desc, env, mep_url);
+            }
         }
         op_name = axiom_attribute_get_value(op_name_att, env);
         qopname = axutil_qname_create(env, op_name, NULL, NULL);
         op_desc = axis2_op_create(env);
-        if(mep_url)
-        {
-            axis2_op_set_msg_exchange_pattern(op_desc, env, mep_url);
-        }
         axis2_op_set_qname(op_desc, env, qopname);
-
         axutil_qname_free(qopname, env);
         qopname = NULL;
+
+        desc = axis2_op_get_base(op_desc,  env);
+        policy_include = axis2_desc_get_policy_include(desc, env);
+
         /* operation parameters */
         qparamst = axutil_qname_create(env, AXIS2_PARAMETERST, NULL, NULL);
         params_itr = axiom_element_get_children_with_qname(op_element, env,
@@ -501,6 +549,48 @@
         {
             return AXIS2_FAILURE;
         }
+
+        /* setting the policy_include */
+
+        /* processing <wsp:Policy> .. </..> elements */
+        
+        qpolicy = axutil_qname_create(env, NEETHI_POLICY, NEETHI_NAMESPACE, NULL);
+        itr = axiom_element_get_children_with_qname(op_element, env,
+                qpolicy, op_node);
+        axutil_qname_free(qpolicy, env) ;
+        qpolicy = NULL;
+
+        if (itr)
+        {
+            axis2_process_policy_elements(env, AXIS2_SERVICE_POLICY, itr,
+                policy_include);
+        }
+
+        /* processing <wsp:PolicyReference> .. </..> elements */
+        qpolicy = axutil_qname_create(env, NEETHI_REFERENCE, NEETHI_NAMESPACE, NULL);
+        itr = axiom_element_get_children_with_qname(op_element, env,
+                qpolicy, op_node);
+        axutil_qname_free(qpolicy, env) ;
+        qpolicy = NULL;
+
+        if (itr)
+        {
+            axis2_process_policy_reference_elements(env, AXIS2_SERVICE_POLICY, itr,
+                policy_include);
+        }
+
+        qmessage = axutil_qname_create(env, AXIS2_MESSAGE, NULL, NULL);
+        itr = axiom_element_get_children_with_qname(op_element, env,
+                qmessage, op_node);
+        axutil_qname_free(qmessage, env) ;
+        qmessage = NULL;
+
+        if (itr)
+        {
+            axis2_svc_builder_process_msgs(svc_builder, env,
+                itr, op_desc);
+        }
+
         /* setting operation phase */
         dep_engine = 
             axis2_desc_builder_get_dep_engine(svc_builder->desc_builder, env);
@@ -518,6 +608,88 @@
     return ops;
 }
 
+static void 
+axis2_svc_builder_process_msgs(axis2_svc_builder_t *svc_builder,
+    const axutil_env_t *env,
+    axiom_children_qname_iterator_t *iterator,
+    axis2_op_t *op)
+{
+    while (AXIS2_TRUE == axiom_children_qname_iterator_has_next(iterator, env))
+    {
+        axiom_node_t *node = NULL;
+        axiom_element_t *element = NULL;
+        axutil_qname_t *qname = NULL;
+        axis2_char_t *msg_label = NULL;
+        axis2_msg_t *msg = NULL;
+        axiom_children_qname_iterator_t *itr = NULL;
+        axutil_qname_t *qpolicy = NULL;
+        axis2_desc_t *desc = NULL;
+        axis2_policy_include_t *policy_include = NULL;
+                
+        
+        node = axiom_children_qname_iterator_next(iterator, env);
+        element = axiom_node_get_data_element(node, env);
+        qname = axutil_qname_create(env, AXIS2_LABEL, NULL, NULL);
+
+        if (element)
+        {
+            msg_label = axiom_element_get_attribute_value(element, env, qname);
+        }
+
+        if(msg_label)
+        {
+            msg = axis2_op_get_msg(op, env, msg_label);
+        }
+
+        if (msg)
+        {
+            /* operation parameters */
+            axiom_children_qname_iterator_t *params_itr = NULL;
+            axutil_qname_t *qparamst = NULL;
+            qparamst = axutil_qname_create(env, AXIS2_PARAMETERST, NULL, NULL);
+            params_itr = axiom_element_get_children_with_qname(element, env,
+                    qparamst, node);
+            axutil_qname_free(qparamst, env);
+            qparamst = NULL;
+            axis2_desc_builder_process_params(svc_builder->desc_builder,
+                env, params_itr, 
+                axis2_msg_get_param_container(msg, env), 
+                axis2_op_get_param_container(op, env));
+
+            desc = axis2_msg_get_base(msg,  env);
+            policy_include = axis2_desc_get_policy_include(desc, env);
+
+            /* setting the policy_include */
+
+            /* processing <wsp:Policy> .. </..> elements */
+            
+            qpolicy = axutil_qname_create(env, NEETHI_POLICY, NEETHI_NAMESPACE, NULL);
+            itr = axiom_element_get_children_with_qname(element, env,
+                    qpolicy, node);
+            axutil_qname_free(qpolicy, env) ;
+            qpolicy = NULL;
+
+            if (itr)
+            {
+                axis2_process_policy_elements(env, AXIS2_SERVICE_POLICY, itr,
+                    policy_include);
+            }
+
+            /* processing <wsp:PolicyReference> .. </..> elements */
+            qpolicy = axutil_qname_create(env, NEETHI_REFERENCE, NEETHI_NAMESPACE, NULL);
+            itr = axiom_element_get_children_with_qname(element, env,
+                    qpolicy, node);
+            axutil_qname_free(qpolicy, env) ;
+            qpolicy = NULL;
+
+            if (itr)
+            {
+                axis2_process_policy_reference_elements(env, AXIS2_SERVICE_POLICY, itr,
+                    policy_include);
+            }
+        }
+    }
+}
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_svc_builder_process_svc_module_conf(axis2_svc_builder_t *svc_builder,

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/description/msg.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/description/msg.c?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/description/msg.c (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/description/msg.c Mon Apr 23 05:48:38 2007
@@ -349,3 +349,9 @@
     return msg->base;
 }
 
+AXIS2_EXTERN axutil_param_container_t *AXIS2_CALL
+axis2_msg_get_param_container(const axis2_msg_t *msg,
+    const axutil_env_t *env)
+{
+    return msg->param_container;
+}

Modified: webservices/axis2/scratch/c/neethi/axis2c/src/core/engine/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/src/core/engine/Makefile.am?view=diff&rev=531453&r1=531452&r2=531453
==============================================================================
--- webservices/axis2/scratch/c/neethi/axis2c/src/core/engine/Makefile.am (original)
+++ webservices/axis2/scratch/c/neethi/axis2c/src/core/engine/Makefile.am Mon Apr 23 05:48:38 2007
@@ -36,6 +36,7 @@
             -I$(top_builddir)/src/core/util \
             -I$(top_builddir)/src/core/clientapi \
             -I$(top_builddir)/util/include \
+            -I$(top_builddir)/neethi/include \
             -I$(top_builddir)/axiom/include
 
 EXTRA_DIST=axis2_disp_checker.h



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org