axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r450430 [3/7] - in /webservices/axis2/trunk/c/tools/codegen: include/ src/schema/ src/schema/compiler/ src/schema/writer/ src/templates/ src/templates/c/ src/typemappers/
Date Wed, 27 Sep 2006 13:16:07 GMT
Added: webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_compiler_options.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_compiler_options.c?view=auto&rev=450430
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_compiler_options.c
(added)
+++ webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_compiler_options.c
Wed Sep 27 06:16:04 2006
@@ -0,0 +1,588 @@
+/*
+ * 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_schema_compiler_options.h>
+#include <axis2_string.h>
+
+/**
+ * @brief
+ */
+typedef struct w2c_schema_compiler_options_impl
+{
+    w2c_schema_compiler_options_t compiler_options;
+
+    axis2_char_t *output_location;
+    axis2_char_t *package_name;
+    axis2_char_t *mapper_class_package;
+    axis2_bool_t helper_mode;
+    axis2_bool_t write_out;
+    axis2_bool_t wrap_classes;
+    axis2_hash_t *ns2package_map;
+    axis2_char_t *language;
+
+    W2C_ENGINE_CONFIGURATION_NAMEMAKER maker_func;
+    w2c_qname2name_maker_t *qname2name_maker;
+
+} w2c_schema_compiler_options_impl_t;
+
+#define W2C_INTF_TO_IMPL(schema_compiler_options) \
+        ((w2c_schema_compiler_options_impl_t *) schema_compiler_options)
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_free (w2c_schema_compiler_options_t *schema_compiler_options,
+                                    const axis2_env_t *env);
+
+axis2_char_t*AXIS2_CALL
+w2c_schema_compiler_options_get_output_location( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_output_location( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *output_location);
+
+axis2_char_t*AXIS2_CALL
+w2c_schema_compiler_options_get_mapper_class_package( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_mapper_class_package( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *mapper_class_package);
+
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_compiler_options_get_package_name( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_package_name( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *package_name);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_helper_mode( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_helper_mode( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t helper_mode);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_write_out( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_write_out( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t write_out);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_wrap_classes( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_wrap_classes( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t wrap_classes);
+
+axis2_hash_t* AXIS2_CALL
+w2c_schema_compiler_options_get_ns2package_map( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_ns2package_map( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_hash_t *ns2package_map);
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_compiler_options_get_language( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_language( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *language);
+
+w2c_qname2name_maker_t* AXIS2_CALL
+w2c_schema_compiler_options_get_qname2name_maker( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_qname2name_maker( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        w2c_qname2name_maker_t *maker);
+
+W2C_ENGINE_CONFIGURATION_NAMEMAKER AXIS2_CALL
+w2c_schema_compiler_options_get_name_maker_func( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_name_maker_func( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        W2C_ENGINE_CONFIGURATION_NAMEMAKER maker);
+
+/** function for the default qname 2 name */
+axis2_char_t* 
+w2c_schema_compiler_options_default_name_maker( axis2_char_t *name,
+                                     const axis2_env_t *env);
+
+AXIS2_EXTERN w2c_schema_compiler_options_t * AXIS2_CALL
+w2c_schema_compiler_options_create (const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    compiler_options_impl = (w2c_schema_compiler_options_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_schema_compiler_options_impl_t));
+
+    if(NULL == compiler_options_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    compiler_options_impl->output_location = NULL;
+    compiler_options_impl->package_name = NULL;
+    compiler_options_impl->helper_mode = AXIS2_FALSE;
+    compiler_options_impl->write_out = AXIS2_FALSE;
+    compiler_options_impl->wrap_classes = AXIS2_FALSE;
+    compiler_options_impl->ns2package_map = NULL;
+    compiler_options_impl->language = NULL;
+    compiler_options_impl->qname2name_maker = NULL;
+    compiler_options_impl->maker_func = 
+        w2c_schema_compiler_options_default_name_maker;
+
+
+    compiler_options_impl->compiler_options.ops =
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_schema_compiler_options_ops_t));
+    if(NULL == compiler_options_impl->compiler_options.ops)
+    {
+        w2c_schema_compiler_options_free(&(compiler_options_impl->compiler_options),
env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    compiler_options_impl->compiler_options.ops->free = w2c_schema_compiler_options_free;
+    
+    compiler_options_impl->compiler_options.ops->get_output_location =
+                            w2c_schema_compiler_options_get_output_location;
+    compiler_options_impl->compiler_options.ops->set_output_location =
+                            w2c_schema_compiler_options_set_output_location;
+    compiler_options_impl->compiler_options.ops->get_package_name =
+                            w2c_schema_compiler_options_get_package_name;
+    compiler_options_impl->compiler_options.ops->set_package_name =
+                            w2c_schema_compiler_options_set_package_name;
+    compiler_options_impl->compiler_options.ops->get_helper_mode =
+                            w2c_schema_compiler_options_get_helper_mode;
+    compiler_options_impl->compiler_options.ops->set_helper_mode =
+                            w2c_schema_compiler_options_set_helper_mode;
+    compiler_options_impl->compiler_options.ops->get_write_out =
+                            w2c_schema_compiler_options_get_write_out;
+    compiler_options_impl->compiler_options.ops->set_write_out =
+                            w2c_schema_compiler_options_set_write_out;
+    compiler_options_impl->compiler_options.ops->get_wrap_classes =
+                            w2c_schema_compiler_options_get_wrap_classes;
+    compiler_options_impl->compiler_options.ops->set_wrap_classes =
+                            w2c_schema_compiler_options_set_wrap_classes;
+    compiler_options_impl->compiler_options.ops->get_ns2package_map =
+                            w2c_schema_compiler_options_get_ns2package_map;
+    compiler_options_impl->compiler_options.ops->set_ns2package_map =
+                            w2c_schema_compiler_options_set_ns2package_map;
+    compiler_options_impl->compiler_options.ops->get_mapper_class_package=
+                            w2c_schema_compiler_options_get_mapper_class_package;
+    compiler_options_impl->compiler_options.ops->set_mapper_class_package=
+                            w2c_schema_compiler_options_set_mapper_class_package;
+    compiler_options_impl->compiler_options.ops->get_language=
+                            w2c_schema_compiler_options_get_language;
+    compiler_options_impl->compiler_options.ops->set_language=
+                            w2c_schema_compiler_options_set_language;
+    compiler_options_impl->compiler_options.ops->get_name_maker_func=
+                            w2c_schema_compiler_options_get_name_maker_func;
+    compiler_options_impl->compiler_options.ops->set_name_maker_func=
+                            w2c_schema_compiler_options_set_name_maker_func;
+    compiler_options_impl->compiler_options.ops->get_qname2name_maker=
+                            w2c_schema_compiler_options_get_qname2name_maker;
+    compiler_options_impl->compiler_options.ops->set_qname2name_maker=
+                            w2c_schema_compiler_options_set_qname2name_maker;
+
+
+    return &(compiler_options_impl->compiler_options);
+}
+
+axis2_status_t AXIS2_CALL 
+w2c_schema_compiler_options_free (w2c_schema_compiler_options_t *schema_compiler_options,

+                            const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *schema_compiler_options_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_compiler_options_impl = W2C_INTF_TO_IMPL(schema_compiler_options);
+    
+    if (schema_compiler_options_impl-> output_location)
+    {
+        AXIS2_FREE(env-> allocator, schema_compiler_options_impl-> output_location);
+    }
+    if (schema_compiler_options_impl-> mapper_class_package)
+    {
+        AXIS2_FREE(env-> allocator, schema_compiler_options_impl-> mapper_class_package);
+    }
+    if (schema_compiler_options_impl-> package_name)
+    {
+        AXIS2_FREE(env-> allocator, schema_compiler_options_impl-> package_name);
+    }
+    if (schema_compiler_options_impl-> ns2package_map)
+    {
+        axis2_hash_free(schema_compiler_options_impl-> ns2package_map, env);
+    }
+    if (schema_compiler_options_impl-> language)
+    {
+        AXIS2_FREE(env-> allocator, schema_compiler_options_impl-> language);
+    }
+    if(schema_compiler_options->ops)
+    {
+        AXIS2_FREE(env->allocator, schema_compiler_options->ops);
+        schema_compiler_options->ops = NULL;
+    }
+    if(schema_compiler_options_impl)
+    {
+        AXIS2_FREE(env->allocator, schema_compiler_options_impl);
+        schema_compiler_options_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+
+
+axis2_char_t*AXIS2_CALL
+w2c_schema_compiler_options_get_output_location( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> output_location;
+
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_output_location( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *output_location)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> output_location = AXIS2_STRDUP(output_location, env);
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t*AXIS2_CALL
+w2c_schema_compiler_options_get_mapper_class_package( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> mapper_class_package;
+
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_mapper_class_package( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *mapper_class_package)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> mapper_class_package = AXIS2_STRDUP(mapper_class_package,
env);
+
+    return AXIS2_SUCCESS;
+}
+
+
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_compiler_options_get_package_name( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> package_name;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_package_name( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *package_name)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> package_name = AXIS2_STRDUP(package_name, env);
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_helper_mode( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> helper_mode;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_helper_mode( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t helper_mode)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> helper_mode = helper_mode;
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_write_out( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> write_out;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_write_out( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t write_out)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> write_out = write_out;
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_compiler_options_get_wrap_classes( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> wrap_classes;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_wrap_classes( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_bool_t wrap_classes)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> wrap_classes = wrap_classes;
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_hash_t* AXIS2_CALL
+w2c_schema_compiler_options_get_ns2package_map( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> ns2package_map;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_ns2package_map( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_hash_t *ns2package_map)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> ns2package_map = ns2package_map;
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_compiler_options_get_language( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> language;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_language( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        axis2_char_t *language)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> language = AXIS2_STRDUP(language, env);
+
+    return AXIS2_SUCCESS;
+}
+
+w2c_qname2name_maker_t* AXIS2_CALL
+w2c_schema_compiler_options_get_qname2name_maker( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    return compiler_options_impl-> qname2name_maker;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_qname2name_maker( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        w2c_qname2name_maker_t *maker)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+
+    compiler_options_impl-> qname2name_maker = maker;
+
+    return AXIS2_SUCCESS;
+}
+
+W2C_ENGINE_CONFIGURATION_NAMEMAKER AXIS2_CALL
+w2c_schema_compiler_options_get_name_maker_func( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+    
+    return compiler_options_impl-> maker_func;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_compiler_options_set_name_maker_func( w2c_schema_compiler_options_t *compiler_options,
+        const axis2_env_t *env,
+        W2C_ENGINE_CONFIGURATION_NAMEMAKER maker)
+{
+    w2c_schema_compiler_options_impl_t *compiler_options_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    compiler_options_impl = W2C_INTF_TO_IMPL(compiler_options);
+    
+    if ( maker != NULL)
+    {
+        compiler_options_impl-> maker_func = maker;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t* 
+w2c_schema_compiler_options_default_name_maker( axis2_char_t *name,
+                                     const axis2_env_t *env)
+{
+        return AXIS2_STRDUP( name, env);
+}
+

Added: webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_property_loader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_property_loader.c?view=auto&rev=450430
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_property_loader.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/schema/compiler/schema_property_loader.c Wed
Sep 27 06:16:04 2006
@@ -0,0 +1,484 @@
+/*
+ * 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_schema_property_loader.h>
+#include <axis2_properties.h>
+#include <axis2_array_list.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+#include <axis2_hash.h>
+#include <stdlib.h>
+#include <w2c_messages.h>
+#include <w2c_class_loader.h>
+
+#define W2C_SCHEMA_PROPERTY_LOADER_WRITER_CLASS "schema.writer.class"
+#define W2C_SCHEMA_PROPERTY_LOADER_WRITER_TEMPLATE "schema.writer.template"
+#define W2C_SCHEMA_PROPERTY_LOADER_TYPEMAP "schema.typemap"
+
+#define W2C_SCHEMA_PROPERTY_LOADER_CLASS "default.class"
+#define W2C_SCHEMA_PROPERTY_LOADER_ARRAY "default.array"
+
+#define W2C_SCHEMA_PROPERTY_LOADER_DEFAULT_PROPERTIES \
+            "/conf/schema-config.properties"
+
+/** 
+ * @brief
+ */
+typedef struct w2c_schema_property_loader_impl
+{
+    w2c_schema_property_loader_t schema_property_loader;
+    
+    axis2_char_t *template_name;
+    w2c_schema_writer_t *writer_instance;
+    axis2_char_t *typemapper_name;
+
+    axis2_properties_t *prop_set;
+    axis2_char_t *prop_filename;
+    axis2_char_t *language;
+    axis2_char_t *default_class;
+    axis2_char_t *default_array;
+       
+} w2c_schema_property_loader_impl_t;
+
+#define W2C_INTF_TO_IMPL(schema_property_loader) \
+    ((w2c_schema_property_loader_impl_t *) schema_property_loader)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_free(
+    w2c_schema_property_loader_t *schema_property_loader, 
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_set_filename(
+          w2c_schema_property_loader_t *schema_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *filename);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_set_language(
+          w2c_schema_property_loader_t *schema_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *language);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_reload(
+    w2c_schema_property_loader_t *schema_property_loader, 
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_property_loader_get_template_name(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env);
+
+w2c_schema_writer_t* AXIS2_CALL
+w2c_schema_property_loader_get_writer_instance(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL 
+w2c_schema_property_loader_get_typemapper_name(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL 
+w2c_schema_property_loader_get_default_array(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL 
+w2c_schema_property_loader_get_default_class(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env);
+
+
+
+/* private methods */
+
+static void
+w2c_schema_property_loader_load_values(
+                      w2c_schema_property_loader_impl_t *obj_impl,
+                      const axis2_env_t *env);
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_schema_property_loader_t * AXIS2_CALL 
+w2c_schema_property_loader_create (const axis2_env_t *env,
+                                 axis2_char_t *language)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    axis2_char_t* axis2c_home;
+    int path_len;
+    FILE *f = NULL;
+   
+    AXIS2_ENV_CHECK(env, NULL);
+
+    
+
+    schema_property_loader_impl = (w2c_schema_property_loader_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_schema_property_loader_impl_t));
+
+    if(NULL == schema_property_loader_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+    
+    schema_property_loader_impl->schema_property_loader.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_schema_property_loader_ops_t));
+    if(NULL == schema_property_loader_impl->schema_property_loader.ops)
+    {
+        w2c_schema_property_loader_free(&(schema_property_loader_impl->schema_property_loader),
env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+ 
+    schema_property_loader_impl->default_array = NULL;
+    schema_property_loader_impl->default_class = NULL;
+    schema_property_loader_impl->template_name = NULL;
+    schema_property_loader_impl->writer_instance = NULL;
+    schema_property_loader_impl->typemapper_name = NULL;
+    schema_property_loader_impl->prop_filename = NULL;
+    schema_property_loader_impl->language = AXIS2_STRDUP(language, env);
+     
+    axis2c_home = getenv ( "AXIS2C_HOME" );
+    path_len = AXIS2_STRLEN (axis2c_home ) + 
+             AXIS2_STRLEN (W2C_SCHEMA_PROPERTY_LOADER_DEFAULT_PROPERTIES) +
+             2;
+    schema_property_loader_impl-> prop_filename = AXIS2_MALLOC ( env->allocator,
+                                        sizeof(axis2_char_t)*path_len );
+    sprintf(schema_property_loader_impl-> prop_filename, "%s%s", axis2c_home,
+                           W2C_SCHEMA_PROPERTY_LOADER_DEFAULT_PROPERTIES);
+    
+    f = fopen ( schema_property_loader_impl-> prop_filename, "r+");
+    if ( f == NULL )
+    {
+        w2c_schema_property_loader_free(&(schema_property_loader_impl->schema_property_loader),
env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_COULD_NOT_OPEN_FILE, AXIS2_FAILURE);
+        return NULL;
+    }
+    schema_property_loader_impl-> prop_set =  axis2_properties_create( env);
+    AXIS2_PROPERTIES_LOAD( schema_property_loader_impl-> prop_set, env, f);
+
+    if ( schema_property_loader_impl-> prop_set != NULL )
+    {
+        w2c_schema_property_loader_load_values( schema_property_loader_impl, env );
+    }
+    schema_property_loader_impl->schema_property_loader.ops->free = 
+                      w2c_schema_property_loader_free;
+    schema_property_loader_impl->schema_property_loader.ops->set_filename= 
+                      w2c_schema_property_loader_set_filename;
+    schema_property_loader_impl->schema_property_loader.ops->set_language= 
+                      w2c_schema_property_loader_set_language;
+    schema_property_loader_impl->schema_property_loader.ops->reload = 
+                      w2c_schema_property_loader_reload;
+    schema_property_loader_impl->schema_property_loader.ops->get_template_name=
+                      w2c_schema_property_loader_get_template_name ;
+    schema_property_loader_impl->schema_property_loader.ops->get_writer_instance=
+                      w2c_schema_property_loader_get_writer_instance;
+    schema_property_loader_impl->schema_property_loader.ops->get_typemapper_name= 
+                      w2c_schema_property_loader_get_typemapper_name;
+    schema_property_loader_impl->schema_property_loader.ops->get_default_array= 
+                      w2c_schema_property_loader_get_default_array;
+    schema_property_loader_impl->schema_property_loader.ops->get_default_class= 
+                      w2c_schema_property_loader_get_default_class;
+
+    return &(schema_property_loader_impl->schema_property_loader);
+}
+
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL 
+w2c_schema_property_loader_free (w2c_schema_property_loader_t *schema_property_loader, 
+                            const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    if (schema_property_loader_impl-> template_name)
+    {
+        AXIS2_FREE (env-> allocator,
+                 schema_property_loader_impl-> template_name);
+    }
+    
+    if (schema_property_loader_impl-> writer_instance)
+    {
+        W2C_SCHEMA_WRITER_FREE( 
+                schema_property_loader_impl-> writer_instance, env);
+    }
+    if (schema_property_loader_impl-> typemapper_name)
+    {
+        AXIS2_FREE (env-> allocator,
+                 schema_property_loader_impl-> typemapper_name);
+    }
+
+    if (schema_property_loader_impl-> prop_set)
+    {
+        AXIS2_PROPERTIES_FREE( schema_property_loader_impl-> prop_set, env);
+    }
+
+    if (schema_property_loader_impl-> prop_filename)
+    {
+        AXIS2_FREE (env-> allocator, schema_property_loader_impl-> prop_filename);
+    }
+
+    if (schema_property_loader_impl-> language)
+    {
+        AXIS2_FREE (env-> allocator, schema_property_loader_impl-> language);
+    }
+
+    if (schema_property_loader_impl-> default_class)
+    {
+        AXIS2_FREE (env-> allocator, schema_property_loader_impl-> default_class);
+    }
+
+    if (schema_property_loader_impl-> default_array)
+    {
+        AXIS2_FREE (env-> allocator, schema_property_loader_impl-> default_array);
+    }
+
+    if(schema_property_loader->ops)
+    {
+        AXIS2_FREE(env->allocator, schema_property_loader->ops);
+        schema_property_loader->ops = NULL;
+    }
+    if(schema_property_loader_impl)
+    {
+        AXIS2_FREE(env->allocator, schema_property_loader_impl);
+        schema_property_loader_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_set_filename (
+          w2c_schema_property_loader_t *schema_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *filename)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+  
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    schema_property_loader_impl -> prop_filename = filename;   
+    w2c_schema_property_loader_reload ( schema_property_loader, env );
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_set_language(
+          w2c_schema_property_loader_t *schema_property_loader,
+          const axis2_env_t *env,
+          axis2_char_t *language)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+  
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    schema_property_loader_impl -> language = language;   
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_property_loader_reload (
+    w2c_schema_property_loader_t *schema_property_loader, 
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    FILE *f = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    if (schema_property_loader_impl-> prop_set)
+    {
+         AXIS2_PROPERTIES_FREE ( schema_property_loader_impl->prop_set, env );
+    }
+
+    f = fopen ( schema_property_loader_impl-> prop_filename, "r+");
+    if ( f == NULL )
+    {
+        w2c_schema_property_loader_free(&(schema_property_loader_impl->schema_property_loader),
env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_COULD_NOT_OPEN_FILE, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    schema_property_loader_impl-> prop_set =  axis2_properties_create( env);
+    AXIS2_PROPERTIES_LOAD( schema_property_loader_impl-> prop_set, env, f);
+
+    if ( schema_property_loader_impl-> prop_set != NULL )
+    {
+        w2c_schema_property_loader_load_values( schema_property_loader_impl, env );
+    }
+    else
+    {
+        return AXIS2_FAILURE;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_property_loader_get_template_name(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    return schema_property_loader_impl-> template_name;
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_property_loader_get_default_class(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    return schema_property_loader_impl-> default_class;
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_property_loader_get_default_array(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    return schema_property_loader_impl-> default_array;
+}
+
+w2c_schema_writer_t* AXIS2_CALL
+w2c_schema_property_loader_get_writer_instance(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    return schema_property_loader_impl-> writer_instance;
+}
+
+
+axis2_char_t* AXIS2_CALL 
+w2c_schema_property_loader_get_typemapper_name(
+    w2c_schema_property_loader_t *schema_property_loader,
+    const axis2_env_t *env)
+{
+    w2c_schema_property_loader_impl_t *schema_property_loader_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    schema_property_loader_impl = W2C_INTF_TO_IMPL(schema_property_loader);
+    
+    return schema_property_loader_impl-> typemapper_name;
+}
+
+
+
+static void
+w2c_schema_property_loader_load_values(
+                      w2c_schema_property_loader_impl_t *obj_impl,
+                      const axis2_env_t *env)
+{
+     axis2_hash_t *prop_hash = NULL;
+     axis2_hash_index_t *hi = NULL;
+     axis2_char_t *key= NULL;
+     axis2_char_t *val= NULL;
+     int index = 0;
+     axis2_char_t *language = NULL;
+     w2c_schema_writer_t *writer = NULL;
+     axis2_dll_desc_t *dll_desc = NULL;
+
+     prop_hash = AXIS2_PROPERTIES_GET_ALL( obj_impl-> prop_set, env);
+     language = obj_impl-> language;
+
+     /**
+      * run through the language specific properties and populate the
+      * language specific property map
+      */
+     if ( language)
+     {
+         for (hi = axis2_hash_first(prop_hash, env); hi;
+              hi = axis2_hash_next(env, hi))
+         {
+            axis2_hash_this(hi, (void*)&key, NULL, (void*)&val);
+            if ( w2c_string_indexof_cs ( key, language) == 0 && 
+                         (index = w2c_string_indexof ( key, '.')) == AXIS2_STRLEN(language))
+            {
+                if (w2c_string_indexof_cs( key,
+                     W2C_SCHEMA_PROPERTY_LOADER_WRITER_CLASS) == index + 1)
+                {
+                    writer = w2c_class_loader_get_object_from_class_name
+                          ( env, val, W2C_CLASS_LOADER_WRITER_PATH, &dll_desc );
+                    if ( NULL == writer )
+                    {
+                        w2c_messages_print_n_log_error( env,
+                                       "schema.writerclassMissing");
+                        return;
+                    }
+                    obj_impl-> writer_instance = writer;
+                }
+                if (w2c_string_indexof_cs( key,
+                     W2C_SCHEMA_PROPERTY_LOADER_WRITER_TEMPLATE) == index + 1)
+                {
+                    obj_impl-> template_name = AXIS2_STRDUP( val, env);
+                }
+                if (w2c_string_indexof_cs( key, 
+                     W2C_SCHEMA_PROPERTY_LOADER_TYPEMAP) == index + 1)
+                {
+                    obj_impl-> typemapper_name = AXIS2_STRDUP( val, env);
+                }
+                if (w2c_string_indexof_cs( key, 
+                     W2C_SCHEMA_PROPERTY_LOADER_CLASS) == index + 1)
+                {
+                    obj_impl-> default_class = AXIS2_STRDUP( val, env);
+                }
+                if (w2c_string_indexof_cs( key, 
+                     W2C_SCHEMA_PROPERTY_LOADER_ARRAY) == index + 1)
+                {
+                    obj_impl-> default_array = AXIS2_STRDUP( val, env);
+                }
+            }
+         }
+     }   
+}
+



---------------------------------------------------------------------
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