| 12
 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
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 
 | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JPF Code Generator - 0.4</title>
<script type="text/javascript" src="resources/website/sh_main.min.js" />
<script type="text/javascript" src="resources/website/sh_java.js" />
<script type="text/javascript" src="resources/website/sh_xml.min.js" />
<link type="text/css" rel="stylesheet"
	href="resources/website/sh_ide-eclipse.css" />
<style type="text/css">
/*<![CDATA[*/
body {
	margin: 0;
	margin-bottom: 20px;
	padding: 0;
	background-color: #CCCCCC;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #000000;
}
h1,h2,h3,p {
	margin-top: 10pt;
	margin-bottom: 3pt;
	padding-left: 15pt;
	padding-right: 15pt;
}
h2 {
	padding-top: 15pt;
	border-top: solid 1px #999999;
}
.example {
	margin: 15pt;
	padding-left: 10pt;
	padding-right: 10pt;
	background-color: #EEEEEE;
	border: solid 1px #999999;
	color: #000000;
}
.example pre {
	margin: 10pt;
	padding: 5pt;
	border: solid 1px #999999;
	background-color: #FFFFFF;
}
.example p {
	padding: 0;
}
dl,ul,ol {
	margin-top: 3pt;
	margin-bottom: 3pt;
	padding-left: 15pt;
	padding-right: 15pt;
}
dt {
	margin: 10pt 0 0 0;
	padding: 0;
	font-weight: bold;
}
dd {
	margin: 0;
	padding: 0;
}
li,img {
	margin-left: 15pt;
}
a {
	text-decoration: none;
	color: #990000;
}
hr {
	margin-top: 0;
	margin-bottom: 0;
}
/*]]>*/
</style>
</head>
<body>
<h1>JPF Code Generator - 0.4</h1>
<h2>Table of Contents</h2>
<ol>
	<li><a href="#introduction">Introduction</a></li>
	<li><a href="#examples">Examples / Tutorials</a></li>
	<li><a href="#download">Download and Bugtracker</a></li>
	<li><a href="#dependencies">Dependencies</a></li>
	<li><a href="#version">Version information</a></li>
	<li><a href="#release">Release announcements</a></li>
	<li><a href="#contact">Contact & License</a></li>
</ol>
<h2>Introduction</h2>
<p>This is a handy little tool that generates classes for accessing
the attributes and extensions of JPF plug-ins from plugin.xml files.
This has the advantage of providing a strongly typed access to the
plug-in and simplyfies working with plug-ins.</p>
<div class="example">
<p>Run it using...</p>
<pre>jar -jar jpfCodeGenerator-x.x.jar <comma separated plug-in locations> <overwrite:true|false></pre>
<p>...and pass it a comma separated list of plug-in locations
(folders in which to search for plugin.xml) and a boolean whether
generated files from previous runs should be overwritten.</p>
</div>
<div class="example">
<p>The plugin.xml needs to contain the class attribute:</p>
<pre class="sh_xml"><plugin id="pluginID" version="0.1.0" class="com.example.MyPlugin"></pre>
<p>or have an attribute with id "helperClassName" set:</p>
<pre class="sh_xml"><attributes>
   <attribute id="jpfcodegen">
      <attribute id="helperClassName" value="com.example.MyPluginHelper"/>
   </attribute>
</attributes></pre>
<p>so that the script knows which class to generate.</p>
</div>
<div class="example">
<p>The script will generate two files (in a src-folder in the same
folder as the plugin.xml):</p>
<pre class="sh_java">com.example.MyPlugin</pre>
<p>and</p>
<pre class="sh_java">com.example.generated._MyPlugin</pre></div>
<p>_MyPlugin contains all the essential method for accessing the
attributes and extensions of the plug-in but will be regenerated when
you re-run the code generator. All customizations should thus be put
into MyPlugin (which extends _MyPlugin), which by default is not
recreated. To recreate MyPlugin also, pass true as a second parameter to
the script.</p>
<p>If you choose to use the attribute helperClassName version, then
a separate class is generated that is independent of the plugin-class
(you don't even need one at all).</p>
<h2 id="examples">Examples / Tutorials</h2>
<p>The source distribution of the code generator comes with the
following examples / tutorials:</p>
<ul>
	<li><a href="tutorials/basic/index.html">Basic Tutorial for
	the JPF CodeGenerator</a></li>
</ul>
<h2 id="downloads">Downloads</h2>
<p>The latest version of the code generator can be downloaded from
the <a href="http://forge.spline.inf.fu-berlin.de/projects/jpfcodegen/">JPF
Code Generator project homepage</a> where you also find <a
	href="http://forge.spline.inf.fu-berlin.de/tracker/?group_id=75">the
bug-tracker of the project</a>.</p>
<ul>
	<li>Version 0.4 - <a
		href="http://forge.spline.inf.fu-berlin.de/frs/?group_id=75">Download
	Page</a>
	<ul>
		<li>JPFCodeGenerator-0.4.jar - Binary jar for running the code
		generator.</li>
		<li>JPFCodeGenerator-0.4-rt.jar - Runtime Jar, needed for running
		applications that use code generated by the code generator.</li>
		<li>JPFCodeGenerator-0.4-src.jar - Source Distribution including
		examples and documentation.</li>
	</ul>
	</li>
	<li>Version 0.3 - <a
		href="http://forge.spline.inf.fu-berlin.de/frs/?group_id=75&release_id=46">Download
	Page</a>
	<ul>
		<li>JPFCodeGenerator-0.3.jar - Binary jar for running the code
		generator.</li>
		<li>JPFCodeGenerator-0.3-rt.jar - Runtime Jar, needed for running
		applications that use code generated by the code generator.</li>
		<li>JPFCodeGenerator-0.3-src.jar - Source Distribution including
		examples and documentation.</li>
	</ul>
	</li>
</ul>
<h2 id="configuration">Configuration</h2>
<p>There are a couple of attributes that can be used to configure
the code generation behavior of the JPF code generator. Each attribute
needs to be defined in the <code><attributes></code>-element of
the plugin.xml as a sub-<code>attribute</code> of an <code>attribute</code>
with id <code>jpfcodegen</code></p>
<p>Possible attributes include</p>
<ul>
	<li><code>helperClassName</code> - If defined will cause the code
	generator to not create a plug-in class with helper methods to access
	the attributes and extensions of the plug-in, but rather an independent
	helper class. If not defined the code generator will use the name of
	the plugin class attribute.</li>
	<li><code>targetDir</code> - If defined will alter the output
	directory into which the code generator will write the resulting java
	files. If the attribute is not given the default directory is <code>src/</code></li>
</ul>
<div class="example">
<p>An example of how to tell the code generator to create a
standalone helper class with class name <code>com.example.MyPluginHelper</code>
in the <code>src</code> two levels up from the location of the
plugin.xml:</p>
<pre class="sh_xml"><attributes>
   <attribute id="jpfcodegen">
      <attribute id="helperClassName" value="com.example.MyPluginHelper"/>
      <attribute id="targetDir" value="../../src/"/>
   </attribute>
</attributes></pre></div>
<h2 id="dependencies">Dependencies</h2>
<p>To run the code generator jar you need (from the lib directory):</p>
<ul>
	<li>Velocity-dep-1.5.jar - Apache Velocity Template Engine is used
	to create the classes.</li>
	<li>jpf.jar - JPF engine is used to read the plugin.xml</li>
	<li>jpf-boot.jar - The boot library is used to collect
	plugin-locations.</li>
</ul>
<p>To run the code that gets generated you need:</p>
<ul>
	<li>jpf.jar - You need this anyway to use JPF ;-)</li>
	<li>JPFCodeGenerator-x.x-rt.jar - Contains some helper classes
	needed by the generated classes.</li>
	<li>commons-logging.jar - This is both needed by JPF and the
	classes generated by the code generator.</li>
</ul>
<h2 id="version">Version / Todo</h2>
<p>Todo:</p>
<ul>
	<li>Advanced examples.</li>
	<li>Support extension multiplicity.</li>
	<li>Support inheritance of extension points.</li>
	<li>Support extension plugin attributes (normal and nested).</li>
	<li>Support for documentation nodes</li>
	<li>Support for all extension parameter types (plugin-ID,
	extension-point-ID, extension-ID are missing).</li>
	<li>Improve support for naming choices. At the moment if you
	define extension-attributes using type "fixed", the values you use must
	be valid Java identifiers.</li>
	<li>Add JUnit tests.</li>
</ul>
<p>0.4 - 2007-07-19</p>
<ul>
    <li>Bug in generator template that caused a wrong classname to be generated.</li>
    <li>Can now create classes in a user-defined target directory.</li>
    <li>Bug fixes for parameter that are not set in an extension.</li>
    <li>Documentation improvement for Helper Classes.</li>
    <li>Added support for parameters of type resource.</li>
</ul>
<p>0.3 - 2007-07-11</p>
<ul>
	<li>Date/time extension parameters are now supported.</li>
	<li>Basic Tutorial added to documentation.</li>
	<li>Nested extension parameters are now possible.</li>
</ul>
<p>0.2 - 2007-07-05</p>
<ul>
	<li>Added option to generate HelperClass instead of putting the
	code into the Plugin class</li>
	<li>Added ant build.xml to generate rt.jar and run the Code
	Generator</li>
	<li>Added support for type "fixed" attributes using enums. See
	limitations.</li>
	<li>Multiplicity support for parameter attributes (so far only
	String (and Class), Number, Fixed, Boolean parameters are supported).</li>
</ul>
<p>0.1 - 2007-07-03</p>
<ul>
	<li>Initial release posted on SF.net</li>
</ul>
<h2 id="release">Release Announcements</h2>
<div class="example">
<p>0.3 - 2007-07-11</p>
<pre>
Hi Guys,
  version 0.3 of the code generator is ready. It comes with better documentation 
(a tutorial at http://www.inf.fu-berlin.de/~oezbek/jpf/tutorials/basic/) and 
some additional features like nested extension-point-parameters. I also 
added a small homepage for it at http://www.inf.fu-berlin.de/~oezbek/jpf/
where you will also find the link for downloading it.
Suggestions and comments are highly welcome: Send them to oezi[at]oezi.de
Cheers,
  Christopher
</pre>
<p>0.2 - 2007-07-05</p>
<pre> 
Hi Guys,
  I have just extended the code generator a little bit to also support 
extension-point parameter multiplicity, attributes of type fixed and
a standalone mode:
1.) If you have a parameter with a multiplicity that might result in several
    parameter values:
<parameter-def type="string" id="name" multiplicity="any"/>
then this will now generate this code:
public Collection<String> getNames(){
  return getStringParameters("name");
}
2.) If you have a parameter with a type fixed then this will be mapped to
    an enum in Java:
<parameter-def type="fixed" id="alignment" custom-data="left|right|top|bottom"/>
will generate:
public enum Alignment {
    LEFT, RIGHT, TOP, BOTTOM;
}
public Alignment getAlignment(){
    return Alignment.valueOf(getStringParameter("alignment").toUpperCase());
}
3.) If you don't want to use the plugin class-attribute as a target
    class to generate, you can now also use plugin-attributes to define 
    the name of the class to generate:
<attributes>
   <attribute id="helperClassName" value="com.example.MyPluginHelper"/>
</attributes>
4.) The Code Generator also now comes in 3 handy jars:
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2.jar 
  -> The code generator as a binary package to run using
  
java -jar JPFCodeGenerator-0.2.jar <comma separated plug-in locations> <overwrite:true|false>
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2-rt.jar
The runtime dependencies needed to use the generated classes, add 
this to your buildpath in the project.
http://page.mi.fu-berlin.de/oezbek/jpf/JPFCodeGenerator-0.2-src.jar
The source code if anybody is interested to play with it.
Cheers,
  Christopher
</pre></div>
<h2 id="contact">Contact & License</h2>
<p>Copyright (C) Christopher Oezbek (2007) - <a
	href="mailto:oezi[at]oezi.de">oezi[at]oezi.de</a></p>
<p>This tool was created as part of the ongoing migration in the <a
	href="http://jabref.sf.net">JabRef reference manager</a> to move to a
modular plug-in architecture and is released under the <a
	href="http://www.gnu.org">LGPL 3.0</a>.</p>
<p>Your <a href="mailto:oezi[at]oezi.de">improvements and
suggestions are welcome</a>.</p>
</body>
</html>
 |