Search in sources :

Example 56 with LocalizedMessage

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);
    }
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 57 with LocalizedMessage

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);
}
Also used : File(java.io.File) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 58 with LocalizedMessage

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);
}
Also used : File(java.io.File) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 59 with LocalizedMessage

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;
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 60 with LocalizedMessage

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;
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Aggregations

LocalizedMessage (com.sun.identity.install.tools.util.LocalizedMessage)73 Map (java.util.Map)9 File (java.io.File)8 ArrayList (java.util.ArrayList)8 IOException (java.io.IOException)6 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 ConnectException (java.net.ConnectException)4 UnknownHostException (java.net.UnknownHostException)4 StringTokenizer (java.util.StringTokenizer)4 FileNotFoundException (java.io.FileNotFoundException)3 RESTUtils (com.sun.identity.install.tools.util.RESTUtils)2 BufferedReader (java.io.BufferedReader)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 TreeMap (java.util.TreeMap)2 Audit (com.sun.identity.install.tools.util.Audit)1 FileReader (java.io.FileReader)1 InputStream (java.io.InputStream)1