Class UpdateConfig


  • public final class UpdateConfig
    extends java.lang.Object
    Update configuration. Required current config and updating file. Optionally, environment variables could be provided (to replace in updating file). To override existing values (or to remove outdated paths) specify yaml paths to remove in old file before update (note that yaml path elements split with '/' because yaml property could contain dots).
    Since:
    14.04.2021
    • Method Detail

      • getCurrent

        public java.io.File getCurrent()
        Returns:
        current config that must be updated
      • isBackup

        public boolean isBackup()
        Returns:
        true to save current config backup after update
      • getBackupDir

        public java.io.File getBackupDir()
        Returns:
        directory to store backups in or null to store near original config
      • getUpdate

        public java.lang.String getUpdate()
        Configuration file may contain placeholders (getEnv()). Only properties not found in the current config would be added (for properties remove see getDeleteProps()).
        Returns:
        new configuration to update from
      • getDeleteProps

        public java.util.List<java.lang.String> getDeleteProps()
        NOTE: '/' used for property separation because in yaml property name could contain dot.
        Returns:
        properties to remove in current file (would be replaced if provided in new file)
      • getEnv

        public java.util.Map<java.lang.String,​java.lang.String> getEnv()
        Variables for replacing placeholders in update file #{var}. Variables searched without counting yaml semantics. Used to adopt configuration to the target environment (especially useful for the first installation).
        Returns:
        variables to replace in updating file
      • isValidateResult

        public boolean isValidateResult()
        Returns:
        true to validate result against old and new file trees (to make sure all old values preserved and new values added)
      • getListener

        public UpdateListener getListener()
        Returns:
        configured listener (might be dummy adapter if nothing configured)
      • isDryRun

        public boolean isDryRun()
        Returns:
        true if configuration should not be modified (test run), false for normal execution