1 |
<?xml version="1.0" encoding="utf-8"?> |
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> |
4 |
|
5 |
<head> |
6 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
7 |
<title>JPF Code Generator - 0.4</title> |
8 |
<script type="text/javascript" src="resources/website/sh_main.min.js" /> |
9 |
<script type="text/javascript" src="resources/website/sh_java.js" /> |
10 |
<script type="text/javascript" src="resources/website/sh_xml.min.js" /> |
11 |
<link type="text/css" rel="stylesheet" |
12 |
href="resources/website/sh_ide-eclipse.css" /> |
13 |
<style type="text/css"> |
14 |
/*<![CDATA[*/ |
15 |
body { |
16 |
margin: 0; |
17 |
margin-bottom: 20px; |
18 |
padding: 0; |
19 |
background-color: #CCCCCC; |
20 |
font-family: Verdana, Arial, Helvetica, sans-serif; |
21 |
font-size: 10pt; |
22 |
color: #000000; |
23 |
} |
24 |
|
25 |
h1,h2,h3,p { |
26 |
margin-top: 10pt; |
27 |
margin-bottom: 3pt; |
28 |
padding-left: 15pt; |
29 |
padding-right: 15pt; |
30 |
} |
31 |
|
32 |
h2 { |
33 |
padding-top: 15pt; |
34 |
border-top: solid 1px #999999; |
35 |
} |
36 |
|
37 |
.example { |
38 |
margin: 15pt; |
39 |
padding-left: 10pt; |
40 |
padding-right: 10pt; |
41 |
background-color: #EEEEEE; |
42 |
border: solid 1px #999999; |
43 |
color: #000000; |
44 |
} |
45 |
|
46 |
.example pre { |
47 |
margin: 10pt; |
48 |
padding: 5pt; |
49 |
border: solid 1px #999999; |
50 |
background-color: #FFFFFF; |
51 |
} |
52 |
|
53 |
.example p { |
54 |
padding: 0; |
55 |
} |
56 |
|
57 |
dl,ul,ol { |
58 |
margin-top: 3pt; |
59 |
margin-bottom: 3pt; |
60 |
padding-left: 15pt; |
61 |
padding-right: 15pt; |
62 |
} |
63 |
|
64 |
dt { |
65 |
margin: 10pt 0 0 0; |
66 |
padding: 0; |
67 |
font-weight: bold; |
68 |
} |
69 |
|
70 |
dd { |
71 |
margin: 0; |
72 |
padding: 0; |
73 |
} |
74 |
|
75 |
li,img { |
76 |
margin-left: 15pt; |
77 |
} |
78 |
|
79 |
a { |
80 |
text-decoration: none; |
81 |
color: #990000; |
82 |
} |
83 |
|
84 |
hr { |
85 |
margin-top: 0; |
86 |
margin-bottom: 0; |
87 |
} |
88 |
/*]]>*/ |
89 |
</style> |
90 |
</head> |
91 |
|
92 |
<body> |
93 |
|
94 |
<h1>JPF Code Generator - 0.4</h1> |
95 |
|
96 |
<h2>Table of Contents</h2> |
97 |
<ol> |
98 |
<li><a href="#introduction">Introduction</a></li> |
99 |
<li><a href="#examples">Examples / Tutorials</a></li> |
100 |
<li><a href="#download">Download and Bugtracker</a></li> |
101 |
<li><a href="#dependencies">Dependencies</a></li> |
102 |
<li><a href="#version">Version information</a></li> |
103 |
<li><a href="#release">Release announcements</a></li> |
104 |
<li><a href="#contact">Contact & License</a></li> |
105 |
</ol> |
106 |
|
107 |
<h2>Introduction</h2> |
108 |
|
109 |
<p>This is a handy little tool that generates classes for accessing |
110 |
the attributes and extensions of JPF plug-ins from plugin.xml files. |
111 |
This has the advantage of providing a strongly typed access to the |
112 |
plug-in and simplyfies working with plug-ins.</p> |
113 |
|
114 |
<div class="example"> |
115 |
<p>Run it using...</p> |
116 |
<pre>jar -jar jpfCodeGenerator-x.x.jar <comma separated plug-in locations> <overwrite:true|false></pre> |
117 |
<p>...and pass it a comma separated list of plug-in locations |
118 |
(folders in which to search for plugin.xml) and a boolean whether |
119 |
generated files from previous runs should be overwritten.</p> |
120 |
</div> |
121 |
|
122 |
<div class="example"> |
123 |
<p>The plugin.xml needs to contain the class attribute:</p> |
124 |
<pre class="sh_xml"><plugin id="pluginID" version="0.1.0" class="com.example.MyPlugin"></pre> |
125 |
<p>or have an attribute with id "helperClassName" set:</p> |
126 |
<pre class="sh_xml"><attributes> |
127 |
<attribute id="jpfcodegen"> |
128 |
<attribute id="helperClassName" value="com.example.MyPluginHelper"/> |
129 |
</attribute> |
130 |
</attributes></pre> |
131 |
<p>so that the script knows which class to generate.</p> |
132 |
</div> |
133 |
|
134 |
<div class="example"> |
135 |
<p>The script will generate two files (in a src-folder in the same |
136 |
folder as the plugin.xml):</p> |
137 |
<pre class="sh_java">com.example.MyPlugin</pre> |
138 |
<p>and</p> |
139 |
<pre class="sh_java">com.example.generated._MyPlugin</pre></div> |
140 |
<p>_MyPlugin contains all the essential method for accessing the |
141 |
attributes and extensions of the plug-in but will be regenerated when |
142 |
you re-run the code generator. All customizations should thus be put |
143 |
into MyPlugin (which extends _MyPlugin), which by default is not |
144 |
recreated. To recreate MyPlugin also, pass true as a second parameter to |
145 |
the script.</p> |
146 |
<p>If you choose to use the attribute helperClassName version, then |
147 |
a separate class is generated that is independent of the plugin-class |
148 |
(you don't even need one at all).</p> |
149 |
|
150 |
<h2 id="examples">Examples / Tutorials</h2> |
151 |
<p>The source distribution of the code generator comes with the |
152 |
following examples / tutorials:</p> |
153 |
<ul> |
154 |
<li><a href="tutorials/basic/index.html">Basic Tutorial for |
155 |
the JPF CodeGenerator</a></li> |
156 |
</ul> |
157 |
|
158 |
<h2 id="downloads">Downloads</h2> |
159 |
<p>The latest version of the code generator can be downloaded from |
160 |
the <a href="http://forge.spline.inf.fu-berlin.de/projects/jpfcodegen/">JPF |
161 |
Code Generator project homepage</a> where you also find <a |
162 |
href="http://forge.spline.inf.fu-berlin.de/tracker/?group_id=75">the |
163 |
bug-tracker of the project</a>.</p> |
164 |
|
165 |
<ul> |
166 |
<li>Version 0.4 - <a |
167 |
href="http://forge.spline.inf.fu-berlin.de/frs/?group_id=75">Download |
168 |
Page</a> |
169 |
<ul> |
170 |
<li>JPFCodeGenerator-0.4.jar - Binary jar for running the code |
171 |
generator.</li> |
172 |
<li>JPFCodeGenerator-0.4-rt.jar - Runtime Jar, needed for running |
173 |
applications that use code generated by the code generator.</li> |
174 |
<li>JPFCodeGenerator-0.4-src.jar - Source Distribution including |
175 |
examples and documentation.</li> |
176 |
</ul> |
177 |
</li> |
178 |
<li>Version 0.3 - <a |
179 |
href="http://forge.spline.inf.fu-berlin.de/frs/?group_id=75&release_id=46">Download |
180 |
Page</a> |
181 |
<ul> |
182 |
<li>JPFCodeGenerator-0.3.jar - Binary jar for running the code |
183 |
generator.</li> |
184 |
<li>JPFCodeGenerator-0.3-rt.jar - Runtime Jar, needed for running |
185 |
applications that use code generated by the code generator.</li> |
186 |
<li>JPFCodeGenerator-0.3-src.jar - Source Distribution including |
187 |
examples and documentation.</li> |
188 |
</ul> |
189 |
</li> |
190 |
</ul> |
191 |
|
192 |
<h2 id="configuration">Configuration</h2> |
193 |
|
194 |
<p>There are a couple of attributes that can be used to configure |
195 |
the code generation behavior of the JPF code generator. Each attribute |
196 |
needs to be defined in the <code><attributes></code>-element of |
197 |
the plugin.xml as a sub-<code>attribute</code> of an <code>attribute</code> |
198 |
with id <code>jpfcodegen</code></p> |
199 |
|
200 |
<p>Possible attributes include</p> |
201 |
<ul> |
202 |
<li><code>helperClassName</code> - If defined will cause the code |
203 |
generator to not create a plug-in class with helper methods to access |
204 |
the attributes and extensions of the plug-in, but rather an independent |
205 |
helper class. If not defined the code generator will use the name of |
206 |
the plugin class attribute.</li> |
207 |
<li><code>targetDir</code> - If defined will alter the output |
208 |
directory into which the code generator will write the resulting java |
209 |
files. If the attribute is not given the default directory is <code>src/</code></li> |
210 |
</ul> |
211 |
|
212 |
<div class="example"> |
213 |
<p>An example of how to tell the code generator to create a |
214 |
standalone helper class with class name <code>com.example.MyPluginHelper</code> |
215 |
in the <code>src</code> two levels up from the location of the |
216 |
plugin.xml:</p> |
217 |
|
218 |
<pre class="sh_xml"><attributes> |
219 |
<attribute id="jpfcodegen"> |
220 |
<attribute id="helperClassName" value="com.example.MyPluginHelper"/> |
221 |
<attribute id="targetDir" value="../../src/"/> |
222 |
</attribute> |
223 |
</attributes></pre></div> |
224 |
|
225 |
<h2 id="dependencies">Dependencies</h2> |
226 |
|
227 |
<p>To run the code generator jar you need (from the lib directory):</p> |
228 |
<ul> |
229 |
<li>Velocity-dep-1.5.jar - Apache Velocity Template Engine is used |
230 |
to create the classes.</li> |
231 |
<li>jpf.jar - JPF engine is used to read the plugin.xml</li> |
232 |
<li>jpf-boot.jar - The boot library is used to collect |
233 |
plugin-locations.</li> |
234 |
</ul> |
235 |
|
236 |
<p>To run the code that gets generated you need:</p> |
237 |
<ul> |
238 |
<li>jpf.jar - You need this anyway to use JPF ;-)</li> |
239 |
<li>JPFCodeGenerator-x.x-rt.jar - Contains some helper classes |
240 |
needed by the generated classes.</li> |
241 |
<li>commons-logging.jar - This is both needed by JPF and the |
242 |
classes generated by the code generator.</li> |
243 |
</ul> |
244 |
|
245 |
<h2 id="version">Version / Todo</h2> |
246 |
|
247 |
<p>Todo:</p> |
248 |
<ul> |
249 |
<li>Advanced examples.</li> |
250 |
<li>Support extension multiplicity.</li> |
251 |
<li>Support inheritance of extension points.</li> |
252 |
<li>Support extension plugin attributes (normal and nested).</li> |
253 |
<li>Support for documentation nodes</li> |
254 |
<li>Support for all extension parameter types (plugin-ID, |
255 |
extension-point-ID, extension-ID are missing).</li> |
256 |
<li>Improve support for naming choices. At the moment if you |
257 |
define extension-attributes using type "fixed", the values you use must |
258 |
be valid Java identifiers.</li> |
259 |
<li>Add JUnit tests.</li> |
260 |
</ul> |
261 |
|
262 |
<p>0.4 - 2007-07-19</p> |
263 |
|
264 |
<ul> |
265 |
<li>Bug in generator template that caused a wrong classname to be generated.</li> |
266 |
<li>Can now create classes in a user-defined target directory.</li> |
267 |
<li>Bug fixes for parameter that are not set in an extension.</li> |
268 |
<li>Documentation improvement for Helper Classes.</li> |
269 |
<li>Added support for parameters of type resource.</li> |
270 |
</ul> |
271 |
|
272 |
<p>0.3 - 2007-07-11</p> |
273 |
<ul> |
274 |
<li>Date/time extension parameters are now supported.</li> |
275 |
<li>Basic Tutorial added to documentation.</li> |
276 |
<li>Nested extension parameters are now possible.</li> |
277 |
</ul> |
278 |
|
279 |
<p>0.2 - 2007-07-05</p> |
280 |
<ul> |
281 |
<li>Added option to generate HelperClass instead of putting the |
282 |
code into the Plugin class</li> |
283 |
<li>Added ant build.xml to generate rt.jar and run the Code |
284 |
Generator</li> |
285 |
<li>Added support for type "fixed" attributes using enums. See |
286 |
limitations.</li> |
287 |
<li>Multiplicity support for parameter attributes (so far only |
288 |
String (and Class), Number, Fixed, Boolean parameters are supported).</li> |
289 |
</ul> |
290 |
|
291 |
<p>0.1 - 2007-07-03</p> |
292 |
<ul> |
293 |
<li>Initial release posted on SF.net</li> |
294 |
</ul> |
295 |
|
296 |
<h2 id="release">Release Announcements</h2> |
297 |
|
298 |
<div class="example"> |
299 |
<p>0.3 - 2007-07-11</p> |
300 |
<pre> |
301 |
Hi Guys, |
302 |
version 0.3 of the code generator is ready. It comes with better documentation |
303 |
(a tutorial at http://www.inf.fu-berlin.de/~oezbek/jpf/tutorials/basic/) and |
304 |
some additional features like nested extension-point-parameters. I also |
305 |
added a small homepage for it at http://www.inf.fu-berlin.de/~oezbek/jpf/ |
306 |
where you will also find the link for downloading it. |
307 |
|
308 |
Suggestions and comments are highly welcome: Send them to oezi[at]oezi.de |
309 |
|
310 |
Cheers, |
311 |
Christopher |
312 |
</pre> |
313 |
<p>0.2 - 2007-07-05</p> |
314 |
<pre> |
315 |
Hi Guys, |
316 |
I have just extended the code generator a little bit to also support |
317 |
extension-point parameter multiplicity, attributes of type fixed and |
318 |
a standalone mode: |
319 |
|
320 |
1.) If you have a parameter with a multiplicity that might result in several |
321 |
parameter values: |
322 |
|
323 |
<parameter-def type="string" id="name" multiplicity="any"/> |
324 |
|
325 |
then this will now generate this code: |
326 |
|
327 |
public Collection<String> getNames(){ |
328 |
return getStringParameters("name"); |
329 |
} |
330 |
|
331 |
2.) If you have a parameter with a type fixed then this will be mapped to |
332 |
an enum in Java: |
333 |
|
334 |
<parameter-def type="fixed" id="alignment" custom-data="left|right|top|bottom"/> |
335 |
|
336 |
will generate: |
337 |
|
338 |
public enum Alignment { |
339 |
LEFT, RIGHT, TOP, BOTTOM; |
340 |
} |
341 |
|
342 |
public Alignment getAlignment(){ |
343 |
return Alignment.valueOf(getStringParameter("alignment").toUpperCase()); |
344 |
} |
345 |
|
346 |
3.) If you don't want to use the plugin class-attribute as a target |
347 |
class to generate, you can now also use plugin-attributes to define |
348 |
the name of the class to generate: |
349 |
|
350 |
<attributes> |
351 |
<attribute id="helperClassName" value="com.example.MyPluginHelper"/> |
352 |
</attributes> |
353 |
|
354 |
4.) The Code Generator also now comes in 3 handy jars: |
355 |
|
356 |
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2.jar |
357 |
-> The code generator as a binary package to run using |
358 |
|
359 |
java -jar JPFCodeGenerator-0.2.jar <comma separated plug-in locations> <overwrite:true|false> |
360 |
|
361 |
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2-rt.jar |
362 |
|
363 |
The runtime dependencies needed to use the generated classes, add |
364 |
this to your buildpath in the project. |
365 |
|
366 |
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2-src.jar |
367 |
|
368 |
The source code if anybody is interested to play with it. |
369 |
|
370 |
Cheers, |
371 |
Christopher |
372 |
</pre></div> |
373 |
|
374 |
<h2 id="contact">Contact & License</h2> |
375 |
|
376 |
<p>Copyright (C) Christopher Oezbek (2007) - <a |
377 |
href="mailto:oezi[at]oezi.de">oezi[at]oezi.de</a></p> |
378 |
|
379 |
<p>This tool was created as part of the ongoing migration in the <a |
380 |
href="http://jabref.sf.net">JabRef reference manager</a> to move to a |
381 |
modular plug-in architecture and is released under the <a |
382 |
href="http://www.gnu.org">LGPL 3.0</a>.</p> |
383 |
|
384 |
<p>Your <a href="mailto:oezi[at]oezi.de">improvements and |
385 |
suggestions are welcome</a>.</p> |
386 |
|
387 |
</body> |
388 |
</html> |
389 |
|
390 |
|