Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
The Somusar/SoProTech[tm] Booklet Series
Volume IX

"Code Generation Somusar Style"

Printer friendly


Contents
1. Introduction
2. Reproducing a POC on Your Computer
3. J2EE Generator
3.1 Proof-of-concept (POC) Information
3.2 Description
3.3 SQL Generator: SQL Database Schema Script
3.4 DAO Generator: Data Access Object Pattern
3.5 POJO Generator: Plain Old Java Object
4. .NET Generator
5. PHP Generator
6. Java (J2SE) Generator
7. Bare Bones Multitier Generator
8. XML Processor
9. XML Generator
10. API Generator Producing C and HTML
11. VisualBasic.NET Generator Draft
12. VisualBasic.NET Generator
13. XML to Java Generator
14. PHP/HTML Generator
15. Java and JSP DAO Struts Generator
16. Further Reading

Chapter 3 - J2EE Generator

3.1 - Proof-of-concept (POC) Information        top

3.2 - Description        top

This comparatively large POC generates several files that reproduce corresponding files from Sun Microsystems' Java[tm] Adventure Builder Demo (JABD), a new sample application released with the SDK of the Java 2 Enterprise Edition, version 1.4.

The purpose of this POC is twofold:

  • Demonstrate how Somusar's software entities allow to abstract a model decoupling its information contents from the implementation technology;

  • Demonstrate how Somusar's generator building services allow to reproduce a significant part of the skills and expertise of master software craftsmen, such as Sun Microsystem's J2EE developers.

The architecture of this POC generator is shown below.

Figure 1 - J2EE generator architecture Figure 1 - J2EE generator architecture

The current version of this POC generates the SQL database schema and two types of Java files from thirteen software entities. All generated files have been successfully tested against the original hand-written counterparts within a working JABD as follows:

  • a usage scenario has been tested on the original JABD;

  • the original sources have been renamed;

  • their place in the build tree has been taken by the corresponding generated files;

  • JABD has been rebuilt, and redeployed from scratch;

  • JABD has been tested again with the same scenario, to check proper functioning of the system.

The generated SQL schema script "db_schema.sql" faithfully reproduces file "pointbase.sql" from the JABD sample application.

The first type of generated Java file implements the DAO pattern for the Pointbase database. The second type is a plain Java class, often referred to as POJO (Plain Old Java Object).

The DAO code generator produced the complete code of the DAO classes, with the only exception of method PointbaseUserDAO.matchPassword, which was written by hand in file "project/signon/methods/matchPassword".

The POJO code generator produced the complete code of the POJO classes, with the only exception of method AdventurePackage.setHotelItemId, which was written by hand in file "project/catalog/methods/setHotelItemId".

3.3 - SQL Generator: SQL Database Schema Script        top

Table 1 - SQL Generator: Generated Files

File name Source code
project/DB/db_schema.sql View

Table 2 - SQL Generator: Input Design Files

File name Source code
project/db_schema.ef View
project/catalog/data/activity View
project/catalog/data/adventure_package View
project/catalog/data/lodging View
project/catalog/data/transportation View
project/data/activity_list View
project/data/category View
project/customer/data/account View
project/signon/data/user View

3.4 - DAO Generator: Data Access Object Pattern        top

Table 3 - DAO Generator: Generated Files

File name Source code
project/catalog/LOGIC/PointbaseCatalogDAO.java View
project/customer/LOGIC/PointbaseAccountDAO.java View
project/signon/LOGIC/PointbaseUserDAO.java View

Table 4 - DAO Generator: Input Design Files

File name Source code
project/catalog/catalog.ef View
project/customer/account.ef View
project/signon/user.ef View
project/signon/methods/matchPassword View

3.5 - POJO Generator: Plain Old Java Object        top

Table 5 - POJO Generator: Generated Files

File name Source code
project/catalog/LOGIC/Activity.java View
project/catalog/LOGIC/AdventurePackage.java View
project/catalog/LOGIC/Lodging.java View
project/catalog/LOGIC/Transportation.java View
project/customer/LOGIC/Address.java View
project/customer/LOGIC/ContactInformation.java View
project/customer/LOGIC/Account.java View

Table 6 - POJO Generator: Input Design Files

File name Source code
project/catalog/activity.ef View
project/catalog/adventure_package.ef View
project/catalog/methods/setHotelItemId View
project/catalog/lodging.ef View
project/catalog/transportation.ef View
project/customer/address.ef View
project/customer/contact_information.ef View
project/customer/account.ef View

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / cg_somusar  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster