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.
- Version:
- 1.0.1
- Author:
- Tom Spirit
-
Method Summary
Modifier and TypeMethodDescriptioncreateProfile(String jobName, boolean withSave) 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 list registry.Retrieves the persistent operational event synchronization logging path locator.intReturns the maximum number of historical backup log files to retain.longReturns the maximum size threshold in bytes before a log file is rotated.getProfile(String jobName) Retrieves an allocated configuration tracking state context signature via its workspace identifier.Retrieves the absolute configuration root storage path locator.getTheme()Gets the currently configured application theme.voidinitGlobalRootConfigPath(Path customRoot) Reconfigures and overrides the global operational ecosystem workspace root coordinates.booleanVerifies whether the active execution environment deviates from the standard system workspace path.booleanEvaluates 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.booleanmoveProfile(int newIdx, int draggedIdx, Preference pref) Adjusts the sequential position of an automation profile within the structural execution queue.booleanremoveProfile(String jobName) Atomically 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.setNewProfile(String jobName, Preference pref) Atomically set a copy of an active synchronization job context tracking assignment.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:
- The new configuration instance, or null if the configuration allready exists.
-
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.
-
setNewProfile
Atomically set a copy of an active synchronization job context tracking assignment. Evicts cached properties from memory and updates the primary configuration storage file.- Parameters:
jobName- The high-level UI task context container targeted for decommissioning.pref- Associated configuration parameters data segment instance.- Returns:
- The new configuration copy, or null if the configuration allready exists.
-
moveProfile
Adjusts the sequential position of an automation profile within the structural execution queue. Mutates the underlying tracking sequence under the active synchronization runtime lock and flushes the updated order to disk immediately.- Parameters:
newIdx- The target destination index where the profile should be relocated.draggedIdx- The current source index of the profile being manipulated.pref- Associated configuration parameters data segment instance.- Returns:
- true if reordering and persistence succeeded; false if parameters were invalid or execution failed.
-
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:
jobName- The job name targeted for decommissioning.- Returns:
- true if jobname exists and deleted successfuly.
-
getLoadedProfiles
Exposes the active, in-memory configuration profile list 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.- Parameters:
theme- The new AppTheme
-
getTheme
Gets the currently configured application theme.- Returns:
- the active AppTheme
-
isCustomConfigDir
public boolean isCustomConfigDir()Verifies whether the active execution environment deviates from the standard system workspace path. Evaluates the structural equality of the root path against the default deployment home directory.- Returns:
- true if a user-defined custom configuration directory is active; false if using the default home path.
-
getRootPath
Retrieves the absolute configuration root storage path locator.- Returns:
- The absolute filesystem path directing to the root config path.
-
getMaxLogSize
public long getMaxLogSize()Returns the maximum size threshold in bytes before a log file is rotated.- Returns:
- the maximum log file size in bytes
-
getMaxLogCount
public int getMaxLogCount()Returns the maximum number of historical backup log files to retain.- Returns:
- the maximum allowed number of backup files
-