Esempio n. 1
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_set_last_handler(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    const axis2_char_t *handler_name = axutil_string_get_buffer(
        axis2_handler_get_name(handler, env), env);
    const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
    if(phase->last_handler_set)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_LAST_HANDLER_ALREADY_SET, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Last handler of phase already set, so cannot set handler %s "
                "in to the phase %s as last handler", handler_name, phase_name);
        return AXIS2_FAILURE;
    }
    else
    {
        if(_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_LAST_HANDLER, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invalid last handler %s set for the Phase %s",
                handler_name, phase_name);
            return AXIS2_FAILURE;
        }
        phase->last_handler = handler;
        phase->last_handler_set = AXIS2_TRUE;
    }

    return AXIS2_SUCCESS;
}
Esempio n. 2
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_engine_invoke_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_status_t status = AXIS2_SUCCESS;

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

    if(phases)
        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);

        status = axis2_phase_invoke(phase, env, msg_ctx);

        if(status != AXIS2_SUCCESS)
        {
            const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoking phase %s failed", phase_name);
            return status;
        }
    }
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "End:axis2_engine_invoke_phases");
    return AXIS2_SUCCESS;
}
Esempio n. 3
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;
}