ServerControl.Cli cli = ServerControl
.onServer(context.getPluginConfiguration(), getMode(), context.getSystemInformation())
.waitingFor(waitTime * 1000)
.killingOnTimeout(Boolean.parseBoolean(parameters.getSimpleValue("killOnTimeout", "false"))).cli();
ProcessExecutionResults results;
String commands = parameters.getSimpleValue("commands");
if (commands != null) {
results = cli.executeCliCommand(commands);
} else {
File script = new File(parameters.getSimpleValue("file"));
if (!script.isAbsolute()) {
script = new File(serverPluginConfig.getHomeDir(), script.getPath()).getAbsoluteFile();
}
results = cli.executeCliScript(script);
}
logExecutionResults(results);
result.setSimpleResult(results.getCapturedOutput());
if (results.getError() != null) {
result.setErrorMessage(results.getError().getMessage());
return result;
}
if (results.getExitCode() == null) {
result.setErrorMessage("jboss-cli execution timed out");
return result;
}
if (results.getExitCode() != 0) {
result.setErrorMessage("jboss-cli execution failed with error code " + results.getExitCode());
return result;
}
if (Boolean.parseBoolean(parameters.getSimpleValue("triggerAvailability", null))) {
context.getAvailabilityContext().requestAvailabilityCheck();