[izpack-devel] Implementation for conditions in izpack

Dennis Reil Dennis.Reil at reddot.de
Thu Nov 9 08:48:56 CET 2006


Hi,

As mentioned, some time ago, I implemented an extension which adds the
possibility of defining conditions for the izpack installer. These
conditions can be used e.g. to only show panels for which conditions are
met. Conditions can be currently defined based on pack selections,
variables and Java field values. The boolean conditions and, or, xor and
not are also possible to create more complex conditions.

These conditions can be used to specify which panel are shown, which
packs can be installed and which variables should be set. I also
extended UserInputPanel so that conditions could be used to show fields
on a panel.

Conditions are currently defined in a resource file. An example
conditions.xml could look like:

<?xml version="1.0" ?>
<conditions>	
	<condition type="variable" id="notwarfilesetup">
		<name>izpack.setuptype</name>
		<value>standard</value>
	</condition>
        <condition type="packselection" id="demoprojectsselected">
                <packid>pack.demo.projects</packid>
        </condition>
        <panelcondition panelid="jvmpanel"  
                  conditionid="notwarfilesetup"/>
        <panelcondition panelid="projects.settings"
                  conditionid="demoprojectsselected" />
	<packcondition packid="pack.appserver.tomcat"
                 conditionid="notwarfilesetup" />
</conditions>

This spec has two conditions, one based on a variable value
(notwarfilesetup) and one based on a pack selection. Based on this
conditions two panelconditions and one packcondition is defined. This
means, that jvmpanel is only shown if notwarfilesetup validates true
which means, that the variable with name izpack.setuptype has to be
standard. The pack (pack.appserver.tomcat) will only be available for
installation if condition notwarfilesetup validates true.


If you find this useful, I would create the appropriate patches to
integrate it in izpack. New types of conditions can easily be added by
subclassing an abstract condition base class. As the rules engine loads
conditions by reflections, a new type can easily be used in the spec
file.
For sure, there are many more places in izpack, where conditions can be
useful (e.g. pack definition, executables, parsables).


Do you find this useful?

Regards 
   Dennis




More information about the izpack-devel mailing list