Feature Matrix
The following table tells you about the different ways to
generate a class with the code generation plugin. For each possibility
is given an example with screenshot and resulting class.
Ways to generate code
The following list shows the different ways to create a java
class. For each method an example is given
- Create with a Java
Emitter template
- Create with a Java Emitter template and
enhance with AST (Abstract Syntax Tree) code generation
- Generate a Java
Emitter template and generate code with it
- Generate the class from
scratch with AST
- Generate a Java
Emitter template and generate code with it that is further enhanced
with AST code generation
- Above 2. - 5. can be combined with a reference implementation. A
reference implementation is a class with designated methods that are
copied into the generated class.
- The java class can be asossiated with a database
through an inputfile that specifies the structure
- The java class can be asossiated with a database
through a connection to a database table
- The java class may not be related to a database.
Supported input files
The input files define a model that conform to a specified
syntax/language. You can supply your own model by defining a domain
specific language (DSL). The following input files are supported. Futher
can be added through extensions.
- SQL create script for Oracle: the file must end
on *.sql
- XML files: the generator for the model must be
specified in the XML file. The generator parses the file and generates
a model object that is used in the generation of the java class
Ways to extend the plugin
This sections lists all the extension points provided by the
plug-in and states their use.
- ch.sahits.codegen.java.generator: This extension
point let's you supply your own generator classes (1..n) that are
needed when using the generation option. The classes must implement the
interface IBaseGenerator
- ch.sahits.codegen.java.inputdbconnection: This
extension point let's you supply your own model generator classes
(1..n) for database tables through a db connection. The generator
classes must implement the interface IDBConnectionModelGenerator.
Besides the generator class you specify for which database product this
class can generate a model. This information is used in the DB product
drop-down list. The class supplies default values for the connection.
- ch.sahits.codegen.java.inputdbparser: This
extension point let's you supply parsers (1..n) for an *.sql file for a
specific DB product. If for one database product more than one
implementation/extension exits only the first one found in the registry
is evaluated. The parser class must implement the interface IDBInputParser.
The class supplies default values for the connection.
- ch.sahits.codegen.java.inputparser: This
extension point let's you define your own parser/model generator (1..n)
for an input file type. The file type is differentiated by the file
extension. If there are several extensions for one file extension the
first found will be applied. The parser must implement the interface IInputParser
- ch.sahits.codegen.java.jettemplate: This
extension point let you supply your own Java Emitter templates (1..n)
as an extension
- ch.sahits.codegen.inputxmlparser: This extension
point let's you define 1..n XML parser classes that can parse an XML
input file. The classes must implement the interface IXMLInputFileParser
- ch.sahits.codegen.java.connectionpage: This extension point offers you
the possibility to define your own ways to retrieve the database data. There must be specified
a class name that implements the basic wizard page class BasicDBDefinitionPage.
- ch.sahits.codegen.sql.manipulation: This extension point provides you
with the possibility to define a manipulation class that changes the data that are
written into the insert script.
Implemented Extensions
This section shows where in the plugin the extension points are
used to extend the functionality and thereby also funcion as a
reference.
- ch.sahits.codegen.java.generator: The classes InitializableDbBeanGenerator,
PureASTOracleDAOGenerator,
ASTBeanWithDelete
and JETASTGenerator
are extensions. The sources can be viewed at Sourceforge.net.
The definition of the extension is as follows:
<extension point="ch.sahits.codegen.java.generator">
<generator
class="ch.sahits.codegen.java.generator.jettemplate.InitializableDbBeanGenerator">
</generator>
<generator
class="ch.sahits.codegen.java.generator.ast.PureASTOracleDAOGenerator">
</generator>
<generator
class="ch.sahits.codegen.java.generator.ast.ASTBeanWithDelete">
</generator>
<generator
class="ch.sahits.codegen.java.generator.ast.JETASTGenerator">
</generator>
</extension>
- ch.sahits.codegen.java.inputdbconnection: The
class MySQLConnectionModelGenerator
implements this extension point. The source code can be viewed at Sourceforge.net.
The definition of the extension is as follows:
<extension point="ch.sahits.codegen.java.inputdbconnection">
<dbconnection
class="ch.sahits.codegen.java.input.db.MySQLConnectionModelGenerator"
dbproduct="MySQL">
</dbconnection>
</extension>
- ch.sahits.codegen.java.inputdbparser: The class OracleSQLCreateScriptInputParser
is the extension. The source code can be reviewed at Sourceforge.net.
The definition of the extension is as follows:
<extension point="ch.sahits.codegen.java.inputdbparser">
<dbproduct name="oracle"
parserClass="ch.sahits.codegen.java.input.OracleSQLCreateScriptInputParser">
</dbproduct>
</extension>
- ch.sahits.codegen.java.inputparser: Currently
this extension is not used by the plugin itself
- ch.sahits.codegen.java.jettemplate: The
dbbean.javajet Java Emitter template is realised through this extension
point. The definition of the extension is as follows:
<extension point="ch.sahits.codegen.java.jettemplate">
<template location="jet_templates" name="dbbean.javajet">
</template>
</extension>
- ch.sahits.codegen.inputxmlparser:
- ch.sahits.codegen.java.connectionpage: Define the way how the database connection
data are retrieved.
<extension
point="ch.sahits.codegen.java.connectionpage">
<dbDefinition
btnText="DB with connection"
btnTooltip="Create the class DB relations gathered from the connection"
className="ch.sahits.codegen.java.internal.wizards.DBDefinitionPage"
pageTitle="Java Code Generator">
</dbDefinition>
</extension>
- ch.sahits.codegen.sql.manipulation: You can define a manipulation class for
your data that is read from database A. The manipulation takes place before the insert script is
generated.
<extension
point="ch.sahits.codegen.sql.manipulation">
<manipulationClass
class="ch.sahits.codegen.example.CountryChanger">
</manipulationClass>
</extension>
Checks
This section tells you about the checks that are implemented in
the wizard.
Class definition
The checks on this page are the same as the one in the ordinary
class wizard.
Java Code Generation
Since different values are needed for the different ways of code
generation let us splitt the checks up:
Generating code with Java Emitter templates
Screenshot: As seen in the
walkthrough There are to ways for
generating code for a database table:
Through an input file. Here the following fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- DB product must be specified (NONE is not valid)
Through a database connection:
- Jet template may be provided as a valid file or a selection
from the drop down
- DB product must be specified (NONE is not valid)
- Information from page 3 are needed
If you choose to go with the option "Without DB" the following
fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
JETemplate with AST improvement
Screenshot: As seen in
the walkthrough There are
to ways for generating code for a database table:
Through an input file. Here the following fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJETASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
Through a database connection:
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJETASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
- Information from page 3 are needed
If you choose to go with the option "Without DB" the following
fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJETASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
Generate JETemplate
Screenshot: As seen in
the walkthrough There are
to ways for generating code for a database table:
Through an input file. Here the following fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJetCodeGenerator
- DB product must be specified (NONE is not valid)
Through a database connection:
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJetCodeGenerator
- DB product must be specified (NONE is not valid)
- Information from page 3 are needed
If you choose to go with the option "Without DB" the following
fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IJetCodeGenerator
AST generation
Screenshot: As seen in
the walkthrough There are
to ways for generating code for a database table:
Through an input file. Here the following fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IPureASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
Through a database connection:
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IPureASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
- Information from page 3 are needed
If you choose to go with the option "Without DB" the following
fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IPureASTGenerator
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
JETemplate generation with AST improvement
Screenshot: As seen in
the walkthrough There are
to ways for generating code for a database table:
Through an input file. Here the following fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IASTGeneratorInizializer
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
Through a database connection:
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IASTGeneratorInizializer
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
- DB product must be specified (NONE is not valid)
- Information from page 3 are needed
If you choose to go with the option "Without DB" the following
fields are needed:
- Data Input must be a valid file.
- Jet template may be provided as a valid file or a selection
from the drop down
- Supply a generator class that implements the interface IASTGenerator
- Supply a generator class that implements the interface IASTGeneratorInizializer
- If the generator class implements the interface IReferenceImpleCaller
a reference implementation must be supplied.
- If a reference implementation is needed the class must
implement the interface IReferenceImplementation
Database access
- This wizard page is optional unless the database
model is generated through a database connection or the generator class
is needed and it implements the interface IDBAccess
- DB name may not be null or empty
- DB host may not be null or empty
- DB port may not be null or empty
- DB user may not be null or empty
- DB password may not be null or empty
- DB table may not be null or empty if the database
model is generated through a database connection
- DB schema may be null if and only if the database product does
not support the schema concept (e.g. MySQL)
This Project is hosted at:
Last modified: