Menu

[r3031]: / trunk / ch.sahits.codegen.help / html / samples / extensions.html  Maximize  Restore  History

Download this file

221 lines (213 with data), 13.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!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>Extension Points</title>
</head>
<body>
<h1>Extension Points</h1>
<p>This section shows where in the plug-in the extension points are
used to extend the functionality and thereby also function as a
reference.</p>
<ul>
<li>ch.sahits.codegen.java.generator: The classes <a href="../reference/doc/ch/sahits/codegen/java/generator/jettemplate/InitializableDbBeanGenerator.html">InitializableDbBeanGenerator</a>,
<a href="../reference/doc/ch/sahits/codegen/java/generator/ast/PureASTOracleDAOGenerator.html">PureASTOracleDAOGenerator</a>,
<a href="../reference/doc/ch/sahits/codegen/java/generator/ast/ASTBeanWithDelete.html">ASTBeanWithDelete</a>
and <a href="../reference/doc/ch/sahits/codegen/java/generator/ast/JETASTGenerator.html">JETASTGenerator</a>
are extensions. The sources can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows:<pre> &lt;extension
point=&quot;ch.sahits.codegen.java.generator&quot;&gt;
&lt;generator
class=&quot;ch.sahits.codegen.java.generator.jettemplate.InitializableDbBeanGenerator&quot;
display=&quot;DB Bean with constructor and init method&quot;
helpContext=&quot;ch.sahits.codegen.help.GenInitializableBean&quot;&gt;
&lt;/generator&gt;
&lt;generator
class=&quot;ch.sahits.codegen.java.generator.ast.PureASTOracleDAOGenerator&quot;
display=&quot;Data Access Object for Oracle&quot;
helpContext=&quot;ch.sahits.codegen.help.GenPureAST&quot;&gt;
&lt;/generator&gt;
&lt;generator
class=&quot;ch.sahits.codegen.java.generator.ast.ASTBeanWithDelete&quot;
display=&quot;DB Bean with remove method&quot;
helpContext=&quot;ch.sahits.codegen.help.GenBeanInsertRemove&quot;&gt;
&lt;/generator&gt;
&lt;generator
class=&quot;ch.sahits.codegen.java.generator.ast.JETASTGenerator&quot;
display=&quot;Improve JET template with Constructor and init method&quot;
helpContext=&quot;ch.sahits.codegen.help.GenUniqueConstructor&quot;&gt;
&lt;/generator&gt;
&lt;/extension&gt;
</pre>The class attribute defines the actual generator class and is mandatory. The display attribute
provides a short user friendly description of what the generator does. Further informations
such as the needed input model format, input file, database informations ... can be added on a
context help page, which's context ID is supplied in the attribute helpContext. This page is
displayed when this generator is selected and the help button is hit.</li>
<li>ch.sahits.codegen.java.inputdbconnection: The
class <a href="../reference/doc/ch/sahits/codegen/java/input/db/MySQLConnectionModelGenerator.html">MySQLConnectionModelGenerator</a>
implements this extension point. The source code can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows:<pre> &lt;extension point="ch.sahits.codegen.java.inputdbconnection"&gt;
&lt;dbconnection
class="ch.sahits.codegen.java.input.db.MySQLConnectionModelGenerator"
dbproduct="MySQL"&gt;
&lt;/dbconnection&gt;
&lt;/extension&gt;
</pre></li>
<li>ch.sahits.codegen.java.inputdbparser: The class <a href="../reference/doc/ch/sahits/codegen/java/input/OracleSQLCreateScriptInputParser.html">OracleSQLCreateScriptInputParser</a>
is the extension. The source code can be reviewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows: <pre> &lt;extension point="ch.sahits.codegen.java.inputdbparser"&gt;
&lt;dbproduct name="oracle"
parserClass="ch.sahits.codegen.java.input.OracleSQLCreateScriptInputParser"&gt;
&lt;/dbproduct&gt;
&lt;/extension&gt;
</pre></li>
<li>ch.sahits.codegen.java.inputparser: The class
<a href="../reference/doc/ch/sahits/codegen/java/gui/input/XHTMLModelParser.html">XHTMLModelParser</a>
implements this extension. The source can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows:<pre>
&lt;extension
point="ch.sahits.codegen.java.inputparser"&gt;
&lt;inputParser
class="ch.sahits.codegen.java.gui.input.XHTMLModelParser"&gt;
&lt;/inputParser&gt;
&lt;/extension&gt;
</pre>
The class
<a href="../reference/doc/ch/sahits/codegen/java/input/CSVInputFileParser.html">CSVInputFileParser</a> is another implementation of this extension. Through this extension *.csv files can be parsed
into a DataBaseTable model. The source can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
the definition of the extension is as follows:<pre>
&lt;extension
point="ch.sahits.codegen.java.inputparser"&gt;
&lt;inputParser
class="ch.sahits.codegen.java.input.CSVInputFileParser"&gt;
&lt;/inputParser&gt;
&lt;/extension&gt;
</pre>
</li>
<li>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:<pre> &lt;extension
point=&quot;ch.sahits.codegen.java.jettemplate&quot;&gt;
&lt;template
display=&quot;DB based data object with getter and setter&quot;
fileextension=&quot;java&quot;
helpContext=&quot;ch.sahits.codegen.help.JetDBBean&quot;
location=&quot;jet_templates&quot;
name=&quot;dbbean.javajet&quot;&gt;
&lt;/template&gt;
&lt;/extension&gt;</pre>
The display attribute provides a short user friendly description of what the generator does. Further informations
such as the needed input model format, input file, database informations ... can be added on a
context help page, which's context ID is supplied in the attribute helpContext. This page is
displayed when this generator is selected and the help button is hit. To be consistent with the
extension point ch.sahits.codegen.generator the fileextension is supplied which will always be java.<br/>
The daoInsertUnique.javajet Java Emitter template is a further example. It can generate a DAO class based on a Database Table model
with a unique load method if a unique key is defined<br/>
The loginServiceInterface.javajet is a very specialized Java Emitter template that generates an interface
that is based on a database table of a user definition.<br/>
The dbbeanConverter.javajet is a Java Emitter template that takes a database table model and generates a
bean class of it, just like dbBean.javajet. Additionaly there is a constrouctor that takes the first
interface the resultig class implements as an argument for its constructor and makes a copy of said interface for
this instance.
</li>
<li>ch.sahits.codegen.inputxmlparser: The class
<a href="../reference/doc/ch/sahits/codegen/xml/XMLParserWithoutDB.html">XMLParserWithoutDB</a>
is an example implementation for an input XML file parser. Another example ist the class
<a href="../reference/doc/ch/sahits/codegen/java/input/XMLTableParser.html">XMLTableParser</a>
Before an XML parser can be defined
in an XML file it must be registered through this parser. The source can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows:<pre>
&lt;extension
point="ch.sahits.codegen.inputxmlparser"&gt;
&lt;xmlparser
class="ch.sahits.codegen.xml.XMLParserWithoutDB"&gt;
&lt;/xmlparser&gt;
&lt;/extension&gt;
</pre>
</li>
<li>ch.sahits.codegen.java.connectionpage: Define the way how the database connection
data are retrieved. There are two implemented extensions. The default implementation for
the connection data <a href="../reference/doc/ch/sahits/codegen/internal/wizards/DBDefinitionPage.html">DBDefinitionPage</a>
and the alternative through the datatools project
<a href="../reference/doc/ch/sahits/codegen/java/internal/wizards/DTPConnectionDefinitionPage.html">DTPConnectionDefinitionPage</a>.
The source can be viewed at <a href="http://codegenjava.svn.sourceforge.net/viewvc/codegenjava/trunk">Sourceforge.net</a>.
The definition of the extension is as follows:<pre>
&lt;extension
point="ch.sahits.codegen.java.connectionpage"&gt;
&lt;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"&gt;
&lt;/dbDefinition&gt;
&lt;/extension&gt;
</pre></li>
<li class="list">ch.sahits.codegen.generator: You define either a JETemplate location and file extension
of the resulting file or a generator class with the class name and file extension.
<pre>
&lt;extension point=&quot;ch.sahits.codegen.generator&quot;&gt;
&lt;jetemplate
display=&quot;%jetemplate.selectSQL.display&quot;
fileextension=&quot;sql&quot;
helpContext=&quot;ch.sahits.codegen.help.SQLSelectGenerator&quot;
location=&quot;jet_templates/selectSQL.sqljet&quot;
withDB=&quot;true&quot;
withFileExtension=&quot;sql&quot;
withXML=&quot;true&quot;
withXMLParser=&quot;ch.sahits.codegen.java.input.XMLTableParser&quot;&gt;
&lt;/jetemplate&gt;
&lt;/extension&gt;
&lt;extension point=&quot;ch.sahits.codegen.generator&quot;&gt;
&lt;generatorClass
class=&quot;ch.sahits.codegen.generator.HibernateConfigurationCreator&quot;
display=&quot;%generatorClass.HibernateCreator.display&quot;
fileextension=&quot;xml&quot;
helpContext=&quot;ch.sahits.codegen.help.HibernateGenerator&quot;
withDB=&quot;true&quot;
withFileExtension=&quot;sql&quot;
withXML=&quot;true&quot;
withXMLParser=&quot;ch.sahits.codegen.java.input.XMLTableParser&quot;&gt;
&lt;/generatorClass&gt;</pre>
The display attribute provides a short user friendly description of what the generator does. Further informations
such as the needed input model format, input file, database informations ... can be added on a
context help page, which's context ID is supplied in the attribute helpContext. This page is
displayed when this generator is selected and the help button is hit. The attribute withDB gives
an additional hint if the generator is database related. If this attribute is set to true the
selection of "Without database" is not allowed. If the generator is based on an input file the
file extension of the input file and thereby the input model generator can be specified through
withFileExtension. If the input file is an XML file the withXML attribute can be set to true. The
appropriate parser must be supplied. These last four attributes are optional and provide guidance for
the user should he select first the generator.
</li>
<li class="list">ch.sahits.codegen.java.refimplementation: The same way you can define a generator
class for your configuration you can add a reference implementation to the selected generator.
A reference implementation is basically class that is available with the source file from which
code fragments are copied into your resulting class:
<pre>
&lt;refImplClass
class=&quot;ch.sahits.codegen.java.generator.ast.CRUDOracleReference&quot;
display=&quot;Add getConnection and delete methods&quot;
helpContext=&quot;ch.sahits.codegen.help.RefOracleDelete&quot;
srcFolder=&quot;src&quot;&gt;
&lt;/refImplClass&gt;</pre>
The class attribute defines the actual generator class and is mandatory. The display attribute
provides a short user friendly description of what the generator does. Further informations
such as the needed input model format, input file, database informations ... can be added on a
context help page, which's context ID is supplied in the attribute helpContext. This page is
displayed when this generator is selected and the help button is hit. In the attribute srcFolder
you specify where the source file for the class can be found within the same bundle.
</li>
<li class="list">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.
<pre> &lt;extension
point="ch.sahits.codegen.sql.manipulation"&gt;
&lt;manipulationClass
class="ch.sahits.codegen.example.CountryChanger"&gt;
&lt;/manipulationClass&gt;
&lt;/extension&gt;
</pre>
</li>
</ul>
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.