source: other-projects/trunk/realistic-books/packages/AntInstaller/web/manual-print.html@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 69.5 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4 <title>Ant Installer</title>
5 <link href="style-print.css" type="text/css" rel="stylesheet">
6 <link rel="SHORTCUT ICON" href="images/antinstaller-icon.png">
7 <meta name="keywords"
8 content="Ant, installer, AntInstaller, gui, console, input, parameters, properties, swing, user interface, validation, configuration">
9</head>
10<body>
11 <div class="tpheadertitle">AntInstaller</div>
12 <div class="tpcontent">
13<!-- JSP start -->
14
15
16<h2>Manual</h2>
17
18To set up an AntInstall there are a few requirements.
19 <ul>
20 <li>The <a href="#config"><code>antinstall-config.xml</code></a> file to describe
21 the installation</li>
22 <li>The <a href="#configbuild"><code>build.xml</code></a> ant script to run, with targets
23 that should match values in <code>antinstall-config.xml</code> </li>
24 <li>The resources to run the installer e.g. ant-installer.jar
25 and ant.jar</li>
26 <li>The binarires and resources to install for your application</li>
27 <li>The installer can be delivered as a <a href="#extractor">self extracting JAR</a> which extracts all the files on the target machine prior to running the installer.</li>
28 <li>The installer can be run directly from the Jar so the resources are not extracted until Ant is run. This is the recommended way to package an installer, see <a href="#non-extractor">non extracting JAR</a>.</li>
29 <li>All config files, classes and resources should then be packaged into a jar, this can be easily achieved with a dedicated <a href="installertask.html">Ant task</a>.</li>
30 <li>If not using a self or non extracting jar, <a href="#scripts">scripts</a> to run the installer would be required e.g. <code>install.sh</code></li>
31 </ul>
32 <a name="config"></a>
33 <h3><code>antinstall-config.xml</code></h3>
34
35This part of the guide is the reference manual for the
36configuration of <code>antinstall-config.xml</code>. The config file
37is an XML file that describes the pages to display to the user,
38and the input the user must enter. <br/>
39A simple example might be a License page to show the license of the
40software, followed by a page asking the user for their name and email.
41The next page would allow the user to choose the components to install
42(binaries, source, documentation) and the progress page with an install
43button to perform the installation. <br/>
44 <br/>
45The config file must always have a root element installer with some
46requried attributes as follows. <br/>
47 <br/>
48 <pre>&lt;installer<br/> ui="swing,text"<br/> verbose="false"<br/> lookAndFeel="com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"<br/> name="Test Installer"<br/> windowIcon="/resources/gkmain_inv.png"<br/> defaultImageResource="/resources/greens.png"<br/> minJavaVersion="1.4"&gt;<br/> ...<br/> </pre>
49The file is then made up of <code>page</code> elements containing <code>input</code>
50elements.
51<br/>The last page of the installer must be a <a href="#pageprogress">Progress Page</a>.
52If packaging the installer with the <a href="installertask.html">Ant task</a> the <code>antinstall-config.xml</code> file can be validated.<br/>
53When setting values, similar to Ant, ${my.property} syntax can be used for default values and comments, see <a href="#refs">dynamic references</a>.<br/>
54To determin which pages are shown and which are ommitted, see <a href="#pagedisplay">Page displaying</a>.<br/><br/>
55<div class="tpnoprint">
56An example antinstall-config.xml file can be seen <a href="antinstall-config-example.html" title="Example config" >here</a>.
57
58 <br/><br/>
59 <ul>
60 <li><a href="#installer">Installer</a></li>
61 <li><a href="#page">Pages</a>
62 <ul>
63 <li><a href="#pagesplash">Splash Page</a></li>
64 <li><a href="#pagelicense">License Page</a></li>
65 <li><a href="#pageinput">Input Page</a></li>
66 <li><a href="#pageprogress">Progress Page</a></li>
67 </ul>
68 </li>
69 <li><a href="#inputtypes">Input types</a>
70 <ul>
71 <li>Text fields
72 <ul>
73 <li><a href="#comment">Comment</a></li>
74 <li><a href="#text">Unvalidated Text</a></li>
75 <li><a href="#validated">Validated Text</a></li>
76 <li><a href="#extvalidated">Externally Validated Text</a></li>
77 <li><a href="#date">Date</a></li>
78 <li><a href="#password">Password Text</a></li>
79 <li><a href="#password-confirm">Confirm Password</a></li>
80 </ul>
81 </li>
82 <li>Target fields
83 <ul>
84 <li><a href="#target">Target</a></li>
85 <li><a href="#target-select">Target Select</a></li>
86 </ul>
87 </li>
88 <li>File fields
89 <ul>
90 <li><a href="#file">File</a></li>
91 <li><a href="#directory">Directory</a></li>
92 <li><a href="#app-root">Application Root</a></li>
93 </ul>
94 </li>
95 <li>Selection fields
96 <ul>
97 <li><a href="#checkbox">Checkbox</a></li>
98 <li><a href="#select">Select</a></li>
99 <li><a href="#large-select">Large Select</a></li>
100 </ul>
101 </li>
102 </ul>
103 </li>
104 <li><a href="#hiddentypes">Hidden elements</a>
105 <ul>
106 <li><a href="#conditional">Conditional</a></li>
107 <li><a href="#hidden">Hidden</a></li>
108 </ul>
109 </li>
110 </ul>
111</div>
112 <br/>
113 <table class="manual" cellspacing="0">
114 <tbody>
115 <tr class="tpheader">
116 <th class="manual" colspan="3"><a name="installer">&lt;installer&gt;</a></th>
117 </tr>
118 <tr>
119 <td colspan="3">The <code>installer</code> element is
120the root element of the config and has the following attributes.</td>
121 </tr>
122 <tr class="tpheader">
123 <th class="manual2">Attribute</th>
124 <th class="manual2">Description</th>
125 <th class="manual2">Example</th>
126 </tr>
127 <tr>
128 <td>ui</td>
129 <td>Indicates the supported installation modes from the following four values <i>text</i>, <i>swing</i>, <i>swing-auto</i> and <i>text-auto</i>. <i>swing</i> indicates the GUI can be shown, <i>text</i> means the commandline interface can be shown. <a href="auto.html" title="-auto installs"><i>-auto</i> installs</a> are silent installs that read the properties from a file, if available, instead of running the full UI. Ensure you understand the consequences before enabling <i>-auto</i> builds. <br/>
130 This attribute should be a comma separated list of values (whitespace is stripped).</td>
131 <td>swing,text, text-auto,swing-auto</td>
132 </tr>
133 <tr>
134 <td>loadDefaults</td>
135 <td>This flag can be true, false or prompt. Indicates what AntInstaller should do
136 if it finds existing properties in a file.</td>
137 <td>false</td>
138 </tr>
139 <tr>
140 <td>verbose</td>
141 <td>Print more info the the install log file and more
142info in the <code>ant.install.properties</code> file. N.B. the properties file may not be written if the installer
143can not write to the current directory.</td>
144 <td>true</td>
145 </tr>
146 <tr>
147 <td>debug</td>
148 <td>Setting this flag prevents the temporary directory from being deleted on exit, this is useful for debugging
149 install scripts. It should normally be set to false or ommited for a final installer. </td>
150 <td>false</td>
151 </tr>
152 <tr>
153 <td>lookAndFeel</td>
154 <td>The <a href="lookandfeels.html" title="LookAndFeel">LookAndFeel</a> class for the installer or one of the following special values.
155<ul>
156 <li><code>"null"</code> - The string "null" is used to set the default LookAndFeel determined by Java (no extra classes required)</li>
157 <li><code>"jgoodies"</code> - Used to set the default LookAndFeel for AntInstaller org.tp23.jgoodies.plaf.plastic.PlasticXPLookAndFeel
158 (<code>jgoodies-edited-1_2_2.jar</code> or it contents must be on the classpath)</li>
159 <li><code>"native"</code> - Used to set the native LookAndFeel for the runtime Operating System (no extra classes required)</li>
160 <li><code>"greymetal"</code> - Used to set the cutdown MetalLookAndFeel included with AntInstaller. This is the same as MetalLookAndFeel with a grey theme and no bold fonts unless specified in the <code>antinstall-config.xml</code> file (no extra classes required)</li>
161</ul>
162If the lookAndFeel attribute is missing <code>jgoodies</code> is assumed. If the LookAndFeel can not be loaded a message will be added to the log file and the install will continue with the Java default.
163 </td>
164 <td>
165 greymetal<br/>
166 jgoodies</td>
167 </tr>
168 <tr>
169 <td>name</td>
170 <td>The name of the installer, this will appear in the
171title of the installer GUI window.</td>
172 <td>My Installer</td>
173 </tr>
174 <tr>
175 <td>windowIcon</td>
176 <td>This is the resource name of the icon for the
177installer window. It is a string that is used to load the resource from
178the classpath so the image must be in one of the jars on the classpath
179of the install start script. In the self installer it must be in the correct directory
180of the Jar.</td>
181 <td>/resources/gkmain_inv.png</td>
182 </tr>
183 <tr>
184 <td>defaultImageResource</td>
185 <td>This is the resource image used for the top of the
186installer GUI by default, it can be overridden for individual pages.</td>
187 <td>/resources/greens.png</td>
188 </tr>
189 <tr>
190 <td>minJavaVersion</td>
191 <td>The minimum Java version for the installer, this is
192supported as of AntInstaller 0.8beta do disable this feature remove the attribute.</td>
193 <td>1.4</td>
194 </tr>
195 <tr>
196 <td>finishButtonText</td>
197 <td>The text displayed on the install button. If not specified, the default is "Install". This has been
198 added since Antinstaller can be used as a GUI for other Ant builds, in which case "Build" would
199 be more appropriate.</td>
200 <td>Install</td>
201 </tr>
202 <tr>
203 <td>antialiased</td>
204 <td>If this attribute is set to <code>true</code> and the LookAndFeel is <code>org.tp23.jgoodies.plaf.plastic.PlasticXPLookAndFeel</code> or <code>jgoodies</code> the Swing GUI will render using Java 2D antialiasing for the text. This is resource intensive and may slow the GUI down unacceptably on older PCs, but does look better.</td>
205 <td>false</td>
206 </tr>
207 <tr>
208 <td>wide</td>
209 <td>If this attribute is set the width of the installer GUI can be configured. The format is
210 <code>[window-size]:[label-width]</code></td>
211 <td>600:275</td>
212 </tr>
213 <tr>
214 <td>version</td>
215 <td>Defines a version for the installer, this attribute is optional and defaults to "0.0". However, if you want to support <a href="auto.html">automatic installs</a> (ui includes text-auto or swing-auto) this can be used to indicate that a new installer is not compatible with previous properties files. If a new installer for an application is developed that requires new properties increment the major version and old properties files will not be loaded. Increment the minor version if the properties are compatible but additional properties have been added and must be maually entered, text-auto and swing-auto builds will be forbidden. <br/>
216 If the new version of the installer is a compatible version with the properties file found, it will load without errors. No checking is done to ensure that this is logical. When delivering upgraded installers you should ensure that old properties file versions are compatible if you do not increment the version and support automatic installs.</td>
217 <td>1.0.2</td>
218 </tr>
219 </tbody>
220 </table>
221 <br/>
222 <br/>
223 <table class="manual" cellspacing="0">
224 <tbody>
225 <tr class="tpheader">
226 <th class="manual" colspan="3"><a name="page">&lt;page&gt;</a></th>
227 </tr>
228 <tr>
229 <td colspan="3">Pages entries in the XML file represent a
230single window in the installer moved through by the user by selecting
231"Next &gt;&gt;" (or pressing enter) all pages have the following
232atributes.</td>
233 </tr>
234 <tr class="tpheader">
235 <th class="manual2">Attribute</th>
236 <th class="manual2">Description</th>
237 <th class="manual2">Example</th>
238 </tr>
239 <tr>
240 <td><b>type</b></td>
241 <td>The type of page one of four options, progress,
242license, splash or input.</td>
243 <td>input</td>
244 </tr>
245 <tr>
246 <td>name</td>
247 <td>A unique name for the page.</td>
248 <td>User properties</td>
249 </tr>
250 <tr>
251 <td>displayText</td>
252 <td>The text to be shown at the top of the page.</td>
253 <td>Install Options</td>
254 </tr>
255 <tr>
256 <td>imageResource</td>
257 <td>The image to be shown at the top of the page, overriding the defaultImageResource defined
258 in the installer element.</td>
259 <td>Install Options</td>
260 </tr>
261 <tr>
262 <td>target</td>
263 <td>An ant target that will always be run from the <code>build.xml</code>
264file. This attribute is optional see the Target input type if you wish
265to show a targets that can be selected by the user.</td>
266 <td>clean</td>
267 </tr>
268 <tr>
269 <td>overflow</td>
270 <td>Setting this to true causes the Swing GUI to allow the page to extend past the normal height and for scrollbars
271 to be shown when the page overflows.</td>
272 <td>true</td>
273 </tr>
274 </tbody>
275 </table>
276 <br/>
277 <br/>
278 <table class="manual" cellspacing="0">
279 <tbody>
280 <tr class="tpheader">
281 <th class="manual" colspan="3"><a name="pagesplash">&lt;page
282type="splash"&gt;</a></th>
283 </tr>
284 <tr>
285 <td colspan="3">Displays a graphical image page in the Swing GUI</td>
286 </tr>
287 <tr class="tpheader">
288 <th class="manual2">Attribute</th>
289 <th class="manual2">Description</th>
290 <th class="manual2">Example</th>
291 </tr>
292 <tr>
293 <td>splashResource</td>
294 <td>The image resource used for the splash image. The resource must be available on the classpath
295 at runtime.</td>
296 <td>/resources/large-logo-image.png</td>
297 </tr>
298 <tr>
299 <td>altText</td>
300 <td>Alternative text for the console mode</td>
301 <td>Welcome to the installer app</td>
302 </tr>
303 </tbody>
304 </table>
305 <br/>
306 <br/>
307 <table class="manual" cellspacing="0">
308 <tbody>
309 <tr class="tpheader">
310 <th class="manual" colspan="3"><a name="pagetext">&lt;page
311type="text"&gt;</a></th>
312 </tr>
313 <tr>
314 <td colspan="3">Displays an HTML page in swing and a text file in text mode.</td>
315 </tr>
316 <tr class="tpheader">
317 <th class="manual2">Attribute</th>
318 <th class="manual2">Description</th>
319 <th class="manual2">Example</th>
320 </tr>
321 <tr>
322 <td>htmlResource</td>
323 <td>The resource used for the html page. The resource must be available on the classpath at runtime. <br/>
324 The HTML support is that of the Swing JTextPane which is very basic. Embeded images and style sheets are refereced from the classpath. The following HTML will display an image from the classpath. <br/>
325 <code>&lt;img src="/resources/image.png"&gt;</code><br/>
326 Property values are expanded in the file if variables of the form <code>${java.user.name}</code> are found.<br/>
327 </td>
328 <td>/resources/text.html</td>
329 </tr>
330 <tr>
331 <td>textResource</td>
332 <td>Alternative text for the console mode. <br/>
333 Property values are expanded in the file if a variable of the form ${java.user.name} are found.<br/></td>
334 <td>/resources/text.text</td>
335 </tr>
336 </tbody>
337 </table>
338 <br/>
339 <br/>
340 <table class="manual" cellspacing="0">
341 <tbody>
342 <tr class="tpheader">
343 <th class="manual" colspan="3"><a name="pagelicense">&lt;page
344type="license"&gt;</a></th>
345 </tr>
346 <tr>
347 <td colspan="3">Shows a single license file in a
348scrollable window to the user.</td>
349 </tr>
350 <tr class="tpheader">
351 <th class="manual2">Attribute</th>
352 <th class="manual2">Description</th>
353 <th class="manual2">Example</th>
354 </tr>
355 <tr>
356 <td>resource</td>
357 <td>The license text file resource, must be on the
358classpath.</td>
359 <td>/resources/GPL.txt</td>
360 </tr>
361 <tr>
362 <td>usePaging</td>
363 <td>In text mode this parameter stops the scrolling of the license text at 20 lines,
364 and provides options to view the next page or skip to the end. The default is false.</td>
365 <td>true</td>
366 </tr>
367 </tbody>
368 </table>
369 <br/>
370 <br/>
371 <table class="manual" cellspacing="0">
372 <tbody>
373 <tr class="tpheader">
374 <th class="manual" colspan="3"><a name="pageinput">&lt;page
375type="input"&gt;</a>
376 </th>
377 <tr>
378 <td colspan="3">A page for adding input types listed
379below. An installer can have as many input pages as desired. </td>
380 </tr>
381 <tr class="tpheader">
382 <th class="manual2">Attribute</th>
383 <th class="manual2">Description</th>
384 <th class="manual2">Example</th>
385 </tr>
386 <tr>
387 <td>ifTarget</td>
388 <td>This page will be show if the named target has previously been selected. This can be used to
389 conditionally show installation pages when certain parts of the <code>build.xml</code> script are to be run and not
390 if they are to be omitted.</td>
391 <td>documentation</td>
392 </tr>
393 <tr>
394 <td><a name="ifproperty">ifProperty</a></td>
395 <td>This page will be shown if the property has the correct value. This can be used to
396 conditionally show installation pages when certain properties match
397 The format of the property can be as simple as <code>${name}=value</code> or can combine tests on multiple properties such as <code>(${name}!=value) AND (${name2}^=value2)</code>. There must be no spaces
398 and both the property and value are case sensitive. It is a good idea to use a <code>select</code> input type
399 for the value since free text entered by the user is unlikely to match exactly in case and whitespace or use validated
400 text fields.
401N.B. to run tasks based on properties consider the <a href="http://ant-contrib.sourceforge.net">ant-contrib</a> packages. <br/>
402 The new syntax allows for environment variable checks such as <code>${env.DISPLAY}=:0.0</code>
403 <br/><br/>
404 <b>N.B. the old syntax <code>name=value</code> does not work any more.</b> It is <b>not</b> possible to
405 place an = sign in a property name.<br/>
406 e.g. <code>${prop.col=back}=#0000FF</code> will break the simple parser.
407 <br/><br/>
408 The following operators are supported:
409 <ul>
410 <li> = equals. not assignment as in Java</li>
411 <li> == equals same as above for those that wish to be specific</li>
412 <li> != not equals or null</li>
413 <li> $= ends with, the $ is used from regex for end of line</li>
414 <li> ^= starts with, again ^from regular expressions</li>
415 <li> += greater than, only for numbers</li>
416 <li> -= less than, only for numbers. The installer should validate to ensure the property is a valid number
417 or exceptions will be thrown. The rather strange -= and += syntax is used because &gt; and &lt;
418 must be escaped to &amp;gt; and &amp;lt; in XML attributes and the legibility
419 of the configuration files would be impared.</li>
420 <li> !=null not null, the property must be specified. This is usefull for testing the existence of environment variable for example ${env.ANT_HOME}!=null. N.B. the empty string "" also tests to null, if a property exists
421 in the config file it <b>is</b> possible for the user to set the value to null by erasing the text in
422 a text entry type</li>
423 <li> ==null is null or empty</li>
424 </ul>
425 <br/><br/>
426 The following logical operators are supported when combining property tests:
427 <ul>
428 <li>AND</li>
429 <li>OR</li>
430 </ul>
431 If logical operators are being used, each simple test must be enclosed in parentheses.<br/>
432 It is probably a bad idea to use any character that is not a letter or number in a property name
433 because these operators may be extended in the future
434 </td>
435 <td>${myProperty}=value23<br/>
436 (${myFirstProperty}=6) OR (${mySecondProperty}+=12)
437 </td>
438 </tr>
439 <tr>
440 <td>postDisplayTarget</td>
441 <td>Post display targets are special Ant targets run after the page has been displayed. Certain rules apply see <a href="posttargets.html" title="post display targets">post display targets</a></td>
442 <td>antinstaller-pagename</td>
443 </tr>
444
445 </tbody>
446 </table>
447 <br/>
448 <br/>
449 <table class="manual" cellspacing="0">
450 <tbody>
451 <tr class="tpheader">
452 <th class="manual" colspan="3"><a name="pageprogress">&lt;page
453type="progress"&gt;</a></th>
454 </tr>
455 <tr>
456 <td colspan="3">A page for showing the user the progress
457of the installation. This page contains the "Install" Button, so all
458installers should end with a progress page. Currently it is not checked
459that an installer ends with a progress page so the creator of the <code>antinstall-config.xml</code>
460should ensure it does.</td>
461 </tr>
462 <tr>
463 <td>showTargets</td>
464 <td>When this flag is true, in the Swing GUI, a graphical representation of
465 the targets being run and the dependent targets found is displayed.</td>
466 <td>true</td>
467 </tr>
468 </tbody>
469 </table>
470<br/><a name="inputtypes"></a><h3>Input Types</h3>
471Input types represent fields in which users can input values or make selections. <br/>
472The input type element is
473also used to display text to the user. While there is no limit to the number of comments or text you can add in the
474config file, the GUI only has a limited amount of space. Check your config with your choosen Look And Feel to ensure
475that instructions are not cropped.<br/>
476All input types accept the <code>explanatoryText</code> attribute, where multi-line comments can be added.
477The GUI has a fixed width available for the <code>displayText</code> attribute which often does not provide much space.
478Single line comments can be added with the <code>comment</code> type.<br/>
479If anyone has a serious requirement to include more text that is currently possible post an RFE and I will look into
480tool tip popups or a scrollable text box or perhaps instructions that can launch in a help window. This has not been added yet
481since it is much more difficult to implement in the command line UI, and as yet we have no requirement.
482<br/><br/>
483 <table class="manual" cellspacing="0">
484 <tbody>
485 <tr class="tpheader">
486 <th class="manual" colspan="3"><a name="checkbox">&lt;checkbox&gt;</a></th>
487 </tr>
488 <tr>
489 <td colspan="3">The check box input is used for boolean
490input, a check box in the gui and a true false option on the command
491line.</td>
492 </tr>
493 <tr class="tpheader">
494 <th class="manual2">Attribute</th>
495 <th class="manual2">Description</th>
496 <th class="manual2">Example</th>
497 </tr>
498 <tr>
499 <td>property</td>
500 <td>The name of the property to be set in the <code>ant.install.properties</code>
501file the value will be true or false.</td>
502 <td>my.property</td>
503 </tr>
504 <tr>
505 <td>displayText</td>
506 <td>The text to be shown describing the option.</td>
507 <td>Enable all security options</td>
508 </tr>
509 <tr>
510 <td>defaultValue</td>
511 <td>The default for the check box.</td>
512 <td>true</td>
513 </tr>
514 <tr>
515 <td>force</td>
516 <td>Force the option selected to be the default value.
517This can be used to indicate that the option is required. For example,
518an installer could be delivered where "Enable all security options" is
519always selected.</td>
520 <td>false</td>
521 </tr>
522 </tbody>
523 </table>
524 <br/>
525 <table class="manual" cellspacing="0">
526 <tbody>
527 <tr class="tpheader">
528 <th class="manual" colspan="3"><a name="comment">&lt;comment&gt;</a></th>
529 </tr>
530 <tr>
531 <td colspan="3">The comment input displays text to the
532user and does not accept any type of input.</td>
533 </tr>
534 <tr class="tpheader">
535 <th class="manual2">Attribute</th>
536 <th class="manual2">Description</th>
537 <th class="manual2">Example</th>
538 </tr>
539 <tr>
540 <td>displayText</td>
541 <td>The text to be shown describing the option.</td>
542 <td>W</td>
543 </tr>
544 <tr>
545 <td>bold</td>
546 <td>Display the comment in bold, in the GUI version.</td>
547 <td>true</td>
548 </tr>
549 <tr>
550 <td>title</td>
551 <td>Display the comment in a larger font in the GUI or in
552capitals in the command line.</td>
553 <td>false</td>
554 </tr>
555 </tbody>
556 </table>
557 <br/>
558 <table class="manual" cellspacing="0">
559 <tbody>
560 <tr class="tpheader">
561 <th class="manual" colspan="3"><a name="directory">&lt;directory&gt;</a></th>
562 </tr>
563 <tr>
564 <td colspan="3">The directory input allows the user to
565select a directory.</td>
566 </tr>
567 <tr class="tpheader">
568 <th class="manual2">Attribute</th>
569 <th class="manual2">Description</th>
570 <th class="manual2">Example</th>
571 </tr>
572 <tr>
573 <td>property</td>
574 <td>The name of the property to be set in the <code>ant.install.properties</code>
575file the value will be the absolute path to the directory.</td>
576 <td>file.property</td>
577 </tr>
578 <tr>
579 <td>displayText</td>
580 <td>The text to be shown describing the option.</td>
581 <td>Select an installation directory</td>
582 </tr>
583 <tr>
584 <td>defaultValue</td>
585 <td>The default for the directory. Empty defaultValue is accepted as of version beta0.8 provided that create and checkExists are false.</td>
586 <td>/var/log</td>
587 </tr>
588 <tr>
589 <td>defaultValueWin</td>
590 <td>The default for the directory for windows installations.</td>
591 <td>C:\Program Files\myapp</td>
592 </tr>
593 <tr>
594 <td>create</td>
595 <td>If this is true and the directory entered does not
596exist the user will be asked if the directory should be created.</td>
597 <td>true</td>
598 </tr>
599 <tr>
600 <td>checkExists</td>
601 <td>If true the installation will not continue unless the
602directory selected exists. The user will have to select a directory
603that does exist, create it or cancel the install. If create is true and
604the directory does not exist the user simply has to agree to have the
605directory created.</td>
606 <td>false</td>
607 </tr>
608 </tbody>
609 </table>
610 <br/>
611 <table class="manual" cellspacing="0">
612 <tbody>
613 <tr class="tpheader">
614 <th class="manual" colspan="3"><a name="app-root">&lt;app-root&gt;</a></th>
615 </tr>
616 <tr>
617 <td colspan="3">The directory input allows the user to
618select a directory. The existence of files is then checked during
619validation to ensure the user has selected the correct directory. This
620can be used so a user can select the installation directory of a
621previously installed application. The directory can then be validated
622against 2 known files and 2 known directories that should exist.</td>
623 </tr>
624 <tr class="tpheader">
625 <th class="manual2">Attribute</th>
626 <th class="manual2">Description</th>
627 <th class="manual2">Example</th>
628 </tr>
629 <tr>
630 <td>property</td>
631 <td>The name of the property to be set in the <code>ant.install.properties</code>
632file the value will be the absolute path to the directory.</td>
633 <td>file.property</td>
634 </tr>
635 <tr>
636 <td>displayText</td>
637 <td>The text to be shown describing the option.</td>
638 <td>Select an installation directory</td>
639 </tr>
640 <tr>
641 <td>defaultValue</td>
642 <td>The default for the directory.</td>
643 <td>/usr/local/jakarta-tomcat-4.0.1</td>
644 </tr>
645 <tr>
646 <td>defaultValueWin</td>
647 <td>The default for the directory for windows installations.</td>
648 <td>C:\Program Files\Existing Application</td>
649 </tr>
650 <tr>
651 <td>checkFile1</td>
652 <td>The relative path of a file based on the user
653selected directory. When the installer is run this file will be checked
654to see if it exists (optional).</td>
655 <td>conf/server.xml</td>
656 </tr>
657 <tr>
658 <td>checkFile2</td>
659 <td>A second file to check (optional).</td>
660 <td>conf/server.xml</td>
661 </tr>
662 <tr>
663 <td>checkDir1</td>
664 <td>The relative path of a directory based on the user
665selected directory (optional).</td>
666 <td>webapps</td>
667 </tr>
668 <tr>
669 <td>checkDir2</td>
670 <td>A second directory to check (optional).</td>
671 <td>conf</td>
672 </tr>
673 </tbody>
674 </table>
675 <br/>
676 <table class="manual" cellspacing="0">
677 <tbody>
678 <tr class="tpheader">
679 <th class="manual" colspan="3"><a name="file">&lt;file&gt;</a></th>
680 </tr>
681 <tr>
682 <td colspan="3">The file input allows the user to select
683a file</td>
684 </tr>
685 <tr class="tpheader">
686 <th class="manual2">Attribute</th>
687 <th class="manual2">Description</th>
688 <th class="manual2">Example</th>
689 </tr>
690 <tr>
691 <td>property</td>
692 <td>The name of the property to be set in the <code>ant.install.properties</code>
693file the value will be the absolute path to the file.</td>
694 <td>file.property</td>
695 </tr>
696 <tr>
697 <td>displayText</td>
698 <td>The text to be shown describing the option.</td>
699 <td>Select the weblogic configuration file</td>
700 </tr>
701 <tr>
702 <td>defaultValue</td>
703 <td>The default for the file.</td>
704 <td>/var/log</td>
705 </tr>
706 <tr>
707 <td>defaultValueWin</td>
708 <td>The default for the file when installing on windows.</td>
709 <td>C:\log</td>
710 </tr>
711 <tr>
712 <td>checkExists</td>
713 <td>If true the installation will not continue unless the
714file selected exists. The user will have to select a file that does
715exist, create the file or cancel the install. If you want to create the
716file during the install if it does not exist use Ant.</td>
717 <td>false</td>
718 </tr>
719 </tbody>
720 </table>
721 <br/>
722 <table class="manual" cellspacing="0">
723 <tbody>
724 <tr class="tpheader">
725 <th class="manual" colspan="3"><a name="select">&lt;select&gt;</a></th>
726 </tr>
727 <tr>
728 <td colspan="3">The select input allows the user to
729select from a list of options. This will be represented as a group of
730radio buttons or a numbered list on the command line. An input type of
731select should have at least two child elements called <code>&lt;option&gt;</code> with the
732attributes <code>text</code> and <code>value</code>. The text is displayed next to the option and
733the value is the value set into the property. <br/>
734N.B. the defaultValue
735should be blank or one of the values in one of the options. This is not checked by AntInstaller
736but is a requirement, there are no guarantees if you don't RTFM.</td>
737 </tr>
738 <tr class="tpheader">
739 <th class="manual2">Attribute</th>
740 <th class="manual2">Description</th>
741 <th class="manual2">Example</th>
742 </tr>
743 <tr>
744 <td>property</td>
745 <td>The name of the property to be set in the <code>ant.install.properties</code>
746file. The value will be the text of one of the option value attributes.</td>
747 <td>file.property</td>
748 </tr>
749 <tr>
750 <td>displayText</td>
751 <td>The text to be shown describing the options available.</td>
752 <td>Select your favorite colour</td>
753 </tr>
754 <tr>
755 <td>defaultValue</td>
756 <td>The default for the option this should match one of
757the options values.</td>
758 <td>#FF0000</td>
759 </tr>
760 </tbody>
761 </table>
762 <br/>
763 <table class="manual" cellspacing="0">
764 <tbody>
765 <tr class="tpheader">
766 <th class="manual" colspan="3"><a name="target-select">&lt;target-select&gt;</a></th>
767 </tr>
768 <tr>
769 <td colspan="3">The target-select input allows the user to
770select targets from a list of options. This will be represented as a group of
771radio buttons or a numbered list on the command line. This input type is almost identical to the select
772input type but the value as well as being recorded as a property is set as a target.<br/>
773An input type of target-select should have at least two child elements called <code>&lt;option&gt;</code> with the
774attributes <code>text</code> and <code>value</code>. The text is displayed next to the option and
775the value is the target to be run (and the value set into the property).
776N.B. the defaultValue
777should be blank or one of the values in one of the options. This is not checked by AntInstaller at runtime
778but is a requirement, there are no guarantees if you don't RTFM. You should use the checkConfig script to validate the config.</td>
779 </tr>
780 <tr class="tpheader">
781 <th class="manual2">Attribute</th>
782 <th class="manual2">Description</th>
783 <th class="manual2">Example</th>
784 </tr>
785 <tr>
786 <td>property</td>
787 <td>The name of the property to be set in the <code>ant.install.properties</code>
788file. The value will be the text of one of the option value attributes and will be the target that is run.</td>
789 <td>target.property</td>
790 </tr>
791 <tr>
792 <td>displayText</td>
793 <td>The text to be shown describing the options available.</td>
794 <td>Select your favorite colour</td>
795 </tr>
796 <tr>
797 <td>defaultValue</td>
798 <td>The default for the option this should match one of
799the options values.</td>
800 <td>fulldocs</td>
801 </tr>
802 </tbody>
803 </table>
804 <br/>
805 <table class="manual" cellspacing="0">
806 <tbody>
807 <tr class="tpheader">
808 <th class="manual" colspan="3"><a name="large-select">&lt;large-select&gt;</a></th>
809 </tr>
810 <tr>
811 <td colspan="3">The large select has identical options to the <code>select</code> input above.
812 Large select enables the list of options to be greater and is displayed differently.
813 In the Swing GUI the options are rendered as a drop-down list. In the text/console UI
814 the options are shown to the user 20 lines at a time.</td>
815 </tr>
816 </tbody>
817 </table>
818 <br/>
819 <table class="manual" cellspacing="0">
820 <tbody>
821 <tr class="tpheader">
822 <th class="manual" colspan="3"><a name="target">&lt;target&gt;</a></th>
823 </tr>
824 <tr>
825 <td colspan="3">The target input shows a check box, if
826the user selects the target the Ant target will be run when the
827installation starts. The order of the targets in the list is
828significant, and the targets will be run in that order. If there is
829more than one Page with target entry types or there is a page with a
830target attribute the targets will be run in the order they appear in
831the config file.</td>
832 </tr>
833 <tr class="tpheader">
834 <th class="manual2">Attribute</th>
835 <th class="manual2">Description</th>
836 <th class="manual2">Example</th>
837 </tr>
838 <tr>
839 <td>target</td>
840 <td>The name of the target to be run it must exist in the
841build.xml file delivered with the install.</td>
842 <td>installSource</td>
843 </tr>
844 <tr>
845 <td>displayText</td>
846 <td>The text to be shown describing the options available.</td>
847 <td>Do you want to install the source code.</td>
848 </tr>
849 <tr>
850 <td>defaultValue</td>
851 <td>true or false, determines if the check box is
852selected by default.</td>
853 <td>true</td>
854 </tr>
855 <tr>
856 <td>force</td>
857 <td>If true the checkbox will not be editable and will be
858set to the value in the defaultValue attribute. This can be used to indicate that installing
859this component is not optional.</td>
860 <td>false</td>
861 </tr>
862 <tr>
863 <td>osSpecific</td>
864 <td>If the osSpecific flag is set the Operating System of the current system will
865be appended to the name of the target actually run by Ant so that different
866targets can be run according to the final deployment platform.
867This feature goes against the principles of
868building cross platform installers, but is provided so that common installer
869tasks such as creating icons and shortcuts can be run using the platform specific executables.
870</td>
871 <td>false</td>
872 </tr>
873 <tr>
874 <td>strict</td>
875 <td>Currently there are two modes for OS specific targets strict and not strict (lax). <br/>
876Strict target will return the target name plus the exact String in the
877System Property "os.name" this means you will have to provide targets for
878every possible OS version. See
879<a href="http://lopica.sourceforge.net/os.html">this page</a> for a list of possible values.
880There are a great many but you may not want to consider some of the options.<br/><br/>
881Lax target will return one of the following strings only
882<ul>
883 <li>"[target-name]-linux" - Linux </li>
884 <li>"[target-name]-mac" - Mac OS and Mac OS X</li>
885 <li>"[target-name]-sun" - SunOS and Solaris</li>
886 <li>"[target-name]-win" - Windows</li>
887 <li>"[target-name]-other" - any thing else</li>
888</ul>
889so you only have to create 5 ant targets to support all the cases. It is pretty hard
890to support windows bit with this system, if anyone needs to specifically support this and does not
891want to use the existing strict mechanism, get in touch. JDK1.4 on Win16 boxes strikes me as
892an unlikely combination ;)
893 </td>
894 <td>false</td>
895 </tr>
896 </tbody>
897 </table>
898 <br/>
899 <table class="manual" cellspacing="0">
900 <tbody>
901 <tr class="tpheader">
902 <th class="manual" colspan="3"><a name="text">&lt;text&gt;</a></th>
903 </tr>
904 <tr>
905 <td colspan="3">An text input entry is a field into which
906the user can write any text (or no text).</td>
907 </tr>
908 <tr class="tpheader">
909 <th class="manual2">Attribute</th>
910 <th class="manual2">Description</th>
911 <th class="manual2">Example</th>
912 </tr>
913 <tr>
914 <td>property</td>
915 <td>The name of the property to be set in the <code>ant.install.properties</code>
916file, the value will be the text entered by the user.</td>
917 <td>name.property</td>
918 </tr>
919 <tr>
920 <td>displayText</td>
921 <td>The text to be shown describing the text to be
922entered.</td>
923 <td>Enter your name</td>
924 </tr>
925 <tr>
926 <td>defaultValue</td>
927 <td>The default value if the user enters no text or displayed as a default in the GUI.</td>
928 <td>${java.user.name}</td>
929 </tr>
930 </tbody>
931 </table>
932 <br/>
933 <table class="manual" cellspacing="0">
934 <tbody>
935 <tr class="tpheader">
936 <th class="manual" colspan="3"><a name="validated">&lt;validated&gt;</a></th>
937 </tr>
938 <tr>
939 <td colspan="3">A validated text input entry is a text
940field into which the user can write any text but the installation will
941not continue unless the text entered matches a regular expression
942provided.</td>
943 </tr>
944 <tr class="tpheader">
945 <th class="manual2">Attribute</th>
946 <th class="manual2">Description</th>
947 <th class="manual2">Example</th>
948 </tr>
949 <tr>
950 <td>property</td>
951 <td>The name of the property to be set in the <code>ant.install.properties</code>
952file, the value will be the text entered by the user.</td>
953 <td>server.url</td>
954 </tr>
955 <tr>
956 <td>displayText</td>
957 <td>The text to be shown describing the text to be
958entered.</td>
959 <td>Enter your name</td>
960 </tr>
961 <tr>
962 <td>defaultValue</td>
963 <td>The default value if the user enters no text, this
964should be valid according to the regular expression.</td>
965 <td>true</td>
966 </tr>
967 <tr>
968 <td>regex</td>
969 <td>The regular expression used to validate the text, the
970whole regex should match the text entered.</td>
971 <td>^[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]$</td>
972 </tr>
973 </tbody>
974 </table>
975
976 <br/>
977 <table class="manual" cellspacing="0">
978 <tbody>
979 <tr class="tpheader">
980 <th class="manual" colspan="3"><a name="extvalidated">&lt;ext-validated&gt;</a></th>
981 </tr>
982 <tr>
983 <td colspan="3">An externally validated text input entry is a text
984field into which the user can write any text but the installation will
985not continue unless the text entered passes a validation function. The validation function is not part
986of AntInstaller, a fully qualified classname (that is on the classpath at runtime) is specified which AntInstaller
987executes to validate. One instance will be created per input element which should conform to the interface
988<code>org.tp23.antinstaller.input.Validator</code>. <br/>
989This feature is not tested but does provide flexibility in validating input, if you use this feature please
990report back you results (success or failures) to the AntInstaller project pages. We wish to discuss
991integrating external validation into the Localization of the installers (when it happens) with
992active users of this feature.</td>
993 </tr>
994 <tr class="tpheader">
995 <th class="manual2">Attribute</th>
996 <th class="manual2">Description</th>
997 <th class="manual2">Example</th>
998 </tr>
999 <tr>
1000 <td>property</td>
1001 <td>The name of the property to be set in the <code>ant.install.properties</code>
1002file, the value will be the text entered by the user.</td>
1003 <td>server.url</td>
1004 </tr>
1005 <tr>
1006 <td>displayText</td>
1007 <td>The text to be shown describing the text to be entered.</td>
1008 <td>Choose an open network port</td>
1009 </tr>
1010 <tr>
1011 <td>defaultValue</td>
1012 <td>The default value if the user enters no text, this
1013should be valid according to the external validator.</td>
1014 <td>true</td>
1015 </tr>
1016 <tr>
1017 <td>validationClass</td>
1018 <td>The class used as a Validator</td>
1019 <td>com.me.val.PortOpenValidator</td>
1020 </tr>
1021 </tbody>
1022 </table>
1023
1024
1025 <br/>
1026 <table class="manual" cellspacing="0">
1027 <tbody>
1028 <tr class="tpheader">
1029 <th class="manual" colspan="3"><a name="date">&lt;date&gt;</a></th>
1030 </tr>
1031 <tr>
1032 <td colspan="3">A text input entry that must be a valid
1033date. The dateformat string must be compatible with <code>java.text.SimpleDateformat</code>
1034By default the format is english dates <code>dd/MM/yyyy</code> but can be
1035changed to any valid format. If the date field is used in an installer it is not possible to enter blank dates.</td>
1036 </tr>
1037 <tr class="tpheader">
1038 <th class="manual2">Attribute</th>
1039 <th class="manual2">Description</th>
1040 <th class="manual2">Example</th>
1041 </tr>
1042 <tr>
1043 <td>property</td>
1044 <td>The name of the property to be set in the <code>ant.install.properties</code>
1045file, the value will be the date entered by the user.</td>
1046 <td>mydate.property</td>
1047 </tr>
1048 <tr>
1049 <td>displayText</td>
1050 <td>The text to be shown describing the date to be
1051entered.</td>
1052 <td>Enter your name</td>
1053 </tr>
1054 <tr>
1055 <td>defaultValue</td>
1056 <td>The default value if the user enters no text, this
1057should be valid according to the date format. Alternatively the String <code>TODAY</code>
1058may be entered and the default value will be the time the installer is
1059run.</td>
1060 <td>true</td>
1061 </tr>
1062 <tr>
1063 <td>dateFormat</td>
1064 <td>The expression used to create the DateFormat.</td>
1065 <td>dd-MM-yy</td>
1066 </tr>
1067 </tbody>
1068 </table>
1069 <br/>
1070 <table class="manual" cellspacing="0">
1071 <tbody>
1072 <tr class="tpheader">
1073 <th class="manual" colspan="3"><a name="password">&lt;password&gt;</a></th>
1074 </tr>
1075 <tr>
1076 <td colspan="3">A password text input is identical to a
1077validated text input except that the display does not echo in the Swing
1078Version (If anyone knows how to prevent the console echoing please get
1079in touch) This password field is VERY INSECURE so dont blame me. </td>
1080 </tr>
1081 <tr class="tpheader">
1082 <th class="manual2">Attribute</th>
1083 <th class="manual2">Description</th>
1084 <th class="manual2">Example</th>
1085 </tr>
1086 <tr>
1087 <td>property</td>
1088 <td>The name of the property to be sent to Ant the
1089password will not feature in <code>ant.install.properties</code> file,
1090the value will be the text entered by the user. If the installer is in
1091verbose mode the properties file will contain the property name but not
1092the value entered by the user.</td>
1093 <td>password.property</td>
1094 </tr>
1095 <tr>
1096 <td>displayText</td>
1097 <td>The text to be shown describing the password to be
1098entered.</td>
1099 <td>Enter password</td>
1100 </tr>
1101 <tr>
1102 <td>defaultValue</td>
1103 <td>The default value if the user enters no text, this
1104should be valid according to the regular expression. This will be shown
1105as an example if the user enters an invalid password.</td>
1106 <td>pa55word</td>
1107 </tr>
1108 <tr>
1109 <td>regex</td>
1110 <td>The regular expression used to validate the text, the
1111whole regex should match the text entered.</td>
1112 <td>^[a-zA-Z_0-9]{8}$</td>
1113 </tr>
1114 <tr>
1115 <td>textMask</td>
1116 <td>When set to <code>true</code> an attempt is made to hide the password on the command line.
1117 This feature is optional and has not been tested on different platforms.
1118 It is a pure Java solution using a masking thread so there
1119 is a theoretical requirement for some CPU head room to function correctly.
1120 It does not work where \r is not supported for example the eclipse console.<br/><br/>
1121 see SUN's proposed solution
1122 <a href="http://java.sun.com/features/2002/09/pword_mask.html"
1123 >http://java.sun.com/features/2002/09/pword_mask.html</a><br/>
1124 see also, the embarrasing bug report on SUNs site
1125 <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4050435"
1126 >http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4050435</a><br/>
1127 see also, Ant's bug report
1128 <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6687"
1129 >http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6687</a><br/>
1130 </td>
1131 <td>true</td>
1132 </tr>
1133 </tbody>
1134 </table>
1135
1136 <br/>
1137 <table class="manual" cellspacing="0">
1138 <tbody>
1139 <tr class="tpheader">
1140 <th class="manual" colspan="3"><a name="password-confirm">&lt;password-confirm&gt;</a></th>
1141 </tr>
1142 <tr>
1143 <td colspan="3">A confirm password input is identical to a
1144password input except that to validate correctly a password field on the same page
1145with the property name specified in the origField attribute.</td>
1146 </tr>
1147 <tr class="tpheader">
1148 <th class="manual2">Attribute</th>
1149 <th class="manual2">Description</th>
1150 <th class="manual2">Example</th>
1151 </tr>
1152 <tr>
1153 <td>origField</td>
1154 <td>There must be a password field with its property set to this value on the same page.
1155</td>
1156 <td>password.property</td>
1157 </tr>
1158 <tr>
1159 <td>displayText</td>
1160 <td>The text to be shown describing the password to be
1161entered.</td>
1162 <td>Confirm password</td>
1163 </tr>
1164 <tr>
1165 <td>defaultValue</td>
1166 <td>The default value if the user enters no text, this
1167should be valid according to the regular expression. This will be shown
1168as an example if the user enters an invalid password.</td>
1169 <td>pa55word</td>
1170 </tr>
1171 <tr>
1172 <td>regex</td>
1173 <td>The regular expression used to validate the text, the
1174whole regex should match the text entered.</td>
1175 <td>^[a-zA-Z_0-9]{8}$</td>
1176 </tr>
1177 <tr>
1178 <td>textMask</td>
1179 <td>When set to <code>true</code> an attempt is made to hide the password on the command line.
1180 This feature is optional and has not been tested on different platforms.
1181 It is a pure Java solution using a masking thread so there
1182 is a theoretical requirement for some CPU head room to function correctly.
1183 It does not work where \r is not supported for example the eclipse console.<br/><br/>
1184 see SUN's proposed solution
1185 <a href="http://java.sun.com/features/2002/09/pword_mask.html"
1186 >http://java.sun.com/features/2002/09/pword_mask.html</a><br/>
1187 see also, the embarrasing bug report on SUNs site
1188 <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4050435"
1189 >http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4050435</a><br/>
1190 see also, Ant's bug report
1191 <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6687"
1192 >http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6687</a><br/>
1193 </td>
1194 <td>true</td>
1195 </tr>
1196 </tbody>
1197 </table>
1198 <br/><br/>
1199 <a name="hiddentypes"></a><h3>Hidden Elements</h3>
1200 Hidden elements are those elements of pages which are not displayed to the user,
1201 but which can be used to set properties and apply conditional logic.<br/>
1202 <br/>
1203 <table class="manual" cellspacing="0">
1204 <tbody>
1205 <tr class="tpheader">
1206 <th class="manual" colspan="3"><a name="conditional">&lt;conditional&gt;</a></th>
1207 </tr>
1208 <tr>
1209 <td colspan="3">The conditional element allows the conditional execution of a nested element.
1210 Currently, only &lt;hidden&gt; elements may be nested within a conditional block.
1211 This can be useful for initialising properties or default values based on other user selections</td>
1212 </tr>
1213 <tr class="tpheader">
1214 <th class="manual2">Attribute</th>
1215 <th class="manual2">Description</th>
1216 <th class="manual2">Example</th>
1217 </tr>
1218 <tr>
1219 <td>ifProperty</td>
1220 <td>The nested <code>hidden</code> element(s) will be evaluated if the property has the correct value.
1221 This can be used to
1222 conditionally set properties when certain other properties match specific values.
1223 The format of the property can be as simple as <code>${name}=value</code> or can combine tests on multiple properties such as <code>(${name}!=value) AND (${name2}^=value2)</code>. There must be no spaces
1224 and both the property and value are case sensitive. See the <a href="#ifproperty">ifProperty description</a>
1225 for details of the comarisons supported.</td>
1226 <td>(${prop1}=1) OR (${prop2}=${prop3})</td>
1227 </tr>
1228 </table>
1229 <br/>
1230 <table class="manual" cellspacing="0">
1231 <tbody>
1232 <tr class="tpheader">
1233 <th class="manual" colspan="3"><a name="hidden">&lt;hidden&gt;</a></th>
1234 </tr>
1235 <tr>
1236 <td colspan="3">The hidden element allows a property to be set by virtue of the page being displayed or,
1237 when nested within a <code>conditional</code> block, if the condition is true.
1238 This can be useful for initialising properties or default values based on other user selections.</td>
1239 </tr>
1240 <tr class="tpheader">
1241 <th class="manual2">Attribute</th>
1242 <th class="manual2">Description</th>
1243 <th class="manual2">Example</th>
1244 </tr>
1245 <tr>
1246 <td>property</td>
1247 <td>The name of the property to be set in the <code>ant.install.properties</code></td>
1248 <td>my.property</td>
1249 </tr>
1250 <tr>
1251 <td>value</td>
1252 <td>The value to which the property will be set</td>
1253 <td>myvalue</td>
1254 </tr>
1255 </table>
1256 <br/>
1257To edit the <code>antinstall-config.xml</code> file with the above properties a good XML editor is
1258recommended. A DTD exists to aid debugging this file. Add the following doctype to enable validation
1259<code>
1260&lt;!DOCTYPE installer PUBLIC "-//tp23 //DTD Ant Installer Config//EN" "http://antinstaller.sf.net/dtd/antinstall-config-0.8.dtd"&gt;
1261</code>
1262If you find errors in the DTD please <a href="http://sourceforge.net/tracker/?group_id=123466">report them</a>.<br/>
1263 <br/><a name="configbuild"></a>
1264 <h3><code>build.xml</code></h3>
1265
1266Once the <code>antinstall-config.xml</code> file is created you need
1267to create an Ant <code>build.xml</code> file with targets that match
1268the targets available in the install config. The <code>build.xml</code> file is out of scope of this document. The Ant documentation is avaliable at the following URL. <br/>
1269<a href="http://antinstaller.sourceforge.net/manual/manual/index.html" title="Ant manual">http://antinstaller.sourceforge.net/manual/manual/index.html</a><br/>
1270There are many tools to help you create these files, for example, eclipse has built in support.<br/><br/>
1271
1272There are some recomendations for the <code>build.xml</code> file to be used inside an installer.
1273<ul>
1274 <li>It is not recommended to use <code>depends</code> attributes for targets, although they do work in most situations. The progress page graphic sometimes produces confusing results, for this reason it can be disabled. <code>depends</code> targets may be called more often than expected since all targets specified in the <code>antinstall-config.xml</code> file and selected by the user are called explicitly. For the same reason be carful with the <code>if</code> attribute in target elements.</li>
1275 <li>Classpath modifications are irrelevant if all classes are packaged in a self-extracting or non-extracting Jar. Any task dependencies should be packaged with into the Jar with the <code>zipgroupfileset</code> fileset type.
1276 <br/>for example <br/><code>&lt;zipgroupfileset dir="tasklibs" includes="*.jar"/&gt;</code></li>
1277 <li>The <code>basedir</code> attribute, if specifed in the project element, is ignored and set by AntInstaller. It is included in many AntInstaller examples since most tools expect this attribute to be present.</li>
1278 <li>The <code>${ant.home}</code> property should not be relied upon, The computer on which the installer is being run may not have Ant installed.</li>
1279 <li>Ant dependencies, for example Jars for optional tasks, should be explicitly added to the installer jar with a <code>zipgroupfileset</code>. </li>
1280 <li>Some other default Ant properties that relate to a presumed Ant configuration are not reliable due to the way Ant is launched in AntInstaller, for example <code>${ant.file}</code> </li>
1281 <li>Some complex output redirections do not work as expected since output is already redirected to the log files.</li>
1282</ul>
1283
1284 <br/><a name="scripts"></a>
1285 <h3><code>install.sh</code> Start scripts</h3>
1286It is recommended to run create installers as <a href="#extractor">self extracting jars</a>, but it is
1287possible to run the installer from scripts as a normal Java application.
1288Create a new directory and prepare the files as you would
1289for a normal Ant build. You can include the <code>install.sh</code>
1290and <code>install.cmd</code> files from the demo app to launch the
1291installer. These scripts can be launched in a GUI by double clicking on
1292them, but they will require editing to set your classpath and resources correctly.<br/>
1293The main class (<code><a href="java2html/antinstaller/org/tp23/antinstaller/runtime/ExecInstall.java.html">org.tp23.antinstaller.runtime.ExecInstall</a></code>) that starts the installer takes two parameters
1294on the command line which should be set in the start script.<br/>
1295The first is the default
1296GUI mode (either swing or text). <br/>
1297The second is the Ant basedir and typically it should be just "." the current directory.
1298This directory will be the basedir of the ant script no matter what it says in the <code>build.xml</code> file.
1299 <br/>
1300The Ant runner currently passes the directory called <code>antlib</code>
1301in which
1302you can add any Ant optional jars to get them to auto load. You
1303can also load them on classpath of the install scripts.<br/>
1304 <br/><a name="extractor"></a>
1305 <h3>Self Extracting Jars</h3>
1306 There is a mechanism to create a self extracting Jar where the entire installer,
1307 all requried Java code, and the resources to install can be packaged into a single Jar.
1308 The Jar is launched by double clicking on it (if the <code>.jar</code> extension is registered properly by Java) or by calling
1309 the command <code>java -jar [jar_name].jar</code>.<br/>
1310 In windows if the extension <code>.jar</code> has been re-registered (e.g. to open with winzip) right clicking on the jar
1311 and selecting <code>Open With</code> then <code>javaw</code> will also run the installer.<br/>
1312 Packaging a self extracting jar can be achieved with Ant.
1313 See <a href="installertask.html">Installer Ant Task</a> to automate creation of SelfExtracting jars. <br/><br/>
1314
1315 When the isntaller is run all the contents of the jar will be extracted to a temporary
1316 directory on the users machine. This temporary directoy is the base directory for the Ant
1317 build when run.
1318 The build.xml file should not include any relative file references. The <code>${basedir}</code> property is required since
1319 the file is excracted a new empty temporary directory that is not know when
1320 the <code>build.xml</code> file is being written. This directory will be the value of <code>${basedir}</code>
1321 when the installer is run. If packagine the self extractor manually without using the AntInstaller task the main class should be set in the manifest. <br/>
1322 Here is an example <code>MANIFEST.MF</code> file.<br/>
1323 <pre>
1324Manifest-Version: 1.0
1325Main-Class: <a href="java2html/antinstaller/org/tp23/antinstaller/selfextract/SelfExtractor.java.html">org.tp23.antinstaller.selfextract.SelfExtractor</a>
1326Look-And-Feel: org.tp23.jgoodies.plaf.plastic.PlasticXPLookAndFeel
1327 </pre>
1328 The Look And Feel is also required in the <code>MANIFEST.MF</code> file since the autoextract code shows a progress bar using Swing.
1329 The value should be the same Look And Feel used in the main Swing GUI specified in the installer element of <code>antinstall-config.xml</code>. If not, ensure the main Look And Feel fully supports updating the UI, not LAFs all do.
1330 <br/>
1331 <br/>If a resource is included called <code>/resources/extract-image.png</code> it will be displayed during the
1332 extraction process. You can remove the image from the classpath if you don't like it or change it to any other
1333 png image of the same size.<br/>
1334 <img src="images/extract-image-example.png" alt="example extract image"/>
1335 <br/>
1336 <br/>
1337 <br/><a name="non-extractor"></a>
1338 <h3>Non Extracting Jars</h3>
1339 As of version 0.7.2 a feature has been added to load the installer without having to extract any files until the
1340 Ant build is run. This has the advantage of not having to unjar AntInstaller itself or its dependencies such as Ant and the look and feel.
1341 See <a href="installertask.html">Installer Ant Task</a> to automate creation of NonExtracting jars. <br/><br/>
1342 If you are manually packaging the Jar in order to specify that the NonExtractor should be used the Jar <code>META-INF/MANIFEST.MF</code> file should specify
1343 <code><a href="java2html/antinstaller/org/tp23/antinstaller/selfextract/NonExtractor.java.html">org.tp23.antinstaller.selfextract.NonExtractor</a></code>. Since the NonExtractor does not need to show
1344 the progress bar for the extraction no look and feel is required in the manifest.
1345 An example <code>META-INF/MANIFEST.MF</code>
1346 <pre>
1347Manifest-Version: 1.0
1348Main-Class: <a href="java2html/antinstaller/org/tp23/antinstaller/selfextract/NonExtractor.java.html">org.tp23.antinstaller.selfextract.NonExtractor</a>
1349 </pre>
1350 The NonExctractor still creates temporary space on the deployment system and still sets the <code>${basedir}</code>
1351 to this space.
1352 The <code>build.xml</code> file and the <code>antinstall-config.xml</code> are read from inside the Jar and all
1353 properties are passed directly
1354 to Ant. The properties file is still readable for debuging installers. In order to access and extract resources inside the Jar the unzip or unjar Ant tasks should be used. In order to identify the Jar file in teh build.xml file a new property has been added <code>${antinstaller.jar}</code>.
1355 The following example
1356 extracts a file called <code>myresource.zip</code> into the temporary directory (from there it could be unzipped
1357 to the deployment directory)
1358 <pre>
1359&lt;unzip src="${antinstaller.jar}" dest="${basedir}"&gt;
1360 &lt;patternset&gt;
1361 &lt;include name="myresource.zip"/&gt;
1362 &lt;/patternset&gt;
1363&lt;/unzip&gt;</pre>
1364 A more likely example is to unzip all the files in your application to the installation directory selected by the user.
1365 <pre>
1366&lt;unzip src="${antinstaller.jar}" dest="${my.installation.dir}"&gt;
1367 &lt;patternset&gt;
1368 &lt;include name="bin/*"/&gt;
1369 &lt;include name="classes/*"/&gt;
1370 &lt;include name="help/*"/&gt;
1371 &lt;include name="doc/*"/&gt;
1372 &lt;/patternset&gt;
1373&lt;/unzip&gt;</pre>
1374 Remember all the classes for AntInstaller need to be in the root of the Jar for the JVM to find them when the
1375 Jar is first loaded so it is probably best to put all the deployable resources in a subdirectory inside the Jar
1376 This will prevent name clashes with the Jars contents which are in the <code>org</code>, <code>META-INF</code> and <code>resources</code> directories. <br/>
1377
1378 <a name="refs"></a>
1379 <h3>Dynamic References</h3>
1380 As of version beta 0.5 in certain circumstances the default values of input fields can be based on existing properties. To reference collected input values use the Ant property syntax <code>${property.reference}</code>.
1381 References can be mixed with normal text as in Ant. <br/>
1382 For example, <br/>
1383<pre>
1384&lt;text
1385 property="new.property"
1386 displayText="Enter the installation directory"
1387 defaulValue="/usr/local/${project.short.name}"
1388 defaultValueWin="C:\Program Files\${project.short.name}"
1389 create="true"
1390/&gt;
1391</pre>
1392 As of version beta 0.7 the default values of input fields can be based on environment variables. To reference collected input values use the normal Ant syntax <code>${env.ENVIRONMENT_VARIABLE}</code>.<br/>
1393 The prefix is always <code>env.</code> since this is not set with an Ant <code>&lt;property&gt;</code> task, it is part of the AntInstaller runtime. The results will be identical to <code>&lt;property environment="env."&gt;</code> since AntInstaller make direct calls to the Ant APIs.<br/>
1394 The environment is NOT added by default to the build.xml or the installer when Ant runs, if you need the environment
1395 in the <code>build.xml</code> file call it in the usual way
1396 Also the java system properties are included prefixed by "java.". For example, <code>${java.user.name}</code> returns the user currently running the installer.
1397<br/><br/>
1398 Dynamic references can use nested property values. For example, if the value of <code>${target.server}</code> is <code>tomcat</code>,
1399 the following syntax can be used to set the default value of an input property to be the value of <code>${tomcat.default.http.port}</code><br/>
1400<pre>
1401&lt;validated
1402 property="http.port"
1403 displayText="HTTP port:"
1404 defaultValue="${${target.server}.default.http.port}"
1405 regex="^[0-9]{2,5}$"
1406/&gt;
1407</pre>
1408<br/>
1409 Dynamic references have the following limitations<br/>
1410 <br/>
1411 <ul>
1412 <li>Dynamic references can only be added to <code>defaultValue</code>, <code>defaultValueWin</code>, comment <code>displayText</code>, comment <code>explanatoryText</code> and text or html in a <a href="#pagetext" title="Text pages">text page</a> (currently)</li>
1413 <li>The properties must have been set in previous pages not in the current page (or future pages)</li>
1414 <li>Unlike Ant if the property has not been evaluated a blank string "" will be inserted instead of the reference.
1415 This means accidents like <code>/usr/local/${non.prop}</code> should not happen but will use <code>/usr/local</code>, generally neither case
1416 is desired, so as with Ant check the effects of absent properties before releasing your installer. Alternativly use a validated text field and specify a minimum length in the regular expression to ensure that blank values do notget accepted.</li>
1417 <li>Once a user has edited a field the evaluation stops.<br/>
1418 For example, on the first page <code>${proj.short.name}</code> is set
1419 and on a subsequent page <code>${proj.short.name}/lib</code> and <code>${proj.short.name}/classes</code>. If the user changes one field to
1420 <code>[value of ${proj.short.name}]/myclasses</code> and then goes back and changes the first page when the subsequent pages are shown the value will <b>not</b> update to <code>[new value of ${proj.short.name}]/myclasses</code>. This only applies to the Swing GUI since in the command line the user can not go back.</li>
1421 </ul>
1422
1423 <br/>
1424 <br/>
1425 <a name="pagedisplay"></a>
1426 <h3>Page Displaying</h3>
1427 It is a common requirement to have a few options at the start of the installer and only show certain other pages if the user selected one of the initial options. For example, an option to install the source code, if the user is going to install the source code show a page with options to decide where to put the code, the documents and perhaps a checkbox if icons for the documents should be created. This page should not be shown to people who are not installing the source code. Two mechanism are available to achieve this.
1428 <br/><br/>
1429 The first mechanism is to use a <code>target</code> input on a previous page and then add <code>ifTarget</code> attributes to the subsequent page elements.
1430
1431 The second mechanism uses the <code>ifProperty</code> attribute to conditionally show pages based on the existence or value of properties. Since both the System Properties from Java and the users environment variables are available as properties it is now possible to base pages on the existence of certain properties for example if CATALINA_HOME is set it is a safe bet the user already has tomcat installed. Also if ProgramFiles is present it is probably a windows system. N.B. for more a more accurate way to run tasks based on the operating system of the user the target tag has been enhanced to run osSpecific targets.
1432
1433 See the ifProperty attribute of the <a href="#pageinput">InputPage</a> type.
1434
1435 <br/><br/>
1436 <a href="index.html"><img class="but" src="images/ant-install-small.png" alt="home"></a>
1437<!-- Do not edit the following line used by manual-print.jsp -->
1438
1439 </div>
1440</div>
1441</body>
1442</html>
Note: See TracBrowser for help on using the repository browser.