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 14 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. Nested elements provide support for vendor
  153. specific deployment tools. Currently a nested element is provided for Weblogic 5.1 using the
  154. weblogic.ejbc tool.</p>
  155. <p>This task assumes a particular naming convention for deployment descriptor files. For an
  156. Account bean, for example, the deployment descriptor would be named <code>Account-ejb-jar.xml</code>.
  157. This naming convention allows the task to distinguish deployment descriptors without relying on
  158. their positioning within a source tree. It is also used to derive the name of the .jar file
  159. which is generated. For the example this would be <code>Account.jar</code>. Vendor specific files
  160. are assumed to be named in a similar fashion. The deployment descriptor file which defines
  161. additional weblogic specific information for the above bean would be
  162. <code>Account-weblogic-ejb-jar.xml</code>.
  163. <p>The task works as a directory scanning task, and performs an action for each deployment descriptor
  164. found. As such the includes and excludes should be set to ensure that all desired EJB1.1
  165. descriptors are found, but no application server descriptors are found. For each descriptor
  166. found, ejbjar will parse the deployment descriptor to determine the necessary class files which
  167. implement the bean. These files are assembled along with the deployment descriptors into a well
  168. formed EJB jar file. Note that support classes used by the bean but which are not part of the
  169. bean's interfaces are not included in the assembled jar. These need to be collected into a
  170. separate support jar file.</p>
  171. <p>If no nested vendor-specific deployment elements are present, the task will simply generate a
  172. generic EJB jar. Such jars are typically used as the input to vendor-specific deployment tools.
  173. For each nested deployment element, a vendor specific deployment tool is run to generate a jar file
  174. ready for deployment in that vendor's EJB container. Note that at this time the only supported tool is
  175. Weblogic's ejbc tool.
  176. <p>The jar files are only built if they are out of date. Each deployment tool element will examine
  177. its target jar file and determine if it is out of date with respect to the class files and
  178. deployment descriptors that make up the bean. If any of these files are newer than the jar file
  179. the jar will be rebuilt otherwise a message is logged that the jar file is up to date.</p>
  180. <h3>Parameters:</h3>
  181. <table border="1" cellpadding="2" cellspacing="0">
  182. <tr>
  183. <td valign="top"><b>Attribute</b></td>
  184. <td valign="top"><b>Description</b></td>
  185. <td align="center" valign="top"><b>Required</b></td>
  186. </tr>
  187. <tr>
  188. <td valign="top">descriptordir</td>
  189. <td valign="top">The base directory under which to scan for EJB deployment descriptors.</td>
  190. <td valign="top" align="center">Yes</td>
  191. </tr>
  192. <tr>
  193. <td valign="top">srcdir</td>
  194. <td valign="top">The base directory containg the .class files that make up the bean.
  195. Note that this can be the same as the descrptordir if all files are
  196. in the same directory tree.</td>
  197. <td valign="top" align="center">Yes</td>
  198. </tr>
  199. <tr>
  200. <td valign="top">destdir</td>
  201. <td valign="top">The base directory into which generated jar files are deposited. Jar files are deposited in
  202. directories correpsonding to their location within the descriptordir namespace. Note that
  203. this attribute is only used if the task is generating generic jars (i.e. no vendor-specific
  204. deployment elements have been specified).</td>
  205. <td valign="top" align="center">Yes</td>
  206. </tr>
  207. <tr>
  208. <td valign="top">basenameterminator</td>
  209. <td valign="top">String value used to substring out a string from the name of each deployment descriptor found,
  210. which is then used to locate related deployment descriptors (e.g. the WebLogic descriptors).
  211. For example, a basename of '.' and a deployment descriptor called 'FooBean.ejb-jar.xml' would
  212. result in a basename of 'FooBean' which would then be used to find FooBean.weblogic-ejb-jar.xml
  213. and FooBean.weblogic-cmp-rdbms-jar.xml, as well as to create the filenames of the jar files as
  214. FooBean-generic.jar and FooBean-wl.jar.</td>
  215. <td valign="top" align="center">No, defaults to '-'.</td>
  216. </tr>
  217. <tr>
  218. <td valign="top">genericjarsuffix</td>
  219. <td valign="top">String value appended to the basename of the deployment descriptor to create the filename of the
  220. generic EJB jar file.</td>
  221. <td valign="top" align="center">No, defaults to '-generic.jar'.</td>
  222. </tr>
  223. </table>
  224. <h3>Vendor-specific deployment elements</h3>
  225. Each vendor-specific nested element controls the generation of a deployable jar specific to that vendor's
  226. EJB container. The parameters for each supported deployment element are detailed here.
  227. <h3>Weblogic element</h3>
  228. <table border="1" cellpadding="2" cellspacing="0">
  229. <tr>
  230. <td valign="top"><b>Attribute</b></td>
  231. <td valign="top"><b>Description</b></td>
  232. <td align="center" valign="top"><b>Required</b></td>
  233. </tr>
  234. <tr>
  235. <td valign="top">destdir</td>
  236. <td valign="top">The base directory into which the generated weblogic ready jar files are deposited. Jar files are deposited in
  237. directories correpsonding to their location within the descriptordir namespace. </td>
  238. <td valign="top" align="center">Yes</td>
  239. </tr>
  240. <tr>
  241. <td valign="top">genericjarsuffix</td>
  242. <td valign="top">A generic jar is generated as an intermeditate step in build the weblogic deployment
  243. jar. The suffix used to generate the generic jar file is not particularly important
  244. unless it is desired to keep the generic jar file. It should not, however, be the same
  245. as the suffix setting.</td>
  246. <td valign="top" align="center">No, defaults to '-generic.jar'.</td>
  247. </tr>
  248. <tr>
  249. <td valign="top">suffix</td>
  250. <td valign="top">String value appended to the basename of the deployment descriptor to create the filename of the
  251. WebLogic EJB jar file.</td>
  252. <td valign="top" align="center">No, defaults to '.jar'.</td>
  253. </tr>
  254. <tr>
  255. <td valign="top">classpath</td>
  256. <td valign="top">The classpath to be used when running the weblogic ejbc tool. Note that this tool
  257. typically requires the classes that make up the bean to be available on the classpath.
  258. Currently, however, this will cause the ejbc tool to be run in a separate VM</td>
  259. <td valign="top" align="center">No</td>
  260. </tr>
  261. <tr>
  262. <td valign="top">keepgeneric</td>
  263. <td valign="top">This controls whether the generic fiule used as input to ejbc is retained.</td>
  264. <td valign="top" align="center">No, defaults to false</td>
  265. </tr>
  266. </table>
  267. <h3>Examples</h3>
  268. This example shows ejbjar being used to generate deployment jars for a Weblogic EJB container.
  269. <pre>
  270. &lt;ejbjar srcdir="${build.classes}"
  271. descriptordir="${descriptor.dir}"&gt;
  272. &lt;weblogic destdir="${deploymentjars.dir}"
  273. classpath="${descriptorbuild.classpath}"/&gt;
  274. &lt;include name="**/*-ejb-jar.xml"/&gt;
  275. &lt;exclude name="**/*weblogic*.xml"/&gt;
  276. &lt;/ejbjar&gt;
  277. </pre>
  278. </body>
  279. </html>