You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/09/01 14:46:04 UTC
svn commit: r439295 [11/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/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties Fri Sep 1 05:45:57 2006
@@ -0,0 +1,71 @@
+# Translation instructions.
+# 1. Each message line is of the form key=value.
+# Translate the value, DO NOT translate the key.
+# 2. The messages may contain arguments that will be filled in
+# by the runtime. These are of the form: {0}, {1}, etc.
+# These must appear as is in the message, though the order
+# may be changed to support proper language syntax.
+# 3. If a single quote character is to appear in the resulting
+# message, it must appear in this file as two consecutive
+# single quote characters.
+# 4. Lines beginning with "#" (like this one) are comment lines
+# and may contain translation instructions. They need not be
+# translated unless your translated file, rather than this file,
+# will serve as a base for other translators.
+#
+################## WSDL2Code ######################################
+wsdl2code.arg1=Usage WSDL2Code -uri <Location of WSDL> : WSDL file location
+wsdl2code.arg2=-o <output Location> : output file location
+wsdl2code.arg3=-a : Generate async style code only. Default is off
+wsdl2code.arg4=-s : Generate sync style code only. Default is off. takes precedence over -a
+wsdl2code.arg5=-cn : Generate converting names according to the language. - Default is off
+wsdl2code.arg6=-l <language> : valid language(s) are c. Default is c
+wsdl2code.arg7=-id : indent the generated code. currently available for c language
+wsdl2code.arg8=-ss : Generate server side code (i.e. skeletons). Default is off
+wsdl2code.arg9=-sd : Generate service descriptor (i.e. services.xml). Default is off. Valid with -ss
+wsdl2code.arg10=-d <databinding> : valid databinding is none. Default is none
+#currently following cases are not tested correctly
+wsdl2code.arg11=-g Generates all the classes. valid only with the -ss
+wsdl2code.arg12=-pn <port_name> : name of port in the presence of multiple ports
+wsdl2code.arg13=-sn <service_name> : name of service in the presence of multiple services
+wsdl2code.arg14=-u : unpacks the databinding classes
+wsdl2code.arg15=-r <repository_path> : path of the repository against which code is generated
+wsdl2code.arg16=-ns2p <namespace=packagename> :packages to replace the namespace
+wsdl2code.arg17=-ssi generate an interface for the serverside - off by default
+wsdl2code.arg18=-p <package name> : set custom package name
+wsdl2code.arg19=-t : Generate TestCase to test the generated code
+
+################## Utilities #################################
+utils.classloadFailed=Failed in loading the Class
+propfileload.frameworkMismatch=Number of frameworks and extension names do not match!
+propfileload.unknownFramework=Unknown framework specified for default!
+propfileload.emitterMissing=No emitters found!
+propfileload.unknownDefaultLang=Unknown Language specified for default!
+propfileload.generalException=Exception while loading the property file
+
+################# template resolver #################################
+reslover.templateNotFound={0} template not found!
+
+################### Codegen engine ###################################
+engine.wsdlParsingException=Error parsing WSDL
+engine.invalidWsdlLocation=Invalid WSDL Location
+engine.noProperDatabindingException=No proper databinding has taken place
+engine.emitterMissing=Emitter class not found!
+engine.wrongEmitter=Non emitter class found!
+engine.extensionLoadProblem=Extension class loading problem
+engine.extensionInstantiationProblem=Extension class instantiation problem
+engine.illegalExtension=Illegal extension!
+engine.engine.noDefaultLang=No default langauge set
+engine.errorEmit=Error in Emitting the code
+
+################### Codegen emitter ###################################
+emitter.errorParsingWSDL=Error in parsing WSDL
+emitter.errorLoadingServices=Error in loading Services
+
+writer.stubSourceFailed=Failed in generating Stub Source
+writer.stubHeaderFailed=Failed in generating Stub Header
+writer.skelSourceFailed=Failed in generating Skel Source
+writer.skelHeaderFailed=Failed in generating Skel Header
+writer.svcSkelFailed=Failed in generating Service Skeleton
+writer.svcXmlFailed=Failed in generating Service XML
+writer.templateLoadFailed=Failed in loading template
Added: webservices/axis2/trunk/c/tools/codegen/src/util/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/string.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/string.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/string.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,156 @@
+/*
+ * 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_string.h>
+#include <axis2_string.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+/* hoping this all ascii */
+#define W2C_STRING_IS_CAPITAL(c) (c) >= 'A' && (c) <= 'Z'
+#define W2C_STRING_IS_SIMPLE(c) (c) >= 'a' && (c) <= 'z'
+
+
+AXIS2_EXTERN int AXIS2_CALL
+w2c_string_indexof( axis2_char_t* str, axis2_char_t c )
+{
+ int i;
+ for ( i = 0; *str != '\0' ; str ++, i ++ )
+ {
+ if ( *str == c )
+ {
+ return i;
+ }
+ }
+ return -1;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+w2c_string_indexof_cs( axis2_char_t* str, axis2_char_t* cs )
+{
+ int i = 0;
+ axis2_char_t* temp_cs = cs;
+ int starting_i = -1;
+ for ( i = 0; *str != '\0' && *temp_cs!= '\0' ; str ++, i ++ )
+ {
+ if ( *str == *temp_cs )
+ {
+ temp_cs ++;
+ if ( starting_i < 0 )
+ {
+ starting_i = i;
+ }
+ }
+ else if ( starting_i > -1 )
+ {
+ starting_i = -1;
+ temp_cs = cs;
+ }
+ }
+ if ( starting_i > -1 && *temp_cs =='\0' )
+ {
+ return starting_i;
+ }
+ return -1;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_string_add_string ( axis2_char_t* string1, axis2_char_t* string2,
+ const axis2_env_t* env)
+{
+ int current_len = 0;
+ int additional_len = 0;
+ axis2_char_t* new_location = NULL;
+
+ additional_len = strlen ( string2 );
+ if ( 0 == additional_len )
+ {
+ return string1;
+ }
+
+ if ( NULL == string1 )
+ {
+ string1 = AXIS2_MALLOC( env-> allocator,
+ sizeof(axis2_char_t) * (additional_len +1 ) );
+ }
+ else
+ {
+ current_len = strlen ( string1 );
+ string1 = AXIS2_REALLOC( env-> allocator,
+ string1, sizeof(axis2_char_t) *
+ (current_len + additional_len + 1 ) );
+ }
+ new_location = string1 + sizeof(axis2_char_t) * current_len ;
+ memcpy ( new_location , string2, sizeof(axis2_char_t) * additional_len );
+
+ string1[ additional_len + current_len ] = '\0';
+
+ return string1;
+}
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_string_make_c_simple_name( axis2_char_t *name,
+ const axis2_env_t *env)
+{
+ char *p = NULL;
+ int len = 0;
+ char *ret_val = NULL;
+ int new_index = 0;
+ int earlier_capital = 0;
+
+ name = (axis2_char_t*)AXIS2_STRDUP( name, env); /* so constansts are allowd */
+ len = AXIS2_STRLEN( name);
+ ret_val = (axis2_char_t*) AXIS2_MALLOC ( env-> allocator,
+ sizeof(axis2_char_t) * len * 2);
+
+ for ( p = name, new_index = 0, earlier_capital = 0; *p != '\0'; p ++ )
+ {
+ if ( W2C_STRING_IS_CAPITAL(*p) )
+ {
+ if ( new_index != 0 && ret_val[new_index-1] != '_' && !earlier_capital)
+ ret_val[new_index++] = '_';
+ ret_val[new_index++] = tolower(*p);
+ earlier_capital = 1;
+ }
+ else
+ {
+ earlier_capital = 0;
+ ret_val[new_index++] = *p;
+ }
+ }
+ ret_val[new_index] = '\0';
+
+ AXIS2_FREE( env-> allocator, name);
+ return ret_val;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_string_make_c_macro_name( axis2_char_t *name,
+ const axis2_env_t *env)
+{
+ char *p = NULL;
+ char *ret_val = NULL;
+
+ ret_val = w2c_string_make_c_simple_name( name, env);
+
+ for ( p = ret_val; *p != '\0'; p ++ )
+ {
+ *p = toupper(*p);
+ }
+ return ret_val;
+}
Added: webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,409 @@
+/*
+ * 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_typemapper.h>
+#include <axis2_array_list.h>
+#include <axis2_string.h>
+#include <w2c_string.h>
+#include <axiom_document.h>
+#include <axiom_xml_reader.h>
+#include <axiom_stax_builder.h>
+#include <axiom_element.h>
+#include <axiom_node.h>
+#include <axiom_children_iterator.h>
+#include <stdlib.h>
+
+
+
+#define W2C_TYPEMAPPER_UPPER_PARAM_LIMIT 1000
+#define W2C_TYPEMAPPER_PARAM_SUFFIX "param"
+
+/**
+ * @brief
+ */
+typedef struct w2c_typemapper_impl
+{
+ w2c_typemapper_t typemapper;
+
+ axis2_char_t *mapper_name;
+ axis2_hash_t *qname2name;
+ axis2_char_t *default_type;
+ axis2_qname_t *default_qname;
+
+
+} w2c_typemapper_impl_t;
+
+typedef struct w2c_typemapper_type_info
+{
+ axis2_qname_t *qname;
+ axis2_char_t *type;
+} w2c_typemapper_type_info_t;
+#define W2C_INTF_TO_IMPL(typemapper) \
+ ((w2c_typemapper_impl_t *) typemapper)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL
+w2c_typemapper_free (w2c_typemapper_t *typemapper,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_parameter_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname);
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_type_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname);
+
+axis2_status_t AXIS2_CALL
+w2c_typemapper_add_typemapping_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname,
+ axis2_char_t *name);
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_default_mapping_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env);
+
+axis2_qname_t* AXIS2_CALL
+w2c_typemapper_get_default_qname(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env);
+
+ /************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL
+w2c_typemapper_create (const axis2_env_t *env)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ typemapper_impl = (w2c_typemapper_impl_t *) AXIS2_MALLOC(env->
+ allocator, sizeof(w2c_typemapper_impl_t));
+
+ if(NULL == typemapper_impl)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ typemapper_impl->qname2name = NULL;
+ typemapper_impl->default_type = NULL;
+
+ typemapper_impl->typemapper.ops =
+ AXIS2_MALLOC (env->allocator, sizeof(w2c_typemapper_ops_t));
+ if(NULL == typemapper_impl->typemapper.ops)
+ {
+ w2c_typemapper_free(&(typemapper_impl->typemapper), env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ typemapper_impl->typemapper.ops->free = w2c_typemapper_free;
+ typemapper_impl->typemapper.ops->get_parameter_name =
+ w2c_typemapper_get_parameter_name;
+ typemapper_impl->typemapper.ops->get_type_name=
+ w2c_typemapper_get_type_name;
+ typemapper_impl->typemapper.ops->add_typemapping_name =
+ w2c_typemapper_add_typemapping_name;
+ typemapper_impl->typemapper.ops->get_default_mapping_name =
+ w2c_typemapper_get_default_mapping_name;
+ typemapper_impl->typemapper.ops->get_default_qname=
+ w2c_typemapper_get_default_qname;
+
+ return &(typemapper_impl->typemapper);
+}
+
+AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL
+w2c_typemapper_create_from_file(const axis2_env_t *env,
+ axis2_char_t *filename)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+ axiom_xml_reader_t *xml_reader = NULL;
+ axiom_stax_builder_t *om_builder = NULL;
+ axiom_document_t *om_doc = NULL;
+ axis2_char_t *file_path = NULL;
+ axiom_node_t *root = NULL;
+ axiom_element_t *root_ele = NULL;
+ axiom_children_iterator_t *it = NULL;
+ axiom_node_t *child = NULL;
+ axiom_element_t *child_ele = NULL;
+ axis2_bool_t is_default = AXIS2_FALSE;
+ axis2_char_t *uri = NULL;
+ axis2_char_t *prefix = NULL;
+ axis2_char_t *local_name = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *type_val = NULL;
+ w2c_typemapper_type_info_t *type_info = NULL;
+ axis2_char_t *qname2str = NULL;
+ axis2_char_t *attri_val = NULL;
+
+
+ AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_PARAM_CHECK(env->error, filename, NULL);
+
+ typemapper_impl = (w2c_typemapper_impl_t *) w2c_typemapper_create(env);
+ if(!typemapper_impl)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ file_path = getenv("AXIS2C_HOME");
+ file_path = AXIS2_STRDUP( file_path, env);
+ file_path = w2c_string_add_string(file_path, W2C_TYPEMAPPER_MAPPING_PATH, env );
+ file_path = w2c_string_add_string(file_path, filename, env );
+
+ xml_reader =
+ axiom_xml_reader_create_for_file(env, file_path, NULL);
+ if(!xml_reader)
+ return AXIS2_FAILURE;
+ om_builder = axiom_stax_builder_create(env, xml_reader);
+ om_doc = axiom_document_create(env, NULL, om_builder);
+ AXIOM_DOCUMENT_BUILD_ALL(om_doc, env);
+
+ typemapper_impl-> qname2name = axis2_hash_make ( env);
+ root = AXIOM_DOCUMENT_GET_ROOT_ELEMENT(om_doc, env);
+ root_ele = AXIOM_NODE_GET_DATA_ELEMENT(root, env);
+ typemapper_impl-> mapper_name =
+ AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(root_ele, env, "dbf");
+ typemapper_impl-> mapper_name =
+ AXIS2_STRDUP( typemapper_impl-> mapper_name, env);
+ it = AXIOM_ELEMENT_GET_CHILDREN(root_ele, env, root);
+ while ( (child = AXIOM_CHILDREN_ITERATOR_NEXT(it, env )) != NULL )
+ {
+ child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
+ is_default = AXIS2_FALSE;
+ if ( (attri_val = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
+ (child_ele, env, "default") ) != NULL )
+ {
+ is_default = AXIS2_TRUE;
+ }
+ child = AXIOM_NODE_GET_FIRST_CHILD( child, env);
+ child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
+ uri = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
+ (child_ele, env, "namespace");
+ uri = AXIS2_STRDUP( uri, env);
+ prefix = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
+ (child_ele, env, "prefix");
+ prefix = AXIS2_STRDUP( prefix, env);
+ local_name = AXIOM_ELEMENT_GET_TEXT(child_ele, env, child);
+ local_name = AXIS2_STRDUP( local_name, env);
+ qname = axis2_qname_create( env, local_name, uri, prefix);
+ qname2str = AXIS2_QNAME_TO_STRING( qname, env);
+ qname2str = AXIS2_STRDUP( qname2str, env);
+
+ child = AXIOM_NODE_GET_NEXT_SIBLING( child, env );
+ child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
+ type_val = AXIOM_ELEMENT_GET_TEXT( child_ele, env, child);
+ type_val = AXIS2_STRDUP( type_val, env);
+ if ( is_default )
+ {
+ typemapper_impl-> default_type = AXIS2_STRDUP( type_val, env);
+ typemapper_impl-> default_qname = qname;
+ }
+ type_info = (w2c_typemapper_type_info_t*) AXIS2_MALLOC
+ ( env-> allocator, sizeof(w2c_typemapper_type_info_t) );
+ type_info-> qname = qname;
+ type_info-> type = type_val;
+ axis2_hash_set( typemapper_impl-> qname2name, qname2str,
+ AXIS2_HASH_KEY_STRING, type_info );
+ }
+
+ AXIOM_STAX_BUILDER_FREE(om_builder, env);
+ axiom_xml_reader_cleanup();
+
+ return &(typemapper_impl->typemapper);
+}
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL
+w2c_typemapper_free (w2c_typemapper_t *typemapper,
+ const axis2_env_t *env)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ axis2_char_t *key = NULL;
+ w2c_typemapper_type_info_t* value =NULL;
+ axis2_hash_index_t *hi = NULL;
+ axis2_hash_t *h = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+ h = typemapper_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 (value)
+ {
+ if (value-> type)
+ AXIS2_FREE ( env-> allocator, value-> type );
+ if (value-> qname)
+ AXIS2_QNAME_FREE( value-> qname, env);
+ }
+ if (key) AXIS2_FREE ( env-> allocator, key);
+ }
+ axis2_hash_free( h , env);
+
+ if (typemapper_impl-> mapper_name)
+ {
+ AXIS2_FREE (env-> allocator, typemapper_impl-> mapper_name);
+ }
+ if (typemapper_impl-> default_type)
+ {
+ AXIS2_FREE (env-> allocator, typemapper_impl-> default_type);
+ }
+ if(typemapper->ops)
+ {
+ AXIS2_FREE(env->allocator, typemapper->ops);
+ typemapper->ops = NULL;
+ }
+ if(typemapper_impl)
+ {
+ AXIS2_FREE(env->allocator, typemapper_impl);
+ typemapper_impl = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_parameter_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ axis2_char_t *key = NULL;
+ w2c_typemapper_type_info_t *value =NULL;
+ axis2_hash_t *h = NULL;
+ axis2_char_t *prefix= NULL;
+ static int counter = 0;
+ axis2_char_t counter_str[32];
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+ h = typemapper_impl-> qname2name;
+
+ key = AXIS2_QNAME_TO_STRING(qname, env);
+ value = axis2_hash_get( h, key, AXIS2_HASH_KEY_STRING );
+ if ( NULL == value )
+ {
+ return NULL;
+ }
+
+ qname = value-> qname;
+
+ prefix = AXIS2_QNAME_GET_LOCALPART( qname, env);
+ prefix = AXIS2_STRDUP( prefix, env);
+
+ if (counter == W2C_TYPEMAPPER_UPPER_PARAM_LIMIT)
+ {
+ counter = 0;
+ }
+ sprintf(counter_str,"%d",counter++);
+ prefix = w2c_string_add_string(prefix, counter_str, env );
+
+ return prefix;
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_type_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ axis2_char_t *key = NULL;
+ w2c_typemapper_type_info_t *value =NULL;
+ axis2_hash_t *h = NULL;
+ axis2_char_t *type= NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+ h = typemapper_impl-> qname2name;
+
+ key = AXIS2_QNAME_TO_STRING(qname, env);
+ value = axis2_hash_get( h, key, AXIS2_HASH_KEY_STRING );
+ if ( NULL == value )
+ return NULL;
+
+ type = value-> type;
+ return type;
+}
+
+
+axis2_status_t AXIS2_CALL
+w2c_typemapper_add_typemapping_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env,
+ axis2_qname_t *qname,
+ axis2_char_t *name)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+ axis2_hash_t *h = NULL;
+ axis2_char_t *key= NULL;
+ w2c_typemapper_type_info_t *type_info = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+ h = typemapper_impl-> qname2name;
+
+ key = AXIS2_QNAME_TO_STRING( qname, env);
+ type_info = (w2c_typemapper_type_info_t*) AXIS2_MALLOC
+ ( env-> allocator, sizeof(w2c_typemapper_type_info_t) );
+ type_info-> qname = qname;
+ type_info-> type = name;
+ axis2_hash_set( typemapper_impl-> qname2name, key,
+ AXIS2_HASH_KEY_STRING, type_info );
+ return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_typemapper_get_default_mapping_name(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+
+ return typemapper_impl-> default_type;
+}
+
+
+axis2_qname_t* AXIS2_CALL
+w2c_typemapper_get_default_qname(w2c_typemapper_t *typemapper,
+ const axis2_env_t *env)
+{
+ w2c_typemapper_impl_t *typemapper_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+
+ return typemapper_impl-> default_qname;
+}
+
+
Added: webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,192 @@
+/*
+ * 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_url_processor.h>
+#include <w2c_string.h>
+#include <axis2_url.h>
+
+
+static axis2_bool_t AXIS2_CALL
+w2c_url_processor_is_token ( axis2_char_t *str );
+
+static axis2_char_t* axis2_add_word_to_package_name
+ ( axis2_char_t *package_name ,
+ axis2_char_t *long_path,
+ const axis2_env_t *env );
+
+static const axis2_char_t *w2c_url_processor_c_tokens[]={
+ "auto", "break", "case", "axis2_char_t", "const", "continue",
+ "default", "do", "double", "else", "enum", "extern",
+ "float", "for", "goto", "if", "int", "long", "register",
+ "return", "short", "signed", "sizeof", "static",
+ "struct", "switch", "typedef", "union", "unsigned",
+ "void", "volatile", "while", NULL };
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ w2c_url_processor_make_package_name(
+ const axis2_env_t *env,
+ axis2_char_t *namespace)
+{
+ axis2_url_t *url = NULL;
+ axis2_char_t *host_name = NULL;
+ axis2_char_t *path = NULL;
+ int index = 0;
+ int path_length = 0;
+ axis2_char_t *package_name = NULL;
+ axis2_char_t *long_path = NULL;
+ axis2_char_t *long_path_rev = NULL;
+ axis2_char_t *ptr = NULL;
+
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+
+ url = axis2_url_parse_string (env, namespace );
+ host_name = AXIS2_URL_GET_SERVER ( url, env );
+ path = AXIS2_URL_GET_PATH ( url, env );
+
+ if ( NULL == host_name )
+ {
+ index = w2c_string_indexof ( host_name, ':');
+ if ( index > -1 )
+ {
+ host_name =
+ axis2_string_substring_starting_at ( host_name, index );
+
+ index = w2c_string_indexof ( host_name, '/');
+ if ( index > -1 )
+ {
+ host_name =
+ axis2_string_substring_ending_at ( host_name, index);
+ }
+ }
+ else
+ {
+ host_name = namespace;
+ }
+ }
+
+ if ( NULL == host_name || *host_name =='\0' )
+ {
+ return NULL;
+ }
+
+ long_path = (axis2_char_t* )AXIS2_STRDUP ( host_name,env );
+
+ /** make path_name legal */
+
+ path_length = strlen ( long_path );
+
+ for ( long_path_rev = long_path + path_length ; ; long_path_rev -- )
+ {
+ if ( long_path -1 == long_path_rev ||
+ '.' == *long_path_rev ||':' == *long_path_rev )
+ {
+ /** go up one */
+ long_path_rev ++;
+ package_name =
+ axis2_add_word_to_package_name( package_name , long_path_rev, env);
+
+ if ( long_path_rev == long_path ) /** loop should be ended */
+ {
+ break;
+ }
+ else /** prepare for the next loop */
+ {
+ long_path_rev --;
+ *long_path_rev = '\0';
+ package_name =
+ w2c_string_add_string ( package_name, ".", env);
+ }
+ }
+ }
+ free (long_path );
+
+ if ( NULL != path )
+ path_length = strlen ( path );
+ if ( 0 != path_length )
+ {
+ if ( '/' == path[path_length-1] )
+ {
+ path[ path_length -1] = '\0';
+ }
+ if ('/' == *path )
+ {
+ path ++;
+ }
+
+ long_path = ( axis2_char_t* )AXIS2_STRDUP( path, env );
+ long_path = axis2_string_replace ( long_path, '-', '_' );
+ long_path = axis2_string_replace ( long_path, ':', '_' );
+
+ for ( ptr = long_path_rev = long_path;
+ path_length ; ptr ++, path_length -- )
+ {
+ if ( '/' == *ptr || '\0' == *ptr)
+ {
+ *ptr ='\0';
+ package_name =
+ w2c_string_add_string ( package_name, ".", env);
+ package_name =
+ axis2_add_word_to_package_name
+ ( package_name , long_path_rev, env);
+ long_path_rev = ptr + 1;
+ }
+ }
+ free ( long_path );
+ }
+
+ return package_name;
+}
+
+/** internal methods */
+
+static axis2_char_t* axis2_add_word_to_package_name
+ ( axis2_char_t *package_name ,
+ axis2_char_t *long_path,
+ const axis2_env_t *env )
+{
+ /** make non keyword */
+ if ( w2c_url_processor_is_token( long_path) )
+ {
+ package_name = w2c_string_add_string ( package_name,
+ "_", env );
+ }
+ /** starting with digit -> prefix _ */
+ if ( isdigit(*long_path ) )
+ {
+ package_name = w2c_string_add_string ( package_name,
+ "_", env );
+ }
+ long_path = axis2_string_replace ( long_path, '.', '_' );
+ package_name = w2c_string_add_string ( package_name, long_path, env );
+
+ return package_name;
+}
+
+static axis2_bool_t AXIS2_CALL
+w2c_url_processor_is_token ( axis2_char_t *str )
+{
+ int i = 0;
+ while ( w2c_url_processor_c_tokens[i] )
+ {
+ if ( !strcmp (w2c_url_processor_c_tokens[i], str ) )
+ {
+ return AXIS2_TRUE;
+ }
+ i ++;
+ }
+ return AXIS2_FALSE;
+}
+
Added: webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,64 @@
+/*
+ * 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_template_processor.h>
+#include <string.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/debugXML.h>
+#include <libxml/HTMLtree.h>
+#include <libxml/xmlIO.h>
+#include <libxml/xinclude.h>
+#include <libxml/catalog.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+
+
+AXIS2_EXTERN void AXIS2_CALL
+w2c_xslt_template_processor_parse(
+ const axis2_env_t *env,
+ axis2_char_t *xml_stream,
+ axis2_char_t *xslt_filename,
+ axis2_char_t *out_filename)
+{
+ xsltStylesheetPtr ssheet = NULL;
+ xmlDocPtr doc = NULL;
+ xmlDocPtr res = NULL;
+ FILE *out = NULL;
+
+ xmlSubstituteEntitiesDefault(1);
+ xmlLoadExtDtdDefaultValue = 1;
+
+ ssheet = xsltParseStylesheetFile((const xmlChar *)xslt_filename);
+ doc = (xmlDocPtr)xmlParseMemory(xml_stream,
+ (unsigned int)strlen (xml_stream));
+ res = xsltApplyStylesheet(ssheet, doc, NULL);
+
+ out = fopen ( out_filename, "w+");
+ xsltSaveResultToFile(out, res, ssheet);
+
+ xsltFreeStylesheet(ssheet);
+ xmlFreeDoc(res);
+ xmlFreeDoc(doc);
+
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+ /* adding new line at the end */
+ fprintf( out, "\n");
+ fclose( out);
+}
+
Added: webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,148 @@
+/*
+ * 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 <axis2_qname.h>
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+w2c_xslt_utils_add_attribute(
+ const axis2_env_t *env,
+ axiom_node_t *om_node,
+ axis2_char_t *attribute,
+ axis2_char_t *attrib_value)
+{
+ axiom_element_t *om_ele = NULL;
+ axiom_attribute_t *attri = NULL;
+ AXIS2_ENV_CHECK ( env, AXIS2_FAILURE );
+
+ om_ele = AXIOM_NODE_GET_DATA_ELEMENT ( om_node, env );
+ attri = axiom_attribute_create ( env, attribute, attrib_value, NULL );
+ AXIOM_ELEMENT_ADD_ATTRIBUTE ( om_ele, env, attri, om_node );
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+w2c_xslt_utils_add_child_node(
+ const axis2_env_t *env,
+ axis2_char_t *element_name,
+ axiom_node_t *parent_node)
+{
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_ele = NULL;
+ AXIS2_ENV_CHECK ( env, AXIS2_FAILURE );
+
+ child_ele = axiom_element_create ( env,
+ parent_node,
+ element_name,
+ NULL,
+ &child_node );
+ return child_node;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+w2c_xslt_utils_serialize(
+ const axis2_env_t *env,
+ axiom_node_t *root)
+{
+ axiom_output_t *om_output = NULL;
+ axiom_xml_writer_t *xml_writer = NULL;
+ axis2_char_t *buffer = NULL;
+
+ xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ om_output = axiom_output_create (env, xml_writer);
+
+ AXIOM_NODE_SERIALIZE (root, env, om_output);
+ buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(xml_writer, env);
+ return buffer;
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+w2c_xslt_utils_add_text(
+ const axis2_env_t *env,
+ axiom_node_t *node,
+ axis2_char_t *text)
+{
+ axiom_element_t *ele = NULL;
+
+ ele = AXIOM_NODE_GET_DATA_ELEMENT ( node, env);
+ AXIOM_ELEMENT_SET_TEXT( ele, env, text, node);
+ return node;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+w2c_xslt_utils_copy_node_tree(
+ const axis2_env_t *env,
+ axiom_node_t *to,
+ axiom_node_t *from )
+{
+ axiom_element_t *to_ele = NULL;
+ axiom_element_t *from_ele = NULL;
+ axiom_node_t *to_child = NULL;
+ axiom_node_t *from_child = NULL;
+ axiom_element_t *from_child_ele = NULL;
+ axiom_children_iterator_t *it = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *text = NULL;
+
+ axis2_hash_t *attr_ht = NULL;
+ axis2_hash_index_t *hi = NULL;
+ void *val = NULL;
+ axiom_attribute_t *om_attri = NULL;
+
+ to_ele = AXIOM_NODE_GET_DATA_ELEMENT ( to, env );
+ from_ele = AXIOM_NODE_GET_DATA_ELEMENT ( from, env );
+
+ it = AXIOM_ELEMENT_GET_CHILDREN ( from_ele, env, from );
+ AXIOM_CHILDREN_ITERATOR_RESET( it, env);
+
+ while ( (from_child = AXIOM_CHILDREN_ITERATOR_NEXT( it, env )) != NULL )
+ {
+ if ( AXIOM_NODE_GET_NODE_TYPE ( from_child, env ) == AXIOM_TEXT )
+ {
+ text = AXIOM_ELEMENT_GET_TEXT ( from_ele, env, from );
+ text = AXIS2_STRDUP ( text, env);
+ AXIOM_ELEMENT_SET_TEXT ( to_ele, env, text, to);
+ }
+ else
+ {
+ from_child_ele = AXIOM_NODE_GET_DATA_ELEMENT ( from_child, env );
+ qname = AXIOM_ELEMENT_GET_QNAME ( from_child_ele, env, from_child );
+ qname = AXIS2_QNAME_CLONE ( qname, env );
+
+ axiom_element_create_with_qname ( env, to, qname, &to_child );
+ w2c_xslt_utils_copy_node_tree ( env, to_child, from_child );
+ }
+ }
+
+ attr_ht = AXIOM_ELEMENT_GET_ALL_ATTRIBUTES(from_ele, env);
+ if(NULL != attr_ht)
+ {
+ for( hi = axis2_hash_first(attr_ht, env); hi;
+ hi = axis2_hash_next(env, hi))
+ {
+ axis2_hash_this(hi, NULL, NULL, &val);
+ if(NULL != val)
+ {
+ om_attri = (axiom_attribute_t *)val;
+ om_attri = AXIOM_ATTRIBUTE_CLONE ( om_attri, env );
+ AXIOM_ELEMENT_ADD_ATTRIBUTE ( to_ele, env, om_attri, to);
+ }
+ }
+ }
+ return AXIS2_SUCCESS;
+}
Added: webservices/axis2/trunk/c/tools/codegen/src/wsdl/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/wsdl/Makefile.am?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/wsdl/Makefile.am (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/wsdl/Makefile.am Fri Sep 1 05:45:57 2006
@@ -0,0 +1,19 @@
+SUBDIRS = writer emitter extensions
+
+prglibdir=$(prefix)/lib
+prglib_LTLIBRARIES = libw2c_codegen.la
+libw2c_codegen_la_SOURCES = \
+ engine_config_loader.c \
+ engine_configuration.c \
+ engine.c
+
+libw2c_codegen_la_LIBADD = \
+ $(top_builddir)/src/util/libw2c_util.la \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom
+
+
+INCLUDES = -I$(top_builddir)/include \
+ @UTILINC@ \
+ @AXIOMINC@
Added: webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/Makefile.am?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/Makefile.am (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/Makefile.am Fri Sep 1 05:45:57 2006
@@ -0,0 +1,27 @@
+prglibdir=$(prefix)/lib/codegen
+
+noinst_LTLIBRARIES = libw2c_emitter_if.la
+libw2c_emitter_if_la_SOURCES = emitter.c
+
+libw2c_emitter_if_la_LIBADD = \
+ $(top_builddir)/src/util/libw2c_util.la \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_xml_schema \
+ -lwoden_wsdl \
+ -lwoden \
+ $(NULL)
+
+
+INCLUDES = -I$(top_builddir)/include \
+ @UTILINC@ \
+ @AXIOMINC@ \
+ @WODENINC@
+
+prglib_LTLIBRARIES = \
+ libw2c_c_emitter.la
+
+libw2c_c_emitter_la_SOURCES = c_emitter.c
+libw2c_c_emitter_la_LIBADD = libw2c_emitter_if.la
+
Added: webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/c_emitter.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/c_emitter.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/c_emitter.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/wsdl/emitter/c_emitter.c Fri Sep 1 05:45:57 2006
@@ -0,0 +1,497 @@
+/*
+ * 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_emitter_protected.h>
+#include <w2c_writer.h>
+#include <w2c_xslt_utils.h>
+
+#define W2C_C_EMITTER_STUB_PREFIX "axis2_stub_"
+#define W2C_C_EMITTER_STUB_SUFFIX ""
+#define W2C_C_EMITTER_SKEL_PREFIX "axis2_skel_"
+#define W2C_C_EMITTER_SKEL_SUFFIX ""
+#define W2C_C_EMITTER_SVC_SKEL_PREFIX "axis2_svc_skel_"
+#define W2C_C_EMITTER_SVC_SKEL_SUFFIX ""
+
+
+/**********************fucntion prototypes ***********************************/
+
+axis2_status_t AXIS2_CALL
+w2c_c_emitter_emit_stub( w2c_emitter_t *emitter,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_c_emitter_emit_skel( w2c_emitter_t *emitter,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_stub_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_stub_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_skel_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_skel_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_svc_skel( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+axis2_status_t
+w2c_c_emitter_write_svc_xml( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env);
+
+axiom_node_t*
+w2c_c_emitter_create_for_stub (w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env );
+axiom_node_t*
+w2c_c_emitter_create_for_skel(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env );
+axiom_node_t*
+w2c_c_emitter_create_for_svc_skel(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env );
+axiom_node_t*
+w2c_c_emitter_create_for_svc_xml(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env );
+
+/******************standard create and delete for DLL ************************/
+AXIS2_EXPORT int
+axis2_get_instance(w2c_emitter_t **inst,
+ const axis2_env_t *env)
+{
+ w2c_emitter_impl_t *emitter_impl = NULL;
+
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+ emitter_impl = w2c_emitter_create_impl (env);
+ /* this is done through an extension */
+ /*emitter_impl-> name_maker_func = w2c_string_make_c_simple_name;*/
+ if(!emitter_impl)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ emitter_impl->emitter.ops->emit_stub = w2c_c_emitter_emit_stub;
+ emitter_impl->emitter.ops->emit_skel = w2c_c_emitter_emit_skel;
+
+ *inst = &(emitter_impl->emitter);
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int
+axis2_remove_instance(w2c_emitter_t *inst,
+ const axis2_env_t *env)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+ if (inst)
+ {
+ status = W2C_EMITTER_FREE(inst, env);
+ }
+ return status;
+}
+
+/*************************overriden functions ********************************/
+
+axis2_status_t AXIS2_CALL
+w2c_c_emitter_emit_stub( w2c_emitter_t *emitter,
+ const axis2_env_t *env)
+{
+ w2c_emitter_impl_t *emitter_impl = NULL;
+ axis2_status_t status;
+ axis2_status_t overall_status = AXIS2_SUCCESS;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ emitter_impl = W2C_INTF_TO_IMPL(emitter);
+
+ status = w2c_c_emitter_write_stub_source( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.stubSourceFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+ status = w2c_c_emitter_write_stub_header( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.stubHeaderFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+
+ return overall_status;
+}
+
+axis2_status_t AXIS2_CALL
+w2c_c_emitter_emit_skel( w2c_emitter_t *emitter,
+ const axis2_env_t *env)
+{
+ w2c_emitter_impl_t *emitter_impl = NULL;
+ axis2_status_t status;
+ axis2_status_t overall_status = AXIS2_SUCCESS;
+ axis2_bool_t svc_desc = AXIS2_FALSE;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ emitter_impl = W2C_INTF_TO_IMPL(emitter);
+
+ status = w2c_c_emitter_write_skel_source( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.skelSourceFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+ status = w2c_c_emitter_write_skel_header( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.skelHeaderFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+ status = w2c_c_emitter_write_svc_skel( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.svcSkelFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+ svc_desc = W2C_ENGINE_CONFIGURATION_GET_GENERATE_DEPLOYEMENT_DESCRIPTOR
+ ( emitter_impl-> config, env);
+ if (svc_desc )
+ {
+ status = w2c_c_emitter_write_svc_xml( emitter_impl, env);
+ if ( AXIS2_FAILURE == status )
+ {
+ w2c_messages_print_n_log_error( env,
+ "writer.svcXmlFailed");
+ overall_status = AXIS2_FAILURE;
+ }
+ }
+ return overall_status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_stub_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_stub (emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_cstub_source_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_stub_header( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_stub ( emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_cstub_header_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_skel_source( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_skel( emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_cskel_source_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_skel_header( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_skel( emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_cskel_header_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_svc_skel( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_svc_skel( emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_csvc_skeleton_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axis2_status_t
+w2c_c_emitter_write_svc_xml( w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env)
+{
+ axiom_node_t *root = NULL;
+ w2c_writer_t *writer = NULL;
+ axis2_dll_desc_t *dll_desc = NULL;
+ axis2_status_t status;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ root = w2c_c_emitter_create_for_svc_xml( emitter_impl, env );
+ if (NULL == root )
+ {
+ return AXIS2_FAILURE;
+ }
+ writer = (w2c_writer_t*)w2c_class_loader_get_object_from_class_name
+ ( env, "w2c_cservice_xml_writer", W2C_EMITTER_WRITER_DIR, &dll_desc);
+ status = w2c_emitter_write_class ( emitter_impl, env, root, writer );
+ w2c_class_loader_free_loaded_class(env, dll_desc);
+ AXIOM_NODE_FREE_TREE(root, env);
+ return status;
+}
+
+axiom_node_t*
+w2c_c_emitter_create_for_stub (w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env )
+{
+ axiom_node_t *root = NULL;
+ axis2_bool_t flag = AXIS2_FALSE;
+ axis2_char_t *full_name = NULL;
+ axis2_char_t *full_name_c = NULL;
+ axis2_char_t *given_name = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *qname_str = NULL;
+
+ qname = w2c_emitter_pick_service_name( emitter_impl, env );
+ given_name = W2C_QNAME2NAME_MAKER_SUGGEST_NAME(
+ emitter_impl-> qname2name_maker, env, qname);
+ qname_str = AXIS2_QNAME_TO_STRING(qname, env);
+
+ root = w2c_xslt_utils_add_child_node(env, "class", NULL);
+ full_name = AXIS2_STRDUP ( W2C_C_EMITTER_STUB_PREFIX, env );
+ full_name = w2c_string_add_string ( full_name, given_name, env );
+ full_name = w2c_string_add_string
+ ( full_name, W2C_C_EMITTER_STUB_SUFFIX, env);
+ full_name_c = emitter_impl-> name_maker_func( full_name, env);
+
+ w2c_xslt_utils_add_attribute (env, root, "name", full_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "prefix", full_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "servicename", given_name);
+ w2c_xslt_utils_add_attribute (env, root, "package", "");
+ w2c_xslt_utils_add_attribute (env, root, "interfaceName", given_name);
+ w2c_xslt_utils_add_attribute (env, root, "qname" , qname_str);
+
+
+ flag =
+ W2C_ENGINE_CONFIGURATION_GET_PACK_CLASSES( emitter_impl-> config, env);
+ if ( flag )
+ {
+ w2c_xslt_utils_add_attribute (env, root, "wrapped", "yes");
+ }
+ flag =
+ W2C_ENGINE_CONFIGURATION_GET_ASYNC_ON( emitter_impl-> config, env);
+ if ( flag)
+ {
+ w2c_xslt_utils_add_attribute (env, root, "isAsync", "1");
+ }
+ flag =
+ W2C_ENGINE_CONFIGURATION_GET_SYNC_ON( emitter_impl-> config, env);
+ if ( flag)
+ {
+ w2c_xslt_utils_add_attribute (env, root, "isSync", "1");
+ }
+
+
+ w2c_xslt_utils_copy_node_tree( env, root, emitter_impl-> common_node);
+
+ AXIS2_FREE (env->allocator, full_name );
+ AXIS2_FREE (env->allocator, full_name_c );
+
+ return root;
+}
+
+axiom_node_t*
+w2c_c_emitter_create_for_skel(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env )
+{
+ axiom_node_t *root = NULL;
+ axis2_char_t *full_name = NULL;
+ axis2_char_t *full_name_c = NULL;
+ axis2_char_t *given_name = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *qname_str = NULL;
+
+ qname = w2c_emitter_pick_service_name( emitter_impl, env );
+ given_name = W2C_QNAME2NAME_MAKER_SUGGEST_NAME(
+ emitter_impl-> qname2name_maker, env, qname);
+ qname_str = AXIS2_QNAME_TO_STRING(qname, env);
+
+ root = w2c_xslt_utils_add_child_node(env, "interface", NULL);
+ full_name = AXIS2_STRDUP ( W2C_C_EMITTER_SKEL_PREFIX, env );
+ full_name = w2c_string_add_string ( full_name, given_name, env );
+ full_name = w2c_string_add_string
+ ( full_name, W2C_C_EMITTER_SKEL_SUFFIX, env);
+ full_name_c = emitter_impl-> name_maker_func( full_name, env);
+
+ w2c_xslt_utils_add_attribute (env, root, "name", full_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "prefix", full_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "package", "");
+ w2c_xslt_utils_add_attribute (env, root, "qname", qname_str);
+
+ w2c_xslt_utils_copy_node_tree( env, root, emitter_impl-> common_node);
+
+ AXIS2_FREE (env->allocator, full_name );
+ AXIS2_FREE (env->allocator, full_name_c );
+
+ return root;
+}
+
+axiom_node_t*
+w2c_c_emitter_create_for_svc_skel(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env )
+{
+ axiom_node_t *root = NULL;
+ axis2_char_t *skel_name = NULL;
+ axis2_char_t *skel_name_c = NULL;
+ axis2_char_t *svc_skel_name = NULL;
+ axis2_char_t *svc_skel_name_c = NULL;
+ axis2_char_t *given_name = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *qname_str = NULL;
+
+ qname = w2c_emitter_pick_service_name( emitter_impl, env );
+ given_name = W2C_QNAME2NAME_MAKER_SUGGEST_NAME(
+ emitter_impl-> qname2name_maker, env, qname);
+ qname_str = AXIS2_QNAME_TO_STRING(qname, env);
+
+ root = w2c_xslt_utils_add_child_node(env, "interface", NULL);
+ svc_skel_name = AXIS2_STRDUP ( W2C_C_EMITTER_SVC_SKEL_PREFIX, env );
+ svc_skel_name = w2c_string_add_string ( svc_skel_name, given_name, env );
+ svc_skel_name = w2c_string_add_string
+ ( svc_skel_name, W2C_C_EMITTER_SVC_SKEL_SUFFIX, env);
+ svc_skel_name_c = emitter_impl-> name_maker_func( svc_skel_name, env);
+
+ w2c_xslt_utils_add_attribute (env, root, "name", svc_skel_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "prefix", svc_skel_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "qname", qname_str);
+
+ skel_name = AXIS2_STRDUP ( W2C_C_EMITTER_SKEL_PREFIX, env );
+ skel_name = w2c_string_add_string ( skel_name, given_name, env );
+ skel_name = w2c_string_add_string
+ ( skel_name, W2C_C_EMITTER_SKEL_SUFFIX, env);
+ skel_name_c = emitter_impl-> name_maker_func( skel_name, env);
+
+ w2c_xslt_utils_add_attribute (env, root, "svcname", skel_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "svcop_prefix", skel_name_c);
+ w2c_xslt_utils_add_attribute (env, root, "package", "");
+
+ w2c_xslt_utils_copy_node_tree( env, root, emitter_impl-> common_node);
+
+ AXIS2_FREE (env->allocator, skel_name );
+ AXIS2_FREE (env->allocator, skel_name_c );
+ AXIS2_FREE (env->allocator, svc_skel_name );
+ AXIS2_FREE (env->allocator, svc_skel_name_c );
+
+ return root;
+}
+
+axiom_node_t*
+w2c_c_emitter_create_for_svc_xml(w2c_emitter_impl_t *emitter_impl,
+ const axis2_env_t *env )
+{
+ axiom_node_t *root = NULL;
+ axis2_char_t *svc_name = NULL;
+ axis2_char_t *c_svc_name = NULL;
+ axis2_qname_t *qname = NULL;
+ axis2_char_t *qname_str = NULL;
+
+ qname = w2c_emitter_pick_service_name( emitter_impl, env );
+ svc_name = W2C_QNAME2NAME_MAKER_SUGGEST_NAME(
+ emitter_impl-> qname2name_maker, env, qname);
+ qname_str = AXIS2_QNAME_TO_STRING(qname, env);
+ c_svc_name = emitter_impl-> name_maker_func( svc_name, env);
+
+ root = w2c_xslt_utils_add_child_node(env, "interface", NULL);
+ w2c_xslt_utils_add_attribute (env, root, "servicename", svc_name);
+ w2c_xslt_utils_add_attribute (env, root, "c_servicename", c_svc_name);
+ w2c_xslt_utils_add_attribute (env, root, "qname", qname_str);
+
+ w2c_xslt_utils_copy_node_tree( env, root, emitter_impl-> common_node);
+
+ return root;
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org