You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Damitha Kumarage <da...@gmail.com> on 2006/01/16 04:44:53 UTC
dynamic loading of message receivers, modules, services
Hi,
I have designed and implemented a a dyanmic loading mechanism for Axis2c
to load message receivers, modules and services.
Please read below
I have a structure which contain all the fields neccessary for holidng
dll loading
typedef struct axis2_dll_desc_impl
{
axis2_dll_desc_t dll_desc;
axis2_char_t *dll_name;
axis2_dll_type_t dll_type;
int load_options;
AXIS2_DLHANDLER dl_handler;
CREATE_FUNCT create_funct;
DELETE_FUNCT delete_funct;
} axis2_dll_desc_impl_t;
Following piece of code demonstrate the how the message receivers are
loaded into the
axis2c engine
dll_desc = axis2_dll_desc_create(env);
repos_name = AXIS2_DEP_ENGINE_GET_REPOS_PATH(desc_builder->engine, env);
temp_path = AXIS2_STRACAT(repos_name, AXIS2_PATH_SEP_STR, env);
temp_path2 = AXIS2_STRACAT(temp_path, AXIS2_LIB_FOLDER, env);
temp_path3 = AXIS2_STRACAT(temp_path2, AXIS2_PATH_SEP_STR, env);
dll_name = AXIS2_STRACAT(temp_path3, class_name, env); /* class name
here is the class attribute
* of messageReceiver element in axis2.xml.
* There we need to put the dll name of the
* message receiver(not including path)
*/
AXIS2_DLL_DESC_SET_NAME(dll_desc, env, dll_name);
AXIS2_DLL_DESC_SET_TYPE(dll_desc, env, AXIS2_MSG_RECV_DLL);
axis2_class_loader_init(env);
impl_info_param = axis2_param_create(env, NULL, NULL);
AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
msg_recv = (axis2_msg_recv_t *) axis2_class_loader_create_dll(env,
impl_info_param);
I have a class loader(name is bit odd. Please disregard it for the time
being) written to load services,
modules, message receivers depending on the dll_desc_type set. In the
above example it is
AXIS2_MSG_RECV_DLL.
Services, modules and Message Receivers should adhere to a common api
provided by axis2c.
The dll containing them should have the following exposed methods
/**
* Following block distinguish the exposed part of the dll.
*/
int axis2_get_instance(struct axis2_msg_recv **inst,
axis2_env_t **env)
{
*inst = axis2_raw_xml_in_out_msg_recv_create(env);
if(!(*inst))
{
return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
}
int axis2_remove_instance(axis2_svc_skeleton_t *inst,
axis2_env_t **env)
{
axis2_status_t status = AXIS2_FAILURE;
if (inst)
{
status = AXIS2_MSG_RECV_FREE(inst, env);
}
return status;
}
So class loader call these methods and load the dll to a void ponter.
When calling
msg_recv = (axis2_msg_recv_t *) axis2_class_loader_create_dll(env,
impl_info_param);
it cast it to the proper struct and call api methods.
I also have designed and implemented service skeleton api and wrote a
small service sample
for echo. I'll soon explain this.
thanks
damitha
Re: dynamic loading of message receivers, modules, services
Posted by Samisa Abeysinghe <sa...@wso2.com>.
Damitha,
For consistancy could we please s/funct/func and s/FUNCT/FUNC?
Thanks,
Samisa...
Damitha Kumarage wrote:
> Hi,
> I have designed and implemented a a dyanmic loading mechanism for Axis2c
> to load message receivers, modules and services.
> Please read below
>
> I have a structure which contain all the fields neccessary for holidng
> dll loading
>
> typedef struct axis2_dll_desc_impl
> {
> axis2_dll_desc_t dll_desc;
> axis2_char_t *dll_name;
> axis2_dll_type_t dll_type;
> int load_options;
> AXIS2_DLHANDLER dl_handler;
> CREATE_FUNCT create_funct;
> DELETE_FUNCT delete_funct;
> } axis2_dll_desc_impl_t;
>
> Following piece of code demonstrate the how the message receivers are
> loaded into the
> axis2c engine
>
> dll_desc = axis2_dll_desc_create(env);
> repos_name = AXIS2_DEP_ENGINE_GET_REPOS_PATH(desc_builder->engine,
> env);
> temp_path = AXIS2_STRACAT(repos_name, AXIS2_PATH_SEP_STR, env);
> temp_path2 = AXIS2_STRACAT(temp_path, AXIS2_LIB_FOLDER, env);
> temp_path3 = AXIS2_STRACAT(temp_path2, AXIS2_PATH_SEP_STR, env);
> dll_name = AXIS2_STRACAT(temp_path3, class_name, env); /* class
> name here is the class attribute
>
> * of messageReceiver element in axis2.xml.
>
> * There we need to put the dll name of the
>
> * message receiver(not including path)
>
> */
>
> AXIS2_DLL_DESC_SET_NAME(dll_desc, env, dll_name);
> AXIS2_DLL_DESC_SET_TYPE(dll_desc, env, AXIS2_MSG_RECV_DLL);
> axis2_class_loader_init(env);
> impl_info_param = axis2_param_create(env, NULL, NULL);
> AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
> msg_recv = (axis2_msg_recv_t *) axis2_class_loader_create_dll(env,
> impl_info_param);
>
> I have a class loader(name is bit odd. Please disregard it for the
> time being) written to load services,
> modules, message receivers depending on the dll_desc_type set. In the
> above example it is
> AXIS2_MSG_RECV_DLL.
>
> Services, modules and Message Receivers should adhere to a common api
> provided by axis2c.
>
> The dll containing them should have the following exposed methods
>
> /**
> * Following block distinguish the exposed part of the dll.
> */
> int axis2_get_instance(struct axis2_msg_recv **inst,
> axis2_env_t **env)
> {
> *inst = axis2_raw_xml_in_out_msg_recv_create(env);
> if(!(*inst))
> {
> return AXIS2_FAILURE;
> }
>
> return AXIS2_SUCCESS;
> }
>
> int axis2_remove_instance(axis2_svc_skeleton_t *inst,
> axis2_env_t **env)
> {
> axis2_status_t status = AXIS2_FAILURE;
> if (inst)
> {
> status = AXIS2_MSG_RECV_FREE(inst, env);
> }
> return status;
> }
>
> So class loader call these methods and load the dll to a void ponter.
>
> When calling
> msg_recv = (axis2_msg_recv_t *) axis2_class_loader_create_dll(env,
> impl_info_param);
>
> it cast it to the proper struct and call api methods.
> I also have designed and implemented service skeleton api and wrote a
> small service sample
> for echo. I'll soon explain this.
>
> thanks
> damitha
>
>
>
>
>
>