axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r413577 - in /webservices/axis2/trunk/c: include/axis2_desc.h modules/core/description/Makefile.am modules/core/description/desc.c
Date Mon, 12 Jun 2006 04:13:58 GMT
Author: samisa
Date: Sun Jun 11 21:13:57 2006
New Revision: 413577

URL: http://svn.apache.org/viewvc?rev=413577&view=rev
Log:
adding the desc base struct for description

Added:
    webservices/axis2/trunk/c/include/axis2_desc.h
    webservices/axis2/trunk/c/modules/core/description/desc.c
Modified:
    webservices/axis2/trunk/c/modules/core/description/Makefile.am

Added: webservices/axis2/trunk/c/include/axis2_desc.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_desc.h?rev=413577&view=auto
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_desc.h (added)
+++ webservices/axis2/trunk/c/include/axis2_desc.h Sun Jun 11 21:13:57 2006
@@ -0,0 +1,164 @@
+/*
+ * 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_DESC_H
+#define AXIS2_DESC_H
+
+/**
+  * @file axis2_msg.h
+  * @brief axis2 msg interface
+  */
+
+#include <axis2_param_container.h>
+#include <axis2_hash.h>
+#include <axis2_description.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup axis2_op Message Description
+  * @ingroup axis2_core_description
+  * @{
+  */
+typedef struct axis2_desc_ops axis2_desc_ops_t;    
+typedef struct axis2_desc axis2_desc_t;    
+
+    
+/** 
+ * @brief message ops struct
+ * Encapsulator struct for ops of axis2_msg
+ */    
+AXIS2_DECLARE_DATA struct axis2_desc_ops
+{
+    axis2_status_t (AXIS2_CALL *
+    free) (
+        axis2_desc_t *desc, 
+        const axis2_env_t *env);
+    
+    axis2_status_t (AXIS2_CALL *
+    add_param) (axis2_desc_t *desc, 
+        const axis2_env_t *env,       
+        axis2_param_t *param);
+    
+    axis2_param_t *(AXIS2_CALL *
+    get_param) (
+        const axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        const axis2_char_t *param_name);
+    
+    axis2_array_list_t *(AXIS2_CALL *
+    get_all_params)(
+        axis2_desc_t *desc, 
+        const axis2_env_t *env);
+    
+    axis2_bool_t (AXIS2_CALL *
+    is_param_locked)(
+        const axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        const axis2_char_t *param_name);
+    
+    /*axis2_status_t (AXIS2_CALL *
+    set_policy_container)(
+        axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        axis2_policy_container_t *policy_container);
+    
+    axis2_policy_container_t *(AXIS2_CALL *
+    get_policy_container)(
+        const axis2_desc_t *desc, 
+        const axis2_env_t *env);*/
+    
+    axis2_status_t (AXIS2_CALL *
+    add_child)(
+        const axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        const axis2_char_t *key, 
+        const void* child); 
+    
+    axis2_hash_t *(AXIS2_CALL *
+    get_all_children)(const axis2_desc_t *desc, 
+        const axis2_env_t *env);
+    
+    void *(AXIS2_CALL *
+    get_child)(const axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        const axis2_char_t *key);
+    
+    axis2_status_t (AXIS2_CALL *
+    remove_child)(const axis2_desc_t *desc, 
+        const axis2_env_t *env,
+        const axis2_char_t *key);
+};
+
+/** 
+ * @brief message struct
+ *   Axis2 message   
+ */  
+AXIS2_DECLARE_DATA struct axis2_desc
+{
+    axis2_desc_ops_t *ops;
+
+};
+
+/** 
+ * Creates msg struct
+ * @return pointer to newly created msg
+ */
+AXIS2_EXTERN axis2_desc_t *AXIS2_CALL
+axis2_desc_create (const axis2_env_t *env);
+
+/************************** Start of function macros **************************/
+
+#define AXIS2_DESC_FREE(msg, env) \
+        ((msg)->ops->free (msg, env))
+
+#define AXIS2_DESC_ADD_PARAM(msg, env, param) \
+      ((msg)->ops->add_param (msg, env, param))
+
+#define AXIS2_DESC_GET_PARAM(msg, env, key) \
+      ((msg)->ops->get_param (msg, env, key))
+
+#define AXIS2_DESC_GET_ALL_PARAMS(msg, env) \
+      ((msg)->ops->get_all_params (msg, env))
+
+#define AXIS2_DESC_IS_PARAM_LOCKED(msg, env, param_name) \
+        ((msg)->ops->is_param_locked(msg, env, param_name))
+
+#define AXIS2_DESC_SET_POLICY_INCLUDE(desc, env, policy_container) \
+    ((msg)->ops->set_policy_include(desc, env, policy_container))
+
+#define AXIS2_DESC_GET_POLICY_INCLUDE(desc, env) \
+    ((msg)->ops->get_policy_container(desc, env))
+    
+#define AXIS2_DESC_ADD_CHILD(desc, env, key, child) \
+    ((msg)->ops->add_child(desc, env, key, child))
+    
+#define AXIS2_DESC_GET_ALL_CHILDREN(desc, env) \
+    ((msg)->ops->get_all_children(desc, env))
+    
+#define AXIS2_DESC_GET_CHILD(desc, env, key) \
+    ((msg)->ops->get_child(desc, env, key))
+    
+#define AXIS2_DESC_REMOVE_CHILD(desc, env, key) \
+    ((msg)->ops->remove_child(desc, env, key))
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif  /* AXIS2_DESC_H */

Modified: webservices/axis2/trunk/c/modules/core/description/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/description/Makefile.am?rev=413577&r1=413576&r2=413577&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/description/Makefile.am Sun Jun 11 21:13:57 2006
@@ -1,6 +1,7 @@
 noinst_LTLIBRARIES = libaxis2_description.la
 
 libaxis2_description_la_SOURCES = \
+                                desc.c \
                                 op.c \
                                 svc.c \
                                 module.c \

Added: webservices/axis2/trunk/c/modules/core/description/desc.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/description/desc.c?rev=413577&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/desc.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/desc.c Sun Jun 11 21:13:57 2006
@@ -0,0 +1,336 @@
+/*
+* 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_desc.h>
+#include <axis2_property.h>
+
+/** 
+ * @brief Message struct impl
+ *   Axis2 Messages  
+ */ 
+typedef struct axis2_desc_impl
+{
+    axis2_desc_t desc;
+    
+    /** parameter container */
+    axis2_param_container_t *param_container;
+    
+    /** policy container */
+    /* TODO: uncomment when policy is implemented 
+    axis2_policy_container_t *policy_container;*/
+
+    /** children of this description */
+    axis2_hash_t *children;
+} axis2_desc_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(desc) ((axis2_desc_impl_t *)desc)
+   
+/*************************** Function headers *********************************/
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_free (axis2_desc_t *desc, const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_add_param (axis2_desc_t *desc, 
+    const axis2_env_t *env,       
+    axis2_param_t *param);
+
+axis2_param_t * AXIS2_CALL
+axis2_desc_get_param (const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *param_name);
+
+axis2_array_list_t * AXIS2_CALL
+axis2_desc_get_all_params(axis2_desc_t *desc, 
+    const axis2_env_t *env);
+
+axis2_bool_t AXIS2_CALL 
+axis2_desc_is_param_locked(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *param_name);
+
+/*axis2_status_t AXIS2_CALL 
+axis2_desc_set_policy_container(axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    axis2_policy_container_t *policy_container);
+
+axis2_policy_container_t * AXIS2_CALL 
+axis2_desc_get_policy_container(const axis2_desc_t *desc, 
+    const axis2_env_t *env);
+*/
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_add_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key, 
+    const void* child); 
+
+axis2_hash_t * AXIS2_CALL 
+axis2_desc_get_all_children(const axis2_desc_t *desc, 
+    const axis2_env_t *env);
+
+void * AXIS2_CALL 
+axis2_desc_get_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key);
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_remove_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key);
+
+/************************* End of function headers ****************************/   
+
+AXIS2_EXTERN axis2_desc_t * AXIS2_CALL
+axis2_desc_create (const axis2_env_t *env)
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+ 
+    AXIS2_ENV_CHECK(env, NULL);
+   
+   desc_impl =  (axis2_desc_impl_t *) AXIS2_MALLOC (env->allocator,
+      sizeof (axis2_desc_impl_t));
+     
+   if(NULL == desc_impl)
+   {
+      AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+   }
+    
+    desc_impl->param_container = NULL;
+    /*desc_impl->policy_container = NULL;*/
+    desc_impl->children = NULL;
+    desc_impl->desc.ops = NULL;
+
+    desc_impl->param_container = (axis2_param_container_t *)
+      axis2_param_container_create(env);      
+    if(NULL == desc_impl->param_container)
+    {
+        axis2_desc_free(&(desc_impl->desc), env);
+        return NULL;        
+    }
+
+    desc_impl->children = axis2_hash_make(env);
+    if(NULL == desc_impl->children)
+    {
+        axis2_desc_free(&(desc_impl->desc), env);
+        return NULL;        
+    }
+
+    desc_impl->desc.ops = AXIS2_MALLOC(env->allocator, sizeof(axis2_desc_ops_t));
+    if(NULL == desc_impl->desc.ops)
+    {
+        axis2_desc_free(&(desc_impl->desc), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+   
+    desc_impl->desc.ops->free = axis2_desc_free;
+    desc_impl->desc.ops->add_param = axis2_desc_add_param;
+    desc_impl->desc.ops->get_param = axis2_desc_get_param;
+    desc_impl->desc.ops->get_all_params = axis2_desc_get_all_params;
+    desc_impl->desc.ops->is_param_locked = axis2_desc_is_param_locked;
+    /*desc_impl->desc.ops->set_policy_container = axis2_desc_set_policy_container;
+    desc_impl->desc.ops->get_policy_container = axis2_desc_get_policy_container;*/
+    desc_impl->desc.ops->add_child = axis2_desc_add_child;
+    desc_impl->desc.ops->get_all_children = axis2_desc_get_all_children;
+    desc_impl->desc.ops->get_child = axis2_desc_get_child;
+    desc_impl->desc.ops->remove_child = axis2_desc_remove_child;
+
+    
+   return &(desc_impl->desc);
+}
+
+/*************************** Start of desc impls *************************/
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_free (axis2_desc_t *desc, const axis2_env_t *env)
+{ 
+    axis2_desc_impl_t *desc_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+
+    if(NULL != desc_impl->children)
+    {
+        /* contents of the children map should be cleaned by the owner */
+        axis2_hash_free(desc_impl->children, env);
+        desc_impl->children = NULL;
+    }
+
+    if(desc_impl->param_container)
+    {
+        AXIS2_PARAM_CONTAINER_FREE(desc_impl->param_container, env);
+        desc_impl->param_container = NULL;
+    }
+    
+    if (desc_impl->desc.ops)
+    {
+        AXIS2_FREE(env->allocator, desc_impl->desc.ops);
+        desc_impl->desc.ops = NULL;
+    }
+
+    if(desc_impl)    
+    {
+        AXIS2_FREE(env->allocator, desc_impl);
+        desc_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}   
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_add_param (axis2_desc_t *desc, 
+    const axis2_env_t *env,       
+    axis2_param_t *param)
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, param, AXIS2_FALSE);
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+   
+    return AXIS2_PARAM_CONTAINER_ADD_PARAM(desc_impl->param_container, env, param);
+}
+
+axis2_param_t * AXIS2_CALL
+axis2_desc_get_param (const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *param_name)
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+   AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+   AXIS2_PARAM_CHECK(env->error, param_name, NULL);
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+   return AXIS2_PARAM_CONTAINER_GET_PARAM(desc_impl->param_container, env, param_name);
+}
+
+axis2_array_list_t * AXIS2_CALL
+axis2_desc_get_all_params(axis2_desc_t *desc, 
+    const axis2_env_t *env)
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+    AXIS2_PARAM_CHECK(env->error, desc_impl->param_container, AXIS2_FALSE);
+   
+    return AXIS2_PARAM_CONTAINER_GET_PARAMS(desc_impl->param_container, env);
+}
+
+axis2_bool_t AXIS2_CALL 
+axis2_desc_is_param_locked(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *param_name)
+{
+    axis2_param_t *param_l = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, param_name, AXIS2_FALSE);
+    
+    param_l = axis2_desc_get_param(desc, env, param_name);   
+
+    return (param_l != NULL && AXIS2_PARAM_IS_LOCKED(param_l, env));
+}
+
+/*axis2_status_t AXIS2_CALL 
+axis2_desc_set_policy_container(axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    axis2_policy_container_t *policy_container) 
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    AXIS2_INTF_TO_IMPL(desc)->policy_container = policy_container;
+    
+    return AXIS2_SUCCESS;
+}
+
+axis2_policy_container_t * AXIS2_CALL 
+axis2_desc_get_policy_container(const axis2_desc_t *desc, 
+    const axis2_env_t *env) 
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+
+    if(!(desc_impl->policy_container)) 
+    {
+        desc_impl->policy_container = axis2_policy_container_create(env);
+    }
+    return desc_impl->policy_container;
+}
+*/
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_add_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key, 
+    const void* child) 
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+
+    if (desc_impl->children)
+    {
+        axis2_hash_set(desc_impl->children, key, 
+            AXIS2_HASH_KEY_STRING, child);
+        return AXIS2_SUCCESS;
+    }
+    return AXIS2_FAILURE;
+}
+
+axis2_hash_t * AXIS2_CALL 
+axis2_desc_get_all_children(const axis2_desc_t *desc, 
+    const axis2_env_t *env) 
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    return AXIS2_INTF_TO_IMPL(desc)->children;
+}
+
+void * AXIS2_CALL 
+axis2_desc_get_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key) 
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+
+    return axis2_hash_get(desc_impl->children, key, AXIS2_HASH_KEY_STRING);
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_desc_remove_child(const axis2_desc_t *desc, 
+    const axis2_env_t *env,
+    const axis2_char_t *key) 
+{
+    axis2_desc_impl_t *desc_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);    
+    desc_impl = AXIS2_INTF_TO_IMPL(desc);
+    
+    if (desc_impl->children)
+    {
+        axis2_hash_set(desc_impl->children, key, 
+            AXIS2_HASH_KEY_STRING, NULL);
+        return AXIS2_SUCCESS;
+    }
+    return AXIS2_FAILURE;
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message