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

1. Introduction
2. Reproducing a POC on Your Computer
3. J2EE Generator
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
15.1 Proof-of-concept (POC) Information
15.2 Description
15.3 DVD Manager Generator
15.4 CD Manager Generator
15.5 Book Manager Generator
15.6 Vhs Manager Generator
16. Further Reading

Chapter 15 - Java and JSP DAO Struts Generator

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

15.2 - Description        top


This generator can be used from within Eclipse 3. See related article.


This multi-output generator produces a large number of files, derived from the source code written by Keld H. Hansen in his JavaBoutique tutorial "Using DAOs in Apache Struts".

Purpose of this generator is to record and reproduce Keld's skills in delivering high-quality code for several DAOs using various types of back-end implementations.

In order to demonstrate that, the generator reproduces Keld's example code to manage a DVD library, and extends his example producing similar code to manage three additional libraries:

  • a CD library;

  • a book library;

  • a videotape (VHS) library.

Beyond the DAO classes, the generated code for each library manager includes unit tests, user interface code, JSP pages, Struts configuration files in XML, and application property files, as listed in the next table. Overall, for each input entity file, twenty-three files are generated.

Table 39 - Set of generated files

Quantity Type of generated file Corresponding generator template(s)
1 struts-config.xml struts-config.xml
1 POJO .java Class.java
1 ManagerIF.java ClassManagerIF.java
2 Manager.java SimpleManager.java,
2 ManagerFactoryIF.java ClassManagerFactoryIF.java,
4 ManagerFactory.java SimpleManagerFactory.java,
1 Test.java UnitTest.java
1 Form.java DetailForm.java
7 Action.java CommonAction.java,
1 detail.jsp detail.jsp
1 list.jsp list.jsp
1 app.properties application.properties

Each set of library manager files (for DVDs, CDs, books, and VHSes) is generated from a corresponding textual model file written in Sisendel, and listed in the following table.

Table 40 - Input Design Files

File name Source code
project/dvd.ef View
project/cd.ef View
project/book.ef View
project/vhs.ef View

All generated files are accessible through the tables of the following paragraphs, one paragraph for each library manager.

15.3 - DVD Manager Generator        top

Table 41 - DVD Manager Generator: Generated Files

File name Source code
project/CORE/dvd_struts-config.xml View
project/LOGIC/DVD.java View
project/LOGIC/DVDManagerIF.java View
project/DB/SimpleDVDManager.java View
project/DB/DatabaseDVDManager.java View
project/LOGIC/DVDManagerFactoryIF.java View
project/DB/DatabaseDVDManagerFactoryIF.java View
project/DB/SimpleDVDManagerFactory.java View
project/DB/JdbcDVDManagerFactory.java View
project/DB/StrutsDVDManagerFactory.java View
project/DB/TomcatDVDManagerFactory.java View
project/CORE/DVDTest.java View
project/UI/DetailDVDForm.java View
project/UI/CommonDVDAction.java View
project/UI/CreateDVDAction.java View
project/UI/DeleteDVDAction.java View
project/UI/DetailDVDAction.java View
project/UI/ListDVDAction.java View
project/UI/ProcessDVDAction.java View
project/UI/UpdateDVDAction.java View
project/UI/dvd_detail.jsp View
project/UI/dvd_list.jsp View
project/CORE/dvd_app.properties View

15.4 - CD Manager Generator        top

Table 42 - CD Manager Generator: Generated Files

File name Source code
project/CORE/cd_struts-config.xml View
project/LOGIC/CD.java View
project/LOGIC/CDManagerIF.java View
project/DB/SimpleCDManager.java View
project/DB/DatabaseCDManager.java View
project/LOGIC/CDManagerFactoryIF.java View
project/DB/DatabaseCDManagerFactoryIF.java View
project/DB/SimpleCDManagerFactory.java View
project/DB/JdbcCDManagerFactory.java View
project/DB/StrutsCDManagerFactory.java View
project/DB/TomcatCDManagerFactory.java View
project/CORE/CDTest.java View
project/UI/DetailCDForm.java View
project/UI/CommonCDAction.java View
project/UI/CreateCDAction.java View
project/UI/DeleteCDAction.java View
project/UI/DetailCDAction.java View
project/UI/ListCDAction.java View
project/UI/ProcessCDAction.java View
project/UI/UpdateCDAction.java View
project/UI/cd_detail.jsp View
project/UI/cd_list.jsp View
project/CORE/cd_app.properties View

15.5 - Book Manager Generator        top

Table 43 - Book Manager Generator: Generated Files

File name Source code
project/CORE/book_struts-config.xml View
project/LOGIC/Book.java View
project/LOGIC/BookManagerIF.java View
project/DB/SimpleBookManager.java View
project/DB/DatabaseBookManager.java View
project/LOGIC/BookManagerFactoryIF.java View
project/DB/DatabaseBookManagerFactoryIF.java View
project/DB/SimpleBookManagerFactory.java View
project/DB/JdbcBookManagerFactory.java View
project/DB/StrutsBookManagerFactory.java View
project/DB/TomcatBookManagerFactory.java View
project/CORE/BookTest.java View
project/UI/DetailBookForm.java View
project/UI/CommonBookAction.java View
project/UI/CreateBookAction.java View
project/UI/DeleteBookAction.java View
project/UI/DetailBookAction.java View
project/UI/ListBookAction.java View
project/UI/ProcessBookAction.java View
project/UI/UpdateBookAction.java View
project/UI/book_detail.jsp View
project/UI/book_list.jsp View
project/CORE/book_app.properties View

15.6 - Vhs Manager Generator        top

Table 44 - Vhs Manager Generator: Generated Files

File name Source code
project/CORE/vhs_struts-config.xml View
project/LOGIC/Vhs.java View
project/LOGIC/VhsManagerIF.java View
project/DB/SimpleVhsManager.java View
project/DB/DatabaseVhsManager.java View
project/LOGIC/VhsManagerFactoryIF.java View
project/DB/DatabaseVhsManagerFactoryIF.java View
project/DB/SimpleVhsManagerFactory.java View
project/DB/JdbcVhsManagerFactory.java View
project/DB/StrutsVhsManagerFactory.java View
project/DB/TomcatVhsManagerFactory.java View
project/CORE/VhsTest.java View
project/UI/DetailVhsForm.java View
project/UI/CommonVhsAction.java View
project/UI/CreateVhsAction.java View
project/UI/DeleteVhsAction.java View
project/UI/DetailVhsAction.java View
project/UI/ListVhsAction.java View
project/UI/ProcessVhsAction.java View
project/UI/UpdateVhsAction.java View
project/UI/vhs_detail.jsp View
project/UI/vhs_list.jsp View
project/CORE/vhs_app.properties 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