[izpack-devel] Implementation for conditions in izpack

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


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" ?>
	<condition type="variable" id="notwarfilesetup">
        <condition type="packselection" id="demoprojectsselected">
        <panelcondition panelid="jvmpanel"  
        <panelcondition panelid="projects.settings"
                  conditionid="demoprojectsselected" />
	<packcondition packid="pack.appserver.tomcat"
                 conditionid="notwarfilesetup" />

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
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?


More information about the izpack-devel mailing list