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 37 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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" target="_top">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" target="_top">Weblogic</a> 4.5.1 and 5.1 EJB servers. Over time we expect further optional tasks
  27. to support additional EJB Servers.
  28. </p>
  29. <hr>
  30. <h2><a name="ejbtasks">EJB Tasks</a></h2>
  31. <table border="1" cellpadding="5">
  32. <tr><td>Task</td><td>Application Servers</td></tr>
  33. <tr><td><a href="#ddcreator">ddcreator</a></td><td>Weblogic 4.5.1</td></tr>
  34. <tr><td><a href="#ejbc">ejbc</a></td><td>Weblogic 4.5.1</td></tr>
  35. <tr><td><a href="#wlrun">wlrun</a></td><td>Weblogic 4.5.1, 5.1 &amp; 6.0</td></tr>
  36. <tr><td><a href="#wlstop">wlstop</a></td><td>Weblogic 4.5.1, 5.1 &amp; 6.0</td></tr>
  37. <tr><td><a href="#ejbjar">ejbjar</a></td><td>Weblogic 5.1 &amp; 6.0</td></tr>
  38. </table>
  39. <hr>
  40. <h2><a name="ddcreator">ddcreator</a></h2>
  41. <h3><b>Description:</b></h3>
  42. <p>ddcreator will compile a set of Weblogic text-based deployment descriptors into a serialized
  43. EJB deployment descriptor. The selection of which of the text-based descriptors are to be compiled
  44. is based on the standard Ant include and exclude selection mechanisms.
  45. </p>
  46. <h3>Parameters:</h3>
  47. <table border="1" cellpadding="2" cellspacing="0">
  48. <tr>
  49. <td valign="top"><b>Attribute</b></td>
  50. <td valign="top"><b>Description</b></td>
  51. <td align="center" valign="top"><b>Required</b></td>
  52. </tr>
  53. <tr>
  54. <td valign="top">descriptors</td>
  55. <td valign="top">This is the base directory from which descriptors are selected.</td>
  56. <td valign="top" align="center">Yes</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">dest</td>
  60. <td valign="top">The directory where the serialised deployment descriptors will be written</td>
  61. <td valign="top" align="center">Yes</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">classpath</td>
  65. <td valign="top">This is the classpath to use to run the underlying weblogic ddcreator tool.
  66. This must include the <code>weblogic.ejb.utils.DDCreator</code> class</td>
  67. <td valign="top" align="center">No</td>
  68. </tr>
  69. </table>
  70. <h3>Examples</h3>
  71. <pre>&lt;ddcreator descriptors=&quot;${dd.dir}&quot;
  72. dest=&quot;${gen.classes}&quot;
  73. classpath=&quot;${descriptorbuild.classpath}&quot;&gt;
  74. &lt;include name=&quot;*.txt&quot; /&gt;
  75. &lt;/ddcreator&gt;
  76. </pre>
  77. <hr>
  78. <h2><a name="ejbc">ejbc</a></h2>
  79. <h3><b>Description:</b></h3>
  80. <p>The ejbc task will run Weblogic's ejbc tool. This tool will take a serialised deployment descriptor,
  81. examine the various EJB interfaces and bean classes and then generate the required support classes
  82. necessary to deploy the bean in a Weblogic EJB container. This will include the RMI stubs and skeletons
  83. as well as the classes which implement the bean's home and remote interfaces.</p>
  84. <p>
  85. The ant task which runs this tool is able to compile several beans in a single operation. The beans to be
  86. compiled are selected by including their serialised deployment descriptors. The standard ant
  87. <code>include</code> and <code>exclude</code> constructs can be used to select the deployment descriptors
  88. to be included. </p>
  89. <p>
  90. Each descriptor is examined to determine whether the generated classes are out of date and need to be
  91. regenerated. The deployment descriptor is de-serialized to discover the home, remote and
  92. implementation classes. The corresponding source files are determined and checked to see their
  93. modification times. These times and the modification time of the serialised descriptor itself are
  94. compared with the modification time of the generated classes. If the generated classes are not present
  95. or are out of date, the ejbc tool is run to generate new versions.</p>
  96. <h3>Parameters:</h3>
  97. <table border="1" cellpadding="2" cellspacing="0">
  98. <tr>
  99. <td valign="top"><b>Attribute</b></td>
  100. <td valign="top"><b>Description</b></td>
  101. <td align="center" valign="top"><b>Required</b></td>
  102. </tr>
  103. <tr>
  104. <td valign="top">descriptors</td>
  105. <td valign="top">This is the base directory from which the serialised deployment descriptors are selected.</td>
  106. <td valign="top" align="center">Yes</td>
  107. </tr>
  108. <tr>
  109. <td valign="top">dest</td>
  110. <td valign="top">The base directory where the generated classes, RIM stubs and RMI skeletons are written</td>
  111. <td valign="top" align="center">Yes</td>
  112. </tr>
  113. <tr>
  114. <td valign="top">manifest</td>
  115. <td valign="top">The name of a manifest file to be written. This manifest will contain an entry for each EJB processed</td>
  116. <td valign="top" align="center">Yes</td>
  117. </tr>
  118. <tr>
  119. <td valign="top">src</td>
  120. <td valign="top">The base directory of the source tree containing the source files of the home interface,
  121. remote interface and bean implementation classes.</td>
  122. <td valign="top" align="center">Yes</td>
  123. </tr>
  124. <tr>
  125. <td valign="top">classpath</td>
  126. <td valign="top">This classpath must include both the <code>weblogic.ejbc</code> class and the
  127. classfiles of the bean, home interface, remote interface, etc of the bean being
  128. processed.</td>
  129. <td valign="top" align="center">No</td>
  130. </tr>
  131. </table>
  132. <h3>Examples</h3>
  133. <pre>&lt;ejbc descriptors=&quot;${gen.classes}&quot;
  134. src=&quot;${src.dir}&quot;
  135. dest=&quot;${gen.classes}&quot;
  136. manifest=&quot;${build.manifest}&quot;
  137. classpath=&quot;${descriptorbuild.classpath}&quot;&gt;
  138. &lt;include name=&quot;*.ser&quot; /&gt;
  139. &lt;/ejbc&gt;
  140. </pre>
  141. <hr>
  142. <h2><a name="wlrun">wlrun</a></h2>
  143. <h3><b>Description:</b></h3>
  144. <p>The <code>wlrun</code> task is used to start a weblogic server. The task runs
  145. a weblogic instance in a separate Java Virtual Machine. A number of parameters
  146. are used to control the operation of the weblogic instance. Note that the task,
  147. and hence ant, will not complete until the weblogic instance is stopped.</p>
  148. <h3>Parameters:</h3>
  149. <table border="1" cellpadding="2" cellspacing="0">
  150. <tr>
  151. <td valign="top"><b>Attribute</b></td>
  152. <td valign="top"><b>Description</b></td>
  153. <td align="center" valign="top"><b>Required for 4.5.1 and 5.1</b></td>
  154. <td align="center" valign="top"><b>Required for 6.0</b></td>
  155. </tr>
  156. <tr>
  157. <td valign="top">BEA Home</td>
  158. <td valign="top">The location of the BEA Home qwhere the server's config is defined.
  159. If this attribute is present, wlrun assumes that the server will
  160. be running under Weblogic 6.0</td>
  161. <td valign="top" align="center">N/A</td>
  162. <td valign="top" align="center">Yes</td>
  163. </tr>
  164. <tr>
  165. <td valign="top">home</td>
  166. <td valign="top">The location of the weblogic home that is to be used. This is the location
  167. where weblogic is installed.</td>
  168. <td valign="top" align="center">Yes</td>
  169. <td valign="top" align="center">Yes. Note this is the absolute location, not relative to
  170. BEA home.</td>
  171. </tr>
  172. <tr>
  173. <td valign="top">Domain</td>
  174. <td valign="top">The domain to which the server belongs.</td>
  175. <td valign="top" align="center">N/A</td>
  176. <td valign="top" align="center">Yes</td>
  177. </tr>
  178. <tr>
  179. <td valign="top">classpath</td>
  180. <td valign="top">The classpath to be used with the Java Virtual Machine that runs the Weblogic
  181. Server. Prior to Weblogic 6.0, this is typically set to the Weblogic
  182. boot classpath. Under Weblogic 6.0 this should include all the
  183. weblogic jars</td>
  184. <td valign="top" align="center">Yes</td>
  185. <td valign="top" align="center">Yes</td>
  186. </tr>
  187. <tr>
  188. <td valign="top">wlclasspath</td>
  189. <td valign="top">The weblogic classpath used by the Weblogic Server.</td>
  190. <td valign="top" align="center">No</td>
  191. <td valign="top" align="center">N/A</td>
  192. </tr>
  193. <tr>
  194. <td valign="top">properties</td>
  195. <td valign="top">The name of the server's properties file within the weblogic home directory
  196. used to control the weblogic instance.</td>
  197. <td valign="top" align="center">Yes</td>
  198. <td valign="top" align="center">N/A</td>
  199. </tr>
  200. <tr>
  201. <td valign="top">name</td>
  202. <td valign="top">The name of the weblogic server within the weblogic home which is to be run.
  203. This defaults to &quot;myserver&quot;</td>
  204. <td valign="top" align="center">No</td>
  205. <td valign="top" align="center">No</td>
  206. </tr>
  207. <tr>
  208. <td valign="top">policy</td>
  209. <td valign="top">The name of the security policy file within the weblogic home directory that
  210. is to be used. If not specified, the default policy file <code>weblogic.policy</code>
  211. is used.</td>
  212. <td valign="top" align="center">No</td>
  213. <td valign="top" align="center">No</td>
  214. </tr>
  215. <tr>
  216. <td valign="top">username</td>
  217. <td valign="top">The management username used to manage the server</td>
  218. <td valign="top" align="center">N/A</td>
  219. <td valign="top" align="center">No</td>
  220. </tr>
  221. <tr>
  222. <td valign="top">password</td>
  223. <td valign="top">The server's management password</td>
  224. <td valign="top" align="center">N/A</td>
  225. <td valign="top" align="center">Yes</td>
  226. </tr>
  227. <tr>
  228. <td valign="top">pkPassword</td>
  229. <td valign="top">The private key password so the server can decrypt the SSL
  230. private key file</td>
  231. <td valign="top" align="center">N/A</td>
  232. <td valign="top" align="center">No</td>
  233. </tr>
  234. <tr>
  235. <td valign="top">jvmargs</td>
  236. <td valign="top">Additional argument string passed to the Java Virtual Machine used to run the
  237. Weblogic instance.</td>
  238. <td valign="top" align="center">No</td>
  239. <td valign="top" align="center">No</td>
  240. </tr>
  241. <tr>
  242. <td valign="top">args</td>
  243. <td valign="top">Additional argument string passed to the Weblogic instance.</td>
  244. <td valign="top" align="center">No</td>
  245. <td valign="top" align="center">No</td>
  246. </tr>
  247. </table>
  248. <h3>Nested Elements</h3>
  249. <p>The wlrun task supports nested &lt;classpath&gt; and &lt;wlclasspath&gt;
  250. elements to set the repsective classpaths.</p>
  251. <h3>Examples</h3>
  252. <p>This example shows the use of wlrun to run a server under Weblogic 5.1</p>
  253. <pre>
  254. &lt;wlrun taskname=&quot;myserver&quot;
  255. classpath=&quot;${weblogic.boot.classpath}&quot;
  256. wlclasspath=&quot;${weblogic.classes}:${code.jars}&quot;
  257. name=&quot;myserver&quot;
  258. home=&quot;${weblogic.home}&quot;
  259. properties=&quot;myserver/myserver.properties&quot;/&gt;
  260. </pre>
  261. <p>This example shows wlrun being used to run the petstore server under
  262. Weblogic 6.0</p>
  263. <pre>
  264. &lt;wlrun taskname=&quot;petstore&quot;
  265. classpath=&quot;${weblogic.classes}&quot;
  266. name=&quot;petstoreServer&quot;
  267. domain=&quot;petstore&quot;
  268. home=&quot;${weblogic.home}&quot;
  269. password=&quot;petstorePassword&quot;
  270. beahome=&quot;${bea.home}&quot;/&gt;
  271. </pre>
  272. <hr>
  273. <h2><a name="wlstop">wlstop</a></h2>
  274. <h3><b>Description:</b></h3>
  275. <p>The <code>wlstop</code> task is used to stop a weblogic instance which is
  276. currently running. To shut down an instance you must supply both a username and
  277. a password. These will be stored in the clear in the build script used to stop
  278. the instance. For security reasons, this task is therefore only appropriate in a
  279. development environment. </p>
  280. <p>This task works for most version of Weblogic, including 6.0. You need to
  281. specify the BEA Home to have this task work correctly under 6.0</p>
  282. <h3>Parameters:</h3>
  283. <table border="1" cellpadding="2" cellspacing="0">
  284. <tr>
  285. <td valign="top"><b>Attribute</b></td>
  286. <td valign="top"><b>Description</b></td>
  287. <td align="center" valign="top"><b>Required</b></td>
  288. </tr>
  289. <tr>
  290. <td valign="top">BEAHome</td>
  291. <td valign="top">This attribute selects Weblogic 6.0 shutdown.</td>
  292. <td valign="top" align="center">No</td>
  293. </tr>
  294. <tr>
  295. <td valign="top">classpath</td>
  296. <td valign="top">The classpath to be used with the Java Virtual Machine that runs the Weblogic
  297. Shutdown comment.</td>
  298. <td valign="top" align="center">Yes</td>
  299. </tr>
  300. <tr>
  301. <td valign="top">user</td>
  302. <td valign="top">The username of the account which will be used to shutdown the server</td>
  303. <td valign="top" align="center">Yes</td>
  304. </tr>
  305. <tr>
  306. <td valign="top">password</td>
  307. <td valign="top">The password for the account specified in the user parameter.</td>
  308. <td valign="top" align="center">Yes</td>
  309. </tr>
  310. <tr>
  311. <td valign="top">url</td>
  312. <td valign="top">The URL which describes the port to which the server is listening for T3 connections.
  313. For example, t3://localhost:7001</td>
  314. <td valign="top" align="center">Yes</td>
  315. </tr>
  316. <tr>
  317. <td valign="top">delay</td>
  318. <td valign="top">The delay in seconds after which the server will stop. This defaults to an
  319. immediate shutdown.</td>
  320. <td valign="top" align="center">No</td>
  321. </tr>
  322. </table>
  323. <h3>Nested Element</h3>
  324. <p>The classpath of the welstop task can be set by a &lt;classpath&gt; nested element.</p>
  325. <h3>Examples</h3>
  326. <p>This example show the shutdown for a Weblogic 6.0 server</p>
  327. <pre>
  328. &lt;wlstop classpath=&quot;${weblogic.classes}&quot;
  329. user=&quot;system&quot;
  330. url=&quot;t3://localhost:7001&quot;
  331. password=&quot;foobar&quot;
  332. beahome=&quot;${bea.home}&quot;/&gt;
  333. </pre>
  334. <hr>
  335. <h2><a name="ejbjar">ejbjar</a></h2>
  336. <h3><b>Description:</b></h3>
  337. <p>This task is designed to support building of EJB1.1 jar files. Support is
  338. currently provided for 'vanilla' EJB1.1 jar files - i.e. those containing only
  339. the user generated class files and the standard deployment descriptor. Nested
  340. elements provide support for vendor specific deployment tools. These currently
  341. include: </p>
  342. <ul>
  343. <li>an element or building Weblogic 5.1/6.0 session/entity beans using the
  344. weblogic.ejbc tool.</li>
  345. <li>an element for building TOPLink for WebLogic 2.5.1-enabled entity beans.</li>
  346. </ul>
  347. <p>This task supports two approaches to creating ejb jar files. The first
  348. approach assumes a particular naming convention for deployment descriptor files.
  349. For an Account bean, for example, the deployment descriptor would be named
  350. <code>Account-ejb-jar.xml</code>. This naming convention allows the task to
  351. distinguish deployment descriptors without relying on their positioning within a
  352. source tree. It is also used to derive the name of the .jar file which is
  353. generated. For the example this would be <code>Account.jar</code>. Vendor
  354. specific files are assumed to be named in a similar fashion. The deployment
  355. descriptor file which defines additional weblogic specific information for the
  356. above bean would be <code>Account-weblogic-ejb-jar.xml</code>. The second
  357. approach does not require a naming convention. This approach uses a specified a
  358. jar name for the resultant ejb jar. If the jar name is present, then no naming
  359. convention is required. If the jar name is not specified, then the default
  360. naming convention is expected for the deployment descriptor files.</p>
  361. <p>The task works as a directory scanning task, and performs an action for each
  362. deployment descriptor found. As such the includes and excludes should be set
  363. to ensure that all desired EJB1.1 descriptors are found, but no application
  364. server descriptors are found. For each descriptor found, ejbjar will parse the
  365. deployment descriptor to determine the necessary class files which implement the
  366. bean. These files are assembled along with the deployment descriptors into a
  367. well formed EJB jar file. Any support files which need to be included in the
  368. generated jarcan be added with the &lt;support&gt; nested element. For each
  369. class included in the jar, ejbjar will scan for any super classes or super
  370. interfaces. These will be added to the generated jar.</p>
  371. <p>If no nested vendor-specific deployment elements are present, the task will
  372. simply generate a generic EJB jar. Such jars are typically used as the input to
  373. vendor-specific deployment tools. For each nested deployment element, a vendor
  374. specific deployment tool is run to generate a jar file ready for deployment in
  375. that vendor's EJB container. </p>
  376. <p>The jar files are only built if they are out of date. Each deployment tool
  377. element will examine its target jar file and determine if it is out of date with
  378. respect to the class files and deployment descriptors that make up the bean. If
  379. any of these files are newer than the jar file the jar will be rebuilt otherwise
  380. a message is logged that the jar file is up to date.</p>
  381. <h3>Parameters:</h3>
  382. <table border="1" cellpadding="2" cellspacing="0">
  383. <tr>
  384. <td valign="top"><b>Attribute</b></td>
  385. <td valign="top"><b>Description</b></td>
  386. <td align="center" valign="top"><b>Required</b></td>
  387. </tr>
  388. <tr>
  389. <td valign="top">descriptordir</td>
  390. <td valign="top">The base directory under which to scan for EJB
  391. deployment descriptors. If this attribute is not
  392. specified, then the deployment descriptors must be
  393. located in the directory specified by the 'srcdir'
  394. attribute.</td>
  395. <td valign="top" align="center">No</td>
  396. </tr>
  397. <tr>
  398. <td valign="top">srcdir</td>
  399. <td valign="top">The base directory containing the .class files that
  400. make up the bean. Note that this can be the same as
  401. the descriptordir if all files are in the same directory
  402. tree.</td>
  403. <td valign="top" align="center">Yes</td>
  404. </tr>
  405. <tr>
  406. <td valign="top">destdir</td>
  407. <td valign="top">The base directory into which generated jar files are
  408. deposited. Jar files are deposited in directories
  409. corresponding to their location within the descriptordir
  410. namespace. Note that this attribute is only used if the
  411. task is generating generic jars (i.e. no vendor-specific
  412. deployment elements have been specified).</td>
  413. <td valign="top" align="center">Yes</td>
  414. </tr>
  415. <tr>
  416. <td valign="top">basejarname</td>
  417. <td valign="top">The base name that is used for the generated jar files.
  418. If this attribute is specified, the generic jar file name
  419. will use this value as the prefix (followed by the value
  420. specified in the 'genericjarsuffix' attribute) and the
  421. resultant ejb jar file (followed by any suffix specified
  422. in the nested element).</td>
  423. <td valign="top" align="center">No</td>
  424. </tr>
  425. <tr>
  426. <td valign="top">basenameterminator</td>
  427. <td valign="top">String value used to substring out a string from the name
  428. of each deployment descriptor found, which is then used to
  429. locate related deployment descriptors (e.g. the WebLogic
  430. descriptors). For example, a basename of '.' and a
  431. deployment descriptor called 'FooBean.ejb-jar.xml' would
  432. result in a basename of 'FooBean' which would then be used
  433. to find FooBean.weblogic-ejb-jar.xml and
  434. FooBean.weblogic-cmp-rdbms-jar.xml, as well as to create
  435. the filenames of the jar files as FooBean-generic.jar and
  436. FooBean-wl.jar. This attribute is not used if the
  437. 'basejarname' attribute is specified.</td>
  438. <td valign="top" align="center">No, defaults to '-'.</td>
  439. </tr>
  440. <tr>
  441. <td valign="top">genericjarsuffix</td>
  442. <td valign="top">String value appended to the basename of the deployment
  443. descriptor to create the filename of the generic EJB jar
  444. file.</td>
  445. <td valign="top" align="center">No, defaults to '-generic.jar'.</td>
  446. </tr>
  447. <tr>
  448. <td valign="top">classpath</td>
  449. <td valign="top">This classpath is used when resolving classes which
  450. are to be added to the jar. Typically nested deployment
  451. tool elements will also support a classpath which
  452. will be combined with this classpath when resolving
  453. classes</td>
  454. <td valign="top" align="center">No.</td>
  455. </tr>
  456. <tr>
  457. <td valign="top">flatdestdir</td>
  458. <td valign="top">Set this attribute to true if you want all generated jars
  459. to be placed in the root of the destdir, rather than
  460. according to the location of the deployment descriptor
  461. within the descriptor dir hierarchy.</td>
  462. <td valign="top" align="center">No.</td>
  463. </tr>
  464. </table>
  465. <h3>Nested Elements</h3>
  466. <p>In addition to the vendor specific nested elements, the ejbjar task provides
  467. three nested elements. </p>
  468. <h4>Classpath</h4>
  469. <p>The &lt;classpath&gt; nested element allows the classpath
  470. to be set. It is useful when setting the classpath from a reference path. IN all
  471. othe rrespects the behaviour is the same as the classpath attribute.</p>
  472. <h4>dtd</h4>
  473. <p>The &lt;dtd&gt; element is used to specify the local location of DTDs to be
  474. used when parsing the EJB deployment descriptor. Using a local DTD is much
  475. faster than loading the DTD across the net. If you are running ejbjar behind a
  476. firewall you may not even be able to access the remote DTD. The supported
  477. vendor-specific nested elements know the location of the required DTDs within
  478. the vendor class hierarchy and, in general, this means &lt;dtd&gt; elements are
  479. not required. It does mean, however, that the vendor's class hierarchy must be
  480. available in the classpath when Ant is started. If your want to run Ant without
  481. requiring the vendor classes in the classpath, you would need to use a
  482. &lt;dtd&gt; element.</p>
  483. <table border="1" cellpadding="2" cellspacing="0">
  484. <tr>
  485. <td valign="top"><b>Attribute</b></td>
  486. <td valign="top"><b>Description</b></td>
  487. <td align="center" valign="top"><b>Required</b></td>
  488. </tr>
  489. <tr>
  490. <td valign="top">publicId</td>
  491. <td valign="top">The public Id of the DTD for which the location is being provided</td>
  492. <td align="center" valign="top">Yes</td>
  493. </tr>
  494. <tr>
  495. <td valign="top">location</td>
  496. <td valign="top">The location of the local copy of the DTD. This can either be a
  497. file or a resource loadable from the classpath.</td>
  498. <td align="center" valign="top">Yes</td>
  499. </tr>
  500. </table>
  501. <h4>support</h4>
  502. <p>The &lt;support&gt; nested element is used to supply additional classes
  503. (files) to be included in the generated jars. The &lt;support&gt; element is a
  504. FileSet, so it can either reference a fileset declared elsewehere or it can be
  505. defined in-place with the approrpiate &lt;include&gt; and &lt;exclude&gt; nested
  506. elements. The files in the support fileset are added into the generated EJB jar
  507. in the same relative location as their location within the support fileset. Note
  508. that when ejbjar generates more than one jar file, the support files are added
  509. to each one.</p>
  510. <h3>Vendor-specific deployment elements</h3>
  511. Each vendor-specific nested element controls the generation of a deployable jar
  512. specific to that vendor's EJB container. The parameters for each supported
  513. deployment element are detailed here.
  514. <h3>Weblogic element</h3>
  515. <p>The weblogic element is used to control the weblogic.ejbc compiler for
  516. generating weblogic EJB jars. Prior to Ant 1.3, the method of locating CMP
  517. descriptors was to use the ejbjar naming convention. So if your ejb-jar was
  518. called, Customer-ejb-jar.xml, your weblogic descriptor was called Customer-
  519. weblogic-ejb-jar.xml and your CMP descriptor had to be Customer-weblogic-cmp-
  520. rdbms-jar.xml. In addition, the &lt;type-storage&gt; element in the weblogic
  521. descriptor had to be set to the standard name META-INF/weblogic-cmp-rdbms-
  522. jar.xml, as that is where the CMP descriptor was mapped to in the generated
  523. jar.</p>
  524. <p>There are a few problems with this scheme. It does not allow for more than
  525. one CMP descriptor to be defined in a jar and it is not compatible with the
  526. deployment descriptors generated by some tools.</p>
  527. <p>In Ant 1.3, ejbjar parses the weblogic deployment descriptor to discover the
  528. CMP descriptors, which are then included automatically. This behaviour is
  529. controlled by the newCMP attribute. Note that if you move to the new method of
  530. determining CMP descriptors, you will need to update your weblogic deployment
  531. descriptor's &lt;type-storage&gt; element. In the above example, you would
  532. define this as META-INF/Customer-weblogic-cmp-rdbms-jar.xml.</p>
  533. <table border="1" cellpadding="2" cellspacing="0">
  534. <tr>
  535. <td valign="top"><b>Attribute</b></td>
  536. <td valign="top"><b>Description</b></td>
  537. <td align="center" valign="top"><b>Required</b></td>
  538. </tr>
  539. <tr>
  540. <td valign="top">destdir</td>
  541. <td valign="top">The base directory into which the generated weblogic ready
  542. jar files are deposited. Jar files are deposited in
  543. directories corresponding to their location within the
  544. descriptordir namespace. </td>
  545. <td valign="top" align="center">Yes</td>
  546. </tr>
  547. <tr>
  548. <td valign="top">genericjarsuffix</td>
  549. <td valign="top">A generic jar is generated as an intermediate step in
  550. build the weblogic deployment jar. The suffix used to
  551. generate the generic jar file is not particularly
  552. important unless it is desired to keep the generic
  553. jar file. It should not, however, be the same
  554. as the suffix setting.</td>
  555. <td valign="top" align="center">No, defaults to '-generic.jar'.</td>
  556. </tr>
  557. <tr>
  558. <td valign="top">suffix</td>
  559. <td valign="top">String value appended to the basename of the deployment
  560. descriptor to create the filename of the WebLogic EJB
  561. jar file.</td>
  562. <td valign="top" align="center">No, defaults to '.jar'.</td>
  563. </tr>
  564. <tr>
  565. <td valign="top">classpath</td>
  566. <td valign="top">The classpath to be used when running the weblogic ejbc
  567. tool. Note that this tool typically requires the classes
  568. that make up the bean to be available on the classpath.
  569. Currently, however, this will cause the ejbc tool to be
  570. run in a separate VM</td>
  571. <td valign="top" align="center">No</td>
  572. </tr>
  573. <tr>
  574. <td valign="top">wlclasspath</td>
  575. <td valign="top">Weblogic 6.0 will give a warning if the home and remote interfaces
  576. of a bean are on the system classpath used to run weblogic.ejbc.
  577. In that case, the standard weblogic classes should be set with
  578. this attribute (or equivalent nested element) and the
  579. home and remote interfaces located with the standard classpath
  580. attribute</td>
  581. <td valign="top" align="center">No</td>
  582. </tr>
  583. <tr>
  584. <td valign="top">keepgeneric</td>
  585. <td valign="top">This controls whether the generic file used as input to
  586. ejbc is retained.</td>
  587. <td valign="top" align="center">No, defaults to false</td>
  588. </tr>
  589. <tr>
  590. <td valign="top">compiler</td>
  591. <td valign="top">This allows for the selection of a different compiler
  592. to be used for the compilation of the generated Java
  593. files. This could be set, for example, to Jikes to
  594. compile with the Jikes compiler.</td>
  595. <td valign="top" align="center">No</td>
  596. </tr>
  597. <tr>
  598. <td valign="top">rebuild</td>
  599. <td valign="top">This flag controls whether weblogic.ejbc is always
  600. invoked to build the jar file. In certain circumstances,
  601. such as when only a bean class has been changed, the jar
  602. can be generated by merely replacing the changed classes
  603. and not rerunning ejbc. Setting this to false will reduce
  604. the time to run ejbjar.
  605. </td>
  606. <td valign="top" align="center">No, defaults to true.</td>
  607. </tr>
  608. <tr>
  609. <td valign="top">keepgenerated</td>
  610. <td valign="top">Controls whether weblogic will keep the generated Java
  611. files used to build the class files added to the
  612. jar. This can be useful when debugging
  613. </td>
  614. <td valign="top" align="center">No, defaults to false.</td>
  615. </tr>
  616. <tr>
  617. <td valign="top">args</td>
  618. <td valign="top">Any additional arguments to be passed to the weblogic.ejbc
  619. tool.
  620. </td>
  621. <td valign="top" align="center">No.</td>
  622. </tr>
  623. <tr>
  624. <td valign="top">weblogicdtd</td>
  625. <td valign="top"><b>Deprecated</b>. Defines the location of the ejb-jar DTD in
  626. the weblogic class hierarchy. This should not be necessary if you
  627. have weblogic in your classpath. If you do not, you should use a
  628. nested &lt;dtd&gt; element, described above. If you do choose
  629. to use an attribute, you should use the ejbdtd attribute in
  630. preference to this one, anyway.
  631. </td>
  632. <td valign="top" align="center">No.</td>
  633. </tr>
  634. <tr>
  635. <td valign="top">wldtd</td>
  636. <td valign="top"><b>Deprecated</b>. Defines the location of the weblogic-ejb-jar
  637. DTD which covers the Weblogic specific deployment descriptors.
  638. This should not be necessary if you have weblogic in your
  639. classpath. If you do not, you should use a nested &lt;dtd&gt;
  640. element, described above.
  641. </td>
  642. <td valign="top" align="center">No.</td>
  643. </tr>
  644. <tr>
  645. <td valign="top">ejbdtd</td>
  646. <td valign="top"><b>Deprecated</b>. Defines the location of the ejb-jar DTD in
  647. the weblogic class hierarchy. This should not be necessary if you
  648. have weblogic in your classpath. If you do not, you should use a
  649. nested &lt;dtd&gt; element, described above.
  650. </td>
  651. <td valign="top" align="center">No.</td>
  652. </tr>
  653. <tr>
  654. <td valign="top">newCMP</td>
  655. <td valign="top">If this is set to true, the ne wmethod for locating
  656. CMP descriptors will be used.</td>
  657. <td valign="top" align="center">No. Defaults to false</td>
  658. </tr>
  659. <tr>
  660. <td valign="top">oldCMP</td>
  661. <td valign="top"><b>Deprecated</b> This is an antonym for newCMP which should be used instead.</td>
  662. <td valign="top" align="center">No.</td>
  663. </tr>
  664. </table>
  665. <p>The weblogic nested element itself supports two nested elements &lt;classpath&gt; and
  666. &lt;wlclasspath&gt; which are used to set the respective classpaths. These nested elements
  667. are useful when setting up class paths using reference Ids.</p>
  668. <h3>TOPLink for Weblogic element</h3>
  669. <p>The TopLink element is used to handle beans which use Toplink for the CMP operations. It
  670. is derived from the standard weblogic element so it supports the same set of attributes please these
  671. additional attributes</p>
  672. <table border="1" cellpadding="2" cellspacing="0">
  673. <tr>
  674. <td valign="top"><b>Attribute</b></td>
  675. <td valign="top"><b>Description</b></td>
  676. <td align="center" valign="top"><b>Required</b></td>
  677. </tr>
  678. <tr>
  679. <td valign="top">toplinkdescriptor</td>
  680. <td valign="top">This specifies the name of the TOPLink deployment descriptor file contained in the
  681. 'descriptordir' directory.</td>
  682. <td valign="top" align="center">Yes</td>
  683. </tr>
  684. <tr>
  685. <td valign="top">toplinkdtd</td>
  686. <td valign="top">This specifies the location of the TOPLink DTD file. This can be a file path or
  687. a file URL. This attribute is not required, but using a local DTD is recommended.</td>
  688. <td valign="top" align="center">No, defaults to dtd file at www.objectpeople.com.</td>
  689. </tr>
  690. </table>
  691. <h3>Examples</h3>
  692. <p>This example shows ejbjar being used to generate deployment jars using a
  693. Weblogic EJB container. This example requires the naming standard to be used for
  694. the deployment descriptors. Using this format will create a ejb jar file for
  695. each variation of '*-ejb-jar.xml' that is found in the deployment descriptor
  696. directory.</p>
  697. <pre>
  698. &lt;ejbjar srcdir=&quot;${build.classes}&quot;
  699. descriptordir=&quot;${descriptor.dir}&quot;&gt;
  700. &lt;weblogic destdir=&quot;${deploymentjars.dir}&quot;
  701. classpath=&quot;${descriptorbuild.classpath}&quot;/&gt;
  702. &lt;include name=&quot;**/*-ejb-jar.xml&quot;/&gt;
  703. &lt;exclude name=&quot;**/*weblogic*.xml&quot;/&gt;
  704. &lt;/ejbjar&gt;
  705. </pre>
  706. <p>If weblogic is not in the Ant classpath, the following example
  707. shows how to specify the location of the weblogic DTDs. This
  708. example also show the use of a nested classpath element.</p>
  709. <pre>
  710. &lt;ejbjar descriptordir=&quot;${src.dir}&quot; srcdir=&quot;${build.classes}&quot;&gt;
  711. &lt;weblogic destdir=&quot;${deployment.webshop.dir}&quot;
  712. keepgeneric=&quot;true&quot;
  713. args=&quot;-g -keepgenerated ${ejbc.compiler}&quot;
  714. suffix=&quot;.jar&quot;
  715. oldCMP=&quot;false&quot;&gt;
  716. &lt;classpath&gt;
  717. &lt;pathelement path=&quot;${descriptorbuild.classpath}&quot;/&gt;
  718. &lt;/classpath&gt;
  719. &lt;/weblogic&gt;
  720. &lt;include name=&quot;**/*-ejb-jar.xml&quot;/&gt;
  721. &lt;exclude name=&quot;**/*-weblogic-ejb-jar.xml&quot;/&gt;
  722. &lt;dtd publicId=&quot;-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN&quot;
  723. location=&quot;${weblogic.home}/classes/weblogic/ejb/deployment/xml/ejb-jar.dtd&quot;/&gt;
  724. &lt;dtd publicId=&quot;-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN&quot;
  725. location=&quot;${weblogic.home}/classes/weblogic/ejb/deployment/xml/weblogic-ejb-jar.dtd&quot;/&gt;
  726. &lt;/ejbjar&gt;
  727. </pre>
  728. <p>This example shows ejbjar being used to generate a single deployment jar
  729. using a Weblogic EJB container. This example does not require the deployment
  730. descriptors to use the naming standard. This will create only one ejb jar file -
  731. 'TheEJBJar.jar'.</p>
  732. <pre>
  733. &lt;ejbjar srcdir=&quot;${build.classes}&quot;
  734. descriptordir=&quot;${descriptor.dir}&quot;
  735. basejarname=&quot;TheEJBJar&quot;&gt;
  736. &lt;weblogic destdir=&quot;${deploymentjars.dir}&quot;
  737. classpath=&quot;${descriptorbuild.classpath}&quot;/&gt;
  738. &lt;include name=&quot;**/ejb-jar.xml&quot;/&gt;
  739. &lt;exclude name=&quot;**/weblogic*.xml&quot;/&gt;
  740. &lt;/ejbjar&gt;
  741. </pre>
  742. <p>This example shows ejbjar being used to generate deployment jars for a TOPLink-enabled entity bean using a
  743. Weblogic EJB container. This example does not require the deployment descriptors to use the naming standard.
  744. This will create only one TOPLink-enabled ejb jar file - 'Address.jar'.</p>
  745. <pre>
  746. &lt;ejbjar srcdir=&quot;${build.dir}&quot;
  747. destdir=&quot;${solant.ejb.dir}&quot;
  748. descriptordir=&quot;${descriptor.dir}&quot;
  749. basejarname=&quot;Address&quot;&gt;
  750. &lt;weblogictoplink destdir=&quot;${solant.ejb.dir}&quot;
  751. classpath=&quot;${java.class.path}&quot;
  752. keepgeneric=&quot;false&quot;
  753. toplinkdescriptor=&quot;Address.xml&quot;
  754. toplinkdtd=&quot;file:///dtdfiles/toplink-cmp_2_5_1.dtd&quot;
  755. suffix=&quot;.jar&quot;/&gt;
  756. &lt;include name=&quot;**/ejb-jar.xml&quot;/&gt;
  757. &lt;exclude name=&quot;**/weblogic-ejb-jar.xml&quot;/&gt;
  758. &lt;/ejbjar&gt;
  759. </pre>
  760. <p>This final example shows how you would set-up ejbjar under Weblogic 6.0. It also shows the use of the
  761. &lt;support&gt; element to add support files
  762. <pre>
  763. &lt;ejbjar descriptordir=&quot;${dd.dir}&quot; srcdir=&quot;${build.classes.server}&quot;&gt;
  764. &lt;include name=&quot;**/*-ejb-jar.xml&quot;/&gt;
  765. &lt;exclude name=&quot;**/*-weblogic-ejb-jar.xml&quot;/&gt;
  766. &lt;support dir=&quot;${build.classes.server}&quot;&gt;
  767. &lt;include name=&quot;**/*.class&quot;/&gt;
  768. &lt;/support&gt;
  769. &lt;weblogic destdir=&quot;${deployment.dir}&quot;
  770. keepgeneric=&quot;true&quot;
  771. suffix=&quot;.jar&quot;
  772. rebuild=&quot;false&quot;&gt;
  773. &lt;classpath&gt;
  774. &lt;pathelement path=&quot;${build.classes.server}&quot;/&gt;
  775. &lt;/classpath&gt;
  776. &lt;wlclasspath&gt;
  777. &lt;pathelement path=&quot;${weblogic.classes}&quot;/&gt;
  778. &lt;/wlclasspath&gt;
  779. &lt;/weblogic&gt;
  780. &lt;/ejbjar&gt;
  781. </pre>
  782. </body>
  783. </html>