<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Examples</title>
</head>
<body>
<h1>Examples</h1>
There are three examples available divided into two plug-ins.
<h2><a name="dbbean">Bean Generator</a></h2>
<p>
This example shows how the plug-in can be used without a database. As input data an XML
file is used. Therefore giving an example on how to implement a parser for an XML input
file. This is the main focus of the example. Besides it uses classes instead of table fields.
The parser generates from these a DataBaseTable model though it has nothing to do with a
database. This is done that way so the JETemplates for database models can be applied.
The code for this example resides in the plug-in ch.sahits.codegen.java.examples.</p>
<h2>GUI Form</h2>
<p>This example is another form to show how an XML parser can be used. Since the input file
does not end on *.xml but on *.xhtml the parser is directly connected to the file extension.
The example can convert a XHTML form - as long it has no fancy layout, forms of one, two or three
columns work - into a SWT GUI dialog. Several things must be supplied by hand ie. JavaScript code
or general button events. The code for this plug-in resides in ch.sahits.codegen.java.gui</p>
<h2>Data Manipulator</h2>
<p>This is an example implementation of the extension point ch.sahits.codegen.sql.manipulation
for manipulating data before generation the insert script. The example is specific for
the country tables of the schema app of the example database of Derby.
The code for this example resides in the plug-in ch.sahits.codegen.java.examples.</p>
<h2>Bean Convertor</h2>
<p>The Bean Convertor is based on the <a href="#dbbean">Bean Generator</a>. Additionaly the
generetaed class is supplied with a copy constructor. The argument of the constructor is the
first interface that is defined in the generation process. This interface defines the getter
and setter methods of the bean. So you can have a class generated with <a href="#dbbean">Bean Generator</a>,
extract a Interface of its methods and pass the generated bean as an argument to the constructor
of the bean convertor.</p>
<img src="../pic/FeatureRequest2687143.jpg"/><br/>
<p>This class diagram shows the typical use of the bean convertor.</p>
<h2>Login Webservice</h2>
<p>If you want to construct something more complex that consists of multiple classes you may need
several generation stepts, that may be dependent on each other. There is an example for a Login GUI
that comunicates through a Webservice to the backend. This example does not contain all the needed
Java classes for the webcervice generation, but the basis is set for you to complete this example.
All the examples are base on a database table for a user that has this form:</p>
<pre>
CREATE TABLE IF NOT EXISTS `USER` (
`ID` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL,
`password` char(40) NOT NULL,
`email` varchar(50) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
)</pre>
<!--
<h3>The GUI</h3>
<p>The graphical user interface is released as a SWT GUI and can be generated </p>-->
<h3>The Service Interface</h3>
<p>The functions provided by the webservice are defined in an Interface. This interface can be
generated through the JETemplate loginServiceInterface.javajet.</p>
<h3>The Data Access</h3>
<p>The data access class can also be generated with a JETemplate daoInsertQunique.javajet.</p>
<h3>The WSDL File</h3>
<p>The WSDL file can be generated though the ch.sahits.codegen.generator.WSDLGenerator with an inputfile
that conforms to <a href="http://sahits.ch/xsd/webservice.xsd">webservice.xsd</a>. (e.g webservice.xml). To generate the WSDL file the filename can be left out
in the input model but the service class (the interface we defined in a previous step) must be specified.</p>
<h3>The service.xml</h3>
<p>To generate the service.xml file you can use the same input file, but you must add the wsdl filename with
the absolute path to the file generated in the previous step. Check your WSDL file if all namespaces
are set to what you expect. Then the service.xml file can be generated using ch.sahits.codegen.example.generator.Axis2ServiceXMLGenerator.
As Store location you should specify the project root.</p>
<h3>MessageInOutReciever</h3>
<p>For the MessageInOutReciever as well as all the other WSDL relevant classes you use the same setup as
for the services.xml in the previous step. Use ch.sahits.codegen.example.generator.Axis2MessageInOutRecieverGenerator.</p>
<h3>The Data Object</h3>
<p>The Data object implements the service interface defined in a previous step and extends the
Skeleton class.
</p>
</body>
</html>