Example #1
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_engine_resume_invocation_phases(
    axis2_engine_t * engine,
    const axutil_env_t * env,
    axutil_array_list_t * phases,
    axis2_msg_ctx_t * msg_ctx)
{
    int i = 0;
    int count = 0;
    axis2_bool_t found_match = AXIS2_FALSE;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Start:axis2_engine_resume_invocation_phases");
    AXIS2_PARAM_CHECK(env->error, phases, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);

    axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);

    count = axutil_array_list_size(phases, env);

    for(i = 0; i < count && !(axis2_msg_ctx_is_paused(msg_ctx, env)); i++)
    {
        axis2_phase_t *phase = (axis2_phase_t *)axutil_array_list_get(phases, env, i);
        const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
        const axis2_char_t *paused_phase_name = axis2_msg_ctx_get_paused_phase_name(msg_ctx, env);
        /* Skip invoking handlers until we find the paused phase */
        if(phase_name && paused_phase_name && 0 == axutil_strcmp(phase_name, paused_phase_name))
        {
            int paused_handler_i = -1;
            found_match = AXIS2_TRUE;

            paused_handler_i = axis2_msg_ctx_get_current_handler_index(msg_ctx, env);
            /* Invoke the paused handler and rest of the handlers of the paused
             * phase */
            axis2_phase_invoke_start_from_handler(phase, env, paused_handler_i, msg_ctx);
        }
        else
        {
            /* Now we have found the paused phase and invoked the rest of the
             * handlers of that phase, invoke all the phases after that */
            if(found_match)
            {
                axis2_phase_invoke(phase, env, msg_ctx);
            }
        }
    }

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "End:axis2_engine_resume_invocation_phases");
    return AXIS2_SUCCESS;
}
Example #2
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_invoke_start_from_handler(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    const int paused_handler_index,
    axis2_msg_ctx_t * msg_ctx)
{
    int i = 0, size = 0;
    axis2_status_t status = AXIS2_SUCCESS;

    axis2_msg_ctx_set_paused_phase_name(msg_ctx, env, phase->name);

    size = axutil_array_list_size(phase->handlers, env);
    for(i = paused_handler_index; i < size; i++)
    {
        axis2_handler_t *handler =
            (axis2_handler_t *)axutil_array_list_get(phase->handlers, env, i);
        if(handler)
        {
            const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
                handler, env), env);
            int idx = -1;

            axis2_handler_desc_t *handler_desc = axis2_handler_get_handler_desc(handler, env);
            if(!handler_desc)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Invalid Handler State for the handler %s within phase %s", handler_name,
                    phase->name);
                return AXIS2_FAILURE;
            }

            axis2_handler_invoke(handler, env, msg_ctx);
            idx = axis2_msg_ctx_get_current_handler_index(msg_ctx, env);
            axis2_msg_ctx_set_current_handler_index(msg_ctx, env, (idx + 1));
        }
    }
    return status;
}