NBI runtime workflow overview.

This page gives the overview of what happens when user runs the resulting bundle installer. What happens after user double-clicks the installer or starts it from the command line (that is more common for .sh installers - Linux and Solaris)?

Native launcher work before running JVM.

First, the native launcher is doing its work.

  1. It detects the locale which user is running use it later for showing messages (UI or console) in that language (if localization is available, certainly)
  2. It creates the temporary directory which is used further for extracting temporary data
  3. It extracts the helper file (TestJDK.class) from the installer file. This helper is used later to verify Java machines.
  4. It search for the first suitable JDK or JRE on the system using the list of compatible JVMs set during the bundle creation
  • If JVM is bundled in the installer, then it extracted and all packed jars are unpacked.
  1. If no JDK/JRE is found the message is shown and the installer cleans up temporary directory and finishes its work
  2. If JDK/JRE is found, native launcher extracts the bundle.jar, process command-line arguments (if any), accumulate the classpath and finally runs the java process with the main class (org.netbeans.installer.Installer, or org.netbeans.installer.Installer shortly) and command-line arguments (if any).

Java process work

The java process work starts by calling main method() of org.netbeans.installer.Installer class.

  1. First, it runs the constructor for Installer class:
    1. In the constructor, the different initializations are down and different "services" are started:
      1. error handler, which is responsible for showing unexpected error messages.
      2. platform information, like operation system name and architecture. At this moment the native library is loaded
      3. main and additional command-line arguments are handled
      4. engine options, which are stored in data/engine*.properties file are loaded
      5. working directory is created
      6. log manager service is started, by default logs are stored in ~/.nbi/log
      7. download manager service (org.netbeans.installer.downloader.DownloadManager) is started
      8. registry (org.netbeans.installer.product.Registry) is initialized by calling static org.netbeans.installer.product.Registry.getInstance() method
      9. wizard (org.netbeans.installer.wizard.Wizard) is initialized by calling static method org.netbeans.installer.wizard.Wizard.getInstance()
        1. this method reads information about the wizard components (actions, panels, sequences) from the bundled org/netbeans/installer/wizard/wizard-components.xml file (this path can be overridded by using nbi.wizard.components.instance.uri system property, e.g. in engine.properties).
        2. each component in that file is the class name which is been loaded (default constructor) during wizard initialization.
        3. only initialization is performed at this moment, no real panels are shown and no actions are executed.
        4. default wizard-components.xml file consist of :
        5. InitializeRegistryAction. This action is intended to fill the global registry (that`s returned by Registry.getInstance()) by information about the components from local (~/.nbi/registry.xml), bundled (data/registry.xml in the bundle.jar) and remote (if specified explicitely, not used at the moment) registries
        6. ComponentsSelectionPanel. This panel is used for choosing products which user wants to install
        7. MainSequence. This is the main sequence which manages the main installation process.
        8. FinalizeRegistryAction. This is the action which stores the global registry to local one after the installation/uninstallation is ended.
      10. working directory lock file is created.
        1. It prevents from running multiple installer instances at the same time to prevent data loss.
  2. Second, it runs start() method which, in turn, starts the wizard (Wizard.getInstance().open()).
    1. this method creates the co-called wizard container - either Swing (org.netbeans.installer.wizard.containers.SwingFrameContainer) or Silent (org.netbeans.installer.wizard.containers.SilentContainer). There is almost nothing done for silent container, but swing container initalization is worth mentioning
      1. the L&F is initialized (UiUtils.initializeLookAndFeel)
      2. the SFC constructor is executed after calling parents constructors NbiFrame->JFrame.
        1. frame size, icon and title are determined, then SFC.initComponents() is called
        2. this method sets the default "on-close" operation, really sets frame size, icon and title and creates new content pane - SFC.WizardFrameContentPane (WFCP) which has the title/description labels and left/right images for the header, placeholder for the custom panels, top and bottom separators, and buttons - help, back, next, cancel
    2. the container`s open() method is called.
    3. The silent container`s open() method do nothing
    4. The swing container`s open() method shows the new frame by callng .setVisible(true)
    5. the wizard`s next() method is called. This method get the first component in the "list" of the wizard component, calls its initilize() method, puts the component`s UI part to the placeholder from WFCP and then calls executeForward() method for this component.
      1. if the component is actually an action (WizardAction, e.g. InitializeRegistryAction), then it is been executed (execute() method) and then wizard is moved to the next component by calling getWizard().next())
      2. if the component is actually a panel (WizardPanel, e.g. ComponentsSelectionPanel), then its UI is been set to WFCP (execute() method) and next steps are done based on the button (help|back|next|cancel) listeners
      3. if the component is actually a sequence (WizardSequence, e.g. MainSequence), then it loads the sub-wizards for the child components (again - actions, panels, sequences) and executes them one by one.
    6. when all components and processed, the finishHandler (which is actually the Installer) is called by invoking finish() method. This method closes the wizard (hides the frame), stops the services (log and download) and calls System.exit(). This call shutdowns the java process and executes all the standard ShutdownHooks, among others is the Installer cleaner hook which is been registered during utils initialization. This hook writes the names of the files which should be deleted after JVM ends its work in the special file in the temporary folder (deleteNbiFiles*.tmp). After that it starts the "cleaner" process and pass the path to the deleteNbiFiles*.tmp to the cleaner. At this moment 2 processes are active - the cleaner and the native launcher.

Cleaner work

The cleaner process reads the list of files which are stored in deleteNbiFiles*.tmp file and delete one-by-one (making, at maximum, 3 times with some delay).

Launcher work after JVM exits

The launcher process checks the error code returned by the JVM and shows the error if it not zero.
After that it removes temporary directory and finishes its work.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo