| |
|
|
|
|
Introduction |
Ejen is a text generation system ("text" means, including, but not limited
to, source code in any kind of programming language). It makes
use of Java/XML/XSLT technologies and is implemented for now as an
Ant task.
This implementation allows the setup of a complete generation, compilation
and deployment sequence, by maintaining only one "build" file that indicates the
order in which each of these actions must be achieved.
Generally speaking, Ejen should be understood as a system that organizes
a data flow, whose initial source is an XML file containing a (minimal) set of
data (required by the generation process). The data flow grows by the fusion with other
XML files and by going through XSL "filters", until it is sufficiently detailed.
It finally goes through XSL "templates" to produce the resulting text files.
A salient feature of this system is that it allows the use of almost any kind of
text file as input, without the need of developing lengthy and complex Java
extensions. The use of the
Antlr compiler compiler,
when corresponding grammars ("Chomsky grammars") are provided, allows the
transformation of those files into XML tree representations.
Resulting XML trees may then be used in the generation process, as well as other
native XML files.
Ejen is not therefore by itself a code generator. It is rather a system
based on Java/XML/XSLT technologies that makes the actual creation of code generators
easier and faster.
|
The EJB 2.0 demonstration |
A complete EJB 2.0 generation demonstration
has been written for the JBoss-3.+ server
(using Hypersonic SQL,
PostgreSQL or
MySQL database).
This demonstration produces the entire set of Java source and XML files required by
an Entity Beans (of "bean managed" type) deployment : the primary key
classes, the home and remote interfaces, the complete implementation of the beans and
DAO (Data Access Object) class and
the ejb-jar.xml deployment descriptor file.
An XSL/Servlet-based testing
application is also deployed in order to manage the EJBs from
an internet browser : table row creation/modification/destruction is
managed this way, just as finding methods:
You may have a look at the generated EJB files (as well as other static, not generated,
source files that compose the entire EJB demonstration) here.
This demonstration has the following special feature : home and remote
interfaces are deduced from a syntactical analysis of the generated bean. This feature
allows the use of the generator not only to create the first EJB implementation, but
also to synchronize (update) the dependent interfaces from a manual bean modification
(for example, after the addition of a new and specific "findBy" method). As this system
is open and flexible, this feature could be also used in order to synchronize
other dependent classes (like client classes that encapsulate EJB calls).
|
Free use (GPL, Version 2) |
Ejen (code generation system).
Copyright © 2001, 2002, 2003 François Wolff (ejen@noos.fr).
Ejen is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
Ejen is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License
for more details.
|
|
|
|
|
|
|