axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <sam...@wso2.com>
Subject [Axis2][Fwd: Some Improvements to Code Generation Tool]
Date Wed, 22 Nov 2006 16:33:29 GMT


-------- Original Message --------
Subject: 	Some Improvements to Code Generation Tool
Date: 	Wed, 22 Nov 2006 18:41:01 +0530
From: 	Milinda Pathirage <milinda.pathirage@gmail.com>
Reply-To: 	Apache AXIS C Developers List <axis-c-dev@ws.apache.org>
To: 	Apache AXIS C Developers List <axis-c-dev@ws.apache.org>



When I use Axis2 Java Code Generation tool to generate server side code 
for DataHandlerService.wsdl (see the attachment) with data binding 
*adb*, it generates code that has Java Default Class name inside some C 
source and header file which cause some compilation errors.

Example:


struct axis2_echoContent_impl

{

axis2_echoContent_t echoContent;

axis2_qname_t* qname;

org.apache.axiom.om.OMElement attrib_arg_0_2;

};


/**

* setter for arg_0_2

*/

axis2_status_t AXIS2_CALL

axis2_echoContent_set_arg_0_2(

axis2_echoContent_t* echoContent,

const axis2_env_t *env,

org.apache.axiom.om.OMElement param_arg_0_2);


I figured out that this error occur, because there are language specific 
DEFAULT_CLASS_NAME, DEFAULT_CLASS_ARRAY_NAME, DEFAULT_ATTRIB_CLASS_NAME 
and DEFAULT_ATTRIB_ARRAY_CLASS_NAME final Strings are declared inside 
the org.apache.axis2.schema.SchemaCompiler.


To avoid this error I propose to remove these language specific things 
from the SchemaCompiler and include them in the BeanWriter interface 
implementations. Also we have to introduce new methods to the BeanWriter 
interface to make sure that every implementation of BeanWriter interface 
have these default things.


Extra methods to BeanWriter interface:

public String getDefaultClassName();

public String getDefaultClassArrayName();

public String getDefaultAttribClassName();

public String getDefaultAttribArrayClassName();


Example implementations inside implementations:


*For C code generation (CStructWriter)*

public static final String DEFAULT_CLASS_NAME = "axiom_node_t*";

public static final String DEFAULT_CLASS_ARRAY_NAME = "axis2_array_list_t";


public static final String DEFAULT_ATTRIB_CLASS_NAME = "axiom_attribute_t*";

public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME = 
"axis2_array_list_t";

public String getDefaultClassName() {

return DEFAULT_CLASS_NAME;

}


public String getDefaultClassArrayName() {

return DEFAULT_CLASS_ARRAY_NAME;

}


public String getDefaultAttribClassName() {

return DEFAULT_ATTRIB_CLASS_NAME;

}


public String getDefaultAttribArrayClassName() {

return DEFAULT_ATTRIB_ARRAY_CLASS_NAME;

}


And inside the SchemaCompiler we have to use 
writer.getDefaultClassName() instead SchemaCompiler. DEFAULT_CLASS_NAME 
(same for others). Also inside CstructWriter and JavaBeanWriter we have 
to replace SchemaCompiler. DEFAULT_CLASS_NAME with getDefaultClassName().


I tried these modifications and build successful with tests. Also the 
generated C code is compiled without any compilation errors.


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


Mime
View raw message