Package org.duracloud.sync.config
Class SyncToolConfigParser
java.lang.Object
org.duracloud.sync.config.SyncToolConfigParser
Handles reading the configuration parameters for the Sync Tool
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a parser for command line configuration options. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbackupConfig(File backupDir, String[] args) protected ConsolePromptprotected StringprocessCommandLine(String[] args) Parses command line configuration into an object structure, validates correct values along the way.protected SyncToolConfigprocessConfigFileOptions(String[] args) protected SyncToolConfigprocessStandardOptions(String[] args) protected SyncToolConfigprocessStandardOptions(String[] args, boolean requirePassword) protected String[]retrieveConfig(File configBackupFile) retrievePrevConfig(File backupDir) Retrieves the configuration of the previous run of the Sync Tool.
-
Field Details
-
GIGABYTE
protected static final long GIGABYTE- See Also:
-
BACKUP_FILE_NAME
- See Also:
-
PREV_BACKUP_FILE_NAME
- See Also:
-
DEFAULT_PORT
protected static final int DEFAULT_PORT- See Also:
-
DEFAULT_POLL_FREQUENCY
protected static final long DEFAULT_POLL_FREQUENCY- See Also:
-
DEFAULT_NUM_THREADS
protected static final int DEFAULT_NUM_THREADS- See Also:
-
DEFAULT_MAX_FILE_SIZE
protected static final int DEFAULT_MAX_FILE_SIZE- See Also:
-
context
- See Also:
-
-
Constructor Details
-
SyncToolConfigParser
public SyncToolConfigParser()Creates a parser for command line configuration options.
-
-
Method Details
-
processCommandLine
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
-
retrieveConfig
-
retrievePrevConfig
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
-
getConsole
-