Class UpgradeManager
java.lang.Object
org.jjazz.upgrade.api.UpgradeManager
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!).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]The previous versions of JJazzLab released to public. -
Method Summary
Modifier and TypeMethodDescriptionadaptPropertiesFileRelativePath(String relPath) Adapt relPath to the import version.voidduplicateOldPreferences(Preferences modulePrefs) Copy into modulePrefs all the "old" key/value pairs from the corresponding Properties file found in the getImportSourceVersion() directory structure.voidduplicateOldPreferences(Preferences modulePrefs, String relPathToOldPrefFile) Copy into modulePrefs all the "old" key/value pairs from the specified file in the getImportSourceVersion() directory structure.The current JJazzLab version.Get the JJazzLab version from which to import settings.static UpgradeManagergetOldPreferencesFromRelativePath(String relPath) Get the old properties from a specific file in the getImportSourceVersion() directory structure.boolean
-
Field Details
-
PREVIOUS_VERSIONS
The previous versions of JJazzLab released to public.
-
-
Method Details
-
getInstance
-
getCurrentVersion
-
isFreshStart
public boolean isFreshStart()- Returns:
- True if it's the first run of this JJazzLab version (or if this module's preferences file could not be found in the Netbeans user directory).
-
getOldPreferencesFromRelativePath
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
Copy into modulePrefs all the "old" key/value pairs from the corresponding Properties file found in the getImportSourceVersion() directory structure.To be used when module codebase has not changed between 2 versions. But note that app-level codebase name changes, which impacted *all* (or almost all) module, are handled by this method via adaptPropertiesFileRelativePath().
- Parameters:
modulePrefs- The Netbeans preferences of a module.- See Also:
-
adaptPropertiesFileRelativePath
Adapt relPath to the import version.The returned properties file relative path takes into account possible codebase name changes which occured between getImportSourceVersion() and getCurrentVersion().
- Parameters:
relPath- A relative path of a properties file for the current version (>=4.1.0), eg "org/jjazzlab/core/midi.properties"- Returns:
- eg "org/jjazzlab/org/jjazz/midi.properties" for getImportSourceVersion()=4.0.2
- See Also:
-
duplicateOldPreferences
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
Get the JJazzLab version from which to import settings.Take first directory from PREVIOUS_VERSIONS where config/Preferences subdir is present.
- Returns:
- Either a valid version string (eg "2.0.1") or null if no import version available.
-