Class UpgradeManager

java.lang.Object
org.jjazz.upgrade.api.UpgradeManager

public class UpgradeManager extends Object
Manage the tasks to upgrade settings from a previous version of JJazzLab to the current version.

Find the source import JJazzLab version. Call all the UpgradeTasks found in the global Lookup upon fresh start at module install (UI is not yet ready!).

  • Field Details

    • PREVIOUS_VERSIONS

      public static final String[] PREVIOUS_VERSIONS
      The previous versions of JJazzLab released to public.
  • Method Details

    • getInstance

      public static UpgradeManager getInstance()
    • getVersion

      public String getVersion()
    • isFreshStart

      public boolean isFreshStart()
      Returns:
      True if it's the first run of this JJazzLab version (netbeans user dir. was cleaned)
    • getOldPreferencesFromRelativePath

      public Properties getOldPreferencesFromRelativePath(String relPath)
      Get the old properties from a specific file in the getImportSourceVersion() directory structure.

      Parameters:
      relPath - Relative path from ...config/Preferences, eg "org/jjazz/rhythm/database.properties"
      Returns:
      Can be empty if file not found or read error
    • duplicateOldPreferences

      public void duplicateOldPreferences(Preferences modulePrefs)
      Copy into modulePrefs all the "old" key/value pairs from the corresponding Properties file in the getImportSourceVersion() directory structure.

      To be used when package codebase has not changed between 2 versions.

      Parameters:
      modulePrefs - The Netbeans preferences of a module.
    • duplicateOldPreferences

      public void duplicateOldPreferences(Preferences modulePrefs, String relPathToOldPrefFile)
      Copy into modulePrefs all the "old" key/value pairs from the specified file in the getImportSourceVersion() directory structure.

      To be used when package codebase has changed between versions.

      Parameters:
      modulePrefs - The Netbeans preferences of a module.
      relPathToOldPrefFile - Relative path from ...config/Preferences, eg "org/jjazz/rhythm/database.properties"
    • getImportSourceVersion

      public String getImportSourceVersion()
      Get the JJazzLab version from which to import settings.

      Take first directory from PREVIOUS_VERSIONS where config/Preferences subdir is present.

      Returns:
      E.g. "2.0.1". Null if no import version available.