You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/11/07 06:28:57 UTC
svn commit: r331208 - in /webservices/axis2/trunk/c: include/axis2_handler.h
include/axis2_handler_desc.h include/axis2_param_container.h
modules/core/description/src/Makefile.am
modules/core/description/src/handler_desc.c
Author: samisa
Date: Sun Nov 6 21:28:40 2005
New Revision: 331208
URL: http://svn.apache.org/viewcvs?rev=331208&view=rev
Log:
Added the initial compiling version of handler description struct
Added:
webservices/axis2/trunk/c/include/axis2_handler_desc.h
webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c
Modified:
webservices/axis2/trunk/c/include/axis2_handler.h
webservices/axis2/trunk/c/include/axis2_param_container.h
webservices/axis2/trunk/c/modules/core/description/src/Makefile.am
Modified: webservices/axis2/trunk/c/include/axis2_handler.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler.h?rev=331208&r1=331207&r2=331208&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler.h Sun Nov 6 21:28:40 2005
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_HANDLER_H
+#define AXIS2_HANDLER_H
+
+/**
+ * @file axis2_handler.h
+ * @brief Axis2 handler interface
+ */
+
+#include <axis2_defines.h>
+#include <axis2_qname.h>
+#include <axis2_param.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ struct axis2_handler;
+ struct axis2_handler_ops;
+ struct axis2_handler_description;
+ struct axis2_msg_ctx;
+
+/**
+ * @defgroup axis2_handler Handlers
+ * @ingroup axis2_core_handlers
+ * @{
+ */
+
+/**
+ * \brief Handler operations struct
+ */
+ AXIS2_DECLARE_DATA typedef struct axis2_handler_ops
+ {
+ /**
+ * Free an axis2_handler struct
+ * @param env Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param axis2_handler pointer to axis2_handler struct to be freed
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ axis2_status_t (AXIS2_CALL *free) (struct axis2_handler * handler,
+ axis2_env_t **env);
+
+
+ /**
+ * Method init
+ *
+ * @param handlerdesc
+ */
+ axis2_status_t (AXIS2_CALL *init) (struct axis2_handler * handler,
+ axis2_env_t **env,
+ struct axis2_handler_description *handler_desc);
+
+ /**
+ * Invoke is called to do the actual work of the Handler object.
+ * If there is a fault during the processing of this method it is
+ * invoke's job to catch the exception and undo any partial work
+ * that has been completed. Once we leave 'invoke' if a fault
+ * is thrown, this classes 'onFault' method will be called.
+ * Invoke should rethrow any exceptions it catches, wrapped in
+ * an AxisFault.
+ *
+ * @param msgContext the <code>axis2_context_message</code> to process with this
+ * <code>Handler</code>.
+ * @throws AxisFault if the handler encounters an error
+ */
+ axis2_status_t (AXIS2_CALL *invoke) (struct axis2_handler * handler,
+ axis2_env_t **env,
+ struct axis2_msg_ctx *msg_ctx);
+
+
+ /**
+ * Method getName
+ *
+ * @return
+ */
+ axis2_qname_t* (AXIS2_CALL *get_name) (struct axis2_handler * handler,
+ axis2_env_t **env);
+
+ /**
+ * Method getParameter
+ *
+ * @param name
+ * @return
+ */
+ axis2_param_t* (AXIS2_CALL *get_parameter) (struct axis2_handler * handler,
+ axis2_env_t **env,
+ axis2_char_t *name);
+
+ /**
+ * To get the phaseRule of a handler it is required to get the HnadlerDescription of the handler
+ * so the argumnet pass when it call return as HnadlerDescription
+ *
+ * @return
+ */
+ struct axis2_handler_description* (AXIS2_CALL * get_handler_desc) (struct axis2_handler * handler,
+ axis2_env_t **env);
+ } axis2_handler_ops_t;
+
+ /**
+ * \brief Handler struct
+ */
+ typedef struct axis2_handler
+ {
+ /** Handler related operations */
+ axis2_handler_ops_t *ops;
+ } axis2_handler_t;
+
+
+/**
+ * creates handler struct
+ */
+AXIS2_DECLARE(axis2_handler_t*) axis2_handler_create(axis2_env_t **env);
+
+#define AXIS2_HANDLER_FREE(handler, env) ((handler)->ops->free(handler, env))
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_HANDLER_H */
Added: webservices/axis2/trunk/c/include/axis2_handler_desc.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler_desc.h?rev=331208&view=auto
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler_desc.h (added)
+++ webservices/axis2/trunk/c/include/axis2_handler_desc.h Sun Nov 6 21:28:40 2005
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_HANDLER_DESC_H
+#define AXIS2_HANDLER_DESC_H
+
+/**
+ * @file axis2_handler_desc.h
+ * @brief Axis2 handler_desc interface
+ */
+
+#include <axis2_defines.h>
+#include <axis2_qname.h>
+#include <axis2_param.h>
+#include <axis2_phase_rule.h>
+#include <axis2_handler.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ struct axis2_handler_desc;
+ struct axis2_handler_desc_ops;
+
+/**
+ * @defgroup axis2_handler_desc Handler Description
+ * @ingroup axis2_description
+ * @{
+ */
+
+/**
+ * \brief Phase Rule operations struct
+ */
+ AXIS2_DECLARE_DATA typedef struct axis2_handler_desc_ops
+ {
+ axis2_qname_t* (AXIS2_CALL *get_qname) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_qname) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_qname_t *qname);
+ axis2_phase_rule_t* (AXIS2_CALL *get_rules) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_rules) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_phase_rule_t *phase_rule);
+ axis2_param_t* (AXIS2_CALL *get_param) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *name);
+ axis2_status_t (AXIS2_CALL *add_param) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_param_t * param);
+ axis2_hash_t* (AXIS2_CALL *get_params) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+
+ /**
+ * checks whether the paramter is locked at any levle
+ */
+ axis2_bool_t (AXIS2_CALL *is_param_locked)(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t * param_name);
+ axis2_handler_t* (AXIS2_CALL *get_handler) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_handler) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_handler_t * handler);
+ axis2_char_t* (AXIS2_CALL *get_class_name) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_class_name) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *class_name);
+ axis2_param_container_t* (AXIS2_CALL *get_parent) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_parent) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env,
+ axis2_param_container_t * parent);
+ axis2_status_t (AXIS2_CALL *free) (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+
+ } axis2_handler_desc_ops_t;
+
+ /**
+ * \brief Phase Rule struct
+ */
+ typedef struct axis2_handler_desc
+ {
+ /** Phase Rule related operations */
+ axis2_handler_desc_ops_t *ops;
+ } axis2_handler_desc_t;
+
+
+/**
+ * creates handler_desc struct
+ * @param qname qname, can be NULL
+ */
+AXIS2_DECLARE(axis2_handler_desc_t*) axis2_handler_desc_create(axis2_env_t **env, axis2_qname_t *qname);
+
+#define AXIS2_HANDLER_DESC_GET_BEFORE(handler_desc, env) ((handler_desc)->ops->get_before(handler_desc, env))
+#define AXIS2_HANDLER_DESC_SET_BEFORE(handler_desc, env, before) ((handler_desc)->ops->set_before(handler_desc, env, before))
+#define AXIS2_HANDLER_DESC_GET_AFTER(handler_desc, env) ((handler_desc)->ops->get_after(handler_desc, env))
+#define AXIS2_HANDLER_DESC_SET_AFTER(handler_desc, env, after) ((handler_desc)->ops->set_after(handler_desc, env, after))
+#define AXIS2_HANDLER_DESC_GET_NAME(handler_desc, env) ((handler_desc)->ops->get_name(handler_desc, env))
+#define AXIS2_HANDLER_DESC_SET_NAME(handler_desc, env, name) ((handler_desc)->ops->set_name(handler_desc, env, name))
+#define AXIS2_HANDLER_DESC_IS_PHASE_FIRST(handler_desc, env) ((handler_desc)->ops->is_phase_first((handler_desc, env))
+#define AXIS2_HANDLER_DESC_GET_PHASE_FIRST(handler_desc, env, phase_first) ((handler_desc)->ops->set_phase_first(handler_desc, env, phase_first))
+#define AXIS2_HANDLER_DESC_IS_PHASE_LAST(handler_desc, env) ((handler_desc)->ops->is_phase_last(handler_desc, env))
+#define AXIS2_HANDLER_DESC_GET_PHASE_LAST(handler_desc, env, phase_last) ((handler_desc)->ops->set_phase_last(handler_desc, env, phase_last))
+#define AXIS2_HANDLER_DESC_FREE(handler_desc, env) ((handler_desc)->ops->free(handler_desc, env))
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_HANDLER_DESC_H */
Modified: webservices/axis2/trunk/c/include/axis2_param_container.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_param_container.h?rev=331208&r1=331207&r2=331208&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_param_container.h (original)
+++ webservices/axis2/trunk/c/include/axis2_param_container.h Sun Nov 6 21:28:40 2005
@@ -113,13 +113,13 @@
/*************************** Function macros **********************************/
#define AXIS2_PARAM_CONTAINER_FREE(param_container, env) \
- ((param_container->ops)->free (env, param_container))
+ ((param_container->ops)->free (param_container, env))
#define AXIS2_PARAM_CONTAINER_ADD_PARAM(param_container, env, param) \
((param_container->ops)->add_param (param_container, env, param))
-#define AXIS2_PARAM_CONTAINER_GET_PARAM(param_container, env) \
- ((param_container->ops)->get_param (param_container, env))
+#define AXIS2_PARAM_CONTAINER_GET_PARAM(param_container, env, name) \
+ ((param_container->ops)->get_param (param_container, env, name))
#define AXIS2_PARAM_CONTAINER_GET_PARAMS(param_container, env) \
((param_container->ops)->get_params (param_container, env))
Modified: webservices/axis2/trunk/c/modules/core/description/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/Makefile.am?rev=331208&r1=331207&r2=331208&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/Makefile.am Sun Nov 6 21:28:40 2005
@@ -6,7 +6,8 @@
module.c \
param.c \
svc_grp.c \
- phase_rule.c
+ phase_rule.c \
+ handler_desc.c
libaxis2_description_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
Added: webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c?rev=331208&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/handler_desc.c Sun Nov 6 21:28:40 2005
@@ -0,0 +1,394 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_handler_desc.h>
+#include <axis2_param_container.h>
+#include <axis2_string.h>
+#include <axis2_handler.h>
+
+typedef struct axis2_handler_desc_impl
+{
+ /** handler description */
+ axis2_handler_desc_t handler_desc;
+ /** param container */
+ axis2_param_container_t *param_container;
+ /** name */
+ axis2_qname_t *qname;
+ /** phase rules */
+ axis2_phase_rule_t *rules;
+ /** handler repsesented by meta information*/
+ axis2_handler_t *handler;
+ /** class qname */
+ axis2_char_t *class_name;
+ /** parent param container */
+ axis2_param_container_t *parent_param_container;
+} axis2_handler_desc_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(handler_desc) ((axis2_handler_desc_impl_t *)handler_desc)
+
+axis2_qname_t* AXIS2_CALL axis2_handler_desc_get_qname (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_qname (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_qname_t *qname);
+axis2_phase_rule_t* AXIS2_CALL axis2_handler_desc_get_rules(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_rules(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_phase_rule_t *phase_rule);
+axis2_param_t* AXIS2_CALL axis2_handler_desc_get_param(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *name);
+axis2_status_t AXIS2_CALL axis2_handler_desc_add_param(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_param_t * param);
+axis2_hash_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_bool_t AXIS2_CALL axis2_handler_desc_is_param_locked(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t * param_name);
+axis2_handler_t* AXIS2_CALL axis2_handler_desc_get_handler(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_handler(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_handler_t * handler);
+axis2_char_t* AXIS2_CALL axis2_handler_desc_get_class_name(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_class_name(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *class_name);
+axis2_param_container_t* AXIS2_CALL axis2_handler_desc_get_parent(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_parent(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env,
+ axis2_param_container_t * parent_param_container);
+axis2_status_t AXIS2_CALL axis2_handler_desc_free (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env);
+
+axis2_handler_desc_t* AXIS2_CALL axis2_handler_desc_create(axis2_env_t **env, axis2_qname_t *qname)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ handler_desc_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_handler_desc_impl_t) );
+ if (!handler_desc_impl)
+ {
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ handler_desc_impl->param_container = NULL;
+ handler_desc_impl->qname = NULL;
+ handler_desc_impl->rules = NULL;
+ handler_desc_impl->handler = NULL;
+ handler_desc_impl->class_name = NULL;
+ handler_desc_impl->parent_param_container = NULL;
+
+ handler_desc_impl->param_container = axis2_param_container_create(env);
+ if (!handler_desc_impl->param_container)
+ {
+ /** error is already set by last param container create */
+ axis2_handler_desc_free(&(handler_desc_impl->handler_desc), env);
+ return NULL;
+ }
+
+ handler_desc_impl->rules = axis2_phase_rule_create(env, NULL);
+ if (!handler_desc_impl->rules)
+ {
+ /** error is already set by last param container create */
+ axis2_handler_desc_free(&(handler_desc_impl->handler_desc), env);
+ return NULL;
+ }
+
+ if (qname)
+ {
+ handler_desc_impl->qname = qname; /* shallow copy */
+ }
+
+ if (!handler_desc_impl->handler_desc.ops)
+ {
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ axis2_handler_desc_free(&(handler_desc_impl->handler_desc), env);
+ return NULL;
+ }
+
+ /* initialize operations */
+ handler_desc_impl->handler_desc.ops = NULL;
+ handler_desc_impl->handler_desc.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_handler_desc_ops_t) );
+ if (!handler_desc_impl->handler_desc.ops)
+ {
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ axis2_handler_desc_free(&(handler_desc_impl->handler_desc), env);
+ return NULL;
+ }
+
+ handler_desc_impl->handler_desc.ops->get_qname = axis2_handler_desc_get_qname;
+ handler_desc_impl->handler_desc.ops->set_qname = axis2_handler_desc_set_qname;
+ handler_desc_impl->handler_desc.ops->get_rules = axis2_handler_desc_get_rules;
+ handler_desc_impl->handler_desc.ops->set_rules = axis2_handler_desc_set_rules;
+ handler_desc_impl->handler_desc.ops->get_param = axis2_handler_desc_get_param;
+ handler_desc_impl->handler_desc.ops->add_param = axis2_handler_desc_add_param;
+ handler_desc_impl->handler_desc.ops->get_params = axis2_handler_desc_get_params;
+ handler_desc_impl->handler_desc.ops->is_param_locked = axis2_handler_desc_is_param_locked;
+ handler_desc_impl->handler_desc.ops->get_handler = axis2_handler_desc_get_handler;
+ handler_desc_impl->handler_desc.ops->set_handler = axis2_handler_desc_set_handler;
+ handler_desc_impl->handler_desc.ops->get_class_name = axis2_handler_desc_get_class_name;
+ handler_desc_impl->handler_desc.ops->set_class_name = axis2_handler_desc_set_class_name;
+ handler_desc_impl->handler_desc.ops->get_parent = axis2_handler_desc_get_parent;
+ handler_desc_impl->handler_desc.ops->set_parent = axis2_handler_desc_set_parent;
+ handler_desc_impl->handler_desc.ops->free = axis2_handler_desc_free;
+
+ return &(handler_desc_impl->handler_desc);
+}
+
+axis2_qname_t* AXIS2_CALL axis2_handler_desc_get_qname (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+ return AXIS2_INTF_TO_IMPL(handler_desc)->qname;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_qname (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_qname_t *qname)
+{
+ /**TODO: need to have the qname copy constructor here */
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+ AXIS2_INTF_TO_IMPL(handler_desc)->qname = qname;
+ return AXIS2_SUCCESS;
+
+}
+
+axis2_phase_rule_t* AXIS2_CALL axis2_handler_desc_get_rules(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+ return AXIS2_INTF_TO_IMPL(handler_desc)->rules;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_rules(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_phase_rule_t *phase_rule)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ if (handler_desc_impl->rules)
+ {
+ AXIS2_PHASE_RULE_FREE(handler_desc_impl->rules, env);
+ handler_desc_impl->rules = NULL;
+ }
+
+ if (phase_rule)
+ {
+ handler_desc_impl->rules = AXIS2_PHASE_RULE_CLONE(phase_rule, env);
+ if (!(handler_desc_impl->rules))
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_param_t* AXIS2_CALL axis2_handler_desc_get_param(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *name)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ return AXIS2_PARAM_CONTAINER_GET_PARAM(handler_desc_impl->param_container, env, name);
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_add_param(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_param_t * param)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ if (AXIS2_PARAM_CONTAINER_IS_PARAM_LOCKED(handler_desc_impl->parent_param_container, env, AXIS2_PARAM_GET_NAME(param, env)) )
+ {
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_PARAMETER_LOCKED_CANNOT_OVERRIDE);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_PARAM_CONTAINER_ADD_PARAM(handler_desc_impl->param_container, env, param);
+}
+
+axis2_hash_t* AXIS2_CALL axis2_handler_desc_get_params(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ return AXIS2_PARAM_CONTAINER_GET_PARAMS(handler_desc_impl->param_container, env);
+}
+
+axis2_bool_t AXIS2_CALL axis2_handler_desc_is_param_locked(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t * param_name)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ /* see if it is locked in parent_param_container */
+ if( AXIS2_PARAM_CONTAINER_IS_PARAM_LOCKED(handler_desc_impl->parent_param_container, env, param_name) )
+ return AXIS2_TRUE;
+
+ return AXIS2_PARAM_CONTAINER_IS_PARAM_LOCKED(handler_desc_impl->param_container, env, param_name);
+}
+
+axis2_handler_t* AXIS2_CALL axis2_handler_desc_get_handler(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+ return AXIS2_INTF_TO_IMPL(handler_desc)->handler;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_handler(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_handler_t * handler)
+{
+ /* handler dec is the place wehre the handler really lives. Hence this is a deep copy and
+ should be freed by the free mechanism. There is a coupling here in trems of freeing */
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ if (handler_desc_impl->handler)
+ {
+ AXIS2_HANDLER_FREE(handler_desc_impl->handler, env);
+ handler_desc_impl->handler = NULL;
+ }
+
+ if (handler)
+ handler_desc_impl->handler = handler; /* Shallow copy, but free method should free this */
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL axis2_handler_desc_get_class_name(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+ return AXIS2_INTF_TO_IMPL(handler_desc)->class_name;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_class_name(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env, axis2_char_t *class_name)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+ if (handler_desc_impl->class_name)
+ {
+ AXIS2_FREE((*env)->allocator, handler_desc_impl->class_name);
+ handler_desc_impl->class_name = NULL;
+ }
+
+ if (class_name)
+ {
+ handler_desc_impl->class_name = axis2_strdup(class_name);
+ if (!handler_desc_impl->class_name)
+ {
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_param_container_t* AXIS2_CALL axis2_handler_desc_get_parent(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, NULL);
+ return AXIS2_INTF_TO_IMPL(handler_desc)->parent_param_container;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_set_parent(struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env,
+ axis2_param_container_t * parent_param_container)
+{
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+ AXIS2_INTF_TO_IMPL(handler_desc)->parent_param_container = parent_param_container; /* shallow copy, because the parent_param_container lives somewhere else*/
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL axis2_handler_desc_free (struct axis2_handler_desc *handler_desc,
+ axis2_env_t **env)
+{
+ axis2_handler_desc_impl_t *handler_desc_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler_desc, env, AXIS2_FAILURE);
+
+ handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
+
+ if (handler_desc_impl->handler_desc.ops)
+ {
+ AXIS2_FREE((*env)->allocator, handler_desc_impl->handler_desc.ops);
+ handler_desc_impl->handler_desc.ops = NULL;
+ }
+
+ if (handler_desc_impl->param_container)
+ {
+ AXIS2_PARAM_CONTAINER_FREE(handler_desc_impl->param_container, env);
+ handler_desc_impl->param_container = NULL;
+ }
+
+ /** the following block should be uncomented when clone is used in the code
+ if (handler_desc_impl->qname)
+ {
+ AXIS2_QNAME_FREE(handler_desc_impl->qname, env);
+ handler_desc_impl->qname = NULL;
+ }*/
+
+ if (handler_desc_impl->rules)
+ {
+ AXIS2_PHASE_RULE_FREE(handler_desc_impl->rules, env);
+ handler_desc_impl->rules = NULL;
+ }
+
+ if (handler_desc_impl->handler)
+ {
+ AXIS2_HANDLER_FREE(handler_desc_impl->handler, env);
+ handler_desc_impl->handler = NULL;
+ }
+
+ if (handler_desc_impl->class_name)
+ {
+ AXIS2_FREE((*env)->allocator, handler_desc_impl->class_name);
+ handler_desc_impl->class_name = NULL;
+ }
+
+ AXIS2_FREE((*env)->allocator, handler_desc_impl);
+ handler_desc_impl = NULL;
+
+ return AXIS2_SUCCESS;
+}