private static int init()

in src/main/java/com/amazonaws/schemamanager/SchemaManagerMain.java [77:133]


	private static int init(String[] args) {
		options = new Options();
		options.addOption(Option.builder(PROP_NAME_HELP_SHORT)
				.argName(PROP_NAME_HELP_SHORT)
				.longOpt(PROP_NAME_HELP_FULL)
				.desc("prints this message")
				.build()
		);
		options.addOption(Option.builder(PROP_NAME_CONFIG_FILE_SHORT)
				.argName(PROP_NAME_CONFIG_FILE_SHORT)
				.longOpt(PROP_NAME_CONFIG_FILE_FULL)
				.hasArg(true)
				.desc("YAML property file with Schema Manager configuration. "
						+ "For sample, see sample_config.yml under src/main/resources.")
				.build()
		);
		options.addOption(Option.builder(PROP_NAME_MODE_SHORT)
				.argName(PROP_NAME_MODE_SHORT)
				.longOpt(PROP_NAME_MODE_FULL)
				.hasArg(true)
				.desc("define a scenario. Valid values are: `full` - for integrated full sync execution with reporting; "
						+ "`pr` - validate Pull Requests; `build` - run to validate post PR merge integrity and generate artifacts. "
						+ "Default (if not provided) is `full`.")
				.build()
		);
		
		CommandLineParser parser = new DefaultParser();
	    try {
	        // parse the command line arguments
	        CommandLine line = parser.parse( options, args );
	        if (line.hasOption(PROP_NAME_HELP_SHORT)) {
	        	printHelp(options);
		        return 0;
	        }else if (!line.hasOption(PROP_NAME_CONFIG_FILE_SHORT)){
	        	printHelp(options);
	        	List<Option> missingOptions = new ArrayList<Option>(1);
	        	missingOptions.add(options.getOption(PROP_NAME_CONFIG_FILE_SHORT));
	        	throw new MissingOptionException(missingOptions);
	        }
	        String configFilePath = line.getOptionValue(PROP_NAME_CONFIG_FILE_SHORT);
	        AppConfigHelper.initConfig(configFilePath);
	   
	        mode = line.hasOption(PROP_NAME_MODE_SHORT)
	        				? SchemaManagerMode.forName(line.getOptionValue(PROP_NAME_MODE_SHORT)) 
	        				: SchemaManagerMode.FULL;
	    }
	    catch( ParseException | IllegalArgumentException e ) {
	        // oops, something went wrong
	        log.error( "Parsing failed.  Reason: " + e.getMessage(), e);
	        return 500;
	    } catch (IOException e) {
			log.error("Couldn't initialize application config. Check the path to the file.", e);
			return 500;
		}
	    
	    return -1;
	}