| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 3 | |
|---|
| 4 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 5 | <head> |
|---|
| 6 | <title>org.jcoderz.commons.taskdefs package</title> |
|---|
| 7 | </head> |
|---|
| 8 | |
|---|
| 9 | <body> |
|---|
| 10 | <p>This package contains Ant tasks that can be used by any |
|---|
| 11 | jCoderZ Java project. |
|---|
| 12 | </p> |
|---|
| 13 | |
|---|
| 14 | <p> |
|---|
| 15 | Classes in this package are only allowed to have a dependency to |
|---|
| 16 | the JDK, the {@link org.jcoderz.commons} and the |
|---|
| 17 | {@link org.jcoderz.commons.util} package.package. |
|---|
| 18 | </p> |
|---|
| 19 | |
|---|
| 20 | <h1>Log Message Generator</h1> |
|---|
| 21 | |
|---|
| 22 | <p>Process a XML document file that define the application's log |
|---|
| 23 | messages and generate corresponding java typesafe enum classes. |
|---|
| 24 | The classes are generated via XSLT and various stylesheets from |
|---|
| 25 | the FawkeZ Java archive. </p> |
|---|
| 26 | |
|---|
| 27 | <p><b>Note:</b>The |
|---|
| 28 | <a href="http://xml.apache.org/xalan2/">Xalan2</a> XSL processor |
|---|
| 29 | is required for this task. If you are using JDK 1.4 or higher, |
|---|
| 30 | this task does not require external libraries not supplied in |
|---|
| 31 | the FawkeZ distribution.</p> |
|---|
| 32 | |
|---|
| 33 | <p>This task doesn't support/require any nested elements.</p> |
|---|
| 34 | |
|---|
| 35 | <h2>Parameters</h2> |
|---|
| 36 | <table border="1" cellpadding="2" cellspacing="0" summary="parameters"> |
|---|
| 37 | <tr> |
|---|
| 38 | <td valign="top"><b>Attribute</b></td> |
|---|
| 39 | <td valign="top"><b>Description</b></td> |
|---|
| 40 | <td align="center" valign="top"><b>Required</b></td> |
|---|
| 41 | </tr> |
|---|
| 42 | <tr> |
|---|
| 43 | <td valign="top">destdir</td> |
|---|
| 44 | <td valign="top">directory in which to store the results.</td> |
|---|
| 45 | <td align="center" valign="top">Yes</td> |
|---|
| 46 | </tr> |
|---|
| 47 | <tr> |
|---|
| 48 | <td valign="top">in</td> |
|---|
| 49 | <td valign="top">specifies a single XML document that contains |
|---|
| 50 | the log message info.</td> |
|---|
| 51 | <td valign="top" align="center">Yes</td> |
|---|
| 52 | </tr> |
|---|
| 53 | <tr> |
|---|
| 54 | <td valign="top">out</td> |
|---|
| 55 | <td valign="top">specifies the output name for the log output.</td> |
|---|
| 56 | <td valign="top" align="center">Yes</td> |
|---|
| 57 | </tr> |
|---|
| 58 | <tr> |
|---|
| 59 | <td valign="top">project</td> |
|---|
| 60 | <td valign="top">specifies the project name. The project name |
|---|
| 61 | defines the path in the XML document for the transformation. |
|---|
| 62 | The project name can either be the name as defined in the |
|---|
| 63 | XML document in the <code>@name</code> attribute or |
|---|
| 64 | it can be set to the value as defined in the |
|---|
| 65 | <code>@short-name</code> attribute.</td> |
|---|
| 66 | <td valign="top" align="center">Yes</td> |
|---|
| 67 | </tr> |
|---|
| 68 | <tr> |
|---|
| 69 | <td valign="top">xsl</td> |
|---|
| 70 | <td valign="top">specifies a XSL stylesheet that is used for |
|---|
| 71 | transformation.</td> |
|---|
| 72 | <td valign="top" align="center">No; default is to use the |
|---|
| 73 | build-in stylesheet.</td> |
|---|
| 74 | </tr> |
|---|
| 75 | <tr> |
|---|
| 76 | <td valign="top">force</td> |
|---|
| 77 | <td valign="top">Recreate target files, even if they are newer |
|---|
| 78 | than their corresponding source files.</td> |
|---|
| 79 | <td valign="top" align="center">No; default is false</td> |
|---|
| 80 | </tr> |
|---|
| 81 | <tr> |
|---|
| 82 | <td valign="top">failonerror</td> |
|---|
| 83 | <td valign="top">Stop the buildprocess if the target fails |
|---|
| 84 | with an error.</td> |
|---|
| 85 | <td valign="top" align="center">No; default is false</td> |
|---|
| 86 | </tr> |
|---|
| 87 | </table> |
|---|
| 88 | |
|---|
| 89 | <h2>Examples</h2> |
|---|
| 90 | |
|---|
| 91 | <blockquote> |
|---|
| 92 | <pre> |
|---|
| 93 | <taskdef name="log-message-generator" |
|---|
| 94 | classname="org.jcoderz.commons.taskdefs.LogMessageGenerator"> |
|---|
| 95 | <classpath> |
|---|
| 96 | <pathelement location="path/to/fawkez.jar"/> |
|---|
| 97 | </classpath> |
|---|
| 98 | </taskdef> |
|---|
| 99 | </pre> |
|---|
| 100 | Add task definition to the current project. |
|---|
| 101 | <pre> |
|---|
| 102 | <log-message-generator |
|---|
| 103 | in="${base.dir}/src/xml/log-message-info.xml" |
|---|
| 104 | out="${build.dir}/log-message-info.xml.test.out" |
|---|
| 105 | destDir="${build.dir}/foo" |
|---|
| 106 | application="FawkeZ" |
|---|
| 107 | failonerror="true" |
|---|
| 108 | force="true"/> |
|---|
| 109 | </pre> |
|---|
| 110 | Generates the log message info classes to the directory |
|---|
| 111 | <code>${build.dir}/foo</code> for the applicaton |
|---|
| 112 | <code>FawkeZ</code>. The dependency check is omitted, since |
|---|
| 113 | the <code>force</code> attribute is set to <code>true</code>. |
|---|
| 114 | This target will fail if an error occurs. |
|---|
| 115 | </blockquote> |
|---|
| 116 | |
|---|
| 117 | <h1>Simple Types Generator</h1> |
|---|
| 118 | |
|---|
| 119 | <p>Process a XML document file that define simple types like |
|---|
| 120 | type-safe enumerations or restricted strings and generate |
|---|
| 121 | the java classes. |
|---|
| 122 | The classes are generated via XSLT and various stylesheets from |
|---|
| 123 | the FawkeZ Java archive. </p> |
|---|
| 124 | |
|---|
| 125 | <blockquote> |
|---|
| 126 | Take the following XML document defines two simple-types: |
|---|
| 127 | <ul> |
|---|
| 128 | <li>A type-safe enumeration class.</li> |
|---|
| 129 | <li>A restricted string class.</li> |
|---|
| 130 | </ul> |
|---|
| 131 | <pre> |
|---|
| 132 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 133 | |
|---|
| 134 | <simpleTypes> |
|---|
| 135 | |
|---|
| 136 | <!-- =============================================================== |
|---|
| 137 | TYPE-SAFE ENUMERATIONS |
|---|
| 138 | =============================================================== --> |
|---|
| 139 | <typeSafeEnumerations> |
|---|
| 140 | <enumeration |
|---|
| 141 | classname="Color" |
|---|
| 142 | package="org.jcoderz.commons"> |
|---|
| 143 | <value>blue</value> |
|---|
| 144 | <value>red</value> |
|---|
| 145 | <value>yellow</value> |
|---|
| 146 | </enumeration> |
|---|
| 147 | </typeSafeEnumerations> |
|---|
| 148 | |
|---|
| 149 | <!-- =============================================================== |
|---|
| 150 | RESTRICTED STRINGS |
|---|
| 151 | =============================================================== --> |
|---|
| 152 | <restrictedStrings> |
|---|
| 153 | <restrictedString |
|---|
| 154 | classname="FooString" |
|---|
| 155 | package="org.jcoderz.commons" |
|---|
| 156 | min-length="1" |
|---|
| 157 | max-length="10"> |
|---|
| 158 | <constant |
|---|
| 159 | name="CONSTANT_VALUE" |
|---|
| 160 | value="foo" |
|---|
| 161 | comment="Additional Constant defined in the XML document."/> |
|---|
| 162 | </restrictedString> |
|---|
| 163 | </restrictedStrings> |
|---|
| 164 | |
|---|
| 165 | <!-- =============================================================== |
|---|
| 166 | REGEX STRINGS |
|---|
| 167 | =============================================================== --> |
|---|
| 168 | <regexStrings> |
|---|
| 169 | <regexString |
|---|
| 170 | classname="RegexString" |
|---|
| 171 | package="org.jcoderz.commons"> |
|---|
| 172 | <regex>foo|bar|buz</regex> |
|---|
| 173 | </regexString> |
|---|
| 174 | </regexStrings> |
|---|
| 175 | |
|---|
| 176 | </simpleTypes> |
|---|
| 177 | </pre> |
|---|
| 178 | </blockquote> |
|---|
| 179 | |
|---|
| 180 | <p><b>Note:</b>The |
|---|
| 181 | <a href="http://xml.apache.org/xalan2/">Xalan2</a> XSL processor |
|---|
| 182 | is required for this task. If you are using JDK 1.4 or higher, |
|---|
| 183 | this task does not require external libraries not supplied in |
|---|
| 184 | the FawkeZ distribution.</p> |
|---|
| 185 | |
|---|
| 186 | <p>This task doesn't support/require any nested elements.</p> |
|---|
| 187 | |
|---|
| 188 | <h2>Parameters</h2> |
|---|
| 189 | <table border="1" cellpadding="2" cellspacing="0" summary="parameters"> |
|---|
| 190 | <tr> |
|---|
| 191 | <td valign="top"><b>Attribute</b></td> |
|---|
| 192 | <td valign="top"><b>Description</b></td> |
|---|
| 193 | <td align="center" valign="top"><b>Required</b></td> |
|---|
| 194 | </tr> |
|---|
| 195 | <tr> |
|---|
| 196 | <td valign="top">destdir</td> |
|---|
| 197 | <td valign="top">directory in which to store the results.</td> |
|---|
| 198 | <td align="center" valign="top">Yes</td> |
|---|
| 199 | </tr> |
|---|
| 200 | <tr> |
|---|
| 201 | <td valign="top">in</td> |
|---|
| 202 | <td valign="top">specifies a single XML document that contains |
|---|
| 203 | the log message info.</td> |
|---|
| 204 | <td valign="top" align="center">Yes</td> |
|---|
| 205 | </tr> |
|---|
| 206 | <tr> |
|---|
| 207 | <td valign="top">out</td> |
|---|
| 208 | <td valign="top">specifies the output name for the log output.</td> |
|---|
| 209 | <td valign="top" align="center">Yes</td> |
|---|
| 210 | </tr> |
|---|
| 211 | <tr> |
|---|
| 212 | <td valign="top">xsl</td> |
|---|
| 213 | <td valign="top">specifies a XSL stylesheet that is used for |
|---|
| 214 | transformation.</td> |
|---|
| 215 | <td valign="top" align="center">No; default is to use the |
|---|
| 216 | build-in stylesheet.</td> |
|---|
| 217 | </tr> |
|---|
| 218 | <tr> |
|---|
| 219 | <td valign="top">force</td> |
|---|
| 220 | <td valign="top">Recreate target files, even if they are newer |
|---|
| 221 | than their corresponding source files.</td> |
|---|
| 222 | <td valign="top" align="center">No; default is false</td> |
|---|
| 223 | </tr> |
|---|
| 224 | <tr> |
|---|
| 225 | <td valign="top">failonerror</td> |
|---|
| 226 | <td valign="top">Stop the buildprocess if the target fails |
|---|
| 227 | with an error.</td> |
|---|
| 228 | <td valign="top" align="center">No; default is false</td> |
|---|
| 229 | </tr> |
|---|
| 230 | </table> |
|---|
| 231 | |
|---|
| 232 | <h2>Examples</h2> |
|---|
| 233 | |
|---|
| 234 | <blockquote> |
|---|
| 235 | <pre> |
|---|
| 236 | <taskdef name="simple-type-generator" |
|---|
| 237 | classname="org.jcoderz.commons.taskdefs.SimpleTypeGenerator"> |
|---|
| 238 | <classpath> |
|---|
| 239 | <pathelement location="path/to/fawkez.jar"/> |
|---|
| 240 | </classpath> |
|---|
| 241 | </taskdef> |
|---|
| 242 | </pre> |
|---|
| 243 | Add task definition to the current project. |
|---|
| 244 | <pre> |
|---|
| 245 | <simple-type-generator |
|---|
| 246 | in="${base.dir}/src/xml/simple-types.xml" |
|---|
| 247 | out="${build.dir}/simply-types.out" |
|---|
| 248 | destDir="${build.dir}/foo" |
|---|
| 249 | failonerror="true" |
|---|
| 250 | force="true"/> |
|---|
| 251 | </pre> |
|---|
| 252 | Generates the simple type classes to the directory |
|---|
| 253 | <code>${build.dir}/foo</code>. |
|---|
| 254 | The dependency check is omitted, since |
|---|
| 255 | the <code>force</code> attribute is set to <code>true</code>. |
|---|
| 256 | This target will fail if an error occurs. |
|---|
| 257 | </blockquote> |
|---|
| 258 | |
|---|
| 259 | <h1>Generator for Configuration Classes and Initialization Files</h1> |
|---|
| 260 | |
|---|
| 261 | <p>Process a XML document file that define the application's |
|---|
| 262 | configuration entries and generate corresponding java classes |
|---|
| 263 | or initialization files. |
|---|
| 264 | The classes or files are generated via XSLT and various stylesheets |
|---|
| 265 | from the FawkeZ Java archive. </p> |
|---|
| 266 | |
|---|
| 267 | <p><b>Note:</b>The |
|---|
| 268 | <a href="http://xml.apache.org/xalan2/">Xalan2</a> XSL processor |
|---|
| 269 | is required for this task. If you are using JDK 1.4 or higher, |
|---|
| 270 | this task does not require external libraries not supplied in |
|---|
| 271 | the FawkeZ distribution.</p> |
|---|
| 272 | |
|---|
| 273 | <p>This task doesn't support/require any nested elements.</p> |
|---|
| 274 | |
|---|
| 275 | <h2>Parameters</h2> |
|---|
| 276 | <table border="1" cellpadding="2" cellspacing="0" summary="parameters"> |
|---|
| 277 | <tr> |
|---|
| 278 | <td valign="top"><b>Attribute</b></td> |
|---|
| 279 | <td valign="top"><b>Description</b></td> |
|---|
| 280 | <td align="center" valign="top"><b>Required</b></td> |
|---|
| 281 | </tr> |
|---|
| 282 | <tr> |
|---|
| 283 | <td valign="top">destdir</td> |
|---|
| 284 | <td valign="top">directory in which to store the results. |
|---|
| 285 | <b>Note</b>: This attribute is only supported by the |
|---|
| 286 | configuration generator that produces the Java classes.</td> |
|---|
| 287 | <td align="center" valign="top">Yes, for the configuration |
|---|
| 288 | generator that produces the Java classes.</td> |
|---|
| 289 | </tr> |
|---|
| 290 | <tr> |
|---|
| 291 | <td valign="top">in</td> |
|---|
| 292 | <td valign="top">specifies a single XML document that contains |
|---|
| 293 | the log message info.</td> |
|---|
| 294 | <td valign="top" align="center">Yes</td> |
|---|
| 295 | </tr> |
|---|
| 296 | <tr> |
|---|
| 297 | <td valign="top">out</td> |
|---|
| 298 | <td valign="top">specifies the output name for the log output.</td> |
|---|
| 299 | <td valign="top" align="center">Yes</td> |
|---|
| 300 | </tr> |
|---|
| 301 | <tr> |
|---|
| 302 | <td valign="top">project</td> |
|---|
| 303 | <td valign="top">specifies the project name. The project name |
|---|
| 304 | defines the path in the XML document for the transformation. |
|---|
| 305 | The project name can either be the name as defined in the |
|---|
| 306 | XML document in the <code>@name</code> attribute or |
|---|
| 307 | it can be set to the value as defined in the |
|---|
| 308 | <code>@short-name</code> attribute.</td> |
|---|
| 309 | <td valign="top" align="center">Yes</td> |
|---|
| 310 | </tr> |
|---|
| 311 | <tr> |
|---|
| 312 | <td valign="top">groups</td> |
|---|
| 313 | <td valign="top">specifies the group names. The group names |
|---|
| 314 | are used to select the elements in the XML document |
|---|
| 315 | for the transformation. |
|---|
| 316 | The group names must be a non-empty list seperated by |
|---|
| 317 | a whitespace of the <code>@short-name</code> attribute in the |
|---|
| 318 | group element.</td> |
|---|
| 319 | <td valign="top" align="center">Yes</td> |
|---|
| 320 | </tr> |
|---|
| 321 | <tr> |
|---|
| 322 | <td valign="top">mode</td> |
|---|
| 323 | <td valign="top">specifies the initialization mode. |
|---|
| 324 | Valid values are: <b>properties</b> or <b>sql</b>. |
|---|
| 325 | <b>Note</b>: This attribute is only supported by the |
|---|
| 326 | configuration generator that produces the initialization files. |
|---|
| 327 | </td> |
|---|
| 328 | <td valign="top" align="center">No; default is <i> |
|---|
| 329 | properties</i>.</td> |
|---|
| 330 | </tr> |
|---|
| 331 | <tr> |
|---|
| 332 | <td valign="top">xsl</td> |
|---|
| 333 | <td valign="top">specifies a XSL stylesheet that is used for |
|---|
| 334 | transformation.</td> |
|---|
| 335 | <td valign="top" align="center">No; default is to use the |
|---|
| 336 | build-in stylesheet.</td> |
|---|
| 337 | </tr> |
|---|
| 338 | <tr> |
|---|
| 339 | <td valign="top">force</td> |
|---|
| 340 | <td valign="top">Recreate target files, even if they are newer |
|---|
| 341 | than their corresponding source files.</td> |
|---|
| 342 | <td valign="top" align="center">No; default is false</td> |
|---|
| 343 | </tr> |
|---|
| 344 | <tr> |
|---|
| 345 | <td valign="top">failonerror</td> |
|---|
| 346 | <td valign="top">Stop the buildprocess if the target fails |
|---|
| 347 | with an error.</td> |
|---|
| 348 | <td valign="top" align="center">No; default is false</td> |
|---|
| 349 | </tr> |
|---|
| 350 | </table> |
|---|
| 351 | |
|---|
| 352 | <h2>Examples</h2> |
|---|
| 353 | |
|---|
| 354 | <blockquote> |
|---|
| 355 | <pre> |
|---|
| 356 | <taskdef name="config-classes-generator" |
|---|
| 357 | classname="org.jcoderz.commons.taskdefs.ConfigurationClassesGenerator"> |
|---|
| 358 | <classpath> |
|---|
| 359 | <pathelement location="path/to/fawkez.jar"/> |
|---|
| 360 | </classpath> |
|---|
| 361 | </taskdef> |
|---|
| 362 | </pre> |
|---|
| 363 | Add task definition to the current project. |
|---|
| 364 | <pre> |
|---|
| 365 | <config-classes-generator |
|---|
| 366 | in="${base.dir}/src/xml/app-info.xml" |
|---|
| 367 | out="${build.dir}/app-info-config-classes.xml.out" |
|---|
| 368 | destDir="${build.dir}/foo" |
|---|
| 369 | application="FawkeZ" |
|---|
| 370 | groups="SEC FOO BAR" |
|---|
| 371 | failonerror="true" |
|---|
| 372 | force="true"/> |
|---|
| 373 | </pre> |
|---|
| 374 | Generates the configuration classes to the directory |
|---|
| 375 | <code>${build.dir}/foo</code> for the applicaton |
|---|
| 376 | <code>FawkeZ</code> and the groups/services <i>SEC</i>, |
|---|
| 377 | <i>FOO</i> and <i>BAR</i>. The dependency check is omitted, since |
|---|
| 378 | the <code>force</code> attribute is set to <code>true</code>. |
|---|
| 379 | This target will fail if an error occurs. |
|---|
| 380 | </blockquote> |
|---|
| 381 | |
|---|
| 382 | <blockquote> |
|---|
| 383 | <pre> |
|---|
| 384 | <taskdef name="config-init-file-generator" |
|---|
| 385 | classname="org.jcoderz.commons.taskdefs.ConfigurationInitFileGenerator"> |
|---|
| 386 | <classpath> |
|---|
| 387 | <pathelement location="path/to/fawkez.jar"/> |
|---|
| 388 | </classpath> |
|---|
| 389 | </taskdef> |
|---|
| 390 | </pre> |
|---|
| 391 | Add task definition to the current project. |
|---|
| 392 | <pre> |
|---|
| 393 | <config-init-file-generator |
|---|
| 394 | in="${base.dir}/src/xml/app-info.xml" |
|---|
| 395 | out="${build.dir}/configuration.properties" |
|---|
| 396 | application="FawkeZ" |
|---|
| 397 | groups="SEC FOO BAR" |
|---|
| 398 | mode="SQL" |
|---|
| 399 | failonerror="true" |
|---|
| 400 | force="true"/> |
|---|
| 401 | </pre> |
|---|
| 402 | Generates the configuration initialization <b>property</b> file |
|---|
| 403 | <code>${build.dir}/configuration.properties</code> for the applicaton |
|---|
| 404 | <code>FawkeZ</code> and the groups/services <i>SEC</i>, |
|---|
| 405 | <i>FOO</i> and <i>BAR</i>. The dependency check is omitted, since |
|---|
| 406 | the <code>force</code> attribute is set to <code>true</code>. |
|---|
| 407 | This target will fail if an error occurs. |
|---|
| 408 | </blockquote> |
|---|
| 409 | |
|---|
| 410 | </body> |
|---|
| 411 | </html> |
|---|