Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
langxml
titleAssigning a dynamic variable from properties/option files
<dynamicvariables>

    <variable name="option.1" checkonce="true"
              file="${INSTALL_PATH}/../old_installation/test.properties" type="options"
              key="first.setting"/>

    <variable name="option.2" checkonce="true"
              file="${INSTALL_PATH}/../old_installation/test.conf" type="options"
              key="work.dir"/>

</dynamicvariables>
Values from INI Files

...

Code Block
langxml
titleDynamic variable assignment from XML file contents
<dynamicvariables>

    <variable name="XMLReadTest.1" checkonce="true" ignorefailure="false"
              file="${INSTALL_PATH}/../old_installation/test.xml" type="xml"
              key="/installations/installation[path='/usr/local']/title[@lang='en']/text()"/>

    <variable name="XMLReadTest.2" checkonce="true" ignorefailure="false"
              file="${INSTALL_PATH}/../old_installation/test.xml" type="xml"
              key="//title[@lang='en']/text()"/>

</dynamicvariables>
Values From Configuration Files in an Archive (JAR/ZIP)

...

Code Block
langxml
titleAssigning a dynamic variable from an configuration entry in a JAR/ZIP file
<dynamicvariables>

    <variable name="previous.version" jarfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/config.jar"
              entry="release.properties" type="options"
              key="release.version"
              checkonce="false" ignorefailure="true">
      <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="XX.XX.XX"/>
    </variable>

    <variable name="other.stuff" zipfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/misc.zip"
              entry="app.ini" type="ini"
              section="Global Settings" key="AUTOSTART"
              checkonce="true" ignorefailure="true">
    </variable>

</dynamicvariables>
Values from the Windows Registry

...

Code Block
langxml
titleAssigning a dynamic variable value from the output of a command execution
<dynamicvariables>

    <variable name="hostname" checkonce="true"
              executable="hostname"
              type="process"/>

    <variable name="result.value" checkonce="true"
              executable="${INSTALL_PATH}/bin/init.sh"
              type="shell"/>

</dynamicvariables>
Filtering Values Using Regular Expressions

Each dynamic variable assignment can be filtered using a Java regular expression. This is done by the nested regex element.

Example:

Code Block
langxml
titleFiltering dynamic variable assignments using regular expressions
<dynamicvariables>

    <variable name="previous.version" jarfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/config.jar"
              entry="release.properties" type="options"
              key="release.version"
              checkonce="false" ignorefailure="true">
      <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/>
    </variable>

    <variable name="RegExTest.Select.Windows" checkonce="true"
              regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
              regvalue="Path">
      <regex regexp="([^;]*)(.*)"
             select="\1"
             defaultValue="(unmatched)"
             casesensitive="false"/>
    </variable>

    <variable name="RegExTest.ReplaceFirst.Windows" checkonce="true"
              regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
              regvalue="Path">
      <regex regexp="([^;]*)"
             replace="+++ \1 +++"
             defaultValue="(unmatched)"
             casesensitive="false"
             global="false"/>
    </variable>

    <variable name="RegExTest.ReplaceAll.Windows" checkonce="true"
              regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
              regvalue="Path">
      <regex regexp="([^;]*)"
             replace="+++ \1 +++"
             defaultValue="(unmatched)"
             casesensitive="false"
             global="true"/>
    </variable>

</dynamicvariables>