You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ejb.html 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant EJB Tasks</title>
  5. </head>
  6. <body>
  7. <h1>Ant EJB Tasks User Manual</h1>
  8. <p>by</p>
  9. <!-- Names are in alphabetical order, on last name -->
  10. <ul>
  11. <li>Tim Fennell (<a href="mailto:tfenne@rcn.com">tfenne@rcn.com</a>)</li>
  12. <li>Conor MacNeill (<a href="mailto:conor@cortexebusiness.com.au">conor@cortexebusiness.com.au</a>)</li>
  13. </ul>
  14. <p>Version 1.1 - 2000/07/18</p>
  15. <hr>
  16. <h2>Table of Contents</h2>
  17. <ul>
  18. <li><a href="#introduction">Introduction</a></li>
  19. <li><a href="#ejbtasks">EJB Tasks</a></li>
  20. </ul>
  21. <hr>
  22. <h2><a name="introduction">Introduction</a></h2>
  23. <p>Ant provides a number of optional tasks for developing
  24. <a href="http://java.sun.com/products/ejb">Enterprise Java Beans (EJBs)</a>.
  25. In general these tasks are specific to the particular vendor's EJB Server. At present the tasks support
  26. <a href="http://www.bea.com">Weblogic</a> 4.5.1 and 5.1 EJB servers. Over time we expect further optional tasks
  27. to support additional EJB Servers.
  28. <hr>
  29. <h2><a name="ejbtasks">EJB Tasks</a></h2>
  30. <table border="1" cellpadding="5">
  31. <tr><td>Task</td><td>Application Servers</td></tr>
  32. <tr><td><a href="#ddcreator">ddcreator</a></td><td>Weblogic 4.5</td></tr>
  33. <tr><td><a href="#ejbc">ejbc</a></td><td>Weblogic 4.5</td></tr>
  34. <tr><td><a href="#wlrun">wlrun</a></td><td>Weblogic 4.5</td></tr>
  35. <tr><td><a href="#wlstop">wlstop</a></td><td>Weblogic 4.5</td></tr>
  36. <tr><td><a href="#ejbjar">ejbjar</a></td><td>Weblogic 5.1</td></tr>
  37. </table>
  38. <hr>
  39. <h2><a name="ddcreator">ddcreator</a></h2>
  40. <h3><b>Description:</b></h3>
  41. <p>ddcreator will compile a set of Weblogic text-based deployment descriptors into a serialized
  42. EJB deployment descriptor. The selection of which of the text-based descriptors are to be compiled
  43. is based on the standard Ant include and exclude selection mechanisms.
  44. <h3>Parameters:</h3>
  45. <table border="1" cellpadding="2" cellspacing="0">
  46. <tr>
  47. <td valign="top"><b>Attribute</b></td>
  48. <td valign="top"><b>Description</b></td>
  49. <td align="center" valign="top"><b>Required</b></td>
  50. </tr>
  51. <tr>
  52. <td valign="top">descriptors</td>
  53. <td valign="top">This is the base directory from which descriptors are selected.</td>
  54. <td valign="top" align="center">Yes</td>
  55. </tr>
  56. <tr>
  57. <td valign="top">dest</td>
  58. <td valign="top">The directory where the serialised deployment descriptors will be written</td>
  59. <td valign="top" align="center">Yes</td>
  60. </tr>
  61. <tr>
  62. <td valign="top">classpath</td>
  63. <td valign="top">This is the classpath to use to run the underlying weblogic ddcreator tool.
  64. This must include the <code>weblogic.ejb.utils.DDCreator</code> class</td>
  65. <td valign="top" align="center">No</td>
  66. </tr>
  67. </table>
  68. <h3>Examples</h3>
  69. <pre>&lt;ddcreator descriptors=&quot;${dd.dir}&quot;
  70. dest=&quot;${gen.classes}&quot;
  71. classpath=&quot;${descriptorbuild.classpath}&quot;&gt;
  72. &lt;include name=&quot;*.txt&quot; /&gt;
  73. &lt;/ddcreator&gt;</code>
  74. </pre>
  75. <hr>
  76. <h2><a name="ejbc">ejbc</a></h2>
  77. <h3><b>Description:</b></h3>
  78. <p>The ejbc task will run Weblogic's ejbc tool. This tool will take a serialised deployment descriptor,
  79. examine the various EJB interfaces and bean classes and then generate the required support classes
  80. necessary to deploy the bean in a Weblogic EJB container. This will include the RMI stubs and skeletons
  81. as well as the classes which implement the bean's home and remote interfaces.
  82. <p>
  83. The ant task which runs this tool is able to compile several beans in a single operation. The beans to be
  84. compiled are selected by including their serialised deployment descriptors. The standard ant
  85. <code>include</code> and <code>exclude</code> constructs can be used to select the deployment descriptors
  86. to be included.
  87. <p>
  88. Each descriptor is examined to determiune whether the generated classes are out of date and need to be
  89. regenerated. The deployment descriptor is de-serialized to discover the home, remote and
  90. implementation classes. The corresponding source files are determined and checked to see their
  91. modification times. These times and the modification time of the serialised descriptor itself are
  92. compared with the modification time of the generated classes. If the generated classes are not present
  93. or are out of date, the ejbc tool is run to generate new versions.
  94. <h3>Parameters:</h3>
  95. <table border="1" cellpadding="2" cellspacing="0">
  96. <tr>
  97. <td valign="top"><b>Attribute</b></td>
  98. <td valign="top"><b>Description</b></td>
  99. <td align="center" valign="top"><b>Required</b></td>
  100. </tr>
  101. <tr>
  102. <td valign="top">descriptors</td>
  103. <td valign="top">This is the base directory from which the serialised deployment descriptors are selected.</td>
  104. <td valign="top" align="center">Yes</td>
  105. </tr>
  106. <tr>
  107. <td valign="top">dest</td>
  108. <td valign="top">The base directory where the generated classes, RIM stubs and RMI skeletons are written</td>
  109. <td valign="top" align="center">Yes</td>
  110. </tr>
  111. <tr>
  112. <td valign="top">manifest</td>
  113. <td valign="top">The name of a manifest file to be written. This manifest will contain an entry for each EJB processed</td>
  114. <td valign="top" align="center">Yes</td>
  115. </tr>
  116. <tr>
  117. <td valign="top">src</td>
  118. <td valign="top">The base directory of the source tree containing the source files of the home interface,
  119. remote interface and bean implementation classes.</td>
  120. <td valign="top" align="center">Yes</td>
  121. </tr>
  122. <tr>
  123. <td valign="top">classpath</td>
  124. <td valign="top">This classpath must include both the <code>weblogic.ejbc</code> class and the
  125. classfiles of the bean, home interface, remote interface, etc of the bean being
  126. processed.</td>
  127. <td valign="top" align="center">No</td>
  128. </tr>
  129. </table>
  130. <h3>Examples</h3>
  131. <pre>&lt;ejbc descriptors=&quot;${gen.classes}&quot;
  132. src=&quot;${src.dir}&quot;
  133. dest=&quot;${gen.classes}&quot;
  134. manifest=&quot;${build.manifest}&quot;
  135. classpath=&quot;${descriptorbuild.classpath}&quot;&gt;
  136. &lt;include name=&quot;*.ser&quot; /&gt;
  137. &lt;/ejbc&gt;</code>
  138. </pre>
  139. <hr>
  140. <h2><a name="wlrun">wlrun</a></h2>
  141. <h3><b>Description:</b></h3>
  142. <p>This is an experimental task and is not currently documented.
  143. <hr>
  144. <h2><a name="wlstop">wlstop</a></h2>
  145. <h3><b>Description:</b></h3>
  146. <p>This is an experimental task and is not currently documented.
  147. <hr>
  148. <h2><a name="ejbjar">ejbjar</a></h2>
  149. <h3><b>Description:</b></h3>
  150. <p>This task is designed to support building of arbitrary EJB1.1 jar files. Support is currently
  151. provided for 'vanilla' EJB1.1 jar files - i.e. those containing only the user generated class
  152. files and the standard deployment descriptor, as well as for WebLogic 5.1 jar files.</p>
  153. <p>The task works as a directory scanning task, and performs an action for each deployment descriptor
  154. found. As such the includes and excludes should be set to ensure that all desired EJB1.1
  155. descriptors are found, but no application server descriptors are found. For each descriptor
  156. found, ejbjar will parse the deployment descriptor to determine the necessary class files to
  157. include and assemble those files and necessary deployment descriptors into a well formed EJB
  158. jar file. If generateweblogic is set to true, weblogic.ejbc is then invoked (in VM) to create
  159. the WebLogic jar file.</p>
  160. <p>In order to locate the WebLogic deployment descriptors for each jar file, certain naming
  161. conventions are assumed. For the purpose of this document we will assume a basenameterminator
  162. of '-' (see below for how to specify this option). If you have a deployment descriptor called
  163. FooBean-ejb-jar.xml, the basename will be taken as FooBean, the string up to the basenameterminator.
  164. Descriptors will then be searched for called FooBean-weblogic-ejb-jar.xml and also
  165. FooBean-weblogic-cmp-rdbms-jar.xml. If generateweblogic is false, neither WebLogic descriptor is
  166. required, but will still be embedded if found. If generateweblogic is true, only
  167. FooBean-weblogic-ejb-jar.xml is required, but again, both will be embedded in the jar file if
  168. they are found.</p>
  169. <p>The jar files are only built if they are out of date. As more than one jar file can be built
  170. per deployment descriptor, this process works as follows. If generateweblogic is true use the
  171. modification date of the WebLogic jar file as the jar file modification date, otherwise use the
  172. modification date of the generic jar file. If the modification timestamp of any of the class
  173. files or deployment descriptors is later than the selected jar file's, a build is executed,
  174. otherwise a message is logged that the jar file is up to date.</p>
  175. <h3>Parameters:</h3>
  176. <table border="1" cellpadding="2" cellspacing="0">
  177. <tr>
  178. <td valign="top"><b>Attribute</b></td>
  179. <td valign="top"><b>Description</b></td>
  180. <td align="center" valign="top"><b>Required</b></td>
  181. </tr>
  182. <tr>
  183. <td valign="top">srcdir</td>
  184. <td valign="top">The base directory under which to scan for EJB deployment descriptors.</td>
  185. <td valign="top" align="center">Yes</td>
  186. </tr>
  187. <tr>
  188. <td valign="top">destdir</td>
  189. <td valign="top">The base directory under which generated jar files are deposited. Jar files are deposited in
  190. directories correpsonding to the package in which their deployment descriptor was found.</td>
  191. <td valign="top" align="center">Yes</td>
  192. </tr>
  193. <tr>
  194. <td valign="top">generateweblogic</td>
  195. <td valign="top">Boolean value specifying whether or not ejbc should be invoked to create the weblogic jar file.
  196. Acceptable values are 'true' and 'false'.</td>
  197. <td valign="top" align="center">No, defaults to 'false'.</td>
  198. </tr>
  199. <tr>
  200. <td valign="top">keepgeneric</td>
  201. <td valign="top">Boolean value specifying whether or not to keep the generic EJB1.1 jar files created. If you are
  202. only interested in the generated WebLogic jar files, set this to false to remove the temporary
  203. jar files created. Acceptable values are 'true' and 'false'.</td>
  204. <td valign="top" align="center">No, defaults to 'true'.</td>
  205. </tr>
  206. <tr>
  207. <td valign="top">basenameterminator</td>
  208. <td valign="top">String value used to substring out a string from the name of each deployment descriptor found,
  209. which is then used to locate related deployment descriptors (e.g. the WebLogic descriptors).
  210. For example, a basename of '.' and a deployment descriptor called 'FooBean.ejb-jar.xml' would
  211. result in a basename of 'FooBean' which would then be used to find FooBean.weblogic-ejb-jar.xml
  212. and FooBean.weblogic-cmp-rdbms-jar.xml, as well as to create the filenames of the jar files as
  213. FooBean-generic.jar and FooBean-wl.jar.</td>
  214. <td valign="top" align="center">No, defaults to '-'.</td>
  215. </tr>
  216. <tr>
  217. <td valign="top">genericjarsuffix</td>
  218. <td valign="top">String value appended to the basename of the deployment descriptor to create the filename of the
  219. generic EJB jar file.</td>
  220. <td valign="top" align="center">No, defaults to '-generic.jar'.</td>
  221. </tr>
  222. <tr>
  223. <td valign="top">weblogicjarsuffix</td>
  224. <td valign="top">String value appended to the basename of the deployment descriptor to create the filename of the
  225. WebLogic EJB jar file.</td>
  226. <td valign="top" align="center">No, defaults to '-wl.jar'.</td>
  227. </tr>
  228. </table>
  229. <h3>Examples</h3>
  230. <pre>
  231. &lt;ejbjar srcdir="classes"
  232. destdir="classes"
  233. generateweblogic="true"
  234. keepgeneric="false"
  235. genericjarsuffix="-temp.jar"
  236. weblogicjarsuffix=".jar"&gt;
  237. &lt;include name="**/*-ejb-jar.xml"/&gt;
  238. &lt;exclude name="**/*weblogic*.xml"/&gt;
  239. &lt;/ejbjar&gt;
  240. </pre>
  241. </body>
  242. </html>