ADB Tweaking Guide

This document explains the mechanisms available to extend ADB and possibly adopt it to compile schemas to support other languages.

Content

Introduction

ADB is written with future extensions in mind, with a clear and flexible way to extend or modify it's functionality. Available mechanisms to extend ADB and possibly adopt it to compile schemas to support other languages are described below.

Know the Configuration

The configuration for the ADB framework is in the schema-compile.properties file found in the org.apache.axis2.schema package. This properties file has the following important properties

The First Tweak - Generate Plain Java Beans

The first, most simple tweak for the code generator could be to switch to plain bean generation. The default behavior of the ADB framework is to generate ADBBeans, but most users, if they want to use ADB as a standalone compiler, would love to have plain java beans. This can in fact be done by simply changing the template used.

The template for plain java beans is already available in the org.apache.axis2.schema.template package. To make this work replace the /org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl with the /org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl in the schema-compile.properties.

Congratulations! You just tweaked ADB to generate plain java beans.

To generate custom formats, the templates need to be modified. The schema for the xml generated by the JavaBeanWriter is available in the source tree under the Other directory in the codegen module. Advanced users with knowledge of XSLT can easily modify the templates to generate code in their own formats.

A More Advanced Tweak - Generate Code for Another Language

To generate code for another language, there are two main components to be written.

Surprisingly, this is enough to have other language support for ADB. Change the configuration and you are ready to generate code for other languages!

This tweaking guide is supposed to be a simple guideline for anyone who wishes to dig deep into the mechanics of the ADB code generator. Users are free experiment with it and modify the schema compiler accordingly to their needs. Also note that the intention of this section is not to be a step by step guide to custom code generation. Anyone who wish to do so would need to dig into the code and get their hands dirty!