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

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