Exemplo n.º 1
0
void AXIS2_CALL
axis2_tcp_server_free(
    axis2_transport_receiver_t * server,
    const axutil_env_t * env)
{
    axis2_tcp_server_impl_t *server_impl = NULL;
    AXIS2_ENV_CHECK(env, void);
    server_impl = AXIS2_INTF_TO_IMPL(server);
    if (server_impl->svr_thread)
    {
        axis2_tcp_svr_thread_destroy(server_impl->svr_thread, env);
        axis2_tcp_svr_thread_free(server_impl->svr_thread, env);
        server_impl->svr_thread = NULL;
    }

    if (server_impl->conf_ctx_private)
    {
        axis2_conf_ctx_free(server_impl->conf_ctx_private, env);
        server_impl->conf_ctx_private = NULL;
    }

    /**
     * Do not free this. It may own to some other object
     */
    server_impl->conf_ctx = NULL;
    AXIS2_FREE(env->allocator, server_impl);
    return;
}
Exemplo n.º 2
0
AXIS2_EXTERN void AXIS2_CALL
axis2_amqp_receiver_free(
    axis2_transport_receiver_t* receiver,
    const axutil_env_t* env)
{
    AXIS2_ENV_CHECK_VOID(env);

    axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
    receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);

    if(receiver_resource_pack->qpid_receiver)
    {
        axis2_qpid_receiver_free(receiver_resource_pack->qpid_receiver, env);
        receiver_resource_pack->qpid_receiver = NULL;
    }

    if(receiver_resource_pack->conf_ctx_private)
    {
        axis2_conf_ctx_free(receiver_resource_pack->conf_ctx_private, env);
        receiver_resource_pack->conf_ctx_private = NULL;
    }

    receiver_resource_pack->conf_ctx = NULL; /* Do not free this. It may be owned by some other object */

    AXIS2_FREE(env->allocator, receiver_resource_pack);
}
Exemplo n.º 3
0
void AXIS2_CALL
axis2_xmpp_server_free(
    axis2_transport_receiver_t *server,
    const axutil_env_t *env)
{
    axis2_xmpp_server_impl_t *impl = NULL;
    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);

    impl = AXIS2_INTF_TO_IMPL(server);
    if (impl->svr_thread)
    {
        AXIS2_XMPP_SVR_THREAD_DESTROY(impl->svr_thread, env);
        AXIS2_XMPP_SVR_THREAD_FREE(impl->svr_thread, env);
        impl->svr_thread = NULL;
    }

    if (impl->conf_ctx_private)
    {
        axis2_conf_ctx_free(impl->conf_ctx_private, env);
        impl->conf_ctx_private = NULL;
    }

    /**
     * Do not free this. It may belong to some other object
     */
    impl->conf_ctx = NULL;


    AXIS2_FREE(env->allocator, impl);
}
Exemplo n.º 4
0
void
axis2_test_conf_ctx_init(axutil_env_t *env
    )
{
    struct axis2_conf *conf = NULL;
    struct axis2_svc_grp_ctx *svc_grp_ctx1 = NULL;
    struct axis2_svc_grp_ctx *svc_grp_ctx2 = NULL;
    struct axis2_svc_grp *svc_grp1 = NULL;
    struct axis2_svc_grp *svc_grp2 = NULL;
    struct axis2_conf_ctx *conf_ctx = NULL;
    struct axis2_svc_ctx *svc_ctx1 = NULL;
    struct axis2_svc_ctx *svc_ctx2 = NULL;
    struct axis2_svc *svc1 = NULL;
    struct axis2_svc *svc2 = NULL;
    struct axutil_qname *qname1 = NULL;
    struct axutil_qname *qname2 = NULL;
    struct axis2_op_ctx *op_ctx1 = NULL;
    struct axis2_op_ctx *op_ctx2 = NULL;
    struct axis2_op *op = NULL;
    struct axutil_hash_t *op_ctx_map = NULL;
    struct axutil_hash_t *svc_ctx_map = NULL;
    struct axutil_hash_t *svc_grp_ctx_map = NULL;
    axis2_status_t status = AXIS2_FAILURE;

    conf = axis2_conf_create(env);
    CUT_ASSERT_PTR_NOT_EQUAL(conf, NULL, 1);

    conf_ctx = axis2_conf_ctx_create(env, conf);
    CUT_ASSERT_PTR_NOT_EQUAL(conf_ctx, NULL, 1);
	
    svc_grp1 = axis2_svc_grp_create(env);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_grp1, NULL, 0);
    svc_grp2 = axis2_svc_grp_create(env);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_grp2, NULL, 0);

    svc_grp_ctx1 = axis2_svc_grp_ctx_create(env, svc_grp1, conf_ctx);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx1, NULL, 0);
    svc_grp_ctx2 = axis2_svc_grp_ctx_create(env, svc_grp2, conf_ctx);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx2, NULL, 0);

    qname1 = axutil_qname_create(env, "name1", NULL, NULL);
    CUT_ASSERT_PTR_NOT_EQUAL(qname1, NULL, 0);
    qname2 = axutil_qname_create(env, "name2", NULL, NULL);
    CUT_ASSERT_PTR_NOT_EQUAL(qname2, NULL, 0);

    svc1 = axis2_svc_create_with_qname(env, qname1);
    CUT_ASSERT_PTR_NOT_EQUAL(svc1, NULL, 0);
    svc2 = axis2_svc_create_with_qname(env, qname2);
    CUT_ASSERT_PTR_NOT_EQUAL(svc2, NULL, 0);

    svc_ctx1 = axis2_svc_ctx_create(env, svc1, svc_grp_ctx1);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);
    svc_ctx2 = axis2_svc_ctx_create(env, svc2, svc_grp_ctx2);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);

    op = axis2_op_create(env);
    CUT_ASSERT_PTR_NOT_EQUAL(op, NULL, 0);

    op_ctx1 = axis2_op_ctx_create(env, op, svc_ctx1);
    CUT_ASSERT_PTR_NOT_EQUAL(op_ctx1, NULL, 0);

    op_ctx2 = axis2_op_ctx_create(env, op, svc_ctx2);
    CUT_ASSERT_PTR_NOT_EQUAL(op_ctx2, NULL, 0);

    op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, env);
    CUT_ASSERT_PTR_NOT_EQUAL(op_ctx_map, NULL, 0);
    if (op_ctx_map)
    {
        axutil_hash_set(op_ctx_map, "op_ctx1", AXIS2_HASH_KEY_STRING, op_ctx1);
        axutil_hash_set(op_ctx_map, "op_ctx2", AXIS2_HASH_KEY_STRING, op_ctx2);
    }

    svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, env);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx_map, NULL, 0);
    if (svc_ctx_map)
    {
        axutil_hash_set(svc_ctx_map, "svc_ctx1", AXIS2_HASH_KEY_STRING,
                        svc_ctx1);
        axutil_hash_set(svc_ctx_map, "svc_ctx2", AXIS2_HASH_KEY_STRING,
                        svc_ctx2);
    }

    svc_grp_ctx_map = axis2_conf_ctx_get_svc_grp_ctx_map(conf_ctx, env);
    CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx_map, NULL, 0);

    if (svc_grp_ctx_map)
    {
        axutil_hash_set(svc_ctx_map, "svc_grp_ctx1", AXIS2_HASH_KEY_STRING,
                        svc_grp_ctx1);
        axutil_hash_set(svc_ctx_map, "svc_grp_ctx2", AXIS2_HASH_KEY_STRING,
                        svc_grp_ctx2);
    }

    status = axis2_conf_ctx_init(conf_ctx, env, conf);
    CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
	printf("Error code : %d\n", env->error->error_number);
	/*
    CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
    */
    
    /* To avoid warning of not using cut_str_equal */
    CUT_ASSERT_STR_EQUAL("", "", 0);

    axis2_conf_ctx_free(conf_ctx, env);
}
Exemplo n.º 5
0
AXIS2_EXTERN axis2_conf_ctx_t *AXIS2_CALL
axis2_conf_ctx_create(
    const axutil_env_t * env,
    axis2_conf_t * conf)
{
    axis2_conf_ctx_t *conf_ctx = NULL;

    conf_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_conf_ctx_t));
    if(!conf_ctx)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
        return NULL;
    }

    conf_ctx->base = NULL;
    conf_ctx->conf = NULL;
    conf_ctx->root_dir = NULL;
    conf_ctx->op_ctx_map = NULL;
    conf_ctx->svc_ctx_map = NULL;
    conf_ctx->svc_grp_ctx_map = NULL;
    conf_ctx->mutex = axutil_thread_mutex_create(env->allocator, AXIS2_THREAD_MUTEX_DEFAULT);
    if(!conf_ctx->mutex)
    {
        axis2_conf_ctx_free(conf_ctx, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Could not create thread mutex");
        return NULL;
    }

    if(conf)
        conf_ctx->conf = conf;

    conf_ctx->base = axis2_ctx_create(env);
    if(!(conf_ctx->base))
    {
        axis2_conf_ctx_free(conf_ctx, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Could not create base context");
        return NULL;
    }

    conf_ctx->op_ctx_map = axutil_hash_make(env);
    if(!(conf_ctx->op_ctx_map))
    {
        axis2_conf_ctx_free(conf_ctx, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Could not create operation context map");
        return NULL;
    }

    conf_ctx->svc_ctx_map = axutil_hash_make(env);
    if(!(conf_ctx->svc_ctx_map))
    {
        axis2_conf_ctx_free(conf_ctx, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Could not create service context map");
        return NULL;
    }

    conf_ctx->svc_grp_ctx_map = axutil_hash_make(env);
    if(!(conf_ctx->svc_grp_ctx_map))
    {
        axis2_conf_ctx_free(conf_ctx, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Could not create service group context map");
        return NULL;
    }

    return conf_ctx;
}
Exemplo n.º 6
0
AXIS2_EXTERN void AXIS2_CALL
axis2_svc_client_free(
    axis2_svc_client_t * svc_client,
    const axutil_env_t * env)
{
    if(!svc_client)
    {
        return;
    }

    if(svc_client->headers)
    {
        axis2_svc_client_remove_all_headers(svc_client, env);
        axutil_array_list_free(svc_client->headers, env);
        svc_client->headers = NULL;
    }

    if(svc_client->svc && !svc_client->keep_externally_passed_ctx_and_svc)
    {
        axis2_svc_free(svc_client->svc, env);
    }

    if(svc_client->callback_recv)
    {
        AXIS2_CALLBACK_RECV_FREE(svc_client->callback_recv, env);
    }

    if(svc_client->op_client)
    {
        axis2_op_client_free(svc_client->op_client, env);
        svc_client->op_client = NULL;
    }

    if(svc_client->options)
    {
        axis2_options_free(svc_client->options, env);
    }

    if(svc_client->listener_manager)
    {
        axis2_listener_manager_free(svc_client->listener_manager, env);
    }

    if(svc_client->conf_ctx && !svc_client->keep_externally_passed_ctx_and_svc)
    {
        axis2_conf_ctx_free(svc_client->conf_ctx, env);
    }

    if(svc_client->auth_type)
    {
        AXIS2_FREE(env->allocator, svc_client->auth_type);
    }

    if(svc_client->http_headers)
    {
        axis2_svc_client_set_http_info(svc_client, env, NULL);
    }

    AXIS2_FREE(env->allocator, svc_client);

    return;
}