Class WinMsiBundler

java.lang.Object
jdk.jpackage.internal.WinMsiBundler
All Implemented Interfaces:
Bundler

public class WinMsiBundler extends Object
WinMsiBundler Produces .msi installer from application image. Uses WiX Toolkit to build .msi installer.

execute(java.util.Map<java.lang.String, ? super java.lang.Object>, java.nio.file.Path) method creates a number of source files with the description of installer to be processed by WiX tools. Generated source files are stored in "config" subdirectory next to "app" subdirectory in the root work directory. The following WiX source files are generated:

  • main.wxs. Main source file with the installer description
  • bundle.wxf. Source file with application and Java run-time directory tree description.
  • ui.wxf. Source file with UI description of the installer.

main.wxs file is a copy of main.wxs resource from jdk.jpackage.internal.resources package. It is parametrized with the following WiX variables:

  • JpAppName. Name of the application. Set to the value of --name command line option
  • JpAppVersion. Version of the application. Set to the value of --app-version command line option
  • JpAppVendor. Vendor of the application. Set to the value of --vendor command line option
  • JpAppDescription. Description of the application. Set to the value of --description command line option
  • JpProductCode. Set to product code UUID of the application. Random value generated by jpackage every time execute(java.util.Map<java.lang.String, ? super java.lang.Object>, java.nio.file.Path) method is called
  • JpProductUpgradeCode. Set to upgrade code UUID of the application. Random value generated by jpackage every time execute(java.util.Map<java.lang.String, ? super java.lang.Object>, java.nio.file.Path) method is called if --win-upgrade-uuid command line option is not specified. Otherwise this variable is set to the value of --win-upgrade-uuid command line option
  • JpAllowUpgrades. Set to "yes", but all that matters is it is defined.
  • JpAllowDowngrades. Defined for application installers, and undefined for Java runtime installers.
  • JpConfigDir. Absolute path to the directory with generated WiX source files.
  • JpIsSystemWide. Set to "yes" if --win-per-user-install command line option was not specified. Undefined otherwise
  • JpAppSizeKb. Set to estimated size of the application in kilobytes
  • JpHelpURL. Set to value of --win-help-url command line option if it was specified. Undefined otherwise
  • JpAboutURL. Set to value of --about-url command line option if it was specified. Undefined otherwise
  • JpUpdateURL. Set to value of --win-update-url command line option if it was specified. Undefined otherwise

ui.wxf file is generated based on --license-file, --win-shortcut-prompt, --win-dir-chooser command line options. It is parametrized with the following WiX variables:

  • JpLicenseRtf. Set to the value of --license-file command line option. Undefined if --license-file command line option was not specified
  • Constructor Details

    • WinMsiBundler

      public WinMsiBundler()
  • Method Details

    • getName

      public String getName()
      Returns:
      User Friendly name of this bundler.
    • getID

      public String getID()
      Returns:
      Command line identifier of the bundler. Should be unique.
    • getBundleType

      public String getBundleType()
      Returns:
      The bundle type of the bundle that is created by this bundler.
    • supported

      public boolean supported(boolean platformInstaller)
      Description copied from interface: Bundler
      Returns "true" if this bundler is supported on current platform.
    • isDefault

      public boolean isDefault()
      Description copied from interface: Bundler
      Returns "true" if this bundler is he default for the current platform.
    • validate

      public boolean validate(Map<String,? super Object> params) throws ConfigException
      Description copied from interface: Bundler
      Determines if this bundler will execute with the given parameters.
      Parameters:
      params - The parameters to be validate. Validation may modify the map, so if you are going to be using the same map across multiple bundlers you should pass in a deep copy.
      Returns:
      true if valid
      Throws:
      ConfigException - If the configuration params are incorrect. The exception may contain advice on how to modify the params map to make it valid.
    • execute

      public Path execute(Map<String,? super Object> params, Path outputParentDir) throws PackagerException
      Description copied from interface: Bundler
      Creates a bundle from existing content. If a call to Bundler.validate(java.util.Map) date} returns true with the parameters map, then you can expect a valid output. However if an exception was thrown out of validate or it returned false then you should not expect sensible results from this call. It may or may not return a value, and it may or may not throw an exception. But any output should not be considered valid or sane.
      Parameters:
      params - The Bundle parameters, Keyed by the id from the ParamInfo. Execution may modify the map, so if you are going to be using the same map across multiple bundlers you should pass in a deep copy.
      outputParentDir - The parent dir that the returned bundle will be placed in.
      Returns:
      The resulting bundled file For a bundler that produces a single artifact file this will be the location of that artifact (.exe file, .deb file, etc) For a bundler that produces a specific directory format output this will be the location of that specific directory (.app file, etc). For a bundler that produce multiple files, this will be a parent directory of those files (linux and windows images), whose name is not relevant to the result.
      Throws:
      PackagerException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • cleanup

      public void cleanup(Map<String,? super Object> params)
      Description copied from interface: Bundler
      Removes temporary files that are used for bundling.
      Specified by:
      cleanup in interface Bundler