axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r672486 - in /webservices/axis2/trunk/c: include/axis2_phase_resolver.h include/axis2_phases_info.h src/core/deployment/conf_builder.c src/core/deployment/phases_info.c
Date Sat, 28 Jun 2008 09:52:55 GMT
Author: damitha
Date: Sat Jun 28 02:52:55 2008
New Revision: 672486

URL: http://svn.apache.org/viewvc?rev=672486&view=rev
Log:
Adding useful code comments.

Modified:
    webservices/axis2/trunk/c/include/axis2_phase_resolver.h
    webservices/axis2/trunk/c/include/axis2_phases_info.h
    webservices/axis2/trunk/c/src/core/deployment/conf_builder.c
    webservices/axis2/trunk/c/src/core/deployment/phases_info.c

Modified: webservices/axis2/trunk/c/include/axis2_phase_resolver.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_phase_resolver.h?rev=672486&r1=672485&r2=672486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_phase_resolver.h (original)
+++ webservices/axis2/trunk/c/include/axis2_phase_resolver.h Sat Jun 28 02:52:55 2008
@@ -21,13 +21,6 @@
 
 /**
  * @defgroup axis2_phase_resolver phase resolver
- * @ingroup axis2
- * @{
- * @}
- */
-
-/**
- * @defgroup axis2_phase_res phase resolver
  * @ingroup axis2_phase_resolver
  *
  * Engaging modules into axis2 configuration, services and operations are done here. 

Modified: webservices/axis2/trunk/c/include/axis2_phases_info.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_phases_info.h?rev=672486&r1=672485&r2=672486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_phases_info.h (original)
+++ webservices/axis2/trunk/c/include/axis2_phases_info.h Sat Jun 28 02:52:55 2008
@@ -20,8 +20,18 @@
 #define AXIS2_PHASES_INFO_H
 
 /** @defgroup axis2_phases_info phases information
- * @ingroup axis2_engine
- * Description
+ * @ingroup axis2_deployment
+ * 
+ * In deployment engine when configuration builder parse phase order elements in axis2.xml,
for
+ * phases defined in a phase order it will create a phase name list and add it to the phases
+ * info. There are four phase orders. inflow, outflow, in faultflow and out faultflow.
+ * So configuration builder add array lists for each of this phase orders into the phases
info.
+ *
+ * At the time of module engagement phase resolver call the functions here to retrieve phase
+ * lists for each flow for the purpose of adding handlers. When such a request come what
each
+ * function do is, create phase instances list for corresponding phase names stored in the
phase name 
+ * list for that flow and return.
+ *
  * @{
  */
 
@@ -54,6 +64,9 @@
         const axutil_env_t * env);
 
     /**
+     * Set the inflow phase names as an array list. These phases are defined in the inflow
phase 
+     * order element defined in axis2.xml.
+     *
      * @param phases_info pointer to phases info
      * @param env pointer to environment struct
      * @param in_phases inter to in phases
@@ -66,6 +79,9 @@
         axutil_array_list_t * in_phases);
 
     /**
+     * Set the outflow phase names as an array list. These phases are defined in the outflow
phase 
+     * order element defined in axis2.xml.
+     *
      * @param phases_info pointer to phases info
      * @param env pointer to environment struct
      * @param out_phases pointer to out phases
@@ -78,6 +94,9 @@
         axutil_array_list_t * out_phases);
 
     /**
+     * Set the INfaultflow phase names as an array list. These phases are defined in the
INfaultflow 
+     * phase order element defined in axis2.xml.
+     *
      * @param phases_info pointer to phases info
      * @param env pointer to environment struct
      * @param in_faultphases pionter to in fault phases
@@ -91,6 +110,9 @@
         axutil_array_list_t * in_faultphases);
 
     /**
+     * Set the Outfaultflow phase names as an array list. These phases are defined in the

+     * Outfaultflow phase order element defined in axis2.xml.
+     *
      * @param phases_info pointer to phases info
      * @param env pointer to env
      * @param out_faultphases pointer to out fault phases

Modified: webservices/axis2/trunk/c/src/core/deployment/conf_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/deployment/conf_builder.c?rev=672486&r1=672485&r2=672486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/deployment/conf_builder.c (original)
+++ webservices/axis2/trunk/c/src/core/deployment/conf_builder.c Sat Jun 28 02:52:55 2008
@@ -515,7 +515,10 @@
 }
 
 /**
- * To process all the phase orders which are defined in axis2.xml
+ * To process all the phase orders which are defined in axis2.xml retrieve each phase order
node
+ * from the iterator passed as parameter and from each phase order node retrieve phases list
+ * defined for that phase order. Add the phases names into a array list and set it into the

+ * dep_engine->phases_info with the corresponding phase order name.
  * @param phase_orders
  */
 static axis2_status_t
@@ -526,16 +529,14 @@
 {
     axis2_phases_info_t *info = NULL;
 
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "Entry:axis2_conf_builder_process_phase_orders");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_conf_builder_process_phase_orders");
+
     AXIS2_PARAM_CHECK(env->error, phase_orders, AXIS2_FAILURE);
 
-    info =
-        axis2_dep_engine_get_phases_info(axis2_desc_builder_get_dep_engine
-                                         (conf_builder->desc_builder, env),
-                                         env);
-    while (AXIS2_TRUE ==
-           axiom_children_qname_iterator_has_next(phase_orders, env))
+    info = axis2_dep_engine_get_phases_info(axis2_desc_builder_get_dep_engine(
+                conf_builder->desc_builder, env), env);
+
+    while (axiom_children_qname_iterator_has_next(phase_orders, env))
     {
         axiom_node_t *phase_orders_node = NULL;
         axiom_element_t *phase_orders_element = NULL;
@@ -544,19 +545,15 @@
         axis2_char_t *flow_type = NULL;
         axutil_array_list_t *phase_list = NULL;
 
-        phase_orders_node =
-            (axiom_node_t *) axiom_children_qname_iterator_next(phase_orders,
-                                                                env);
+        phase_orders_node = (axiom_node_t *) axiom_children_qname_iterator_next(phase_orders,
env);
         if (phase_orders_node)
         {
-            phase_orders_element =
-                axiom_node_get_data_element(phase_orders_node, env);
+            phase_orders_element = axiom_node_get_data_element(phase_orders_node, env);
         }
         if (phase_orders_element)
         {
             qtype = axutil_qname_create(env, AXIS2_TYPE, NULL, NULL);
-            phase_orders_att = axiom_element_get_attribute(phase_orders_element,
-                                                           env, qtype);
+            phase_orders_att = axiom_element_get_attribute(phase_orders_element, env, qtype);
             axutil_qname_free(qtype, env);
         }
 
@@ -565,18 +562,20 @@
             flow_type = axiom_attribute_get_value(phase_orders_att, env);
         }
 
-        phase_list = axis2_conf_builder_get_phase_list(conf_builder, env,
-                                                       phase_orders_node);
+        phase_list = axis2_conf_builder_get_phase_list(conf_builder, env, phase_orders_node);
         if (!phase_list)
         {
             axis2_status_t status_code = AXIS2_FAILURE;
+
             status_code = AXIS2_ERROR_GET_STATUS_CODE(env->error);
             if (AXIS2_SUCCESS != status_code)
             {
                 return status_code;
             }
+
             return AXIS2_SUCCESS;
         }
+
         if (flow_type && !axutil_strcmp(AXIS2_IN_FLOW_START, flow_type))
         {
             axis2_phases_info_set_in_phases(info, env, phase_list);
@@ -585,22 +584,24 @@
         {
             axis2_phases_info_set_in_faultphases(info, env, phase_list);
         }
-        else if (flow_type &&
-                 !axutil_strcmp(AXIS2_OUT_FLOW_START, flow_type))
+        else if (flow_type && !axutil_strcmp(AXIS2_OUT_FLOW_START, flow_type))
         {
             axis2_phases_info_set_out_phases(info, env, phase_list);
         }
-        else if (flow_type &&
-                 !axutil_strcmp(AXIS2_OUT_FAILTFLOW, flow_type))
+        else if (flow_type && !axutil_strcmp(AXIS2_OUT_FAILTFLOW, flow_type))
         {
             axis2_phases_info_set_out_faultphases(info, env, phase_list);
         }
     }
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "Exit:axis2_conf_builder_process_phase_orders");
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_conf_builder_process_phase_orders");
+
     return AXIS2_SUCCESS;
 }
 
+/* From the phase order node passed as parameter retrieve all phase element nodes. From them
extract
+ * the phase name and add it to a array list. Return the array list.
+ */
 static axutil_array_list_t *
 axis2_conf_builder_get_phase_list(
     axis2_conf_builder_t * conf_builder,
@@ -612,31 +613,33 @@
     axutil_qname_t *qphase = NULL;
     axiom_element_t *phase_orders_element;
 
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "Entry:axis2_conf_builder_get_phase_list");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_conf_builder_get_phase_list");
+
     AXIS2_PARAM_CHECK(env->error, phase_orders_node, NULL);
 
     phase_orders_element = axiom_node_get_data_element(phase_orders_node, env);
     if (!phase_orders_element)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Retrieving phase orders data element from phase orders node "\
-            "failed. Unable to continue");
+            "Retrieving phase orders data element from phase orders node failed. Unable to
continue");
+
         return NULL;
     }
+
     phase_list = axutil_array_list_create(env, 0);
     qphase = axutil_qname_create(env, AXIS2_PHASE, NULL, NULL);
-    phases = axiom_element_get_children_with_qname(phase_orders_element, env,
-                                                   qphase, phase_orders_node);
+    phases = axiom_element_get_children_with_qname(phase_orders_element, env, qphase, 
+            phase_orders_node);
+
     axutil_qname_free(qphase, env);
     if (!phases)
     {
         axutil_array_list_free(phase_list, env);
+
         /* I guess this is not an error. So adding debug message*/
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-            "No phase node found in the phase orders node");
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No phase node found in the phase orders
node");
+
         return NULL;
     }
 
@@ -648,25 +651,23 @@
         axutil_qname_t *qattname = NULL;
         axis2_char_t *att_value = NULL;
 
-        phase_node =
-            (axiom_node_t *) axiom_children_qname_iterator_next(phases, env);
+        phase_node = (axiom_node_t *) axiom_children_qname_iterator_next(phases, env);
         if (phase_node)
         {
-            phase_element =
-                (axiom_element_t *) axiom_node_get_data_element(phase_node,
-                                                                env);
+            phase_element = (axiom_element_t *) axiom_node_get_data_element(phase_node, env);
         }
 
         qattname = axutil_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
         if (phase_element)
         {
-            phase_att = axiom_element_get_attribute(phase_element, env,
-                                                    qattname);
+            phase_att = axiom_element_get_attribute(phase_element, env, qattname);
         }
+
         if (phase_att)
         {
             att_value = axiom_attribute_get_value(phase_att, env);
         }
+
         if (att_value)
         {
             axutil_array_list_add(phase_list, env, att_value);
@@ -674,8 +675,9 @@
 
         axutil_qname_free(qattname, env);
     }
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "Exit:axis2_conf_builder_get_phase_list");
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_conf_builder_get_phase_list");
+
     return phase_list;
 }
 

Modified: webservices/axis2/trunk/c/src/core/deployment/phases_info.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/deployment/phases_info.c?rev=672486&r1=672485&r2=672486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/deployment/phases_info.c (original)
+++ webservices/axis2/trunk/c/src/core/deployment/phases_info.c Sat Jun 28 02:52:55 2008
@@ -217,6 +217,9 @@
     return phases_info->out_faultphases;
 }
 
+/* Here we create the operation inflow as an array list and create phases for phases defined
in
+ * inflow of axis2.xml and add them into the array list.
+ */
 AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
 axis2_phases_info_get_op_in_phases(
     const axis2_phases_info_t * phases_info,
@@ -242,17 +245,19 @@
     {
         return op_in_phases;
     }
+
+    /* For each inflow phase name create a phase instance and add into the inflow. */
     size = axutil_array_list_size(phases_info->in_phases, env);
     for (i = 0; i < size; i++)
     {
-        phase_name = (axis2_char_t *)
-            axutil_array_list_get(phases_info->in_phases, env, i);
+        phase_name = (axis2_char_t *) axutil_array_list_get(phases_info->in_phases, env,
i);
+
         if (!axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name) ||
             !axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name) ||
             !axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name) ||
             !axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
         {
-            /* Do nothing */
+            /* We are not concerned here with system phases. */
         }
         else
         {
@@ -293,6 +298,9 @@
     return op_in_phases;
 }
 
+/* Here we create the operation outflow as an array list and create phases for phases defined
in
+ * outflow of axis2.xml and add them into the array list.
+ */
 AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
 axis2_phases_info_get_op_out_phases(
     const axis2_phases_info_t * phases_info,
@@ -311,24 +319,18 @@
     {
         size = axutil_array_list_size(phases_info->out_phases, env);
     }
+
     op_out_phases = axutil_array_list_create(env, 0);
     if (!op_out_phases)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+
     for (i = 0; i < size; i++)
     {
-        phase_name = (axis2_char_t *) axutil_array_list_get(phases_info->
-                                                            out_phases, env, i);
-        /*phase = axutil_hash_get(phases_info->op_out_phases, phase_name, 
-           AXIS2_HASH_KEY_STRING);
-           if(!phase)
-           {
-           phase = axis2_phase_create(env, phase_name);
-           axutil_hash_set(phases_info->op_out_phases, phase_name,
-           AXIS2_HASH_KEY_STRING, phase);
-           } */
+        phase_name = (axis2_char_t *) axutil_array_list_get(phases_info->out_phases, env,
i);
+
         phase = axis2_phase_create(env, phase_name);
         status = axutil_array_list_add(op_out_phases, env, phase);
         if (AXIS2_SUCCESS != status)
@@ -345,11 +347,13 @@
                 axis2_phase_free(phase, env);
                 phase = NULL;
             }
+
             axutil_array_list_free(op_out_phases, env);
             op_out_phases = NULL;
             return NULL;
         }
     }
+
     return op_out_phases;
 }
 
@@ -371,11 +375,13 @@
     {
         return NULL;
     }
+
     size = axutil_array_list_size(phases_info->in_faultphases, env);
     if (0 == size)
     {
         return NULL;
     }
+
     op_in_faultphases = axutil_array_list_create(env, 0);
     if (!op_in_faultphases)
     {
@@ -384,16 +390,8 @@
     }
     for (i = 0; i < size; i++)
     {
-        phase_name = (axis2_char_t *)
-            axutil_array_list_get(phases_info->in_faultphases, env, i);
-        /*phase = axutil_hash_get(phases_info->op_in_faultphases, phase_name, 
-           AXIS2_HASH_KEY_STRING);
-           if(!phase)
-           {
-           phase = axis2_phase_create(env, phase_name);
-           axutil_hash_set(phases_info->op_in_faultphases, 
-           phase_name, AXIS2_HASH_KEY_STRING, phase);
-           } */
+        phase_name = (axis2_char_t *) axutil_array_list_get(phases_info->in_faultphases,
env, i);
+
         phase = axis2_phase_create(env, phase_name);
         status = axutil_array_list_add(op_in_faultphases, env, phase);
         if (AXIS2_SUCCESS != status)
@@ -416,6 +414,7 @@
 
         }
     }
+
     return op_in_faultphases;
 }
 
@@ -443,24 +442,17 @@
     {
         return NULL;
     }
+
     op_out_faultphases = axutil_array_list_create(env, 0);
     if (!op_out_faultphases)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+
     for (i = 0; i < size; i++)
     {
-        phase_name = (axis2_char_t *)
-            axutil_array_list_get(phases_info->out_faultphases, env, i);
-        /*phase = axutil_hash_get(phases_info->op_out_faultphases, phase_name, 
-           AXIS2_HASH_KEY_STRING);
-           if(!phase)
-           {
-           phase = axis2_phase_create(env, phase_name);
-           axutil_hash_set(phases_info->op_out_faultphases, 
-           phase_name, AXIS2_HASH_KEY_STRING, phase);
-           } */
+        phase_name = (axis2_char_t *) axutil_array_list_get(phases_info->out_faultphases,
env, i);
         phase = axis2_phase_create(env, phase_name);
         status = axutil_array_list_add(op_out_faultphases, env, phase);
         if (AXIS2_SUCCESS != status)
@@ -483,9 +475,15 @@
 
         }
     }
+
     return op_out_faultphases;
 }
 
+/* 
+ * Get user defined phase instances for each flow defined in axis2.xml in an array list and
add it 
+ * into operation. This is called service builder, module builder and service client to add
phases
+ * into operations.
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_phases_info_set_op_phases(
     axis2_phases_info_t * phases_info,
@@ -517,10 +515,8 @@
         return status;
     }
 
-    op_in_faultphases =
-        axis2_phases_info_get_op_in_faultphases(phases_info, env);
-    op_out_faultphases =
-        axis2_phases_info_get_op_out_faultphases(phases_info, env);
+    op_in_faultphases = axis2_phases_info_get_op_in_faultphases(phases_info, env);
+    op_out_faultphases = axis2_phases_info_get_op_out_faultphases(phases_info, env);
 
     status = axis2_op_set_in_flow(op_desc, env, op_in_phases);
     status = axis2_op_set_out_flow(op_desc, env, op_out_phases);
@@ -533,6 +529,7 @@
     {
         status = axis2_op_set_fault_out_flow(op_desc, env, op_out_faultphases);
     }
+
     return status;
 }
 
@@ -543,12 +540,14 @@
 {
     int size = 0,
         i = 0;
+
     axutil_array_list_t *new_flow = NULL;
     if (flow_to_copy)
     {
         size =
             axutil_array_list_size((axutil_array_list_t *) flow_to_copy, env);
     }
+
     if (size > 0)
     {
         new_flow = axutil_array_list_create(env, 0);
@@ -558,13 +557,14 @@
             return NULL;
         }
     }
+
     for (i = 0; i < size; i++)
     {
-        void *item = axutil_array_list_get((axutil_array_list_t *) flow_to_copy,
-                                           env, i);
+        void *item = axutil_array_list_get((axutil_array_list_t *) flow_to_copy, env, i);
         axis2_phase_increment_ref((axis2_phase_t *) item, env);
         axutil_array_list_add(new_flow, env, item);
     }
+
     return new_flow;
 }
 



Mime
View raw message