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 da...@apache.org on 2008/03/20 13:03:44 UTC
svn commit: r639256 - in /webservices/axis2/trunk/c:
include/axis2_phase_resolver.h include/axis2_transport_in_desc.h
src/core/phaseresolver/phase_resolver.c
Author: damitha
Date: Thu Mar 20 05:03:42 2008
New Revision: 639256
URL: http://svn.apache.org/viewvc?rev=639256&view=rev
Log:
Adding meaningful log messages, modifying log messages to be meaningful, coding conventions.
Also adding code comments, removing garbage.
Modified:
webservices/axis2/trunk/c/include/axis2_phase_resolver.h
webservices/axis2/trunk/c/include/axis2_transport_in_desc.h
webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.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=639256&r1=639255&r2=639256&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_phase_resolver.h (original)
+++ webservices/axis2/trunk/c/include/axis2_phase_resolver.h Thu Mar 20 05:03:42 2008
@@ -142,7 +142,10 @@
/**
* Engages the given global module to the given service. This means
* the given module would be engaged to all operations of the given
- * service.
+ * service. This function should not be used to engage a module to
+ * a service. Use axis2_phase_resolver_engage_module_to_svc() instead.
+ * In future this function will be moved as a local function into
+ * phase resolver.
* @param phase_resolver pointer to phase resolver
* @param env pointer to environment struct
* @param svc pointer to service
Modified: webservices/axis2/trunk/c/include/axis2_transport_in_desc.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_transport_in_desc.h?rev=639256&r1=639255&r2=639256&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_transport_in_desc.h (original)
+++ webservices/axis2/trunk/c/include/axis2_transport_in_desc.h Thu Mar 20 05:03:42 2008
@@ -103,7 +103,7 @@
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
- saxis2_transport_in_desc_et_enum(
+ axis2_transport_in_desc_set_enum(
struct axis2_transport_in_desc *transport_in,
const axutil_env_t * env,
const AXIS2_TRANSPORT_ENUMS trans_enum);
Modified: webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c?rev=639256&r1=639255&r2=639256&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c (original)
+++ webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c Thu Mar 20 05:03:42 2008
@@ -57,8 +57,6 @@
{
axis2_phase_resolver_t *phase_resolver = NULL;
- AXIS2_ENV_CHECK(env, NULL);
-
phase_resolver = (axis2_phase_resolver_t *) AXIS2_MALLOC(env->allocator,
sizeof
(axis2_phase_resolver_t));
@@ -66,6 +64,7 @@
if (!phase_resolver)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory.");
return NULL;
}
@@ -82,7 +81,6 @@
{
axis2_phase_resolver_t *phase_resolver = NULL;
- AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK(env->error, axis2_config, NULL);
phase_resolver = (axis2_phase_resolver_t *)
@@ -101,7 +99,6 @@
{
axis2_phase_resolver_t *phase_resolver = NULL;
- AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK(env->error, axis2_config, NULL);
phase_resolver = (axis2_phase_resolver_t *)
@@ -109,6 +106,7 @@
if (!phase_resolver)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No Memory.");
return NULL;
}
phase_resolver->axis2_config = axis2_config;
@@ -125,8 +123,6 @@
axis2_phase_resolver_t * phase_resolver,
const axutil_env_t * env)
{
- AXIS2_ENV_CHECK(env, void);
-
if (phase_resolver)
{
AXIS2_FREE(env->allocator, phase_resolver);
@@ -135,6 +131,10 @@
return;
}
+/**
+ * The caller function first set the service into the phase resolver. Then call
+ * this function to build execution chains for that services operations
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_build_chains(
axis2_phase_resolver_t * phase_resolver,
@@ -146,7 +146,11 @@
axutil_hash_t *ops = NULL;
if (!(phase_resolver->svc))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "No service set to phase resolver");
return AXIS2_FAILURE;
+ }
ops = axis2_svc_get_all_ops(phase_resolver->svc, env);
@@ -167,6 +171,9 @@
return status;
}
+/**
+ * For module operation build execution chains
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_build_module_op(
axis2_phase_resolver_t * phase_resolver,
@@ -176,14 +183,10 @@
int i = 0;
axis2_status_t status = AXIS2_FAILURE;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Start:axis2_phase_resolver_build_module_op");
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_build_module_op");
AXIS2_PARAM_CHECK(env->error, op, AXIS2_FAILURE);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "op name is:%s",
- axutil_qname_get_localpart(axis2_op_get_qname(op, env),
- env));
for (i = 1; i < 5; i++)
{
status = axis2_phase_resolver_build_execution_chains(phase_resolver,
@@ -193,17 +196,27 @@
break;
}
}
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "End:axis2_phase_resolver_build_module_op");
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_build_module_op");
return status;
}
+/**
+ * For operation passed build execution chains. To do this get all engaged modules
+ * from the axis2 configuration and for each module get the all handlers to be
+ * add to the operation specific phases. Then for each operation specific phases
+ * add those handlers. It should be noted that by the time this function is called
+ * the module handlers are already added to global chains.
+ * This function is called from function
+ * axis2_phase_resolver_build_chains() and function
+ * axis2_phase_resolver_build_module_op.
+ */
static axis2_status_t
axis2_phase_resolver_build_execution_chains(
axis2_phase_resolver_t * phase_resolver,
const axutil_env_t * env,
int type,
- axis2_op_t * op)
+ axis2_op_t *op)
{
axutil_array_list_t *all_handlers = NULL;
axutil_array_list_t *moduleqnames = NULL;
@@ -211,10 +224,17 @@
int size = 0;
int status = AXIS2_FAILURE;
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
axis2_phase_holder_t *phase_holder = NULL;
+ const axutil_qname_t *opqname = NULL;
+ axis2_char_t *opname = NULL;
- /* engage handlers from axis2.xml and from modules */
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_build_execution_chains");
+ /* Engage handlers from axis2.xml and from modules */
+ opqname = axis2_op_get_qname(op, env);
+ opname = axutil_qname_get_localpart(opqname, env);
moduleqnames =
axis2_conf_get_all_engaged_modules(phase_resolver->axis2_config, env);
@@ -222,15 +242,16 @@
for (i = 0; i < size; i++)
{
- axutil_qname_t *modulename = NULL;
+ axis2_char_t *modulename = NULL;
+ axutil_qname_t *moduleqname = NULL;
axis2_module_desc_t *module_desc = NULL;
- modulename = (axutil_qname_t *) axutil_array_list_get(moduleqnames, env,
+ moduleqname = (axutil_qname_t *) axutil_array_list_get(moduleqnames, env,
i);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "module name is:%s",
- axutil_qname_get_localpart(modulename, env));
+ modulename = axutil_qname_get_localpart(moduleqname, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Module name is:%s", modulename);
module_desc = axis2_conf_get_module(phase_resolver->axis2_config, env,
- modulename);
+ moduleqname);
if (module_desc)
{
switch (type)
@@ -238,29 +259,35 @@
case AXIS2_IN_FLOW:
{
flow = axis2_module_desc_get_in_flow(module_desc, env);
+ flowname = "in flow";
break;
}
case AXIS2_OUT_FLOW:
{
flow = axis2_module_desc_get_out_flow(module_desc, env);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
{
- flow =
- axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flow = axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flowname = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
{
flow =
axis2_module_desc_get_fault_out_flow(module_desc, env);
+ flowname = "fault out flow";
break;
}
}
status = axis2_op_add_to_engaged_module_list(op, env, module_desc);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding module %s to engaged module list of operation %s"\
+ " failed", modulename, opname);
return status;
}
@@ -269,6 +296,9 @@
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_MODULE_REF,
AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Module description not found in axis2 configuration for "\
+ "name %s", modulename);
return AXIS2_FAILURE;
}
@@ -279,6 +309,8 @@
count = axis2_flow_get_handler_count(flow, env);
if (AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Getting hanlder count for the flow %s failed", flowname);
return AXIS2_ERROR_GET_STATUS_CODE(env->error);
}
@@ -287,25 +319,33 @@
axis2_handler_desc_t *metadata = NULL;
const axis2_char_t *phase_name = NULL;
axis2_phase_rule_t *phase_rule = NULL;
+ const axutil_string_t *handlername = NULL;
+ const axis2_char_t *handlername_buff = NULL;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlername = axis2_handler_desc_get_name(metadata, env);
+ handlername_buff = axutil_string_get_buffer(handlername, env);
phase_rule = axis2_handler_desc_get_rules(metadata, env);
phase_name = axis2_phase_rule_get_name(phase_rule, env);
if (!phase_name)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Phase rules name null for the handler description "\
+ "%s within flow %s", handlername_buff, flowname);
return AXIS2_FAILURE;
}
- if ((0 != axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- && (0 != axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
- (0 != axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- && (0 !=
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
+ (axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
+ /* Get operation specific phases */
if (!all_handlers)
{
all_handlers = axutil_array_list_create(env, 0);
if (!all_handlers)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
return AXIS2_FAILURE;
}
}
@@ -317,119 +357,31 @@
axutil_array_list_free(all_handlers, env);
all_handlers = NULL;
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler description %s failed for phase "\
+ "%s within flow %s", handlername_buff, phase_name, flowname);
return status;
}
}
else
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "This handler is"
- " trying to added to system pre defined phases , but those"
- " handlers are already added to global chain which run"
- " irrespective of the service");
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "Trying to add this handler %s to system pre defined "\
+ "phases , but those handlers are already added to "\
+ "global chain which run irrespective of the service",
+ handlername_buff);
}
}
}
}
-
- /* process handlers form service.xml */
- flow = NULL;
-
- if (flow)
+ if(!all_handlers)
{
- int j = 0;
- int count = 0;
- count = axis2_flow_get_handler_count(flow, env);
-
- if (AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
- {
- if (all_handlers)
- {
- axutil_array_list_free(all_handlers, env);
- all_handlers = NULL;
- }
- return AXIS2_ERROR_GET_STATUS_CODE(env->error);
- }
- for (j = 0; j < count; j++)
- {
- axis2_handler_desc_t *metadata = NULL;
- const axis2_char_t *phase_name = NULL;
- axis2_phase_rule_t *phase_rule = NULL;
-
- metadata = axis2_flow_get_handler(flow, env, j);
- phase_rule = axis2_handler_desc_get_rules(metadata, env);
- if (phase_rule)
- {
- phase_name = axis2_phase_rule_get_name(phase_rule, env);
- }
-
- if (!phase_name || (0 == axutil_strcmp(phase_name, "")))
- {
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_IS_NOT_SPECIFED,
- AXIS2_FAILURE);
- return AXIS2_FAILURE;
-
- }
- else if ((0 == axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- || (0 == axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name))
- || (0 ==
- axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- || (0 ==
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
- {
- if (all_handlers)
- {
- axutil_array_list_free(all_handlers, env);
- all_handlers = NULL;
- }
- AXIS2_ERROR_SET(env->error,
- AXIS2_ERROR_SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
- AXIS2_FAILURE);
- return AXIS2_FAILURE;
-
- }
- else
- {
- if (!all_handlers)
- {
- all_handlers = axutil_array_list_create(env, 0);
- if (!all_handlers)
- {
- return AXIS2_FAILURE;
- }
- }
-
- status = axutil_array_list_add(all_handlers, env, metadata);
-
- if (AXIS2_SUCCESS != status)
- {
- if (all_handlers)
- {
- int size = 0;
- int i = 0;
- size = axutil_array_list_size(all_handlers, env);
- for (i = 0; i < size; i++)
- {
- axis2_handler_desc_t *handler_desc = NULL;
-
- handler_desc = axutil_array_list_get(all_handlers,
- env, i);
- axis2_handler_desc_free(handler_desc, env);
- }
- axutil_array_list_free(all_handlers, env);
- all_handlers = NULL;
- }
- return status;
- }
- }
- }
- }
-
- else if (!all_handlers)
- {
- /* no flows configured */
+ /* No flows configured */
return AXIS2_SUCCESS;
}
+ flow = NULL;
+ flowname = NULL;
switch (type)
{
@@ -440,6 +392,7 @@
phase_list = axis2_op_get_in_flow(op, env);
phase_holder =
axis2_phase_holder_create_with_phases(env, phase_list);
+ flowname = "in flow";
break;
}
case AXIS2_OUT_FLOW:
@@ -449,6 +402,7 @@
phase_list = axis2_op_get_out_flow(op, env);
phase_holder =
axis2_phase_holder_create_with_phases(env, phase_list);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
@@ -458,6 +412,7 @@
phase_list = axis2_op_get_fault_in_flow(op, env);
phase_holder =
axis2_phase_holder_create_with_phases(env, phase_list);
+ flowname = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
@@ -467,16 +422,12 @@
phase_list = axis2_op_get_fault_out_flow(op, env);
phase_holder =
axis2_phase_holder_create_with_phases(env, phase_list);
+ flowname = "fault out flow";
break;
}
}
size = axutil_array_list_size(all_handlers, env);
- if (AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
- {
- return AXIS2_ERROR_GET_STATUS_CODE(env->error);
- }
-
for (i = 0; i < size; i++)
{
axis2_handler_desc_t *metadata = NULL;
@@ -503,7 +454,8 @@
{
axis2_phase_holder_free(phase_holder, env);
}
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_build_execution_chains");
return status;
}
@@ -516,8 +468,9 @@
axis2_transport_out_desc_t **transports_out = NULL;
int index_i = 0;
axis2_status_t status = AXIS2_FAILURE;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_build_transport_chains");
transports_in =
axis2_conf_get_all_in_transports(phase_resolver->axis2_config, env);
@@ -525,6 +478,8 @@
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_TRANSPORT_IN_CONFIGURED,
AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "No transport in descriptions configured");
return AXIS2_SUCCESS;
}
@@ -534,6 +489,8 @@
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_TRANSPORT_OUT_CONFIGURED,
AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "No transport out descriptions configured");
return AXIS2_SUCCESS;
}
@@ -548,6 +505,8 @@
[index_i]);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Building transport in chains failed");
return status;
}
}
@@ -564,6 +523,8 @@
[index_i]);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Building transport out chains failed");
return status;
}
}
@@ -571,11 +532,17 @@
/* If transport in or transport out maps are not null but still they don't
* have chains configured then we return success, because there are no
- * chain to process
+ * chains to process.
*/
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_build_transport_chains");
return AXIS2_SUCCESS;
}
+/**
+ * This function is called from function
+ * axis2_phase_resolver_build_transport_chains().
+ */
static axis2_status_t
axis2_phase_resolver_build_in_transport_chains(
axis2_phase_resolver_t * phase_resolver,
@@ -586,13 +553,17 @@
int j = 0;
axis2_status_t status = AXIS2_FAILURE;
axutil_array_list_t *handlers = NULL;
+ AXIS2_TRANSPORT_ENUMS transport_enum =
+ axis2_transport_in_desc_get_enum(transport, env);;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_build_in_transport_chains");
AXIS2_PARAM_CHECK(env->error, transport, AXIS2_FAILURE);
for (type = 1; type < 4; type++)
{
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
axis2_phase_t *phase = NULL;
switch (type)
@@ -601,6 +572,7 @@
{
flow = axis2_transport_in_desc_get_in_flow(transport, env);
phase = axis2_transport_in_desc_get_in_phase(transport, env);
+ flowname = "in flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
@@ -608,6 +580,7 @@
flow =
axis2_transport_in_desc_get_fault_in_flow(transport, env);
phase = axis2_transport_in_desc_get_fault_phase(transport, env);
+ flowname = "fault in flow";
break;
}
}
@@ -622,8 +595,12 @@
{
axis2_handler_desc_t *metadata = NULL;
axis2_phase_rule_t *rule = NULL;
+ const axis2_char_t *handlername = NULL;
+ const axutil_string_t *handlersname = NULL;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
rule = axis2_handler_desc_get_rules(metadata, env);
if (rule)
{
@@ -646,6 +623,10 @@
}
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Setting name %s to phase rules for handler %s failed"\
+ "for in transport %d within flow %s", AXIS2_TRANSPORT_PHASE,
+ handlername, transport_enum, flowname);
return status;
}
status = axutil_array_list_add(handlers, env, metadata);
@@ -665,6 +646,10 @@
}
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler %s from in transport %d to handler "\
+ "list failed within flow %s", handlername, transport_enum,
+ flowname);
return status;
}
}
@@ -687,6 +672,7 @@
}
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
return AXIS2_FAILURE;
}
@@ -708,9 +694,15 @@
{
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_build_in_transport_chains");
return status;
}
+/**
+ * This function is called from function
+ * axis2_phase_resolver_build_transport_chains().
+ */
static axis2_status_t
axis2_phase_resolver_build_out_transport_chains(
axis2_phase_resolver_t * phase_resolver,
@@ -720,12 +712,16 @@
int type = 0;
axis2_status_t status = AXIS2_FAILURE;
axutil_array_list_t *handlers = NULL;
+ AXIS2_TRANSPORT_ENUMS transport_enum =
+ axis2_transport_out_desc_get_enum(transport, env);;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_build_out_transport_chains");
AXIS2_PARAM_CHECK(env->error, transport, AXIS2_FAILURE);
for (type = 1; type < 5; type++)
{
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
axis2_phase_t *phase = NULL;
switch (type)
@@ -734,6 +730,7 @@
{
flow = axis2_transport_out_desc_get_out_flow(transport, env);
phase = axis2_transport_out_desc_get_out_phase(transport, env);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
@@ -742,6 +739,7 @@
axis2_transport_out_desc_get_fault_out_flow(transport, env);
phase =
axis2_transport_out_desc_get_fault_phase(transport, env);
+ flowname = "fault out flow";
break;
}
}
@@ -754,6 +752,7 @@
hndlr_count = axis2_flow_get_handler_count(flow, env);
if (AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "");
return AXIS2_ERROR_GET_STATUS_CODE(env->error);
}
handlers = axutil_array_list_create(env, 0);
@@ -762,8 +761,12 @@
{
axis2_handler_desc_t *metadata = NULL;
axis2_phase_rule_t *rule = NULL;
+ const axis2_char_t *handlername = NULL;
+ const axutil_string_t *handlersname = NULL;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
rule = axis2_handler_desc_get_rules(metadata, env);
if (rule)
@@ -787,6 +790,10 @@
}
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Setting name %s to phase rules for handler %s failed"\
+ "for out transport %d within flow %s", AXIS2_TRANSPORT_PHASE,
+ handlername, transport_enum, flowname);
return status;
}
@@ -807,6 +814,10 @@
}
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler %s from out transport %d to handler "\
+ "list failed within flow %s", handlername, transport_enum,
+ flowname);
return status;
}
}
@@ -829,6 +840,7 @@
}
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
return AXIS2_FAILURE;
}
@@ -850,9 +862,21 @@
{
axutil_array_list_free(handlers, env);
}
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_build_out_transport_chains");
return status;
}
+/**
+ * This is in general called to engage a module to the axis2 engine. In other
+ * words modules handlers are added into all global and operation specific
+ * phases appropriately. Where these handlers should go is determined by the
+ * module handler specific descriptions in module.xml file.
+ * First add all the handlers in the module into the global chains. Then
+ * retrieve all services from axis2 configuration and add module handlers
+ * into each services operation phases.
+ */
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_engage_module_globally(
axis2_phase_resolver_t * phase_resolver,
@@ -863,46 +887,59 @@
axutil_qname_t *qname_addressing = NULL;
axutil_hash_t *svcs = NULL;
- const axutil_qname_t *mod_name = NULL;
+ const axutil_qname_t *mod_qname = NULL;
+ axis2_char_t *mod_name = NULL;
axutil_hash_t *all_ops = NULL;
axutil_hash_index_t *index_j = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_engage_module_globally");
AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
+ mod_qname = axis2_module_desc_get_qname(module_desc, env);
+ mod_name = axutil_qname_get_localpart(mod_qname, env);
+ /* Add module handlers into global phases */
status = axis2_phase_resolver_engage_to_global_chain(phase_resolver, env,
module_desc);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Engaging module %s to global chain failed", mod_name);
return status;
}
svcs = axis2_conf_get_all_svcs(phase_resolver->axis2_config, env);
if (!svcs)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "There are no services in the axis2 configuration");
return AXIS2_FAILURE;
}
qname_addressing = axutil_qname_create(env, AXIS2_MODULE_ADDRESSING, NULL, NULL);
- mod_name = axis2_module_desc_get_qname(module_desc, env);
for (index_j = axutil_hash_first(svcs, env); index_j; index_j =
axutil_hash_next(env, index_j))
{
axis2_svc_t *svc = NULL;
void *w = NULL;
axis2_svc_grp_t *parent = NULL;
+ const axis2_char_t *svc_name = NULL;
+ const axis2_char_t *svc_grp_name = NULL;
axutil_hash_this(index_j, NULL, NULL, &w);
svc = (axis2_svc_t *) w;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "svc name is:%s",
- axis2_svc_get_name(svc, env));
-
+ svc_name = axis2_svc_get_name(svc, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "svc name is:%s", svc_name);
status = axis2_svc_add_module_ops(svc, env, module_desc,
phase_resolver->axis2_config);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding module operations for module %s to service %s failed",
+ mod_name, svc_name);
axutil_qname_free(qname_addressing, env);
return status;
}
+ /* Call this function to add module handlers into service operation phases */
status =
axis2_phase_resolver_engage_module_to_svc_from_global
(phase_resolver, env, svc, module_desc);
@@ -910,10 +947,15 @@
if (AXIS2_SUCCESS != status)
{
axutil_qname_free(qname_addressing, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Engaging module %s to service %s failed", mod_name, svc_name);
return status;
}
- if (axutil_qname_equals(mod_name, env, qname_addressing))
+ if (axutil_qname_equals(mod_qname, env, qname_addressing))
{
+ /* If addressing module then all operations which are not module
+ * operations with a wsa mapping parameter is added to the
+ * service's wsa-mapping list*/
all_ops = axis2_svc_get_all_ops(svc, env);
if (all_ops)
{
@@ -927,8 +969,7 @@
if (val)
{
- if (axis2_op_is_from_module((axis2_op_t *) val, env) ==
- AXIS2_FALSE)
+ if (!axis2_op_is_from_module((axis2_op_t *) val, env))
{
axis2_op_t *op_desc = NULL;
axutil_array_list_t *params = NULL;
@@ -946,7 +987,7 @@
param = axutil_array_list_get(params, env, j);
param_name = axutil_param_get_name(param, env);
- if (0 == axutil_strcmp(param_name, AXIS2_WSA_MAPPING))
+ if (!axutil_strcmp(param_name, AXIS2_WSA_MAPPING))
{
axis2_char_t *key = NULL;
key = (axis2_char_t *) axutil_param_get_value(param, env);
@@ -966,6 +1007,7 @@
int j = 0;
int sizej = 0;
axis2_bool_t add_to_group = AXIS2_TRUE;
+ svc_grp_name = axis2_svc_grp_get_name(parent, env);
modules = axis2_svc_grp_get_all_module_qnames(parent, env);
sizej = axutil_array_list_size(modules, env);
@@ -974,7 +1016,7 @@
axutil_qname_t *module = NULL;
module = (axutil_qname_t *) axutil_array_list_get(modules, env, j);
- if (axutil_qname_equals(mod_name, env, module))
+ if (axutil_qname_equals(mod_qname, env, module))
{
add_to_group = AXIS2_FALSE;
break;
@@ -982,20 +1024,32 @@
}
if (add_to_group)
{
- status = axis2_svc_grp_add_module_qname(parent, env, mod_name);
+ status = axis2_svc_grp_add_module_qname(parent, env, mod_qname);
}
}
if (AXIS2_SUCCESS != status)
{
axutil_qname_free(qname_addressing, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding module %s to service group %s failed", mod_name,
+ svc_grp_name);
return status;
}
}
axutil_qname_free(qname_addressing, env);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_engage_module_globally");
return status;
}
+/**
+ * For each operation of the service first check whether module is already
+ * engaged to operation. If not take each operations flows and add the module
+ * handlers into them appropriately. This function is called from function
+ * axis2_phase_resolver_engage_module_globally() to add handlers from module
+ * into each services all operations.
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_engage_module_to_svc_from_global(
axis2_phase_resolver_t * phase_resolver,
@@ -1009,14 +1063,18 @@
int type = 0;
axis2_status_t status = AXIS2_FAILURE;
axis2_phase_holder_t *phase_holder = NULL;
+ const axis2_char_t *svc_name = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_engage_module_to_svc_from_global");
AXIS2_PARAM_CHECK(env->error, svc, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
-
+ svc_name = axis2_svc_get_name(svc, env);
ops = axis2_svc_get_all_ops(svc, env);
if (!ops)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "No operations for the service %s", svc_name);
return AXIS2_FAILURE;
}
@@ -1028,20 +1086,26 @@
int j = 0;
axutil_array_list_t *modules = NULL;
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
const axutil_qname_t *module_desc_qname = NULL;
+ axis2_char_t *module_desc_name = NULL;
int size = 0;
+ axis2_char_t *op_name = NULL;
axutil_hash_this(index_i, NULL, NULL, &v);
op_desc = (axis2_op_t *) v;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Operation name is : %s",
- axutil_qname_get_localpart(axis2_op_get_qname
- (op_desc, env), env));
+ op_name = axutil_qname_get_localpart(axis2_op_get_qname(op_desc, env),
+ env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Operation name is : %s",
+ op_name);
modules = axis2_op_get_all_modules(op_desc, env);
module_desc_qname = axis2_module_desc_get_qname(module_desc, env);
+ module_desc_name = axutil_qname_get_localpart(module_desc_qname, env);
if (modules)
{
size = axutil_array_list_size(modules, env);
}
+ /* Checking whether module is already engaged to operation */
for (j = 0; j < size; j++)
{
axis2_module_desc_t *module_desc_l = NULL;
@@ -1107,30 +1171,34 @@
}
}
- /* process modules referred by axis2.xml */
+ /* Process modules referred by axis2.xml */
switch (type)
{
case AXIS2_IN_FLOW:
{
flow = axis2_module_desc_get_in_flow(module_desc, env);
+ flowname = "in flow";
break;
}
case AXIS2_OUT_FLOW:
{
flow = axis2_module_desc_get_out_flow(module_desc, env);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
{
flow =
axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flowname = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
{
flow =
axis2_module_desc_get_fault_out_flow(module_desc, env);
+ flowname = "fault out flow";
break;
}
}
@@ -1144,8 +1212,12 @@
axis2_handler_desc_t *metadata = NULL;
const axis2_char_t *phase_name = NULL;
axis2_phase_rule_t *phase_rule = NULL;
+ const axutil_string_t *handlersname = NULL;
+ const axis2_char_t *handlername = NULL;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
phase_rule = axis2_handler_desc_get_rules(metadata, env);
if (phase_rule)
{
@@ -1153,17 +1225,18 @@
}
if (!phase_name)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Handler rules for the handler description %s "\
+ "within flow %s has no name", handlername, flowname);
return AXIS2_FAILURE;
}
- if ((0 !=
- axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name)) &&
- (0 != axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name))
- && (0 !=
- axutil_strcmp(AXIS2_PHASE_POST_DISPATCH,
+ if ((axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name)) &&
+ (axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_POST_DISPATCH,
phase_name)) &&
- (0 !=
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ (axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
+ /* If phase is operation specific, add module handler to it */
if (phase_holder)
{
status =
@@ -1172,6 +1245,10 @@
if (!status)
{
axis2_phase_holder_free(phase_holder, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler desc %s to phase %s "\
+ "within flow %s failed", handlername,
+ phase_name, flowname);
return status;
}
}
@@ -1187,13 +1264,24 @@
status = axis2_op_add_to_engaged_module_list(op_desc, env, module_desc);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding module description %s to engaged module list of "\
+ "operation %s failed", module_desc_name, op_name);
return status;
}
}
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_engage_module_to_svc_from_global");
return AXIS2_SUCCESS;
}
+/**
+ * Take the phases for each flow from the axis2 configuration, take all the
+ * handlers of each flow from the module description and then each handler
+ * is added into the corresponding global phase. This is function is called
+ * from function axis2_phase_resolver_engage_module_globally() to add module
+ * handlers into global phases.
+ */
static axis2_status_t
axis2_phase_resolver_engage_to_global_chain(
axis2_phase_resolver_t * phase_resolver,
@@ -1203,12 +1291,17 @@
int type = 0;
axis2_status_t status = AXIS2_FAILURE;
axis2_phase_holder_t *phase_holder = NULL;
+ const axutil_qname_t *modqname = NULL;
+ axis2_char_t *modname = NULL;
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_engage_to_global_chain");
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+ modqname = axis2_module_desc_get_qname(module_desc, env);
+ modname = axutil_qname_get_localpart(modqname, env);
for (type = 1; type < 5; type++)
{
axis2_flow_t *flow = NULL;
+ axis2_char_t *flow_name = NULL;
switch (type)
{
@@ -1263,28 +1356,31 @@
}
}
- /* modules referred by axis2.xml */
-
+ /* Modules referred by axis2.xml */
switch (type)
{
case AXIS2_IN_FLOW:
{
flow = axis2_module_desc_get_in_flow(module_desc, env);
+ flow_name = "in flow";
break;
}
case AXIS2_OUT_FLOW:
{
flow = axis2_module_desc_get_out_flow(module_desc, env);
+ flow_name = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
{
flow = axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flow_name = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
{
flow = axis2_module_desc_get_fault_out_flow(module_desc, env);
+ flow_name = "fault out flow";
break;
}
}
@@ -1296,8 +1392,12 @@
axis2_handler_desc_t *metadata = NULL;
const axis2_char_t *phase_name = NULL;
axis2_phase_rule_t *phase_rule = NULL;
+ const axutil_string_t *handlersname = NULL;
+ const axis2_char_t *handlername = NULL;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
phase_rule = axis2_handler_desc_get_rules(metadata, env);
if (phase_rule)
{
@@ -1305,35 +1405,51 @@
}
if (!phase_name)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Phase rules for handler %s has no name", handlername);
return AXIS2_FAILURE;
}
- if ((0 == axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- || (0 == axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
- (0 == axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- || (0 ==
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((!axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
+ (!axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
+ /* If a global phase add the module handler*/
status = axis2_phase_holder_add_handler(phase_holder, env,
metadata);
if (!status)
{
axis2_phase_holder_free(phase_holder, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler %s of module %s to phase %s of "\
+ "flow %s failed", handlername, modname, phase_name,
+ flow_name);
return status;
}
-
}
}
}
-
if (phase_holder)
{
axis2_phase_holder_free(phase_holder, env);
}
}
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_engage_to_global_chain");
return AXIS2_SUCCESS;
}
+/**
+ * This function is called to engage a module to a service specifically. In
+ * other words all module handlers are added into service operation's execution
+ * chains appropriately. Where each module handler should go is determined by
+ * module handler descriptions in module.xml file.
+ * First we add the operations defined in the module into the service.
+ * Then for all the operations of the service we check whether the module
+ * already engaged to operation. If not engage it to service operation.
+ * Also if the module is newly engaged to operation add the module qnname to
+ * the engaged module list of the operation.
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_engage_module_to_svc(
axis2_phase_resolver_t * phase_resolver,
@@ -1345,19 +1461,22 @@
axutil_hash_index_t *index_i = NULL;
axis2_status_t status = AXIS2_FAILURE;
const axutil_qname_t *module_d_qname = NULL;
+ axis2_char_t *modname_d = NULL;
+ const axis2_char_t *svcname = NULL;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Start:axis2_phase_resolver_engage_module_to_svc");
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_engage_module_to_svc");
+ module_d_qname = axis2_module_desc_get_qname(module_desc, env);
+ modname_d = axutil_qname_get_localpart(module_d_qname, env);
+ svcname = axis2_svc_get_name(svc, env);
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Module %s will be engaged to %s",
- axutil_qname_get_localpart(axis2_module_desc_get_qname
- (module_desc, env), env),
- axis2_svc_get_name(svc, env));
+ "Module %s will be engaged to %s", modname_d, svcname);
ops = axis2_svc_get_all_ops(svc, env);
if (!ops)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Service %s has no operation", svcname);
return AXIS2_FAILURE;
}
status = axis2_svc_add_module_ops(svc, env, module_desc,
@@ -1365,9 +1484,11 @@
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding module operations from module %s into service %s failed",
+ modname_d, svcname);
return status;
}
- module_d_qname = axis2_module_desc_get_qname(module_desc, env);
for (index_i = axutil_hash_first(ops, env); index_i; index_i =
axutil_hash_next(env, index_i))
{
@@ -1377,9 +1498,12 @@
int j = 0;
void *v = NULL;
axis2_bool_t engaged = AXIS2_FALSE;
+ axis2_char_t *opname = NULL;
axutil_hash_this(index_i, NULL, NULL, &v);
op_desc = (axis2_op_t *) v;
+ opname = axutil_qname_get_localpart(axis2_op_get_qname(op_desc, env),
+ env),
modules = axis2_op_get_all_modules(op_desc, env);
if (modules)
{
@@ -1392,28 +1516,27 @@
module_desc_l = axutil_array_list_get(modules, env, j);
module_d_qname_l = axis2_module_desc_get_qname(module_desc_l, env);
- if (AXIS2_TRUE == axutil_qname_equals(module_d_qname, env,
+ if (axutil_qname_equals(module_d_qname, env,
module_d_qname_l))
{
engaged = AXIS2_TRUE;
status = AXIS2_SUCCESS;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Module %s already engaged to %s of %s",
- axutil_qname_get_localpart(module_d_qname, env),
- axutil_qname_get_localpart(axis2_op_get_qname
- (op_desc, env), env),
- axis2_svc_get_name(svc, env));
+ "Module %s already engaged to %s of %s", opname, svcname);
break;
}
}
- if (AXIS2_FALSE == engaged)
+ if (!engaged)
{
status =
axis2_phase_resolver_engage_module_to_op(phase_resolver, env,
op_desc, module_desc);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Engaging module %s to operation %s failed.", modname_d,
+ opname);
return status;
}
@@ -1422,8 +1545,8 @@
}
}
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "End:axis2_phase_resolver_engage_module_to_svc");
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_engage_module_to_svc");
return status;
}
@@ -1438,27 +1561,20 @@
axutil_hash_index_t *index_i = NULL;
axis2_status_t status = AXIS2_FAILURE;
const axutil_qname_t *module_d_qname = NULL;
+ const axis2_char_t *svc_name = axis2_svc_get_name(svc, env);
+ axis2_char_t *modname_d = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_disengage_module_from_svc");
ops = axis2_svc_get_all_ops(svc, env);
if (!ops)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Service %s has no operation", svc_name);
return AXIS2_FAILURE;
}
-
-/* status = axis2_svc_add_module_ops(svc, env, module_desc, */
-
-/* phase_resolver->axis2_config); */
-
-/* if (AXIS2_SUCCESS != status) */
-
-/* { */
-
-/* return status; */
-
-/* } */
module_d_qname = axis2_module_desc_get_qname(module_desc, env);
+ modname_d = axutil_qname_get_localpart(module_d_qname, env);
for (index_i = axutil_hash_first(ops, env); index_i; index_i =
axutil_hash_next(env, index_i))
{
@@ -1468,9 +1584,13 @@
int j = 0;
void *v = NULL;
axis2_bool_t engaged = AXIS2_FALSE;
+ const axutil_qname_t *opqname = NULL;
+ axis2_char_t *opname = NULL;
axutil_hash_this(index_i, NULL, NULL, &v);
op_desc = (axis2_op_t *) v;
+ opqname = axis2_op_get_qname(op_desc, env);
+ opname = axutil_qname_get_localpart(opqname, env);
modules = axis2_op_get_all_modules(op_desc, env);
if (modules)
{
@@ -1483,14 +1603,11 @@
module_desc_l = axutil_array_list_get(modules, env, j);
module_d_qname_l = axis2_module_desc_get_qname(module_desc_l, env);
- if (AXIS2_TRUE == axutil_qname_equals(module_d_qname, env,
- module_d_qname_l))
+ if (axutil_qname_equals(module_d_qname, env, module_d_qname_l))
{
engaged = AXIS2_TRUE;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Module %s already engaged.",
- axutil_qname_get_localpart(module_d_qname,
- env));
+ "Module %s already engaged.", modname_d);
break;
}
}
@@ -1503,6 +1620,8 @@
module_desc);
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Disengaging module %s from operation %s failed", modname_d, opname);
return status;
}
@@ -1511,9 +1630,16 @@
}
}
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_disengage_module_from_svc");
return status;
}
+/**
+ * In this function all the handlers in each flow of the module description
+ * are added to the phases of the operation. First handlers of global phases
+ * are added. Then handlers of operation specific phases are added.
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_resolver_engage_module_to_op(
axis2_phase_resolver_t * phase_resolver,
@@ -1524,13 +1650,15 @@
int type = 0;
axis2_phase_holder_t *phase_holder = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_engage_module_to_op");
AXIS2_PARAM_CHECK(env->error, axis_op, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
for (type = 1; type < 5; type++)
{
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
axutil_array_list_t *phases = NULL;
switch (type)
@@ -1567,21 +1695,25 @@
case AXIS2_IN_FLOW:
{
flow = axis2_module_desc_get_in_flow(module_desc, env);
+ flowname = "in flow";
break;
}
case AXIS2_OUT_FLOW:
{
flow = axis2_module_desc_get_out_flow(module_desc, env);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
{
flow = axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flowname = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
{
flow = axis2_module_desc_get_fault_out_flow(module_desc, env);
+ flowname = "fault out flow";
break;
}
}
@@ -1594,38 +1726,45 @@
handler_count = axis2_flow_get_handler_count(flow, env);
for (j = 0; j < handler_count; j++)
{
+ /* For all handlers in the flow from the module description */
axis2_handler_desc_t *metadata = NULL;
const axis2_char_t *phase_name = NULL;
axis2_phase_rule_t *phase_rule = NULL;
+ const axutil_string_t *handlersname = NULL;
+ const axis2_char_t *handlername = NULL;
axis2_status_t status = AXIS2_FAILURE;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
phase_rule = axis2_handler_desc_get_rules(metadata, env);
phase_name = axis2_phase_rule_get_name(phase_rule, env);
- if ((0 != axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- && (0 != axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
- (0 != axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- && (0 !=
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
+ (axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
+ /* For operation specific phases */
status = axis2_phase_holder_add_handler(phase_holder,
env, metadata);
if (AXIS2_SUCCESS != status)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Handler inclusion failed for %s phase,\
- %s might not available in axis2.xml",phase_name, phase_name);
+ "Handler %s inclusion failed for %s phase within "\
+ "flow %s. Phase might not available in axis2.xml",
+ handlername, phase_name, phase_name, flowname);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "");
axis2_phase_holder_free(phase_holder, env);
return status;
}
}
- if ((0 == axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- || (0 == axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
- (0 == axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- || (0 ==
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((!axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
+ (!axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
+ /* For global phases */
axutil_array_list_t *phase_list = NULL;
axis2_phase_holder_t *phase_holder = NULL;
@@ -1647,6 +1786,9 @@
phase_holder = NULL;
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Adding handler %s to phase %s within flow %s failed",
+ handlername, phase_name, flowname);
return status;
}
}
@@ -1659,7 +1801,8 @@
phase_holder = NULL;
}
}
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_engage_module_to_op");
return AXIS2_SUCCESS;
}
@@ -1673,13 +1816,15 @@
int type = 0;
axis2_phase_holder_t *phase_holder = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Entry:axis2_phase_resolver_disengage_module_from_op");
AXIS2_PARAM_CHECK(env->error, axis_op, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
for (type = 1; type < 5; type++)
{
axis2_flow_t *flow = NULL;
+ axis2_char_t *flowname = NULL;
axutil_array_list_t *phases = NULL;
switch (type)
@@ -1716,21 +1861,25 @@
case AXIS2_IN_FLOW:
{
flow = axis2_module_desc_get_in_flow(module_desc, env);
+ flowname = "in flow";
break;
}
case AXIS2_OUT_FLOW:
{
flow = axis2_module_desc_get_out_flow(module_desc, env);
+ flowname = "out flow";
break;
}
case AXIS2_FAULT_IN_FLOW:
{
flow = axis2_module_desc_get_fault_in_flow(module_desc, env);
+ flowname = "fault in flow";
break;
}
case AXIS2_FAULT_OUT_FLOW:
{
flow = axis2_module_desc_get_fault_out_flow(module_desc, env);
+ flowname = "fault out flow";
break;
}
}
@@ -1746,34 +1895,37 @@
axis2_handler_desc_t *metadata = NULL;
const axis2_char_t *phase_name = NULL;
axis2_phase_rule_t *phase_rule = NULL;
+ const axutil_string_t *handlersname = NULL;
+ const axis2_char_t *handlername = NULL;
axis2_status_t status = AXIS2_FAILURE;
metadata = axis2_flow_get_handler(flow, env, j);
+ handlersname = axis2_handler_desc_get_name(metadata, env);
+ handlername = axutil_string_get_buffer(handlersname, env);
phase_rule = axis2_handler_desc_get_rules(metadata, env);
phase_name = axis2_phase_rule_get_name(phase_rule, env);
- if ((0 != axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- && (0 != axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
- (0 != axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- && (0 !=
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) &&
+ (axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ && (axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
status = axis2_phase_holder_remove_handler(phase_holder,
env, metadata);
if (AXIS2_SUCCESS != status)
{
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "Handler Removal failed for %s phase",
- phase_name);
+ "Handler %s Removal failed for %s phase within flow %s",
+ handlername, phase_name, flowname);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "");
axis2_phase_holder_free(phase_holder, env);
return status;
}
}
- if ((0 == axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
- || (0 == axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
- (0 == axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
- || (0 ==
- axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+ if ((!axutil_strcmp(AXIS2_PHASE_TRANSPORT_IN, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_DISPATCH, phase_name)) ||
+ (!axutil_strcmp(AXIS2_PHASE_POST_DISPATCH, phase_name))
+ || (!axutil_strcmp(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
{
axutil_array_list_t *phase_list = NULL;
axis2_phase_holder_t *phase_holder = NULL;
@@ -1796,6 +1948,9 @@
phase_holder = NULL;
if (AXIS2_SUCCESS != status)
{
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Removing handler %s from phase %s within flow %s failed",
+ handlername, phase_name, flowname);
return status;
}
}
@@ -1808,6 +1963,8 @@
phase_holder = NULL;
}
}
-
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "Exit:axis2_phase_resolver_disengage_module_from_op");
return AXIS2_SUCCESS;
}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org