You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/09/01 14:46:04 UTC

svn commit: r439295 [10/15] - in /webservices/axis2/trunk/c: tools/ tools/codegen/ tools/codegen/include/ tools/codegen/samples/ tools/codegen/samples/client/ tools/codegen/samples/client/calculator/ tools/codegen/samples/client/interop_test_svc/ tools...

Added: webservices/axis2/trunk/c/tools/codegen/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/Makefile.am?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/Makefile.am (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/Makefile.am Fri Sep  1 05:45:57 2006
@@ -0,0 +1,33 @@
+samplesdir=$(prefix)/conf
+samples_DATA= codegen-config.properties resource.properties
+
+noinst_LTLIBRARIES = libw2c_util.la
+libw2c_util_la_SOURCES = \
+   string.c  \
+   url_processor.c  \
+   xslt_utils.c \
+   file_writer.c \
+   xslt_template_processor.c \
+   properties.c \
+   cmdline_option.c \
+   cmdline_option_parser.c \
+   cmdline_option_validator.c \
+   config_property_loader.c \
+   messages.c \
+   class_loader.c \
+   typemapper.c \
+   $(NULL)
+
+
+libw2c_util_la_LIBADD =  \
+                      -L$(AXIS2C_HOME)/lib \
+                      -lxml2 -lxslt \
+                      -laxis2_util \
+                      -laxis2_axiom \
+                      -laxis2_parser \
+                      $(NULL)
+
+
+INCLUDES = -I$(top_builddir)/include \
+                        @UTILINC@ \
+                        @AXIOMINC@

Added: webservices/axis2/trunk/c/tools/codegen/src/util/class_loader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/class_loader.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/class_loader.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/class_loader.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,79 @@
+/*
+ * 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_class_loader.h>
+#include <w2c_class_loader.h>
+#include <w2c_string.h>
+#include <w2c_messages.h>
+
+AXIS2_EXTERN void* AXIS2_CALL
+w2c_class_loader_get_object_from_class_name
+                         (const axis2_env_t *env,
+                          char *class_name,
+                          axis2_char_t *inter_path,
+                          axis2_dll_desc_t **pdll_desc)
+{
+    axis2_char_t *dll_name = NULL;
+    axis2_dll_desc_t *dll_desc = NULL;
+    axis2_param_t *impl_info_param = NULL;
+    axis2_char_t *file_path = NULL;
+    void *obj = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, class_name, AXIS2_FAILURE);
+
+    file_path = getenv("AXIS2C_HOME");
+    file_path = AXIS2_STRDUP( file_path, env);
+    dll_desc = axis2_dll_desc_create(env);
+    *pdll_desc = dll_desc;
+
+    dll_name=
+       AXIS2_DLL_DESC_CREATE_PLATFORM_SPECIFIC_DLL_NAME(
+                 dll_desc,  env, class_name );
+    if ( NULL == dll_name )
+    {
+        w2c_messages_print_n_log_error ( env, "utils.classloadFailed");
+        return NULL;
+    }
+    file_path = w2c_string_add_string(file_path, inter_path, env );
+    file_path = w2c_string_add_string(file_path, dll_name, env );
+
+    AXIS2_DLL_DESC_SET_NAME(dll_desc, env, file_path);
+    AXIS2_DLL_DESC_SET_TYPE(dll_desc, env, -1); /* not a standard type */
+
+    impl_info_param = axis2_param_create(env, NULL, NULL);
+    AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
+
+    axis2_class_loader_init(env);
+    obj = axis2_class_loader_create_dll(env, impl_info_param);
+
+    AXIS2_FREE ( env->allocator, file_path);
+    return obj;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+w2c_class_loader_free_loaded_class(
+                          const axis2_env_t *env,
+                          axis2_dll_desc_t *dll_desc )
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, dll_desc, AXIS2_FAILURE);
+
+    axis2_class_loader_delete_dll(env, dll_desc);
+    /*AXIS2_DLL_DESC_FREE ( dll_desc, env );*/
+
+    return AXIS2_SUCCESS;
+}

Added: webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,247 @@
+/*
+ * 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 <w2c_cmdline_option.h>
+#include <w2c_cmdline_option_consts.h>
+#include <axis2_array_list.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+
+/** 
+ * @brief
+ */
+typedef struct w2c_cmdline_option_impl
+{
+    w2c_cmdline_option_t cmdline_option;
+    
+    axis2_char_t *type;
+    axis2_array_list_t *values_arr;
+       
+} w2c_cmdline_option_impl_t;
+
+#define W2C_INTF_TO_IMPL(cmdline_option) \
+    ((w2c_cmdline_option_impl_t *) cmdline_option)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cmdline_option_free (w2c_cmdline_option_t *cmdline_option, 
+           const axis2_env_t *env);
+
+axis2_char_t* 
+w2c_cmdline_option_get_type(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_cmdline_option_get_value(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL
+w2c_cmdline_option_get_values(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env);
+
+/* internal functions */
+axis2_char_t*
+w2c_cmdline_option_set_type(
+               w2c_cmdline_option_impl_t *cmdline_option_impl,
+               const axis2_env_t *env,
+               axis2_char_t *type );
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_cmdline_option_t * AXIS2_CALL 
+w2c_cmdline_option_create (const axis2_env_t *env)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    cmdline_option_impl = (w2c_cmdline_option_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_cmdline_option_impl_t));
+
+    if(NULL == cmdline_option_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    cmdline_option_impl->type = NULL;
+    cmdline_option_impl->values_arr = NULL;
+    
+    cmdline_option_impl->cmdline_option.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_cmdline_option_ops_t));
+    if(NULL == cmdline_option_impl->cmdline_option.ops)
+    {
+        w2c_cmdline_option_free(&(cmdline_option_impl->cmdline_option), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    cmdline_option_impl->cmdline_option.ops->free = w2c_cmdline_option_free;
+    cmdline_option_impl->cmdline_option.ops->get_type =
+                                                w2c_cmdline_option_get_type;
+    cmdline_option_impl->cmdline_option.ops->get_value =
+                                                w2c_cmdline_option_get_value;
+    cmdline_option_impl->cmdline_option.ops->get_values = 
+                                                w2c_cmdline_option_get_values;
+
+    return &(cmdline_option_impl->cmdline_option);
+}
+
+AXIS2_EXTERN w2c_cmdline_option_t * AXIS2_CALL 
+w2c_cmdline_option_create_with_values (const axis2_env_t *env,
+                          axis2_char_t *type,
+                          axis2_array_list_t *values_arr)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+  
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK(env->error, type, NULL);
+    
+    cmdline_option_impl = (w2c_cmdline_option_impl_t *) w2c_cmdline_option_create(env);
+    if(!cmdline_option_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;  
+    }
+    /* populate data */
+    w2c_cmdline_option_set_type(  cmdline_option_impl ,
+                                env, (axis2_char_t*)AXIS2_STRDUP(type, env));
+    cmdline_option_impl-> values_arr = values_arr;
+
+    return &(cmdline_option_impl->cmdline_option);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cmdline_option_free (w2c_cmdline_option_t *cmdline_option, 
+                            const axis2_env_t *env)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+    int i = 0;
+    int size= 0;
+    axis2_char_t *value = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    cmdline_option_impl = W2C_INTF_TO_IMPL(cmdline_option);
+    
+    if (cmdline_option_impl-> type)
+    {
+        AXIS2_FREE (env-> allocator, cmdline_option_impl-> type);
+    }
+    if( cmdline_option_impl-> values_arr )
+    {
+        size = AXIS2_ARRAY_LIST_SIZE ( cmdline_option_impl-> values_arr, env );
+        for (i =0; i < size; i++ )
+        {
+            value = AXIS2_ARRAY_LIST_GET ( cmdline_option_impl-> values_arr, env, i );
+            AXIS2_FREE ( env-> allocator, value );
+        }
+        AXIS2_ARRAY_LIST_FREE ( cmdline_option_impl-> values_arr, env );
+    }
+    if(cmdline_option->ops)
+    {
+        AXIS2_FREE(env->allocator, cmdline_option->ops);
+        cmdline_option->ops = NULL;
+    }
+    if(cmdline_option_impl)
+    {
+        AXIS2_FREE(env->allocator, cmdline_option_impl);
+        cmdline_option_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t* 
+w2c_cmdline_option_get_type(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    cmdline_option_impl = W2C_INTF_TO_IMPL(cmdline_option);
+    
+    return cmdline_option_impl-> type;
+    
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_cmdline_option_get_value(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    cmdline_option_impl = W2C_INTF_TO_IMPL(cmdline_option);
+    
+   if ( cmdline_option_impl-> values_arr &&
+           AXIS2_ARRAY_LIST_SIZE ( cmdline_option_impl-> values_arr, env) > 0)
+   {
+       return AXIS2_ARRAY_LIST_GET (cmdline_option_impl-> values_arr, env, 0);
+   }
+   return NULL;
+}
+
+axis2_array_list_t* AXIS2_CALL
+w2c_cmdline_option_get_values(w2c_cmdline_option_t *cmdline_option,
+          const axis2_env_t *env)
+{
+    w2c_cmdline_option_impl_t *cmdline_option_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    cmdline_option_impl = W2C_INTF_TO_IMPL(cmdline_option);
+  
+    return cmdline_option_impl-> values_arr;
+ 
+}
+
+/* internal functions */
+axis2_char_t*
+w2c_cmdline_option_set_type(
+               w2c_cmdline_option_impl_t *cmdline_option_impl,
+               const axis2_env_t *env,
+               axis2_char_t *type )
+{
+    int index = 0;
+    
+    index = w2c_string_indexof_cs ( type, "--" );
+    if ( index > -1 )
+    {
+        /* skip -- */
+        type = (axis2_char_t*)
+                 axis2_string_substring_starting_at ( type, index +2 );
+    } 
+    index = w2c_string_indexof_cs ( type, "-" );
+    if ( index > -1 )
+    {
+        /* skip - */
+        type = (axis2_char_t*)
+                 axis2_string_substring_starting_at ( type, index +1 );
+    }
+    index = w2c_string_indexof_cs ( type, 
+                          W2C_CMDLINE_OPTION_CONSTS_EXTRA_OPTIONTYPE_PREFIX );
+     
+    if (index < 0 )
+    {
+        type = (axis2_char_t*)axis2_string_tolower( type );
+    }
+    cmdline_option_impl-> type = type;
+    return type;
+}

Added: webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_parser.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_parser.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_parser.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,222 @@
+/*
+ * 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 <w2c_cmdline_option_parser.h>
+#include <w2c_cmdline_option_consts.h>
+#include <w2c_cmdline_option.h>
+#include <w2c_cmdline_option_validator.h>
+#include <axis2_string.h>
+
+/** 
+ * @brief
+ */
+typedef struct w2c_cmdline_option_parser_impl
+{
+    w2c_cmdline_option_parser_t cmdline_option_parser;
+    
+    axis2_hash_t *hash;
+       
+} w2c_cmdline_option_parser_impl_t;
+
+#define W2C_INTF_TO_IMPL(cmdline_option_parser) \
+    ((w2c_cmdline_option_parser_impl_t *) cmdline_option_parser)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cmdline_option_parser_free (
+           w2c_cmdline_option_parser_t *cmdline_option_parser, 
+           const axis2_env_t *env);
+
+
+axis2_hash_t* AXIS2_CALL
+w2c_cmdline_option_parser_get_options (
+          w2c_cmdline_option_parser_t *cmdline_option_parser,
+          const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_cmdline_option_parser_get_invalid_options (
+          w2c_cmdline_option_parser_t *cmdline_option_parser,
+          const axis2_env_t *env);
+
+/** private method */
+void
+w2c_cmdline_option_parser_parse( w2c_cmdline_option_parser_impl_t *parser,
+                          const axis2_env_t *env,
+                          int argv, axis2_char_t **argc);
+   
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_cmdline_option_parser_t* AXIS2_CALL 
+w2c_cmdline_option_parser_create (const axis2_env_t *env,
+                                  int argc,
+                                  axis2_char_t **argv)
+{
+    w2c_cmdline_option_parser_impl_t *cmdline_option_parser_impl = NULL;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    cmdline_option_parser_impl = (w2c_cmdline_option_parser_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_cmdline_option_parser_impl_t));
+
+    if(NULL == cmdline_option_parser_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    cmdline_option_parser_impl->hash = NULL;
+    
+    cmdline_option_parser_impl->cmdline_option_parser.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_cmdline_option_parser_ops_t));
+    if(NULL == cmdline_option_parser_impl->cmdline_option_parser.ops)
+    {
+        w2c_cmdline_option_parser_free(
+                     &(cmdline_option_parser_impl->cmdline_option_parser), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    w2c_cmdline_option_parser_parse
+        ( cmdline_option_parser_impl, env, argc, argv );
+
+    cmdline_option_parser_impl->cmdline_option_parser.ops->free = 
+                                w2c_cmdline_option_parser_free;
+    cmdline_option_parser_impl->cmdline_option_parser.ops->get_options =
+                                w2c_cmdline_option_parser_get_options;
+    cmdline_option_parser_impl->cmdline_option_parser.ops->get_invalid_options =
+                                w2c_cmdline_option_parser_get_invalid_options;
+
+    return &(cmdline_option_parser_impl->cmdline_option_parser);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cmdline_option_parser_free (w2c_cmdline_option_parser_t *cmdline_option_parser, 
+                            const axis2_env_t *env)
+{
+    w2c_cmdline_option_parser_impl_t *cmdline_option_parser_impl = NULL;
+    axis2_hash_index_t *hi;
+    w2c_cmdline_option_t *option = NULL;
+  
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    cmdline_option_parser_impl = W2C_INTF_TO_IMPL(cmdline_option_parser);
+    
+    if(cmdline_option_parser->ops)
+    {
+        AXIS2_FREE(env->allocator, cmdline_option_parser->ops);
+        cmdline_option_parser->ops = NULL;
+    }
+ 
+    if (cmdline_option_parser_impl-> hash)
+    {
+        for (hi = axis2_hash_first(cmdline_option_parser_impl->hash, env); hi;
+                     hi = axis2_hash_next(env, hi))
+        {
+            axis2_hash_this(hi, NULL, NULL, (void*)&option);
+            W2C_CMDLINE_OPTION_FREE ( option, env );
+        }
+        axis2_hash_free ( cmdline_option_parser_impl-> hash, env );
+    }
+
+    if(cmdline_option_parser_impl)
+    {
+        AXIS2_FREE(env->allocator, cmdline_option_parser_impl);
+        cmdline_option_parser_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+axis2_hash_t* AXIS2_CALL
+w2c_cmdline_option_parser_get_options (
+          w2c_cmdline_option_parser_t *cmdline_option_parser,
+          const axis2_env_t *env)
+{
+    w2c_cmdline_option_parser_impl_t *cmdline_option_parser_impl = NULL;
+  
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    cmdline_option_parser_impl = W2C_INTF_TO_IMPL(cmdline_option_parser);
+    return cmdline_option_parser_impl -> hash;   
+}
+
+axis2_array_list_t* AXIS2_CALL
+w2c_cmdline_option_parser_get_invalid_options (
+          w2c_cmdline_option_parser_t *cmdline_option_parser,
+          const axis2_env_t *env)
+{
+    w2c_cmdline_option_parser_impl_t *cmdline_option_parser_impl = NULL;
+    axis2_array_list_t *invalid_arr = NULL;
+    axis2_hash_index_t *hi = NULL;
+    w2c_cmdline_option_t *option = NULL;
+  
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    cmdline_option_parser_impl = W2C_INTF_TO_IMPL(cmdline_option_parser);
+    
+    invalid_arr = axis2_array_list_create ( env, 1 );
+    
+    for (hi = axis2_hash_first(cmdline_option_parser_impl->hash, env); hi;
+                        hi = axis2_hash_next( env, hi))
+    {
+         axis2_hash_this(hi, NULL, NULL, (void*)&option);
+         if (w2c_cmdline_option_validator_isinvalid ( env,option ) )
+         {
+             AXIS2_ARRAY_LIST_ADD ( invalid_arr, env, option );
+         }
+     }
+     return invalid_arr;
+}
+
+/** private method */
+void
+w2c_cmdline_option_parser_parse( w2c_cmdline_option_parser_impl_t *parser,
+                          const axis2_env_t *env,
+                          int argc, axis2_char_t **argv)
+{
+    int i = 0;
+    w2c_cmdline_option_t *option = NULL;
+    axis2_hash_t *hash;
+    axis2_char_t *key = NULL;
+    axis2_char_t *value = NULL;
+    axis2_array_list_t *values_arr= NULL;
+   
+    hash = axis2_hash_make ( env );
+    parser->hash = hash;
+    while ( i < argc )
+    {
+        key = argv[i];
+        values_arr = (axis2_array_list_t*)
+                    axis2_array_list_create(env, 1 );
+        i ++;
+        while ( i < argc && !(w2c_string_indexof_cs ( argv[i], "-" ) == 0)
+            && !(w2c_string_indexof_cs ( argv[i], "--" ) == 0) )
+        {
+            value = (axis2_char_t*)AXIS2_STRDUP(argv[i], env);
+            AXIS2_ARRAY_LIST_ADD ( values_arr, env, value );
+            i ++;
+        }
+        option = (w2c_cmdline_option_t*)
+           w2c_cmdline_option_create_with_values( env, key, values_arr );
+        key = W2C_CMDLINE_OPTION_GET_TYPE ( option, env );
+        axis2_hash_set ( hash, key, AXIS2_HASH_KEY_STRING, option );
+    } 
+    return;
+}
+

Added: webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_validator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_validator.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_validator.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/cmdline_option_validator.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,83 @@
+/*
+ * 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 <w2c_cmdline_option_validator.h>
+#include <w2c_cmdline_option_consts.h>
+#include <w2c_cmdline_option.h>
+
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+w2c_cmdline_option_validator_isinvalid(
+    const axis2_env_t *env,
+    w2c_cmdline_option_t *option)
+{
+    axis2_bool_t isinvalid = AXIS2_FALSE;
+    axis2_char_t *type = NULL;
+    int index = -1;
+    
+    type = W2C_CMDLINE_OPTION_GET_TYPE( option, env );
+    index = w2c_string_indexof_cs(type,
+            W2C_CMDLINE_OPTION_CONSTS_EXTRA_OPTIONTYPE_PREFIX);
+    if (index != 0 )
+    {
+        isinvalid =  
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_WSDL_LOCATION_URI, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_OUTPUT_LOCATION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_SERVER_SIDE_CODE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_SERVICE_DESCRIPTION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_ASYNC_ONLY, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_SYNC_ONLY, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_PACKAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_STUB_LANGUAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_GENERATE_TEST_CASE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_DATA_BINDING_TYPE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_UNPACK_CLASSES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_GENERATE_ALL, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_PORT_NAME, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_SERVICE_NAME, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_REPOSITORY_PATH, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_NAME_SPACE_TO_PACKAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_SERVER_SIDE_INTERFACE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_EXTERNAL_MAPPING, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_WSDL_VERSION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_FLATTEN_FILES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_CONVERT_NAMES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_INDENT_CODE , type ) &&
+
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_OUTPUT_LOCATION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_SERVER_SIDE_CODE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_SERVICE_DESCRIPTION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_ASYNC_ONLY, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_SYNC_ONLY, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_PACKAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_STUB_LANGUAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_GENERATE_TEST_CASE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_DATA_BINDING_TYPE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_UNPACK_CLASSES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_GENERATE_ALL, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_PORT_NAME, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_SERVICE_NAME, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_REPOSITORY_PATH, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_NAME_SPACE_TO_PACKAGE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_SERVER_SIDE_INTERFACE, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_EXTERNAL_MAPPING, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_WSDL_VERSION, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_FLATTEN_FILES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_CONVERT_NAMES, type ) &&
+            strcmp( W2C_CMDLINE_OPTION_CONSTS_LONG_INDENT_CODE, type );
+    }
+    return isinvalid;
+}

Added: webservices/axis2/trunk/c/tools/codegen/src/util/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/codegen-config.properties?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/codegen-config.properties (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/codegen-config.properties Fri Sep  1 05:45:57 2006
@@ -0,0 +1,44 @@
+#######################################################################################################################
+#####################   code generator property file  #################################################################
+#######################################################################################################################
+# Extensions - The extension class names are comma separated
+# and these extensions will run before the main emitter
+# these are loaded in their lexical order
+codegen.extension=w2c_databinding_default_ext, \
+                  w2c_default_qname2name_ext, \
+                  w2c_c_namemaker_ext, \
+                  w2c_c_qname2name_ext
+post.codegen.extension=w2c_c_code_indenter_ext
+# Language types - these are the language types that the code generator understands. Again this is the name of the
+# language that should be passed from the tool as well
+#
+codegen.languages=c
+# Emitter class is the  major code generator class that should be changed according to the language.
+# The emiiters need to implement the Emitter interface
+# Note - The emitters should appear in the lexical order of the languages. So the language c in the above
+# list corresponds to the w2c_c_emitter.JavaEmitter
+codegen.emitters=w2c_c_emitter
+# Default language, this is the default language that would be picked when no language is specified. it should be
+# one of the languages specified above
+codegen.languages.default=c
+#####################################################################################################################
+########################  Language specific section #################################################################
+#####################################################################################################################
+# The language specific section has a special custom style. The language name comes first and separated from the period
+# a unique name. These parameters will be included in a hashmap that is will be stored in another hash map with the
+# language as the key
+#####################################################################################################################
+# C section  - Templates.
+# The format of the templates is <writer-class-name>,<template-name>
+# Note this section is specific to the emitter logic. One can have anything here!
+
+c.interface.header.template=w2c_cstub_header_writer,c/StubHeaderTemplate.xsl
+c.interface.impl.template=w2c_cstub_source_writer,c/StubSourceTemplate.xsl
+c.skeleton.header.template=w2c_cskel_header_writer,c/SkelHeaderTemplate.xsl
+c.skeleton.impl.template=w2c_cskel_source_writer,c/SkelSourceTemplate.xsl
+c.svc_skeleton.template=w2c_csvc_skeleton_writer,c/ServiceSkeleton.xsl
+c.service.template=w2c_cservice_xml_writer,c/ServiceXMLTemplate.xsl
+
+# file extension for generated source files from this language
+c.filename.extension=c
+

Added: webservices/axis2/trunk/c/tools/codegen/src/util/config_property_loader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/config_property_loader.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/config_property_loader.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/config_property_loader.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,893 @@
+/*
+ * 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 <w2c_config_property_loader.h>
+#include <w2c_properties.h>
+#include <axis2_array_list.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+#include <axis2_hash.h>
+#include <stdlib.h>
+
+#define W2C_CONFIG_PROPERTY_LOADER_CODE_GEN_KEY_PREFIX "codegen.extension"
+#define W2C_CONFIG_PROPERTY_LOADER_POST_CODE_GEN_KEY_PREFIX \
+             "post.codegen.extension"
+#define W2C_CONFIG_PROPERTY_LOADER_THIRD_PARTY_SCHEMA_KEY_PREFIX \
+             "codegen.thirdparty.schema"
+#define W2C_CONFIG_PROPERTY_LOADER_LANGUAGE_TYPE_KEY_PREFIX "codegen.languages"
+#define W2C_CONFIG_PROPERTY_LOADER_DEFAULT_LANGUAGE_TYPE_KEY \
+             "codegen.languages.default"
+#define W2C_CONFIG_PROPERTY_LOADER_EMITTER_CLASS_KEY \
+             "codegen.emitters"
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_NAME_KEY \
+             "codegen.databinding.frameworks"
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY \
+             "codegen.databinding.frameworks.default"
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY \
+             "codegen.databinding.extensions"
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY \
+            "codegen.databinding.supporter.template"
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY \
+            "codegen.databinding.testobject.template"
+/* the above define should be replace to follwing pre and suf fix defines */
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX \
+            "codegen.databinding." 
+#define W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX \
+            "template"
+#define W2C_CONFIG_PROPERTY_LOADER_DEFAULT_CODEGEN_CONFIG_PROPERTIES \
+            "/conf/codegen-config.properties"
+
+/* Note - Should be a non regular expression character.
+ If not it should be properly escaped */
+#define W2C_CONFIG_PROPERTY_LOADER_SEPARATOR_CHAR  ','
+
+
+/** 
+ * @brief
+ */
+typedef struct w2c_config_property_loader_impl
+{
+    w2c_config_property_loader_t config_property_loader;
+    
+    axis2_char_t *test_object_template_name;
+    axis2_char_t *db_supporter_template_name;
+    axis2_array_list_t *extension_class_names;
+    axis2_array_list_t *post_extension_class_names;
+    axis2_array_list_t *third_party_schema_names;
+    axis2_array_list_t *language_types;
+    axis2_hash_t *language_emitter_map;
+    axis2_char_t *default_language;
+    axis2_hash_t *language_specific_properties_map;
+    axis2_array_list_t *databinding_framework_names;
+    axis2_hash_t *databinding_framework_name_to_extension_map;
+    axis2_char_t *default_db_framework_name;
+
+    w2c_properties_t *prop_set;
+    axis2_char_t *prop_filename;
+       
+} w2c_config_property_loader_impl_t;
+
+#define W2C_INTF_TO_IMPL(config_property_loader) \
+    ((w2c_config_property_loader_impl_t *) config_property_loader)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL
+w2c_config_property_loader_free (
+    w2c_config_property_loader_t *config_property_loader, 
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_config_property_loader_set_filename (
+          w2c_config_property_loader_t *config_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *filename);
+
+axis2_status_t AXIS2_CALL
+w2c_config_property_loader_reload (
+    w2c_config_property_loader_t *config_property_loader, 
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_config_property_loader_get_test_object_template_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_config_property_loader_get_db_supporter_template_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_extension_class_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_post_extension_class_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_third_party_schema_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_types (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_emitter_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL 
+w2c_config_property_loader_get_default_language (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_specific_properties_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_databinding_framework_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_databinding_framework_name_to_extension_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL 
+w2c_config_property_loader_get_default_db_framework_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env);
+
+/* private methods */
+
+static void
+w2c_config_property_loader_load_values(
+                      w2c_config_property_loader_impl_t *obj_impl,
+                      const axis2_env_t *env);
+
+static axis2_array_list_t*
+w2c_config_property_loader_dup_array(
+                      axis2_array_list_t *arr,
+                      const axis2_env_t *env);
+
+static axis2_status_t
+w2c_config_property_loader_free_array(
+                      axis2_array_list_t *original,
+                      const axis2_env_t *env);
+
+
+static axis2_status_t
+w2c_config_property_loader_free_hash(
+                      axis2_hash_t *original,
+                      const axis2_env_t *env);
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_config_property_loader_t * AXIS2_CALL 
+w2c_config_property_loader_create (const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    axis2_char_t* axis2c_home;
+    int path_len;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    config_property_loader_impl = (w2c_config_property_loader_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_config_property_loader_impl_t));
+
+    if(NULL == config_property_loader_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    
+    config_property_loader_impl->config_property_loader.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_config_property_loader_ops_t));
+    if(NULL == config_property_loader_impl->config_property_loader.ops)
+    {
+        w2c_config_property_loader_free(&(config_property_loader_impl->config_property_loader), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+ 
+    config_property_loader_impl->test_object_template_name = NULL;
+    config_property_loader_impl->db_supporter_template_name = NULL;
+    config_property_loader_impl->extension_class_names = NULL;
+    config_property_loader_impl->post_extension_class_names = NULL;
+    config_property_loader_impl->third_party_schema_names = NULL;
+    config_property_loader_impl->language_types = NULL;
+    config_property_loader_impl->language_emitter_map = NULL;
+    config_property_loader_impl->default_language = NULL;
+    config_property_loader_impl->language_specific_properties_map = NULL;
+    config_property_loader_impl->databinding_framework_names = NULL;
+    config_property_loader_impl->databinding_framework_name_to_extension_map = NULL;
+    config_property_loader_impl->default_db_framework_name = NULL;
+    config_property_loader_impl->prop_set = NULL;
+    config_property_loader_impl->prop_filename = NULL;
+     
+    axis2c_home = getenv ( "AXIS2C_HOME" );
+    path_len = AXIS2_STRLEN (axis2c_home ) + 
+             AXIS2_STRLEN (W2C_CONFIG_PROPERTY_LOADER_DEFAULT_CODEGEN_CONFIG_PROPERTIES) +
+             2;
+    config_property_loader_impl-> prop_filename = AXIS2_MALLOC ( env->allocator,
+                                        sizeof(axis2_char_t)*path_len );
+    sprintf(config_property_loader_impl-> prop_filename, "%s%s", axis2c_home,
+                           W2C_CONFIG_PROPERTY_LOADER_DEFAULT_CODEGEN_CONFIG_PROPERTIES);
+    
+    config_property_loader_impl-> prop_set =  w2c_properties_create( env, 
+        config_property_loader_impl-> prop_filename ,
+        W2C_CONFIG_PROPERTY_LOADER_SEPARATOR_CHAR );
+    if ( config_property_loader_impl-> prop_set != NULL )
+    {
+        w2c_config_property_loader_load_values( config_property_loader_impl, env );
+    }
+    config_property_loader_impl->config_property_loader.ops->free = 
+                      w2c_config_property_loader_free;
+    config_property_loader_impl->config_property_loader.ops->set_filename= 
+                      w2c_config_property_loader_set_filename;
+    config_property_loader_impl->config_property_loader.ops->reload = 
+                      w2c_config_property_loader_reload;
+    config_property_loader_impl->config_property_loader.ops->get_test_object_template_name  =
+                      w2c_config_property_loader_get_test_object_template_name ;
+    config_property_loader_impl->config_property_loader.ops->get_db_supporter_template_name  =
+                      w2c_config_property_loader_get_db_supporter_template_name ;
+    config_property_loader_impl->config_property_loader.ops->get_extension_class_names = 
+                      w2c_config_property_loader_get_extension_class_names;
+    config_property_loader_impl->config_property_loader.ops->get_post_extension_class_names = 
+                      w2c_config_property_loader_get_post_extension_class_names;
+    config_property_loader_impl->config_property_loader.ops->get_third_party_schema_names = 
+                      w2c_config_property_loader_get_third_party_schema_names;
+    config_property_loader_impl->config_property_loader.ops->get_language_types  = 
+                      w2c_config_property_loader_get_language_types ;
+    config_property_loader_impl->config_property_loader.ops->get_language_emitter_map = 
+                      w2c_config_property_loader_get_language_emitter_map;
+    config_property_loader_impl->config_property_loader.ops->get_default_language = 
+                      w2c_config_property_loader_get_default_language;
+    config_property_loader_impl->config_property_loader.ops->get_language_specific_properties_map = 
+                      w2c_config_property_loader_get_language_specific_properties_map;
+    config_property_loader_impl->config_property_loader.ops->get_databinding_framework_names = 
+                      w2c_config_property_loader_get_databinding_framework_names;
+    config_property_loader_impl->config_property_loader.ops->get_databinding_framework_name_to_extension_map = 
+                      w2c_config_property_loader_get_databinding_framework_name_to_extension_map;
+    config_property_loader_impl->config_property_loader.ops->get_default_db_framework_name =
+                      w2c_config_property_loader_get_default_db_framework_name;
+
+    return &(config_property_loader_impl->config_property_loader);
+}
+
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_config_property_loader_free (w2c_config_property_loader_t *config_property_loader, 
+                            const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    if (config_property_loader_impl-> test_object_template_name)
+    {
+        AXIS2_FREE (env-> allocator,
+                 config_property_loader_impl-> test_object_template_name);
+    }
+    
+    if (config_property_loader_impl-> db_supporter_template_name)
+    {
+        AXIS2_FREE (env-> allocator, 
+             config_property_loader_impl-> db_supporter_template_name);
+    }
+    if (config_property_loader_impl-> extension_class_names)
+    {
+        w2c_config_property_loader_free_array(
+                 config_property_loader_impl-> extension_class_names, env);
+    }
+
+    if (config_property_loader_impl-> post_extension_class_names)
+    {
+        w2c_config_property_loader_free_array(
+                 config_property_loader_impl-> post_extension_class_names, env);
+    }
+
+    if (config_property_loader_impl-> third_party_schema_names)
+    {
+        w2c_config_property_loader_free_array(
+                 config_property_loader_impl-> third_party_schema_names, env);
+    }
+
+    if (config_property_loader_impl-> language_types)
+    {
+        w2c_config_property_loader_free_array(
+                config_property_loader_impl-> language_types, env);
+    }
+
+    if (config_property_loader_impl-> language_emitter_map)
+    {
+        w2c_config_property_loader_free_hash(
+                config_property_loader_impl-> language_emitter_map, env);
+    }
+
+    if (config_property_loader_impl-> default_language)
+    {
+        AXIS2_FREE (env-> allocator, config_property_loader_impl-> default_language);
+    }
+
+    if (config_property_loader_impl-> language_specific_properties_map)
+    {
+        /* all the elemenets here will be freed by some other */
+        axis2_hash_free (
+                 config_property_loader_impl-> language_specific_properties_map, env);
+    }
+
+    if (config_property_loader_impl-> databinding_framework_names)
+    {
+        w2c_config_property_loader_free_array(
+                 config_property_loader_impl-> databinding_framework_names, env);
+    }
+
+    if (config_property_loader_impl-> databinding_framework_name_to_extension_map)
+    {
+        w2c_config_property_loader_free_hash(
+                 config_property_loader_impl-> databinding_framework_name_to_extension_map, env);
+    }
+
+    if (config_property_loader_impl-> default_db_framework_name)
+    {
+        AXIS2_FREE (env-> allocator, config_property_loader_impl-> default_db_framework_name);
+    }
+
+    if (config_property_loader_impl-> prop_set)
+    {
+        W2C_PROPERTIES_FREE( config_property_loader_impl-> prop_set, env);
+    }
+
+    if (config_property_loader_impl-> prop_filename)
+    {
+        AXIS2_FREE (env-> allocator, config_property_loader_impl-> prop_filename);
+    }
+
+    if(config_property_loader->ops)
+    {
+        AXIS2_FREE(env->allocator, config_property_loader->ops);
+        config_property_loader->ops = NULL;
+    }
+    if(config_property_loader_impl)
+    {
+        AXIS2_FREE(env->allocator, config_property_loader_impl);
+        config_property_loader_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_config_property_loader_set_filename (
+          w2c_config_property_loader_t *config_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *filename)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+  
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    config_property_loader_impl -> prop_filename = filename;   
+    w2c_config_property_loader_reload ( config_property_loader, env );
+    return AXIS2_SUCCESS;
+}
+
+
+
+axis2_status_t AXIS2_CALL
+w2c_config_property_loader_reload (
+    w2c_config_property_loader_t *config_property_loader, 
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    if (config_property_loader_impl-> prop_set)
+    {
+         W2C_PROPERTIES_FREE ( config_property_loader_impl->prop_set, env );
+    }
+    config_property_loader_impl-> prop_set=  w2c_properties_create( env, 
+        config_property_loader_impl-> prop_filename ,
+        W2C_CONFIG_PROPERTY_LOADER_SEPARATOR_CHAR );
+    if ( config_property_loader_impl-> prop_set != NULL )
+    {
+        w2c_config_property_loader_load_values( config_property_loader_impl, env );
+    }
+    else
+    {
+        return AXIS2_FAILURE;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_config_property_loader_get_test_object_template_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> test_object_template_name;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_config_property_loader_get_db_supporter_template_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> db_supporter_template_name;
+}
+
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_extension_class_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> extension_class_names;
+}
+
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_post_extension_class_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> post_extension_class_names;
+}
+
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_third_party_schema_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> third_party_schema_names;
+}
+
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_types (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl->language_types;
+}
+
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_emitter_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> language_emitter_map;
+}
+
+
+axis2_char_t* AXIS2_CALL 
+w2c_config_property_loader_get_default_language (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> default_language;
+}
+
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_language_specific_properties_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> language_specific_properties_map;
+}
+
+
+axis2_array_list_t* AXIS2_CALL 
+w2c_config_property_loader_get_databinding_framework_names (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> databinding_framework_names;
+}
+
+
+axis2_hash_t* AXIS2_CALL 
+w2c_config_property_loader_get_databinding_framework_name_to_extension_map (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> databinding_framework_name_to_extension_map;
+}
+
+axis2_char_t* AXIS2_CALL 
+w2c_config_property_loader_get_default_db_framework_name (
+    w2c_config_property_loader_t *config_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_config_property_loader_impl_t *config_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    config_property_loader_impl = W2C_INTF_TO_IMPL(config_property_loader);
+    
+    return config_property_loader_impl-> default_db_framework_name;
+}
+
+
+static void
+w2c_config_property_loader_load_values(
+                      w2c_config_property_loader_impl_t *obj_impl,
+                      const axis2_env_t *env)
+{
+     axis2_hash_t* prop_hash = NULL;
+     axis2_hash_t* temp_hash = NULL;
+     axis2_hash_t* lang_spec_hash = NULL;
+     axis2_hash_index_t* hi = NULL;
+     axis2_array_list_t* prop = NULL;
+     axis2_array_list_t* temp_array = NULL;
+     axis2_char_t* temp_buff = NULL;
+     axis2_char_t* key= NULL;
+     axis2_char_t* val= NULL;
+     int i;
+     int size;
+
+     prop_hash = W2C_PROPERTIES_GET_HASH( obj_impl-> prop_set, env);
+
+     /*TODO: this should be configured to choose the prophash from 
+      * a command line option -codegen.config="file"
+      */
+
+     /*load the extension class names*/
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_CODE_GEN_KEY_PREFIX,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL) 
+     {
+         obj_impl ->extension_class_names = 
+             w2c_config_property_loader_dup_array(prop, env );
+     }
+ 
+     /*load the post extension class names*/
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_POST_CODE_GEN_KEY_PREFIX,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL) 
+     {
+         obj_impl ->post_extension_class_names = 
+             w2c_config_property_loader_dup_array(prop, env );
+     }
+         
+     /* load the data binding framework names */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_NAME_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL) 
+     {
+         obj_impl ->databinding_framework_names =
+             w2c_config_property_loader_dup_array(prop, env );
+     }
+     
+     /* populate the data binding framework name to extension name map */
+     temp_array = NULL;
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         temp_array = 
+             w2c_config_property_loader_dup_array(prop, env );
+         
+         size= AXIS2_ARRAY_LIST_SIZE (obj_impl ->databinding_framework_names, env);
+         if (size != AXIS2_ARRAY_LIST_SIZE (temp_array, env) )
+         {
+              fprintf ( stderr, "data_binding_framework name to extension diff in size" );
+              w2c_config_property_loader_free(
+                       &(obj_impl->config_property_loader), env);         
+              return;
+         }
+
+         temp_hash = axis2_hash_make ( env );
+         obj_impl ->databinding_framework_name_to_extension_map = temp_hash;
+         for (i = 0 ; i < size ;i++ )
+         {
+             axis2_hash_set ( temp_hash,
+              AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(obj_impl ->databinding_framework_names, env, i ), env),
+              AXIS2_HASH_KEY_STRING,
+              AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(temp_array, env, i ), env));
+         }
+     }
+     
+     /*load the default framework name */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->default_db_framework_name = 
+                      AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(prop, env, 0 ), env);
+     }
+      
+     /* load the third party schema names */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_THIRD_PARTY_SCHEMA_KEY_PREFIX,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->third_party_schema_names= 
+                      AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(prop, env, 0 ), env);
+     }
+       
+     /* the db supporter template name */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->db_supporter_template_name= 
+                      AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(prop, env, 0 ), env);
+     }
+      
+     /* test object template name */
+     /* TODO: this should be replce to check for all properties 
+      * starts with W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX
+      * ends with W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX
+      */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->test_object_template_name= 
+                      AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(prop, env, 0), env);
+     }
+     
+      
+     /* load the language types */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_LANGUAGE_TYPE_KEY_PREFIX,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->language_types = 
+                          w2c_config_property_loader_dup_array(prop, env );
+     }
+       
+     /* load the language emitter map */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_EMITTER_CLASS_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         temp_array = w2c_config_property_loader_dup_array(prop, env );
+         
+         size= AXIS2_ARRAY_LIST_SIZE (obj_impl->language_types , env);
+         if (size != AXIS2_ARRAY_LIST_SIZE (temp_array, env) )
+         {
+              fprintf ( stderr, "data_binding_framework name to extension diff in size" );
+              w2c_config_property_loader_free(
+                       &(obj_impl->config_property_loader), env);         
+              return;
+         }
+
+         temp_hash = axis2_hash_make ( env );
+         obj_impl ->language_emitter_map = temp_hash;
+         for (i = 0 ; i< size ; i++ )
+         {
+             key = AXIS2_ARRAY_LIST_GET(obj_impl ->language_types, env, i);
+             val = AXIS2_ARRAY_LIST_GET(temp_array, env, i );
+             axis2_hash_set ( temp_hash,
+              AXIS2_STRDUP(  key, env),
+              AXIS2_HASH_KEY_STRING,
+              AXIS2_STRDUP( val, env));
+         }
+     }
+ 
+     /* load the default language */
+     prop = (axis2_array_list_t*)axis2_hash_get ( prop_hash,
+           W2C_CONFIG_PROPERTY_LOADER_DEFAULT_LANGUAGE_TYPE_KEY,
+           AXIS2_HASH_KEY_STRING );
+     if ( prop != NULL)
+     {
+         obj_impl ->default_language = 
+                      AXIS2_STRDUP( AXIS2_ARRAY_LIST_GET(prop, env, 0 ), env);
+     }
+
+     /**
+      * run through the language specific properties and populate the
+      * language specific property map
+      */
+     if ( obj_impl->language_types)
+     {
+         temp_hash = axis2_hash_make ( env );
+         obj_impl->language_specific_properties_map = temp_hash;
+         size= AXIS2_ARRAY_LIST_SIZE (obj_impl->language_types , env);
+         for (i = 0 ; i< size ; i++ )
+         {
+             temp_buff = AXIS2_ARRAY_LIST_GET(obj_impl ->language_types, env, i );
+             lang_spec_hash = axis2_hash_make ( env );
+             for (hi = axis2_hash_first(prop_hash, env); hi;
+                  hi = axis2_hash_next(env, hi))
+             {
+                axis2_hash_this(hi, (void*)&key, NULL, (void*)&prop);
+                if ( w2c_string_indexof_cs ( key, temp_buff ) == 0 && 
+                                    w2c_string_indexof ( key, '.') == strlen (temp_buff ))
+                {
+                    prop = w2c_config_property_loader_dup_array( prop, env );
+                    axis2_hash_set ( lang_spec_hash, key, AXIS2_HASH_KEY_STRING, prop );
+                }
+             }
+             axis2_hash_set (temp_hash, temp_buff, AXIS2_HASH_KEY_STRING, lang_spec_hash );
+         }
+     }   
+}
+static axis2_array_list_t*
+w2c_config_property_loader_dup_array(
+                    axis2_array_list_t *original,
+                    const axis2_env_t *env)
+{
+    int i = 0;
+    int size = 0;
+    axis2_array_list_t* new_array = NULL;
+    axis2_char_t *tmp = NULL;
+    
+    size = AXIS2_ARRAY_LIST_SIZE( original, env);
+    if ( 0 == size )
+        return axis2_array_list_create( env, 1);
+
+    new_array = axis2_array_list_create( env, size);
+    for( i = 0; i < size; i ++ )
+    {
+        tmp = (axis2_char_t*)AXIS2_ARRAY_LIST_GET( original, env, i);
+        tmp = AXIS2_STRDUP( tmp, env);
+        AXIS2_ARRAY_LIST_ADD_AT( new_array, env, i, tmp);
+    }
+    return new_array;
+}
+
+/** this frees axis2_char_t[] */
+static axis2_status_t
+w2c_config_property_loader_free_array(
+                        axis2_array_list_t *arr,
+                        const axis2_env_t *env)
+{
+    int i = 0;
+    int size = 0;
+    axis2_char_t *tmp = NULL;
+    
+    size = AXIS2_ARRAY_LIST_SIZE( arr, env);
+    for( i = 0; i < size; i ++ )
+    {
+        tmp = (axis2_char_t*)AXIS2_ARRAY_LIST_GET( arr, env, i);
+        AXIS2_FREE( env-> allocator, tmp);
+    }
+    AXIS2_ARRAY_LIST_FREE( arr, env);
+    return AXIS2_SUCCESS;
+}
+
+/** this frees (axis2_char_t, axis2_char_t) */
+static axis2_status_t
+w2c_config_property_loader_free_hash(
+                        axis2_hash_t *h,
+                        const axis2_env_t *env)
+{
+    axis2_char_t *key = NULL;
+    axis2_char_t *value = NULL;
+    axis2_hash_index_t *hi = NULL;
+
+    for (hi = axis2_hash_first( h, env);
+                        hi; hi = axis2_hash_next(env, hi))
+    {
+        axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
+        if (key )
+        {
+            AXIS2_FREE( env-> allocator, key);
+        }
+        if (value)
+        {
+            AXIS2_FREE(env-> allocator, value);
+        }
+    }
+    axis2_hash_free( h, env);
+    return AXIS2_SUCCESS;
+
+}

Added: webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,178 @@
+/*
+ * 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 <w2c_cqname2name_maker.h>
+#include <axis2_hash.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+#include <stdlib.h>
+
+
+#define W2C_TYPEMAPPER_UPPER_PARAM_LIMIT 1000
+#define W2C_TYPEMAPPER_PARAM_SUFFIX "param"
+
+/** 
+ * @brief
+ */
+typedef struct w2c_cqname2name_maker_impl
+{
+    w2c_cqname2name_maker_t cqname2name_maker;
+
+    axis2_hash_t *qname2name;
+    axis2_hash_t *name2number;
+       
+} w2c_cqname2name_maker_impl_t;
+
+#define W2C_INTF_TO_IMPL(cqname2name_maker) \
+    ((w2c_cqname2name_maker_impl_t *) cqname2name_maker)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cqname2name_maker_free (w2c_cqname2name_maker_t *cqname2name_maker, 
+           const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_cqname2name_maker_suggest_name(w2c_cqname2name_maker_t *cqname2name_maker,
+            const axis2_env_t *env,
+            axis2_qname_t *qname);
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_cqname2name_maker_t * AXIS2_CALL 
+w2c_cqname2name_maker_create (const axis2_env_t *env)
+{
+    w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    cqname2name_maker_impl = (w2c_cqname2name_maker_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_cqname2name_maker_impl_t));
+
+    if(NULL == cqname2name_maker_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    cqname2name_maker_impl->qname2name = axis2_hash_make(env);
+    cqname2name_maker_impl->name2number = axis2_hash_make(env);
+    
+    cqname2name_maker_impl->cqname2name_maker.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_cqname2name_maker_ops_t));
+    if(NULL == cqname2name_maker_impl->cqname2name_maker.ops)
+    {
+        w2c_cqname2name_maker_free(&(cqname2name_maker_impl->cqname2name_maker), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    cqname2name_maker_impl->cqname2name_maker.ops->free = w2c_cqname2name_maker_free;
+    cqname2name_maker_impl->cqname2name_maker.ops->suggest_name= 
+                                        w2c_cqname2name_maker_suggest_name;
+
+    return &(cqname2name_maker_impl->cqname2name_maker);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_cqname2name_maker_free (w2c_cqname2name_maker_t *cqname2name_maker, 
+                            const axis2_env_t *env)
+{
+    w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
+ 
+    axis2_char_t *key = NULL;
+    axis2_char_t *value =NULL;
+    axis2_hash_index_t *hi = NULL;
+    axis2_hash_t *h = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    cqname2name_maker_impl = W2C_INTF_TO_IMPL(cqname2name_maker);
+    h = cqname2name_maker_impl-> qname2name;
+    
+    for (hi = axis2_hash_first(h, env) ;
+                hi; hi = axis2_hash_next(env, hi))
+    {
+        axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
+        if (key)
+            AXIS2_FREE( env-> allocator, key);
+        if (value)
+            AXIS2_FREE( env-> allocator, value); 
+    }
+    axis2_hash_free( h , env);
+ 
+    axis2_hash_free( cqname2name_maker_impl-> name2number, env);
+       
+    if(cqname2name_maker->ops)
+    {
+        AXIS2_FREE(env->allocator, cqname2name_maker->ops);
+        cqname2name_maker->ops = NULL;
+    }
+    if(cqname2name_maker_impl)
+    {
+        AXIS2_FREE(env->allocator, cqname2name_maker_impl);
+        cqname2name_maker_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_cqname2name_maker_suggest_name(w2c_cqname2name_maker_t *cqname2name_maker,
+            const axis2_env_t *env,
+            axis2_qname_t *qname)
+{
+    w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
+ 
+    axis2_char_t *key = NULL;
+    axis2_char_t *local = NULL;
+    int counter = 0;
+    axis2_char_t counter_str[32];
+    axis2_char_t *given_name = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    cqname2name_maker_impl = W2C_INTF_TO_IMPL(cqname2name_maker);
+
+    key = AXIS2_QNAME_TO_STRING(qname, env);
+    local = (axis2_char_t*)axis2_hash_get( cqname2name_maker_impl-> qname2name, key,
+                         AXIS2_HASH_KEY_STRING );
+    if( local != NULL) /* key has been there somewhere */
+    {
+        return local;
+    }
+    /* otherwise */
+    local = AXIS2_QNAME_GET_LOCALPART( qname, env);
+    counter = (int)axis2_hash_get( cqname2name_maker_impl-> name2number, local,
+                         AXIS2_HASH_KEY_STRING );
+    if ( counter == 0 ) /** this means name doesnt exist */
+    {
+        axis2_hash_set(cqname2name_maker_impl-> qname2name, key, AXIS2_HASH_KEY_STRING, local);
+        axis2_hash_set( cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)1);
+        return local;
+    }
+    /* else qname would already exist */ 
+    sprintf(counter_str, "%d", counter);
+    given_name = axis2_stracat( local, counter_str, env);
+
+    axis2_hash_set( cqname2name_maker_impl-> qname2name, key, AXIS2_HASH_KEY_STRING, given_name);
+    axis2_hash_set( cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)counter+1);
+
+    return given_name;    
+}
+

Added: webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,111 @@
+/*
+ * 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 <w2c_xslt_utils.h>
+#include <w2c_string.h>
+#include <platforms/axis2_platform_auto_sense.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_file_writer_create_classfile_name (
+    const axis2_env_t *env,
+    axis2_char_t *root_location,
+    axis2_char_t *package_name,
+    axis2_char_t *filename,
+    axis2_char_t *extension )
+{
+    axis2_char_t *full_path = NULL;
+    axis2_char_t *cp = NULL;
+    axis2_bool_t end = AXIS2_FALSE;
+    int error = 0;
+    int length = 0;
+        
+    if ( NULL == root_location )
+    {
+        full_path= AXIS2_STRDUP ( ".", env);
+    }
+    else
+    {
+        full_path = AXIS2_STRDUP ( root_location,env );
+        for ( end = AXIS2_FALSE, cp = full_path; 1; cp ++)
+        {
+            if ( *cp == '\0' )
+            {
+                end = AXIS2_TRUE;
+            }
+            else if ( *cp != AXIS2_PATH_SEP_CHAR)
+            {
+                continue;
+            }
+            *cp = '\0';
+            /* TODO: this should be placed in platform */
+            error = mkdir ( full_path, 0755 ); 
+            if ( end )
+            {
+                if ( cp != full_path && *(cp-1) == AXIS2_PATH_SEP_CHAR )
+                {
+                    *(cp-1) = '\0';
+                }
+                break;
+            }
+            else
+            {
+                *cp = AXIS2_PATH_SEP_CHAR;
+            }
+        }
+    }
+    /* to seperate root location and package path */
+    full_path = w2c_string_add_string ( full_path, AXIS2_PATH_SEP_STR, env );
+
+    /* this is related to adding folder hiearchy corrosponding to the package */
+    if ( package_name && *package_name != '\0')
+    {
+        length = AXIS2_STRLEN ( full_path );
+        full_path = w2c_string_add_string ( full_path, package_name, env);
+
+        /* the loop wil start from the package name */
+        for ( end = AXIS2_FALSE, cp = full_path + length; 1; cp ++)
+        {
+            if ( *cp == '\0' )
+            {
+                end = AXIS2_TRUE;
+            }
+            else if ( *cp !='.' )
+            {
+                continue;
+            }
+            *cp = '\0';
+            /* TODO:this should be placed in platform */
+            error = mkdir ( full_path, 0755 ); 
+            if ( end )
+            {
+                break;
+            }
+            else
+            {
+                *cp = AXIS2_PATH_SEP_CHAR;
+            }
+        }
+        full_path = w2c_string_add_string ( full_path, AXIS2_PATH_SEP_STR, env );
+    }
+    full_path = w2c_string_add_string ( full_path, filename, env);
+    full_path = w2c_string_add_string ( full_path, extension, env );/* extension has the .*/
+
+    return full_path;
+}
+

Added: webservices/axis2/trunk/c/tools/codegen/src/util/messages.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/messages.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/messages.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/messages.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,107 @@
+/*
+ * 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 <w2c_messages.h>
+/*#include <w2c_property_parser.h>
+#include <w2c_property.h>*/
+#include <axis2_property.h>
+#include <axis2_hash.h>
+#include <axis2_string.h>
+#include <platforms/axis2_platform_auto_sense.h>
+
+#define W2C_MESSAGES_FILENAME "resource.properties"
+
+AXIS2_EXTERN axis2_properties_t* AXIS2_CALL
+w2c_messages_get_message_properties(
+    const axis2_env_t *env )
+{
+    axis2_properties_t *props = NULL;
+    axis2_char_t *axis2c_home = NULL;
+    axis2_char_t *filename = NULL;
+    axis2_char_t *filepath= NULL;
+    axis2_char_t *inter_path= NULL;
+    int path_len = 0;
+    FILE *f = NULL;
+   
+    axis2c_home = getenv( "AXIS2C_HOME");
+    if ( axis2c_home == NULL )
+    {
+        fprintf(stderr,"failed to pick AXIS2C_HOME\n" );
+        return NULL;
+    }
+    inter_path = W2C_MESSAGES_INTER_PATH;
+    filename = W2C_MESSAGES_FILENAME;
+    
+    path_len = AXIS2_STRLEN ( filename ) + AXIS2_STRLEN (axis2c_home )
+               + AXIS2_STRLEN ( inter_path ) 
+               + 2; /* for seperator and null char */
+    filepath = AXIS2_MALLOC ( env-> allocator, path_len* sizeof(axis2_char_t) );
+    sprintf ( filepath, "%s%s%s", axis2c_home, inter_path, filename );
+  
+    f = fopen( filepath, "r+");
+    props = axis2_properties_create(env);
+    AXIS2_PROPERTIES_LOAD( props, env, f); 
+    fclose(f);
+
+    return props;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_messages_get_message( const axis2_env_t *env, axis2_char_t *key )
+{
+     axis2_properties_t *props = NULL;
+     axis2_char_t *message = NULL;
+     
+     props = w2c_messages_get_message_properties( env);
+     message = AXIS2_PROPERTIES_GET_PROPERTY( props, env, key);
+     if ( message )
+     {
+         message = AXIS2_STRDUP ( message, env );
+     }
+     AXIS2_PROPERTIES_FREE( props, env);
+
+     return  message;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+w2c_messages_print_n_log_error( const axis2_env_t *env, axis2_char_t *key )
+{
+     axis2_char_t *msg = NULL;
+     msg = w2c_messages_get_message( env, key );
+     if ( msg )
+     {
+         fprintf ( stderr, "%s\n", msg );
+         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                         msg);
+         AXIS2_FREE( env->allocator, msg);
+     }
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+w2c_messages_print_n_log_error_from_properties( const axis2_env_t *env, 
+                                          axis2_properties_t *props,
+                                          axis2_char_t *key )
+{
+     axis2_char_t *msg = NULL;
+     msg = AXIS2_PROPERTIES_GET_PROPERTY( props, env, key);
+     if ( msg )
+     {
+         fprintf ( stderr, "%s\n", msg );
+         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                         msg);
+     }
+}
+

Added: webservices/axis2/trunk/c/tools/codegen/src/util/properties.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/properties.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/properties.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/properties.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,234 @@
+/*
+ * 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 <w2c_properties.h>
+#include <axis2_array_list.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+#include <axis2_properties.h>
+
+/** 
+ * @brief
+ */
+typedef struct w2c_properties_impl
+{
+    w2c_properties_t properties;
+    
+    axis2_hash_t *prop_hash;
+       
+} w2c_properties_impl_t;
+
+#define W2C_INTF_TO_IMPL(properties) \
+    ((w2c_properties_impl_t *) properties)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_properties_free (w2c_properties_t *properties, 
+           const axis2_env_t *env);
+
+axis2_hash_t* AXIS2_CALL
+w2c_properties_get_hash(w2c_properties_t *properties,
+           const axis2_env_t *env);
+
+axis2_char_t*
+w2c_properties_trunk_and_dup( axis2_char_t *start, axis2_char_t *end,
+                                   const axis2_env_t *env );
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_properties_t * AXIS2_CALL 
+w2c_properties_create (const axis2_env_t *env,
+                        axis2_char_t *filename,
+                        axis2_char_t seperator)
+{
+    w2c_properties_impl_t *properties_impl = NULL;
+    axis2_properties_t *main_props = NULL;
+    axis2_char_t *key = NULL;
+    axis2_char_t *value = NULL;
+    axis2_hash_index_t *hi = NULL;
+    axis2_char_t *p = NULL;
+    axis2_char_t *tag = NULL;
+    axis2_hash_t *tmp_hash = NULL;
+    FILE *f = NULL;
+    axis2_array_list_t *arr_list = NULL;
+    int i = 0;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    f = fopen ( filename, "r+");
+    if ( f == NULL )
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_COULD_NOT_OPEN_FILE, AXIS2_FAILURE); 
+        return NULL;
+    }
+
+    properties_impl = (w2c_properties_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_properties_impl_t));
+
+    if(NULL == properties_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    main_props = axis2_properties_create(env);
+    if(NULL == main_props)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    AXIS2_PROPERTIES_LOAD( main_props, env, f );
+    fclose(f);
+
+
+    tmp_hash = AXIS2_PROPERTIES_GET_ALL( main_props, env);
+    
+    properties_impl-> prop_hash = axis2_hash_make (env);
+    if(NULL == properties_impl-> prop_hash)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+
+    if(tmp_hash)
+    {
+        for (hi = axis2_hash_first( tmp_hash, env);
+                            hi; hi = axis2_hash_next(env, hi))
+        {
+            axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
+            if (key && value)
+            {
+                i = 0;
+                arr_list = axis2_array_list_create(env, 10);
+                for( p = value, tag = value; *p; p ++)
+                {
+                    if ( *p == seperator)
+                    {
+                        *p = '\0';
+                        tag = w2c_properties_trunk_and_dup( tag, p, env);
+                        AXIS2_ARRAY_LIST_ADD_AT( arr_list, env, i, tag);
+                        tag = p + 1;
+                        i ++;
+                    }
+                }
+                if ( p != tag )
+                {
+                    tag = w2c_properties_trunk_and_dup( tag, p, env);
+                    AXIS2_ARRAY_LIST_ADD_AT( arr_list, env, i, tag);
+                }
+                key = AXIS2_STRDUP(key, env);
+                axis2_hash_set( properties_impl-> prop_hash, key, AXIS2_HASH_KEY_STRING, arr_list);
+            }
+        }
+    }
+    AXIS2_PROPERTIES_FREE( main_props, env);
+
+
+    properties_impl->properties.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_properties_ops_t));
+    if(NULL == properties_impl->properties.ops)
+    {
+        w2c_properties_free(&(properties_impl->properties), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    properties_impl->properties.ops->free = w2c_properties_free;
+    properties_impl->properties.ops->get_hash =
+                                                w2c_properties_get_hash;
+
+    return &(properties_impl->properties);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_properties_free (w2c_properties_t *properties, 
+                            const axis2_env_t *env)
+{
+    w2c_properties_impl_t *properties_impl = NULL;
+    axis2_array_list_t *values_arr = NULL;
+    axis2_char_t *value = NULL;
+    axis2_char_t *key = NULL;
+    int i = 0;
+    int size = 0;
+    axis2_hash_index_t *hi = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    properties_impl = W2C_INTF_TO_IMPL(properties);
+   
+    if(properties_impl-> prop_hash)
+    {
+        for (hi = axis2_hash_first( properties_impl-> prop_hash, env);
+                            hi; hi = axis2_hash_next(env, hi))
+        {
+            axis2_hash_this(hi, (void*)&key, NULL, (void*)&values_arr);
+            if (key && values_arr)
+            {
+                size = AXIS2_ARRAY_LIST_SIZE( values_arr, env);
+                for (i = 0; i < size; i ++)
+                {
+                    value = (axis2_char_t*)AXIS2_ARRAY_LIST_GET( values_arr, env, i);
+                    if ( value != NULL)
+                    {
+                        AXIS2_FREE( env-> allocator, value);
+                    }
+                }
+                AXIS2_ARRAY_LIST_FREE( values_arr, env);
+                AXIS2_FREE(env-> allocator, key);
+            }
+        }
+        axis2_hash_free( properties_impl-> prop_hash, env);
+    }
+    
+    if(properties->ops)
+    {
+        AXIS2_FREE(env->allocator, properties->ops);
+        properties->ops = NULL;
+    }
+    if(properties_impl)
+    {
+        AXIS2_FREE(env->allocator, properties_impl);
+        properties_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+axis2_hash_t* AXIS2_CALL
+w2c_properties_get_hash(w2c_properties_t *properties,
+           const axis2_env_t *env)
+{
+    w2c_properties_impl_t *properties_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    properties_impl = W2C_INTF_TO_IMPL(properties);
+    
+    return properties_impl-> prop_hash;
+}
+
+axis2_char_t*
+w2c_properties_trunk_and_dup( axis2_char_t* start, axis2_char_t* end,
+                                   const axis2_env_t* env )
+{
+    for ( ; *start == ' '; start ++ ); /* remove front spaces */
+    for ( end --; *end == ' '; end -- ); /* remove rear spaces */
+    *(++end ) = '\0';
+    start = (axis2_char_t*)AXIS2_STRDUP ( start, env );
+    return start;
+}
+



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