private final String realmSpec;
private final String remoteAuthSpec;
public ExhibitorCreator(String[] args) throws Exception
{
ExhibitorCLI cli = new ExhibitorCLI();
CommandLine commandLine;
try
{
CommandLineParser parser = new PosixParser();
commandLine = parser.parse(cli.getOptions(), args);
if ( commandLine.hasOption('?') || commandLine.hasOption(HELP) || (commandLine.getArgList().size() > 0) )
{
throw new ExhibitorCreatorExit(cli);
}
}
catch ( UnrecognizedOptionException e)
{
throw new ExhibitorCreatorExit("Unknown option: " + e.getOption(), cli);
}
catch ( ParseException e )
{
throw new ExhibitorCreatorExit(cli);
}
checkMutuallyExclusive(cli, commandLine, S3_BACKUP, FILESYSTEMBACKUP);
String s3Region = commandLine.getOptionValue(S3_REGION, null);
PropertyBasedS3Credential awsCredentials = null;
PropertyBasedS3ClientConfig awsClientConfig = null;
if ( commandLine.hasOption(S3_CREDENTIALS) )
{
awsCredentials = new PropertyBasedS3Credential(new File(commandLine.getOptionValue(S3_CREDENTIALS)));
}
if ( commandLine.hasOption(S3_PROXY) )
{
awsClientConfig = new PropertyBasedS3ClientConfig(new File(commandLine.getOptionValue(S3_PROXY)));
}
BackupProvider backupProvider = null;
if ( "true".equalsIgnoreCase(commandLine.getOptionValue(S3_BACKUP)) )
{
backupProvider = new S3BackupProvider(new S3ClientFactoryImpl(), awsCredentials, awsClientConfig, s3Region);
}
else if ( "true".equalsIgnoreCase(commandLine.getOptionValue(FILESYSTEMBACKUP)) )
{
backupProvider = new FileSystemBackupProvider();
}
int timeoutMs = Integer.parseInt(commandLine.getOptionValue(TIMEOUT, "30000"));
int logWindowSizeLines = Integer.parseInt(commandLine.getOptionValue(LOGLINES, "1000"));
int configCheckMs = Integer.parseInt(commandLine.getOptionValue(CONFIGCHECKMS, "30000"));
String useHostname = commandLine.getOptionValue(HOSTNAME, cli.getHostname());
int httpPort = Integer.parseInt(commandLine.getOptionValue(HTTP_PORT, "8080"));
String extraHeadingText = commandLine.getOptionValue(EXTRA_HEADING_TEXT, null);
boolean allowNodeMutations = "true".equalsIgnoreCase(commandLine.getOptionValue(NODE_MUTATIONS, "true"));
String configType = commandLine.hasOption(SHORT_CONFIG_TYPE) ? commandLine.getOptionValue(SHORT_CONFIG_TYPE) : (commandLine.hasOption(CONFIG_TYPE) ? commandLine.getOptionValue(CONFIG_TYPE) : null);