use of org.forgerock.openam.installer.utils.StatusChecker in project OpenAM by OpenRock.
the class OpenAMUpgrade method execute.
/**
* Main method of the class which evaluates supplied arguments,
* the supplied config file and sends off necessary requests
*
* @param args Program arguments
*/
public void execute(String[] args) {
//most likely
int configArg = 1;
if (args.length < 2) {
System.out.println(rb.getString("usage"));
System.exit(-1);
}
for (int i = 0; i < args.length; i++) {
if ((i < args.length - 1) && ("--file".equals(args[i]) || "--f".equals(args[i]))) {
configArg = i + 1;
} else if (args[i].equals("--acceptLicense")) {
acceptLicense = true;
}
}
Properties config = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(args[configArg]);
config.load(fis);
} catch (IOException ex) {
System.out.println(rb.getString("errorConfig"));
System.exit(-1);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException ex) {
System.out.println(rb.getString("errorConfig"));
System.exit(-1);
}
}
}
String openAmURL = configure(config);
try {
licensePresenter.presentLicenses(acceptLicense);
} catch (LicenseRejectedException e) {
System.out.println(licensePresenter.getNotice());
System.exit(-1);
}
StatusChecker sc = new StatusChecker(openAmURL, URI_LOCATION);
Thread readProgressThread = new Thread(sc);
readProgressThread.start();
boolean success = getRequestToServer(readProgressThread, openAmURL);
if (success) {
System.exit(0);
} else {
System.exit(-1);
}
}
use of org.forgerock.openam.installer.utils.StatusChecker in project OpenAM by OpenRock.
the class OpenSSOConfigurator method execute.
/**
* Runs the configurator
*
* @param args Program arguments
*/
public void execute(String[] args) {
//most likely
int configArg = 1;
if (args.length < 2) {
System.out.println(rb.getString("usage"));
System.exit(-1);
}
for (int i = 0; i < args.length; i++) {
if ((i < args.length - 1) && ("--file".equals(args[i]) || "--f".equals(args[i]))) {
configArg = i + 1;
} else if (args[i].equals("--acceptLicense")) {
acceptLicense = true;
}
}
Properties config = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(args[configArg]);
config.load(fis);
} catch (IOException ex) {
System.out.println(rb.getString("errorConfig"));
System.exit(-1);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException ex) {
System.out.println(rb.getString("errorConfig"));
System.exit(-1);
}
}
}
String openAmURL = configure(config);
try {
licensePresenter.presentLicenses(acceptLicense);
} catch (LicenseRejectedException e) {
System.out.println(licensePresenter.getNotice());
System.exit(-1);
}
// User must have accepted all license terms now, so ensure parameter is added to request
if (postBodySB.length() > 0) {
postBodySB.append("&");
}
postBodySB.append(ACCEPT_LICENSES_PARAM).append("=").append("true");
StatusChecker sc = new StatusChecker(openAmURL, STATUS_LOCATION);
Thread readProgressThread = new Thread(sc);
readProgressThread.start();
boolean success = postRequestToServer(readProgressThread, openAmURL);
if (success) {
System.exit(0);
} else {
System.exit(-1);
}
}
Aggregations