}
nextState = new PropertyFilePrompt(theConsole, stateValues);
}
private AddPropertiesUser(ConsoleWrapper console, final boolean management, final String user, final String password, final String realm) {
StateValues stateValues = new StateValues();
stateValues.setJBossHome(System.getenv("JBOSS_HOME"));
final Interactiveness howInteractive;
boolean silent = Boolean.valueOf(argsCliProps.getProperty(CommandLineArgument.SILENT.key()));
if (silent) {
howInteractive = Interactiveness.SILENT;
} else {
howInteractive = Interactiveness.NON_INTERACTIVE;
}
stateValues.setHowInteractive(howInteractive);
// Silent modes still need to be able to output an error on failure.
theConsole = console;
if (theConsole.getConsole() == null && !howInteractive.equals(Interactiveness.SILENT)) {
throw MESSAGES.noConsoleAvailable();
}
// Username should not be null or empty.
if (user == null || user.isEmpty()) {
nextState = new ErrorState(theConsole, MESSAGES.noUsernameExiting(), null, stateValues);
return;
}
stateValues.setUserName(user);
// Password should not be null or empty.
if (password == null || password.isEmpty()) {
nextState = new ErrorState(theConsole, MESSAGES.noPasswordExiting(), null, stateValues);
return;
}
stateValues.setPassword(password.toCharArray());
stateValues.setRealm(realm);
stateValues.setManagement(management);
stateValues.setRoles(argsCliProps.getProperty(CommandLineArgument.ROLE.key()));
nextState = new PropertyFileFinder(theConsole, stateValues);
}