use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class InteractionsRunnerBase method runInteractions.
/**
* Method to run all the interations and gather the state information.
*
* @param startFromLast
* if true the last interaction is executed first. Needed if
* somebody does a back on common/instance interaction and the
* instance interaction has to start from the last one
* @return a Map consisting of InteractionResults. The key is the
* Interaction key and value is InteractionResult
* @throws InstallException
*/
public void runInteractions(boolean startFromLast) throws InstallAbortException, InstallException {
if (isActive()) {
int interactionsCount = getAllInteractions().size();
int index = (startFromLast) ? interactionsCount - 1 : 0;
boolean exitStatus = false;
InteractionResultStatus status = null;
// interactions are skipped in a row
while (skipInteraction(index)) {
index = (startFromLast) ? --index : ++index;
}
do {
Debug.log("InteractionsRunnerBase: Running Interaction[" + index + "].");
if (index >= getAllInteractions().size()) {
setFinalStatus(InteractionResultStatus.STATUS_CONTINUE);
return;
}
UserDataInteraction interaction = (UserDataInteraction) getAllInteractions().get(index);
InteractionResult result = runInteraction(interaction, index);
status = result.getStatus();
switch(status.getIntValue()) {
case InteractionResultStatus.INT_STATUS_CONTINUE:
Debug.log("InteractionsRunnerBase: Interaction " + "resulted in CONTINUE @ Index: " + index);
storeSummaryDescription(index, result.getSummaryDescription());
if (++index >= interactionsCount) {
exitStatus = true;
} else {
while (!exitStatus && skipInteraction(index)) {
storeSummaryDescription(index, null);
if (++index >= interactionsCount) {
exitStatus = true;
}
}
}
break;
case InteractionResultStatus.INT_STATUS_BACK:
Debug.log("InteractionsRunnerBase: Interaction " + "resulted in BACK @ Index: " + index);
if (--index < 0) {
exitStatus = true;
} else {
while (!exitStatus && skipInteraction(index)) {
if (--index < 0)
exitStatus = true;
}
}
break;
case InteractionResultStatus.INT_STATUS_ABORT:
Debug.log("InteractionsRunnerBase: ABORT requested " + "for Interaction[" + index + "].");
LocalizedMessage lMessage = LocalizedMessage.get(LOC_DR_MSG_USER_ABORT);
throw new InstallAbortException(lMessage);
}
} while (!exitStatus);
setFinalStatus(status);
Debug.log("InteractionsRunnerBase.runInteractions() Exiting at " + "index: " + index);
} else {
// Nothing to execute. So continue
setFinalStatus(InteractionResultStatus.STATUS_CONTINUE);
}
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class FileSystemValidator method isDirectoryValid.
/**
*
* Method isDirectoryValid
*
*
* @param dirname Directory name
* @param props Map for name value pairs
* @param state IStateAccess
*
* @return ValidationResult
*
*/
public ValidationResult isDirectoryValid(String dirname, Map props, IStateAccess state) {
ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
LocalizedMessage returnMessage = null;
if (isStringValid(dirname)) {
File dir = new File(dirname);
if (dir.exists() && dir.isDirectory()) {
returnMessage = LocalizedMessage.get(LOC_VA_MSG_VAL_DIRECTORY, new Object[] { dirname });
validRes = ValidationResultStatus.STATUS_SUCCESS;
}
}
if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
returnMessage = LocalizedMessage.get(LOC_VA_WRN_IN_VAL_DIRECTORY, new Object[] { dirname });
}
Debug.log("FileSystemValidator : Is directory : " + dirname + " valid ? " + validRes.isSuccessful());
return new ValidationResult(validRes, null, returnMessage);
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class FileSystemValidator method isDirectoryReadWrite.
/**
* Method isDirectoryReadWrite
*
*
* @param dirname Directory name
* @param props Map for name value pairs
* @param state IStateAccess
*
*
* @return IStateAccess
*
*/
public ValidationResult isDirectoryReadWrite(String dirname, Map props, IStateAccess state) {
ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
LocalizedMessage returnMessage = null;
if (isStringValid(dirname)) {
File dir = new File(dirname);
if (dir.exists() && dir.isDirectory() && (dir.canRead()) && (dir.canWrite())) {
returnMessage = LocalizedMessage.get(LOC_VA_MSG_DIR_READ_WRITE, new Object[] { dirname });
validRes = ValidationResultStatus.STATUS_SUCCESS;
}
}
if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
returnMessage = LocalizedMessage.get(LOC_VA_WRN_DIR_NOT_READ_WRITE, new Object[] { dirname });
}
Debug.log("FileSystemValidator : Is directory : " + dirname + " read/writable ? " + validRes.isSuccessful());
return new ValidationResult(validRes, null, returnMessage);
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class InstallDriver method getProductInstanceNameMessage.
public LocalizedMessage getProductInstanceNameMessage() {
String instanceName = (String) getInstallState().getStateAccess().getInstanceName();
Object[] args = { instanceName };
LocalizedMessage message = LocalizedMessage.get(LOC_DR_MSG_PRODUCT_INSTANCE_NAME, args);
return message;
}
use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.
the class InstallDriver method getProductDebugLogsPathMessage.
public LocalizedMessage getProductDebugLogsPathMessage() {
String productDebugDirectory = (String) getInstallState().getStateAccess().get(STR_DEBUG_DIR_PREFIX_TAG);
Object[] args = { productDebugDirectory };
LocalizedMessage message = LocalizedMessage.get(LOC_DR_MSG_PRODUCT_DEBUG_DIR, args);
return message;
}
Aggregations