Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 75750 invoked from network); 22 Nov 2006 13:11:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Nov 2006 13:11:43 -0000 Received: (qmail 1734 invoked by uid 500); 22 Nov 2006 13:11:52 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 1718 invoked by uid 500); 22 Nov 2006 13:11:52 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 1707 invoked by uid 99); 22 Nov 2006 13:11:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2006 05:11:52 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of milinda.pathirage@gmail.com designates 64.233.162.198 as permitted sender) Received: from [64.233.162.198] (HELO nz-out-0102.google.com) (64.233.162.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2006 05:11:33 -0800 Received: by nz-out-0102.google.com with SMTP id m7so108904nzf for ; Wed, 22 Nov 2006 05:11:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=MPXgdWVMH16M84gjxAEAUY4BltDV8ce8it9sa47AbQKAZbinLzJdiK0oGbLCpkqCRJxpIUIH5yllprTadofjnWp+BjiVAkrgS/WXlQLMo0VIvsUGJD5EmjOv5fOHUaNYKtUovGzBrF0iBVAf0GstEuKp4Uyv3PbfYGWtoLMbeho= Received: by 10.65.213.13 with SMTP id p13mr12418880qbq.1164201061925; Wed, 22 Nov 2006 05:11:01 -0800 (PST) Received: by 10.65.51.13 with HTTP; Wed, 22 Nov 2006 05:11:01 -0800 (PST) Message-ID: <22a059a60611220511i1e65f779j74d59f1291680166@mail.gmail.com> Date: Wed, 22 Nov 2006 18:41:01 +0530 From: "Milinda Pathirage" To: "Apache AXIS C Developers List" Subject: Some Improvements to Code Generation Tool MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_36863_24019102.1164201061858" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_36863_24019102.1164201061858 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_36863_24019102.1164201061858 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

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.

------=_Part_36863_24019102.1164201061858--