protected void parseCommandLineArguments ( String [ ] commandLineArguments ) { Options options = constructGnuOptions ( ) ; if ( commandLineArguments . length < 1 ) { printHelp ( options ) ; } CommandLineParser parser = new GnuParser ( ) ; try { CommandLine line = parser . parse ( options , commandLineArguments ) ; if ( line . hasOption ( HELP_OPTION ) ) { printHelp ( options ) ; } if ( line . hasOption ( REGION_OPTION ) ) { regionName = line . getOptionValue ( REGION_OPTION ) ; } if ( line . hasOption ( TIMEOUT_OPTION ) ) { String timeoutString = line . getOptionValue ( TIMEOUT_OPTION ) ; timeout = Long . parseLong ( timeoutString ) ; } if ( line . hasOption ( CLUSTER_OPTION ) ) { clustersProperties = line . getOptionProperties ( CLUSTER_OPTION ) ; if ( clustersProperties . keySet ( ) . size ( ) < 2 ) { Utils . exitWithFailure ( "At least two clusters should be defined" ) ; } } else { Utils . exitWithFailure ( "No clusters defined" ) ; } } catch ( Throwable t ) { Utils . exitWithFailure ( "Throwable caught during the command-line arguments parsing" , t ) ; } }
Parses command - line arguments and sets the local variables