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 kB

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