Versions Compared

Key

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

...

Multiple nested filters can be used. In this case, the order of defining them is the order they will be executed at installation time.

Filters are embedded in the nested filters element like this:

Code Block
languagehtml/xml
titleDynamic Variable Filter Element Definition
<dynamicvariable ...>
   ... <!-- other nested arguments might go here -->
   <filters>
      <filter1 .../>
      <filter2 .../>
      ... <!-- more filters might go here -->
   </filters>
</dynamicvariable>

 

Regular Expression Filter

...

Code Block
titleFiltering dynamic variable assignments using regular expressions
langxml
<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" condition="upgradecheck">
      <filters>
        <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/>
      </filters>
    </variable>

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

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

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

</dynamicvariables>

...

Code Block
languagehtml/xml
titleExample of the location filter
 <variable name="previous.wrapper.java.command.canonical" value="${previous.wrapper.java.home.canonical}/bin/java"
              condition="haveInstallPath+isCompatibleUpgrade+haveWrapperJavaCmd+isSetCanonicalJavaHome">
      <filters>
        <location basedir="${INSTALL_PATH}"/>
      </filters>
 </variable>