Class PreferenceManager
java.lang.Object
de.spiritscorp.datasync.io.PreferenceManager
Thread-safe global configurations orchestrator managing persistent JSON configurations.
Coordinates multi-profile I/O read/write operations for independent replication synchronization tasks
and global application states. Implements the Singleton pattern to ensure centralized state control.
-
Method Summary
Modifier and TypeMethodDescriptioncreateProfile(String jobName) Allocates and provisions a new, distinct profile configuration data scope unit.Retrieves the persistent dynamic configuration storage path target locator.Retrieves the system console output debug log tracking path locator.Retrieves the localized tracking error diagnostic path locator.static PreferenceManagerGets the global Singleton instance.Exposes the active, in-memory configuration profile map registry.Retrieves the persistent operational event synchronization logging path locator.getProfile(String jobName) Retrieves an allocated configuration tracking state context signature via its workspace identifier.getTheme()Gets the currently configured application theme.voidinitGlobalRootConfigPath(Path customRoot) Reconfigures and overrides the global operational ecosystem workspace root coordinates.booleanbooleanEvaluates whether the application ecosystem is provisioned to launch automatically upon host operating system startup sequences.booleanHydrates the global storage matrix layer and multi-job profile cache records from the persistent disk token.booleanAtomically removes an active synchronization job context tracking assignment.booleanrenameProfile(String oldName, String newName, Preference pref) Atomically handles profile rename routines inside the synchronization runtime context.booleanCompiles all active in-memory profile matrices and flushes them into a single unified JSON structure.voidsetGlobalAutoStart(boolean globalAutoStart) Modifies the global automation startup property state parameter.voidSets the visual theme of the application.
-
Method Details
-
getInstance
Gets the global Singleton instance.- Returns:
- The singleton manager instance.
-
initGlobalRootConfigPath
Reconfigures and overrides the global operational ecosystem workspace root coordinates. Re-initializes all system-dependent structural path mappings dynamically.Fallback at (user.home)/DataSync if the target path is not writeable or not valid
- Parameters:
customRoot- The new target base directory path, or null to retain the home default context.
-
createProfile
Allocates and provisions a new, distinct profile configuration data scope unit. Automatically appends the freshly constructed tracking unit block into active memory structures.- Parameters:
jobName- Unique target workspace identifier.- Returns:
- An unpopulated, isolated configuration state segment tracker.
-
getProfile
Retrieves an allocated configuration tracking state context signature via its workspace identifier.- Parameters:
jobName- The unique profile registry lookup key.- Returns:
- The matching configuration instance state, or null if no mapping tracks the parameter.
-
renameProfile
Atomically handles profile rename routines inside the synchronization runtime context. Mutates the tracking key structural state identifier map and flushes changes to disk immediately.- Parameters:
oldName- Original task profile identifier key.newName- Target replacement unique identifier string.pref- Associated configuration parameters data segment instance.- Returns:
- true if persistence succeeded; false if parameters were invalid or execution failed.
-
removeProfile
Atomically removes an active synchronization job context tracking assignment. Evicts cached properties from memory and updates the primary configuration storage file.- Parameters:
job- The high-level UI task context container targeted for decommissioning.- Returns:
- true if structural extraction and serialization completed successfully.
-
getLoadedProfiles
Exposes the active, in-memory configuration profile map registry. Wrapped in an unmodifiable view to preserve structural mutation thread safety bounds.- Returns:
- An unmodifiable structural read-only view tracking live preference profiles.
-
saveAllPreferences
public boolean saveAllPreferences()Compiles all active in-memory profile matrices and flushes them into a single unified JSON structure. Truncates any existing configuration state assets dynamically during filesystem stream allocation.- Returns:
- true if structural file flushing and underlying persistence executed without errors.
-
loadAllPreferences
public boolean loadAllPreferences()Hydrates the global storage matrix layer and multi-job profile cache records from the persistent disk token. Validates individual structural segments during structural ingestion parsing.- Returns:
- true if filesystem parsing completed entirely; false if tracking token was absent or corrupt.
-
isGlobalAutoStart
public boolean isGlobalAutoStart()Evaluates whether the application ecosystem is provisioned to launch automatically upon host operating system startup sequences.- Returns:
- true if the global background autostart configuration sequence is enabled.
-
setGlobalAutoStart
public void setGlobalAutoStart(boolean globalAutoStart) Modifies the global automation startup property state parameter. This execution updates the structural configuration variable memory cache layers.- Parameters:
globalAutoStart- Target state flag to determine automated deployment behavior.
-
getConfigPath
Retrieves the persistent dynamic configuration storage path target locator.- Returns:
- The absolute filesystem path directing to the primary 'conf.json' token.
-
getLogPath
Retrieves the persistent operational event synchronization logging path locator.- Returns:
- The absolute filesystem path directing to the structural 'log.json' entity.
-
getDebugPath
Retrieves the system console output debug log tracking path locator.- Returns:
- The absolute filesystem path directing to the standard runtime 'debug.log' file.
-
getErrorPath
Retrieves the localized tracking error diagnostic path locator.- Returns:
- The absolute filesystem path directing to the critical runtime 'debug.err' stream dump.
-
setTheme
Sets the visual theme of the application. -
getTheme
Gets the currently configured application theme.- Returns:
- the active AppTheme
-
isCustomConfigDir
public boolean isCustomConfigDir()
-