Class SyncToolConfigParser


  • public class SyncToolConfigParser
    extends Object
    Handles reading the configuration parameters for the Sync Tool
    • Constructor Detail

      • SyncToolConfigParser

        public SyncToolConfigParser()
        Creates a parser for command line configuration options.
    • Method Detail

      • processCommandLine

        public SyncToolConfig processCommandLine​(String[] args)
        Parses command line configuration into an object structure, validates correct values along the way. Prints a help message and exits the JVM on parse failure.
        Parameters:
        args - command line configuration values
        Returns:
        populated SyncToolConfig
      • processConfigFileOptions

        protected SyncToolConfig processConfigFileOptions​(String[] args)
                                                   throws org.apache.commons.cli.ParseException
        Throws:
        org.apache.commons.cli.ParseException
      • processStandardOptions

        protected SyncToolConfig processStandardOptions​(String[] args)
                                                 throws org.apache.commons.cli.ParseException
        Throws:
        org.apache.commons.cli.ParseException
      • processStandardOptions

        protected SyncToolConfig processStandardOptions​(String[] args,
                                                        boolean requirePassword)
                                                 throws org.apache.commons.cli.ParseException
        Throws:
        org.apache.commons.cli.ParseException
      • backupConfig

        protected void backupConfig​(File backupDir,
                                    String[] args)
      • retrieveConfig

        protected String[] retrieveConfig​(File configBackupFile)
      • retrievePrevConfig

        public SyncToolConfig retrievePrevConfig​(File backupDir)
        Retrieves the configuration of the previous run of the Sync Tool. If there was no previous run, the backup file cannot be found, or the backup file cannot be read, returns null, otherwise returns the parsed configuration
        Parameters:
        backupDir - the current backup directory
        Returns:
        config for previous sync tool run, or null
      • getPasswordEnvVariable

        protected String getPasswordEnvVariable()